Announcement

Collapse
No announcement yet.

Application sleep while playing .wav?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Application sleep while playing .wav?

    I have tried to put AMS into sleep mode while a short .wav file is played for the user without any success. I have used 'application -- sleep' to create pauses in the display of graphics etc, but I can't seem to get it to work with a sound file. Any advice would be appreciated.

  • #2
    Re: Application sleep while playing .wav?

    Have you tried using a loop. Just set a label, let's say "Loopstart" and then put a conditional which says if x < 5000 (or whatever number you like) then increment x by 1 and GOTO the label Loopstart.

    That will cause a controllable delay in your application, simply set that number to the appropriate amount for your project.

    Corey Milner
    Creative Director, Indigo Rose Software

    Comment


    • #3
      Re: Application sleep while playing .wav?

      Thanks Corey! That was exactly what I needed.

      Comment


      • #4
        Re: Application sleep while playing .wav?

        Well -- It was what I needed; but I can't seem to get it to work. Having spend a couple of hours on this -- I just feel the need to say -- HELP! I have included my actions for review.

        <IR_ACTIONS_LIST>
        <Action name="IF">
        <Type>200</Type>
        <Function>1</Function>
        <DTIndentLevel>0</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        <Condition>%MyVar% = No</Condition>
        </Action>
        <Action name="Set Value">
        <Type>6</Type>
        <Function>0</Function>
        <DTIndentLevel>1</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        <Variable>%Counter%</Variable>
        <Value>1</Value>
        <Evaluate>0</Evaluate>
        </Action>
        <Action name="WHILE">
        <Type>204</Type>
        <Function>1</Function>
        <DTIndentLevel>1</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        <Condition>%Counter% &amp;lt; 5000</Condition>
        </Action>
        <Action name="Play">
        <Type>141</Type>
        <Function>0</Function>
        <DTIndentLevel>2</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        <WAVFile>%SrcDir%\WAV\Let's Get StartedToday.wav</WAVFile>
        <External>1</External>
        <PlaySynchronous>0</PlaySynchronous>
        </Action>
        <Action name="Set Value">
        <Type>6</Type>
        <Function>0</Function>
        <DTIndentLevel>2</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        <Variable>%Counter%</Variable>
        <Value>Evaluate (%Counter% + 1000</Value>
        <Evaluate>0</Evaluate>
        </Action>
        <Action name="END WHILE">
        <Type>205</Type>
        <Function>1</Function>
        <DTIndentLevel>1</DTIndentLevel>
        <Enabled>1</Enabled>
        <ErrorHandling>
        <UserNotificationMode>2</UserNotificationMode>
        <CustomErrorMessage/>
        <OnErrorAction>0</OnErrorAction>
        <JumpToLabel/>
        </ErrorHandling>
        </Action>
        </IR_ACTIONS_LIST>

        Comment


        • #5
          Re: Application sleep while playing .wav?

          Hi Henry - not sure why you want a wav file in a loop but this is the way i see it [I may be corrected here] ... the wav file is not getting chance to play [or even start up to produce sound] before the loop is reaching 'WAV.Play' again and so it starts again. I guess the wav file is in an endless loop of 'start/start again'. Notice how the wav file plays when runtime steps out of the loop, giving the wav file chance to play - finally.

          What is it you want to achieve with this? Perhaps there is another method for doing what yu want.

          In any case, FYI: The Actions yu pasted had no <font color=blue>END IF</font color=blue> and would, naturally, produce an error.
          This would work but of course, it's not good - as we have seen:

          <font color=green>
          <IR_ACTIONS_LIST>
          <Action name="Set Value">
          <Type>6</Type>
          <Function>0</Function>
          <DTIndentLevel>0</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          <Variable>%Counter%</Variable>
          <Value>0</Value>
          <Evaluate>0</Evaluate>
          </Action>
          <Action name="WHILE">
          <Type>204</Type>
          <Function>1</Function>
          <DTIndentLevel>0</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          <Condition>%Counter% &amp;lt; 5000</Condition>
          </Action>
          <Action name="Play">
          <Type>141</Type>
          <Function>0</Function>
          <DTIndentLevel>1</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          <WAVFile>%SrcDir%\HIGH1.WAV</WAVFile>
          <External>1</External>
          <PlaySynchronous>0</PlaySynchronous>
          </Action>
          <Action name="Set Value">
          <Type>6</Type>
          <Function>0</Function>
          <DTIndentLevel>1</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          <Variable>%Counter%</Variable>
          <Value>%Counter% + 1</Value>
          <Evaluate>1</Evaluate>
          </Action>
          <Action name="END WHILE">
          <Type>205</Type>
          <Function>1</Function>
          <DTIndentLevel>0</DTIndentLevel>
          <Enabled>1</Enabled>
          <ErrorHandling>
          <UserNotificationMode>2</UserNotificationMode>
          <CustomErrorMessage/>
          <OnErrorAction>0</OnErrorAction>
          <JumpToLabel/>
          </ErrorHandling>
          </Action>
          </IR_ACTIONS_LIST>

          </font color=green>

          Hope this helps [img]/ubbthreads/images/icons/smile.gif[/img]
          -
          = Derek
          ["All glory comes from daring to begin" - fortune cookie]

          Comment


          • #6
            Re: Application sleep while playing .wav?

            What I am trying to accomplish is this: I have setup a y/n dialog box. If the user selects no, then I want a short (30 sec) wave file to play. The problem is that if the user moves the mouse over any menu item, another sound starts and 'kills' the wave that I want the user to hear. Also, I don't want the user to change menus, etc until after the wave file has completed. What I need is some coding that is very similiar to the application -- sleep command. In fact, I have used this command to pause the app. for various graphics etc, and I tried using the sleep command and it didn't work. That's when I asked for help and Corey suggested using a loop. It sounded 'right-on' to me and I thought the problem was solved, but I couldn't get the coding to work. What I need is a simple 30 second pause, loop, whatever that will allow a file to be played to completion and since the program is in a loop it will prevent the user from stopping the wave file from completing.

            Comment


            • #7
              Re: Application sleep while playing .wav?

              My method is inprecise as loops will execute at different speeds on different machines. Using a flash object would solve your problem but I think there's a bug in the flash player about playing two sounds sources at the same time too, the second source bypasses the system voume and comes out at full volume or some such thing...

              Corey Milner
              Creative Director, Indigo Rose Software

              Comment


              • #8
                Re: Application sleep while playing .wav?

                hmmm - i found App.Sleep works fine with this:
                <font color=green>
                <IR_ACTIONS_LIST>
                <Action name="Message Box">
                <Type>5</Type>
                <Function>0</Function>
                <DTIndentLevel>0</DTIndentLevel>
                <Enabled>1</Enabled>
                <ErrorHandling>
                <UserNotificationMode>2</UserNotificationMode>
                <CustomErrorMessage/>
                <OnErrorAction>0</OnErrorAction>
                <JumpToLabel/>
                </ErrorHandling>
                <DialogTitle>Title</DialogTitle>
                <DialogMessage>message</DialogMessage>
                <Icon>3</Icon>
                <Variable>%Result%</Variable>
                <DialogType>1</DialogType>
                <DefaultButton>0</DefaultButton>
                </Action>
                <Action name="IF">
                <Type>200</Type>
                <Function>1</Function>
                <DTIndentLevel>0</DTIndentLevel>
                <Enabled>1</Enabled>
                <ErrorHandling>
                <UserNotificationMode>2</UserNotificationMode>
                <CustomErrorMessage/>
                <OnErrorAction>0</OnErrorAction>
                <JumpToLabel/>
                </ErrorHandling>
                <Condition>%Result% = NO</Condition>
                </Action>
                <Action name="Play">
                <Type>141</Type>
                <Function>0</Function>
                <DTIndentLevel>1</DTIndentLevel>
                <Enabled>1</Enabled>
                <ErrorHandling>
                <UserNotificationMode>2</UserNotificationMode>
                <CustomErrorMessage/>
                <OnErrorAction>0</OnErrorAction>
                <JumpToLabel/>
                </ErrorHandling>
                <WAVFile>%SrcDir%\WAV\Let's Get StartedToday.wav</WAVFile>
                <External>1</External>
                <PlaySynchronous>0</PlaySynchronous>
                </Action>
                <Action name="Sleep">
                <Type>51</Type>
                <Function>0</Function>
                <DTIndentLevel>1</DTIndentLevel>
                <Enabled>1</Enabled>
                <ErrorHandling>
                <UserNotificationMode>2</UserNotificationMode>
                <CustomErrorMessage/>
                <OnErrorAction>0</OnErrorAction>
                <JumpToLabel/>
                </ErrorHandling>
                <Seconds>30</Seconds>
                </Action>
                <Action name="END IF">
                <Type>201</Type>
                <Function>1</Function>
                <DTIndentLevel>0</DTIndentLevel>
                <Enabled>1</Enabled>
                <ErrorHandling>
                <UserNotificationMode>2</UserNotificationMode>
                <CustomErrorMessage/>
                <OnErrorAction>0</OnErrorAction>
                <JumpToLabel/>
                </ErrorHandling>
                </Action>
                </IR_ACTIONS_LIST>
                </font color=green>
                -
                = Derek
                ["All glory comes from daring to begin" - fortune cookie]

                Comment


                • #9
                  Re: Application sleep while playing .wav?

                  YOUR RIGHT! However, if you stick a page jump in front of the coding, instead of after as I did during my early trials with app. sleep, then the result is different.

                  Just for the record, I am a 'klutz'. Thanks so much for your help! As I've said before -- you guys are great!

                  Comment

                  Working...
                  X