Thanks Steve, I set up a timer--and after a few bumps in the road, I got it working! Again thanks, and thanks for the GWAudioKit! Jeff Weiss
-----Original Message----- From: Stephen Clower [mailto:[email protected]] Sent: Thursday, September 15, 2011 10:17 AM To: [email protected] Subject: Re: continuous play with audioKit Jeff, Instead of looping as you are doing now, use a Timer callback to fire after each sound completes. The callback can then start the next sound playing and reset the timer until the list has been played. Steve On 9/15/2011 11:03 AM, Jeff Weiss wrote: > The only time I manually changed I was when I wanted to exit the > continuous_play function with > I = Total+1 > I guess I could use > Exit For > But this is not the problem. > The for next loop sends the whole list of files off to the play routine. > I put speak commands in there and they are being sent in order. > I think what is happening is that when a file finishes playing, the > others which have been sent were missed. They seem to keep cycling > around and the one that is up at the moment the previous file ends is > played. Eventually they are all played, but they are not in order. > I need a way to make sure they are queued in the order the for next loop > sends them. > Any suggestions about how I can do this would be appreciated. > Thanks, > Jeff Weiss > > > -----Original Message----- > From: Stephen Clower [mailto:[email protected]] > Sent: Thursday, September 15, 2011 8:39 AM > To: [email protected] > Subject: Re: continuous play with audioKit > > Jeff, > > You are using the variable "I" in different ways in your ContinuousPlay > function. In one part, you are manually changing it, and in another you > are using it as a counter in your loop. My guess is that, depending on > the scope of "I," it's being changed so much that your files end up > playing out of order. > > Steve > > > > On 9/14/2011 4:14 PM, Jeff Weiss wrote: >> Here is the Continuous_Play function and the subroutine with a timer >> that plays the files. >> >> >> Function Continuous_Play(dObj) >> On Error Resume Next >> If Continuous = 0 Then >> Continuous = 1 >> Speak "" >> Speak "Continuous play on " >> Sleep 300 >> >> Else >> Continuous = 0 >> Speak "" >> Speak "Continuous play off " >> Sleep 300 >> I = Total+1 >> SOAudioKit.Stop MySoundID >> SOAudioKit.Invalidate MySoundID >> End If >> >> If Continuous = 1 Then >> I = Start >> >> For I = Start To Total >> FileName = ScriptPath& "\"& MyFolder& "\"& cStr(MyArray(I-1)) >> PlayFile FileName >> >> If Continuous = 0 Then >> I = Total+1 >> End If >> >> Next >> >> End If >> On Error Goto 0 >> End Function >> >> sub playFile(FileName) >> On Error Resume Next >> If Continuous = 0 Then >> SOAudioKit.Stop MySoundID >> SOAudioKit.Invalidate MySoundID >> Exit Sub >> End If >> >> if SOAudioKit.IsPlaying(MySoundID) Or Pause = 1 Then >> ' need to wait until it's finished before playing the next sound, > check >> again in 200 milliseconds >> startTimer 100, "PlayFile", FileName >> exit sub >> end if >> >> >> >> -----Original Message----- >> From: Stephen Clower [mailto:[email protected]] >> Sent: Wednesday, September 14, 2011 2:34 PM >> To: [email protected] >> Subject: Re: continuous play with audioKit >> >> Jeff, >> >> Could you post the code you are using to do this? >> >> Steve >> >> >> >> On 9/14/2011 3:31 PM, Jeff Weiss wrote: >>> I am trying to play one song after another using the audioKit. I am >>> using a timer so that one song won't play until the last song is >>> finished. This works fine. >>> >>> When I use a for next loop to play 20 songs, for example, the songs >> will >>> play, but they are not in order. >>> >>> The songs play one after another, but how can I keep them in order >> when >>> they play. >>> >>> Thanks, >>> >>> >>> >>> Jeff Weiss, CVRT >>> >>> Rehabilitation Teacher >>> >>> Lions World Services for the Blind >>> >>> 2811 Fair Park Blvd. >>> >>> Little Rock, AR 72204 >>> >>> >>> >>> http://www.lwsb.org >>> >>> >>> >>> The Mission of LWSB is to educate adults who are blind or visually >>> impaired for careers and independent lives. >>> >>> >>> >>> >> > -- Stephen Clower Product support specialist GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825 260-489-3671 * gwmicro.com
