Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ PlaySound while not in Focus

PlaySound while not in Focus

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Rynok   USA  (25 posts)  Bio
Date Sun 25 Jan 2009 04:22 AM (UTC)
Message
It looks like PlaySound() doesn't kick off if MUSHclient isn't currently in Focus (as in, if I have mushclient running in the background while I surf the net, I won't hear sounds from the PlaySound() function)

Is there a way around this, or is this intended?
I saw that it had options for looping and volume and speaker direction, but I didn't see anything about it not playing at all when not in focus.

The workaround I found seems to be that you have it fire off a trigger that has the Sound play inside of it when it fires (not through PlaySound() but through MUSHclient itself).
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 25 Jan 2009 04:42 AM (UTC)
Message
This forum thread is referred to in the PlaySound documentation:

http://mushclient.com/forum/?id=8721

In there I note:

Quote:

Apparently sounds can stop playing if you Alt+Tab to another application (or simply switch windows), and then switch back. Your scripts might want to periodically check whether music or ambient sounds they have started earlier are still playing (use GetSoundStatus), and if not, start them again.

Under the current configuration, the sounds stop playing if you make another application active, and then resume when MUSHclient is the foreground application again (or at least, it does for me).


Thus the behaviour you are getting is expected.

The PlaySound and related functions were really intended for playing multiple sounds during a battle (which sounds quite neat) like sword hits, grunts, spellups, and so on, merged with background music and ambient sounds. Hence the emphasis on multiple buffers, panning, volume levels and so on.

For the simple case of a sound notification, on a trigger, when the application is not active, the Sound function is probably the best.

Note that GetInfo (113) tells you if the world is currently active or not.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


10,332 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.