Is there a way to see which Music ID is playing?

Find quick help here to get you started with Hollywood
Post Reply
Bugala
Posts: 1402
Joined: Sun Feb 14, 2010 7:11 pm

Is there a way to see which Music ID is playing?

Post by Bugala »

I was looking at Hollywood's Music Commands, as well as GetAttribute options, but didn't catch any way to get info about which Music ID is playing currently.

You can query if a certain music ID is playing, but you can't find out directly which music ID is playing right now.

Is this so, or did I just not find it?
User avatar
jPV
Posts: 749
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Is there a way to see which Music ID is playing?

Post by jPV »

There probably isn't a direct command for it, but you can do a small function yourself:

Code: Select all

Function p_WhichMusicIsPlaying()
	; Returns the ID of a music object that is playing currently.
	; If no music is playing, then it returns Nil.
	Local t, c = GetObjects(#MUSIC)
	For Local i = 0 To c - 1
		If IsMusicPlaying(t[i]) Then Return(t[i])
	Next
EndFunction
Bugala
Posts: 1402
Joined: Sun Feb 14, 2010 7:11 pm

Re: Is there a way to see which Music ID is playing?

Post by Bugala »

Thanks from this.

I actually am already keeping track myself what music is playing, but there is always a chance some bug affects this track keeping, since its main purpose is that I can simply use PlayMusic(name) without worrying if it is already playing or not. As in, it will check if that music is already playing, then it skips the PlayMusic command.

Hence I was preferring some Hollywoods own direct system to avoid bug preventing it working correctly, as in this case I am looking for thing to happen based upon what millisecond of music is played.

Right now your solution seems like the best option, since while not directly getting what music is playing, at least bugs in my own track keeping wouldnt affect it, but your system would be working independently from it, and basically doing it through hollywoods own methods.
Post Reply