问题
I'm trying to figure out how to play music to two different audiodevices at the same time.
What I've done is to create a class that makes life easier for me when programming with Naudio, it has play mp3 & wav's, pause, stop etc etc.
What I'd love to have is the ability to chose what playback device the audiostream should be outputted to. Is there some way I can incorporate it like this:
Play to: Realtek HD audio 2nd output and Speakers (if it was plugged in)
Here's the "Play" function I created:
public void Play(string Searchpath, int Time = 0)
{
DisposeWave();
string FileExtension = System.IO.Path.GetExtension(Searchpath);
if (FileExtension == (".mp3"))
{
NAudio.Wave.WaveStream pcmstream = NAudio.Wave.WaveFormatConversionStream.CreatePcmStream(new NAudio.Wave.Mp3FileReader(Searchpath));
stream = new NAudio.Wave.BlockAlignReductionStream(pcmstream);
}
else if (FileExtension == (".wav"))
{
NAudio.Wave.WaveStream pcmstream = new NAudio.Wave.WaveChannel32(new NAudio.Wave.WaveFileReader(Searchpath));
stream = new NAudio.Wave.BlockAlignReductionStream(pcmstream);
}
output = new NAudio.Wave.DirectSoundOut();
output.Init(stream);
output.Play();
Playbackstate = PlaybackState.Playing;
}
Is there some page I can read up on this at?
Thank you
来源:https://stackoverflow.com/questions/20724897/play-audio-to-two-different-audiodevices-simultaneously-with-naudio