WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Playing Music (https://www.wowinterface.com/forums/showthread.php?t=17537)

Eleuthria 08-03-08 06:21 PM

Playing Music
 
I'm making an addon that functions like a radio station for the guild, playing music files (assuming the guild members have them) whenever an officer clicks 'Play' on the addon.

PlayMusic works, but only if they have it enabled in sound options, and if loop is checked it keeps looping the song. Is there any way to make it play the tracks regardless of the Music option in sound settings, without losing the ability to stop the track at any time?

If not, is there a way to enable music for the track, then disable it before it loops?

Freki 08-03-08 07:54 PM

Best way to do this is to store the current cvar sound settings, set the ones you want, then change them after you're finished.

So...like this:

Code:

local oldEnableMusic,oldLooping = GetCVar("Sound_EnableMusic"), GetCVar("Sound_ZoneMusicNoDelay")
SetCVar("Sound_EnableMusic",1)
SetCVar("Sound_ZoneMusicNoDelay",0)

Then just restore the original values later.

Eleuthria 08-04-08 09:02 AM

That looks great, my only question is how can I find out if the song has finished playing? The only way I can think of right now is the addon would have to have the length of the song in seconds added to it's table for song information. That is possible, but is there any other built-in method to determine if music is still playing?

Duugu 08-04-08 09:55 AM

Quote:

Originally Posted by Eleuthria (Post 97585)
That looks great, my only question is how can I find out if the song has finished playing?

You can't ... afaik at least.


All times are GMT -6. The time now is 06:37 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI