MultiMedia Soft forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

SMF - Just Installed!

Author Topic: Driving custom VUMeters from Players  (Read 2642 times)

vbfan

  • Newbie
  • *
  • Posts: 5
    • View Profile
Driving custom VUMeters from Players
« on: April 07, 2015, 12:25:10 PM »

Hi,
using VB.Net 2008. Iím intended to use two custom VUMeters for two different players, say VUmeter1 for Player1 and VUMeter2 for Player2. 
Embedded VUMeters are working fine but I want to use customized VUMeters that have the property

VUMeter1.Level  Ďcan handle a value from 0 to 40000
 
Iíve the following VUMeter related code:
In the Form Load Iíve:
     AudioDjStudio1.DisplayVUMeter.Create(Player1, VuMeter1.Handle)
     AudioDjStudio1.DisplayVUMeter.Create(Player2, VuMeter2.Handle)


For event Handling:
Private Sub audioDjStudio1_VUMeterValueChange(ByVal Sander As Object, ByVal e As AudioDjStudio.VUMeterValueChangeEventArgs) _ HandlesudioDjStudio1.VUMeterValueChange
        VUMeter1.Value = e.nPeakLeft   ĎWorks fine only for Player1
End Sub


I donít know how to drive my VUMeter2 from Player2. I admit that Iím missing some extremely basic concept (especially with event handling). :-\ Iíve studied documentation but could not figure it even after spending a whole day. Can you please reveal the correct syntax and concept that can drive two VUMeters (VUMeter1 and VUMeter2) from two different Players(Player1 and Player2)?  :)
Best regards.
Logged

Administrator

  • Administrator
  • Sr. Member
  • *****
  • Posts: 298
    • View Profile
    • MultiMedia Soft
Re: Driving custom VUMeters from Players
« Reply #1 on: April 07, 2015, 04:22:07 PM »

Hello,

the VUMeterValueChangeEventArgs class, represented by the "e" parameter of the VUMeterValueChange event, is made of 3 elements and the first element is nPlayerIndex: this number represents the zero-based index of the player that fired the event so, during playback of the 2 streams loaded into Player1 and Player2, it will be fired once for Player1 and once for Player2: usually, as seen inside our samples, Player1 has value 0 while Player2 has value 1 so the parameter nPlayerIndex will come once with value 0 and once with value 1.

The pseudo-code for driving the 2 custom vu-meters will be something similar:

Code: [Select]
Private Sub audioDjStudio1_VUMeterValueChange(ByVal Sander As Object, ByVal e As AudioDjStudio.VUMeterValueChangeEventArgs) _ HandlesudioDjStudio1.VUMeterValueChange
    If e.nPlayerIndex = Player1 Then
        VUMeter1.Value = e.nPeakLeft
    ElseIf e.nPlayerIndex = Player2 Then
        VUMeter2.Value = e.nPeakLeft
    End If
End Sub

Hope this better explains the usage of the e.nPlayerIndex which is identical for any player-related event.

Kind Regards

Severino Delaurenti
MultiMedia Soft
Logged

vbfan

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Driving custom VUMeters from Players
« Reply #2 on: April 07, 2015, 05:47:02 PM »

Thanks. I got the idea and managed it with success.  :D Actually I was confused with the concept of e.
It's working fine now.You helped me a lot (as usual :) ). Thanks again. 
Logged