Having problem to work with VolumeSource

Oct 22, 2014 at 9:34 PM
Hi, I am building a player which should play 5 different audio file and capture audio from Mic and then mix them to the get a new audio. I am having problem to change the volume of individual player. I am using soundSource.AppendSource(x => new VolumeSource(soundSource), out volumeSource); and then changing volumeSource.Volume value but it is not working. Here soundSource is my IWaveSource variable

This is my first post in this forum. Please guide me accordingly.
Coordinator
Oct 23, 2014 at 8:42 AM
Take a look at the SimpleMixer sample. It shows how to use the volumesource for multiple sources. If there are any questions, feel free to ask me.
Oct 24, 2014 at 8:51 PM
I have seen that sample code but still i m unable to control volume using volume source
I am sending u my code snippet
           soundOut = GetSoundOut();
           //create the equalizer. here myEqualizer is user control used on this form
          myEqualizer1._equalizer = GetEqualizer();

            soundSource = myEqualizer1._equalizer.ToWaveSource(16);   

            soundSource.AppendSource(x => new VolumeSource(soundSource), out volumeSource);
            soundOut.Initialize(soundSource);
            soundOut.Play();__
and in volumetab at form i m doing
  private void volumeTB_Scroll(object sender, EventArgs e)
    {
        volumeSource.Volume = (float)(volumeTB.Value / (float)volumeTB.Maximum);
    }
Coordinator
Oct 24, 2014 at 9:48 PM
Ahh I can see the problem.
Change your code from
soundSource.AppendSource(x => new VolumeSource(soundSource), out volumeSource);
from
soundSource = soundSource.AppendSource(x => new VolumeSource(soundSource), out volumeSource);
Otherwise you are initializing the soundOut with the equalizer but the volumeSource will be excluded from the audio chain.
Oct 25, 2014 at 8:24 AM
Thanks for your guidance, My problem solved, previously i was doing this but it was giving me conversion error for

soundSource = soundSource.AppendSource(x => new VolumeSource(soundSource), out volumeSource);

but know it is working with

soundSource = soundSource.AppendSource(x => new VolumeSource(soundSource), out volumeSource).ToWaveSource();


Thank u very much for sparing your time for me