Play memory streams avoiding gap between them in WP8.1 app

42 views Asked by At

I have 2 memory streams which are representing wav files in my Windows Phone 8.1 app. I want to play them but avoiding gaps between them, is there any way to do that without using Sleep methods or something like that?

I've tried already the Thread.Sleep() but I think it is making lot of gaps as my 2 files are 20ms duration each.

1

There are 1 answers

1
jaket On BEST ANSWER

Assuming the audio is the same format and the wave headers have been stripped you could just concatenate the memory streams.

streamTwo.CopyTo(streamOne);

If the wave headers are still embedded then you'd need to skip over the one in the second stream - generally 44 bytes. If the formats are different then you'll need to find another technique.