Announcement

Collapse
No announcement yet.

Playing multiple WAV Files

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Playing multiple WAV Files

    If I put one wave file to play..then everything works ok..

    so how I play a seqence of WAV files ?

    Anyone know?

    Thanks

    Darren

    #2
    Use the async API SipCall.StartPlayingWav( fileName ) and the Event WavFinishedPlaying()

    The procedure WavFinishedPlaying( sipCall ) is called automatically by the plugin in your script when the first wav is finished. In the event procedure, just start playing another wav.

    You could save your sequence number in the call context.
    --
    stipus

    Comment


      #3
      ok thanks for that.

      Comment


        #4
        Hi, I am trying to play wav files depend on caller id etc.
        I have a lookup script to a lokal webservice that translate phonenumbers to name,address, map etc.

        How can I play 4 wavfiles in a sequence and then redirect the call?

        Don't know how to use WavFinishedPlaying to play wav file 2,3,4 etc

        PHP Code:
        Sub CallConnectedByVal c  as SipCall )
            
        Greeting)
        End Sub

        Sub Greeting
        ByVal c as SipCall )
            
        Dim hours As Integer CIntNow.ToString("HH") )
          If 
        hours And hours >= 0 Then
          c
        .StartPlayingWav"c:\ithemmet\PhoneWaves\god_morgon.wav" )    
          ElseIf 
        hours >= And hours 12 Then
                c
        .StartPlayingWav"c:\ithemmet\PhoneWaves\god_formiddag.wav" )
          ElseIf 
        hours >= 12 And hours 18 Then
                c
        .StartPlayingWav"c:\ithemmet\PhoneWaves\god_eftermiddag.wav" )
          ElseIf 
        hours >= 18 And hours <= 22 Then
                c
        .StartPlayingWav"c:\ithemmet\PhoneWaves\god_kvall.wav" )
          Else
          
        c.StartPlayingWav"c:\ithemmet\PhoneWaves\god_kvall.wav" )
          
        End If  
        End Sub

        Sub WavFinishedPlaying
        ByVal c as SipCall 
            
        Greating(c)
        End Sub 
        Please excuse any spelling and grammatical errors I may make.
        --
        Tasker Plugin / Speech Droid
        Tonlof | Sweden

        Comment


          #5
          You may use the call context to store information about the next wav to play... maybe a wav number that your increment each time WavFinishedPlaying is called.

          to store any object into the call context use
          c.SetContext( "OBJECT_NAME", object )

          to get an object back, use
          object = c.GetContext( "OBJECT_NAME" )

          Something like this should work (untested):

          Code:
          Sub CallConnected( ByVal c  as SipCall )
              c.SetContext( "WAV_NUMBER", 0 )
              Greeting( c )
          End Sub
          
          Sub Greeting( ByVal c as SipCall )
              Dim hours As Integer = CInt( Now.ToString("HH") )
            If hours < 9 And hours >= 0 Then
            c.StartPlayingWav( "c:\ithemmet\PhoneWaves\god_morgon.wav" )    
            ElseIf hours >= 9 And hours < 12 Then
                  c.StartPlayingWav( "c:\ithemmet\PhoneWaves\god_formiddag.wav" )
            ElseIf hours >= 12 And hours < 18 Then
                  c.StartPlayingWav( "c:\ithemmet\PhoneWaves\god_eftermiddag.wav" )
            ElseIf hours >= 18 And hours <= 22 Then
                  c.StartPlayingWav( "c:\ithemmet\PhoneWaves\god_kvall.wav" )
            Else
            c.StartPlayingWav( "c:\ithemmet\PhoneWaves\god_kvall.wav" )
            End If  
          End Sub
          
          Sub WavFinishedPlaying( ByVal c as SipCall ) 
              Dim wavNumber as Integer = CInt( c.GetContext( "WAV_NUMBER" ) )
              wavNumber = wavNumber +1
              c.SetContext( "WAV_NUMBER", wavNumber )    
          
              if wavNumber = 1 Then
                 c.StartPlayingWav( "c:\my_wave1.wav" )
              end if
          
              if wavNumber = 2 Then
                 c.StartPlayingWav( "c:\my_wave2.wav" )
              end if
          
              if wavNumber = 3 Then
                 c.StartPlayingWav( "c:\my_wave3.wav" )
              end if
          
              if wavNumber = 4 Then
                 c.Hangup()
              end if
          
          End Sub
          --
          stipus

          Comment


            #6
            Thanks Stipus, that point me in a new direction Thanks.
            Please excuse any spelling and grammatical errors I may make.
            --
            Tasker Plugin / Speech Droid
            Tonlof | Sweden

            Comment

            Working...
            X