Basim Hafidh

Basim Hafidh

  • NA
  • 3
  • 1.7k

Audio Player Class with C#

Feb 6 2013 12:41 PM

I am learning th c# stuff. I downloaded the Audio Player Class posted by Mostafa Kaisoun on April 30, 2012. Instead of controlling the volume by the tbVolume I tried to control the volume using numbers received from  a serial port. I received the numbers but "Myplayer.Volume" does not work. Any help would be appreciated.
The following is my added method:

private void serialPort1_DataReceived(Object sender, System.IO.Ports.SerialDataReceivedEventArgs e)

{   Thread.Sleep(50);

   byteStr = serialPort1.ReadExisting();

   if (byteStr == "") return;

   try{   recevedNumber =Connvert.ToInt32(byteStr);

   }

   catch{

      //MessageBox.Show("An error occurred");

      return;

    }

   // this label is to check if I recived the number

   this.label1.Text = receivedNumber.ToString();

   MyPlayer.Volume = receivedNumber;

}

v