As far as I know, you only need a sound card (preferably) to hear the results. All the editing and transformations happen in software.
True. DOS sound cards do not allow for much - they simply play the end result of all your transformations to the sounds. Multiple channels of sound is an illusion - there in only one master track playing. Sort of like a mixer in a studio. It takes all the vocals, guitars, and keyboard tracks and mixes them into one master track - then to the amp - then to the mains. You must write this 'mixer' in software. Additive mixing works rather well for starters.
For additive mixing simply add up all of the sound values at the same slice in time, divide by the number of sounds and put that result into the main mix. It does suffer from certain problems but it gives relatively good results for starters.
Code:
int result=0;
int samplepos=0;
for (int i=0;i<length;i++)
{
for (int soundnum=0;soundnum<numsamples;soundnum++)
{
if (samplepos<Sample[soundnum].BufferLength)
result+=Sample[soundnum].Buffer[samplepos];
}
result/=numsamples;
if (result<0) result=0;
if (result>65535) result=65535;
MainMix->Buffer[i]=result;
samplepos++;
}
The structure for MainMix and Sample are for you to decide on. I did not provide them because it would only serve to confuse you.
My advice is to use a linked list of sounds, that way when you overrun one sample's buffer - have come to the end of the sound it will not be in the main mix. Therefore it is a waste of time to check what value is in its buffer since the sound is done playing. Remove it from the list. This allows your mixer to perform better.
I used arrays above which is ok, but has problems of its own.
Notice that it would be very easy to play these samples in reverse by simply iterating through the samples from the end to the beginning rather than beginning to end. But each sample is not the same length so you would have to check where the end of sample was and then make sure that when you reach 0, you remove the sample from the playlist.
Each sample above represents one channel of sound. To create looping sound simply create a LoopSound class or something with a flag in it to indicate that this sample will never be removed from the playlist. When it ends, just reset the samplepos to the beginning of the sound and it will repeat.