English 中文(简体)
How can i get 2 wavefilereaders to play sequencially?
原标题:

I m trying to play a set of audio wav files being sent over the network for playing as a overall sound stream. How do i get a set of these chunks to play one after the other with no sound breaks or blips using NAudio? I can have 1 file play, but I cant find a way to detect when one sound file ends or how to attach the 2nd sound file onto the 1st.

Currently when i try to play 2 files, the 1st track is cut off immediately and the only the final sound track is played properly

Any help would be greatly appreciated.

问题回答

This NAudio tutorial shows how to mix streams in real-time. It seems to support positioning (so you can mix the second stream right at the end of the first).

http://opensebj.blogspot.com/2009/02/naudio-tutorial-2-mixing-multiple-wave.html

another approach is to create your own custom WaveStream that contains two WaveFileReaders. In the Read method, return data from the first until it runs out, then start returning data from the second. You ll need to do a little more if you need to support repositioning during playback, but apart from that it should be very straightforward





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签