What I'm trying to do is play a looping wav, but with a specific loop start position like the samples used in music module files (.it, s3m. .mod, etc.). SoundPlayer doesn't have this feature, so I created two separate files: the original wav and the wav with the beginning cut off to where the loop starts. I want to play the two files in succession, seamlessly, first the original wav file with PlaySync() then the loop section with PlayLooping().
Unfortunately after I PlaySync() the first wav, there's a split second interruption between it and when PlayLooping() begins to play back the loop wav.
private static void PlayThread(SoundPlayer soundPlayer, byte[] wav, byte[] loop)
{
MemoryStream stream1 = new MemoryStream(wav);
MemoryStream stream2 = new MemoryStream(loop);
soundPlayer.Stream = stream1;
soundPlayer.PlaySync();
// here is where the split second interruption occurs
soundPlayer.Stream = stream2;
soundPlayer.PlayLooping();
}
This may not be noticeable when playing two separate distinct sounds, but is very noticeable when trying to pull off the looping mechanism I want. The sound wavs are instrument samples, very small (usually no more than 0x1000 bytes).