Thread Tools Display Modes
08-03-08, 06:21 PM   #1
Eleuthria
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 5
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?
  Reply With Quote
08-03-08, 07:54 PM   #2
Freki
A Deviate Faerie Dragon
 
Freki's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 18
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.
  Reply With Quote
08-04-08, 09:02 AM   #3
Eleuthria
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 5
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?
  Reply With Quote
08-04-08, 09:55 AM   #4
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Originally Posted by Eleuthria View Post
That looks great, my only question is how can I find out if the song has finished playing?
You can't ... afaik at least.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Playing Music

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off