AxWindowsMediaPlayer, Volume change is not occuring while playing Midi File

5k Views Asked by At

I am trying to change the volume of an AxWindowsMediaPlayer Object. Like this.

//Change Volume
private void VolumeTrackBar_ValueChanged(object sender, EventArgs e)
{
   if (MidiAxWindowsMediaPlayer != null && VolumeTrackBar != null)
       MidiAxWindowsMediaPlayer.settings.volume = VolumeTrackBar.Value*10;
}

If I place a break point inside that if statement, I can see it is executed as I intended. But the volume change is not reflected during playback. It always plays at the same volume,no matter if I change the volume before, during or after.

The TrackBar has a range from 0 to 10, so when I multiply it's value by 10, I will always get something in the range 0-100, which is the range needed by the AxWindowsMediaPlayer Object.

2

There are 2 best solutions below

0
On BEST ANSWER

After searching and finding no solution (as well as other people having the same problem) I found a fix.

Instead of referencing AxWMPLib, reference WMPLib

Then create the Media Player Object Like so

WMPLib.WindowsMediaPlayer MidiWindowsMediaPlayer = new WMPLib.WindowsMediaPlayer();

ThisObject will allow volume changes to Midi Playback.

0
On

u can use under code

axWindowsMediaPlayer1.settings.volume = 100;

change code for your Request

Good Luck