Waring Beeps (SOLVED

This forum is currently in read-only mode.
  • How do use "every x milliseconds" command after hitting a button?

    I want the "every x milliseconds" command to start after I hit a button

  • Just make sure a condition is met and run the "every..." event as a sub-event.

    + On left clicked on Sprite

    -> System: Set global variable 'warning' to 1

    + Is global variable 'warning' equal to 1

    ++ Every x milliseconds

    -->do whatever is needed after the button was clicked

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you

  • Need some debug help

    http://www.box.net/shared/6ac37tfmk9

    The initial 1 min and 3 minute timer works

    But I can not change my mind and select a different time once one started. Also after hitting stop I can not restart

    Any thoughts?

  • Need some debug help

    http://www.box.net/shared/6ac37tfmk9

    The initial 1 min and 3 minute timer works

    But I can not change my mind and select a different time once one started. Also after hitting stop I can not restart

    Any thoughts?

    Don't mix the code and the behaviour of the xaudio2 object here

    The basic code is correct. It changes 'TimerCheck' to the correct values. The problem is the way you use xa2. You order it to autoplay, that means it will use the next free channel to play whatever it needs to play, until the end of the soundfile is reached. This is not sufficient for your needs I think.

    Instead, use xa2's 'Load file' to bind the soundfile to a specific channel, and use xa2's 'Play' to play the sound. When hitting the stop button you should then also stop the sound.

    To reset the sound, just set the channel's position to zero.

    You don't want to repeat an action every x milliseconds, you rather want to loop a timespan for a specific amount of time (until you hit stop) beginning with a button being pressed. I would recommend to use Timer and a global 'TimeStamp" for this task. With modulo you will get a loop over the allowed timespan. There's just one thing to pass attention to: Timer is an exact value, whereas your events are executed within a tick that may last for several milliseconds. That's why you can't directly compare to zero but a range. For most event sheets, one TimeDelta-range should be enough. TimeDelta is a fraction of a second, so multiply it by 1000 to get a milliseconds value to compare with. If your project grows and you happen to not hear the sound playing, just raise that value in TimeDelta steps (so the next range to compare with would be TimeDelta * 2000)

    btw, you shouldn't raise the volume to 25db, or you will risk the ears of your users. For very quiet sounds setting the master volume to 6 or at maximum 12 db may be ok. On the other hand, there's always the limiter, if you didn't touch it, it will at least prevent distortion. Also, there is no way to restore to 0db right now.

    Yeah, sounds more complicated than it is, really. Have a look at your reworked cap:

    rwTimer.cap

  • tulamide,

    You approach worked out perfectly, though I am now going back to see exaclly whay it worked. XAudio2 seems to have some rules I did not pick up on, but well woth understanding.

    Thank you so much for the fast reply!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)