IsMusicPaused command.

Feature requests for future versions of Hollywood can be voiced here
Post Reply
Bugala
Posts: 1390
Joined: Sun Feb 14, 2010 7:11 pm

IsMusicPaused command.

Post by Bugala »

I have a very simple player, it has PLAY, STOP, and PAUSE.

What I am trying to achieve is that when using Pause it Pauses, and Resumes.

With Stop it simply STOPs, and if after that using PAUSE, it would play from beginning.

With PLAY, it would always start playing from beginning.

Nothing hard there. Except, I would need one command, which is IsMusicPaused (is there one somewhere that I missed?), for so far I haven't been able to get the PLAY-button to play from beginning when in PAUSE-mode, without adding my own variable which keep track if music file is paused or not. I think it would be better that there would be a command to check this, just like IsMusicPlaying (it could actually notify in this whether music is playing, and also, if it is in pause mode), instead of having to add own Variable to keep track of it.


I also encountered a bug probably (this isn't full example):

Code: Select all

Local ID = MakeButton(Nil, #SIMPLEBUTTON, X, Y, ButW, ButH, {OnMouseDown=Function() 
							If IsMusicPlaying(1) = True
								PauseMusic(1)
							Else
								ResumeMusic(1)
							EndIf

Local ID = MakeButton(Nil, #SIMPLEBUTTON, X, Y, ButW, ButH, {OnMouseDown=Function() 
										    StopMusic(1)
										    PlayMusic(1)
										    EndFunction})
InsertItem(Player.Buttons, ID)
By other words, Above one is the Pause button, which simply check if IsMusicPlaying() is TRUE, and then either PauseMusic(), or ResumeMusic().

The second button is the PLAY-button. Idea is that what I was hoping was that if this button would be played after the PauseMusic() has happened (music is on PAUSE-state) then it would first StopMusic() and then PlayMusic(), meaning it in practice would play the music from the beginning.

By otherwords, thought this could be a hack around the problem of having no way to find out if music is in pause mode or not, by forcing music be stopped and then played from beginning.

Result: Instead of playing the music from beginning, as was the intention, it actually works same as ResumeMusic(), continuing the music playing from location I paused it at. I suppose this isn't intended behavior.

Hollywood 10, Windows 11.
Bugala
Posts: 1390
Joined: Sun Feb 14, 2010 7:11 pm

Re: IsMusicPaused command.

Post by Bugala »

Found a solution around this. I dont use StopMusic() or PlayMusic() at all. I only use PauseMusic(), ResumeMusic(), and SeekMusic() to do all. Not ideal, but works.
Bugala
Posts: 1390
Joined: Sun Feb 14, 2010 7:11 pm

Re: IsMusicPaused command.

Post by Bugala »

Found I can query if Music Is Paused throug GetAttribute.

Otherwise all solved, but that probably bug behavior of Pause -> Stop -> Play stays:

Code: Select all

OpenMusic(1, "Testfile.mp3")
PlayMusic(1)
Wait(50)
PauseMusic(1)
StopMusic(1)
Wait(50)
PlayMusic(1)
Repeat
Forever
Test with this code. This code results in Music being Paused and after that wait(50) PlayMusic results in it Resuming the music instead of playing from beginning.

Intended behavior, or a bug?
User avatar
airsoftsoftwair
Posts: 5834
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: IsMusicPaused command.

Post by airsoftsoftwair »

Can't reproduce this here. Which system are you testing this on?
Bugala
Posts: 1390
Joined: Sun Feb 14, 2010 7:11 pm

Re: IsMusicPaused command.

Post by Bugala »

Hollywood 10, Windows 11.
User avatar
airsoftsoftwair
Posts: 5834
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: IsMusicPaused command.

Post by airsoftsoftwair »

With or without the avcodec plugin?
Bugala
Posts: 1390
Joined: Sun Feb 14, 2010 7:11 pm

Re: IsMusicPaused command.

Post by Bugala »

I havent activated it in the code, but if it activates automatically, then it could be there.

Just using this piece of code triggers the behavior for me of last PlayMusic(1) continuing the music instead of starting it from beginning.

Code: Select all

OpenMusic(1, "Testfile.mp3")
PlayMusic(1)
Wait(50)
PauseMusic(1)
StopMusic(1)
Wait(50)
PlayMusic(1)
Repeat
Forever
User avatar
airsoftsoftwair
Posts: 5834
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: IsMusicPaused command.

Post by airsoftsoftwair »

Ok, I can reproduce it, it's fixed now!

Code: Select all

- Fix: Calling StopMusic() after PauseMusic() didn't rewind the music in the same way as when calling StopMusic() without PauseMusic()
Post Reply