Click here to Skip to main content
15,919,245 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hello,
I have a function that allows out a stream: When I speak into the microphone of the computer the sound comes directly from the computer's sound card. But I have a problem with this code does not allow me out the sound in a sound card externe.I have 3 soundcards installed on my computer and I want out he sound of a specific card.
Is someone can help me please. Thank you in advance for your support.

Here is the function 'Start' that I took of this site:

C#
private void Start()
        {
            Stop();
            try
            {
                PaGa.WaveFormatt fmt = new PaGa.WaveFormatt(44100, 16, 2);
                m_Player = new PaGa.WaveOutPlayer(-1, fmt, 16384, 3, new PaGa.BufferFillEventHandler(Filler));
                m_Recorder = new PaGa.WaveInRecorder(-1, fmt, 16384, 3, new PaGa.BufferDoneEventHandler(DataArrived));
            }
            catch
            {
                Stop();
                throw;
            }
        }
Posted

Using DirectShow's Graph Builder[^] you can set and render you output device and test your path
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 17-May-11 18:59pm    
Helpful, my 5.
There is an error in code; please see my answer.
--SA
It does not solve your problem; just an important side note:

This is functionally correct but pointless:
C#
try {
/...
} catch { //there are no cases when you should catch all and not use an instance of Exception
    Stop();
    throw;
}


Correct pattern is this:
C#
try {
/...
} finally { //finally is specially designed for such cases
    Stop();
}


—SA
 
Share this answer
 
Comments
fcronin 17-May-11 20:03pm    
Unless he doesn't want to Stop() unless the try block fails, if no exception he wants to keep 'it' running?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900