Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

How To Stop Audio When Windowed?

Hi all,

When in the windowed mode I want to be able to control the audio so that if the player decides to suddenly chat on MSN or browse the web a little in the middle of a cutscene, the BGM ME SE etc will all be paused immediately and then resume playing when the player clicks on the RPG Maker window again. I'm asking this because several of the audio pieces in my game are specifically timed for plot twists and it would be weird for the music to pick up pace all of the sudden while the player is typing an email and then the audio slows down to a soft melody when the player figures out that their best friend is the real villain!  :cry:
Is it possible or has it already been done?

It would also be useful to know how to do it in fullscreen as well. So that if the player presses ALT+TAB or something, the audio will stop.

Basically I'm wondering is there a script already out there or how would I go about creating my own script.
Thank you for your time.  :smile:

~james8900
 
There is currently no way to 'pause' music in either RGSS or RGSS2. And it's not one of those things that can be easily accomplished with a custom script either. You would have to implement your own Audio module.

Unless someone gets really ambitious & writes an extended Audio module, your best bet is probably breaking up the music into parts, and starting each part when appropriate in your cutscene.

Be Well
 

khmp

Sponsor

Windows + D or Ctrl-Alt-Del if it's fullscreen. I guess an input script might be able to do those. But again detecting keystrokes would not be the only bother to get it the way I think he wants it.
 
Detecting 'out of focus' would be even trickier. For example, if you have the game running in window mode, and you select another application, the game pauses, but the music keeps playing (because it's threaded.)  Like I said, you'd have to write another player that checks the game windows 'focus', and also buffers the audio file (regardless of type), and allows for the 'pause' & 'resume' functions.

I did a bunch of research. There's a dude named Hans Fugal that has written Audio classes for Ruby, and for the price of a T-shirt would probably help. I just don't see it as a priority, and have too many other things to do. It is, however on my list of "Things to do if I get really bored." (way down at the bottom) :scruff:

Be Well
 
Damn, for some reason I didn't think it would be that complicated. But what you guys are saying makes a lot of sense. It's not a huge deal but was bugging me quite a bit.
Thanks for the help everyone, I really appreciate it.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top