Page 1 of 1

IsMusicPaused command.

Posted: Fri May 16, 2025 1:42 pm
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.

Re: IsMusicPaused command.

Posted: Fri May 16, 2025 1:46 pm
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.

Re: IsMusicPaused command.

Posted: Fri May 16, 2025 2:14 pm
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?

Re: IsMusicPaused command.

Posted: Sun May 18, 2025 5:51 pm
by airsoftsoftwair
Can't reproduce this here. Which system are you testing this on?

Re: IsMusicPaused command.

Posted: Sun May 18, 2025 9:33 pm
by Bugala
Hollywood 10, Windows 11.

Re: IsMusicPaused command.

Posted: Sun May 25, 2025 7:18 pm
by airsoftsoftwair
With or without the avcodec plugin?

Re: IsMusicPaused command.

Posted: Sun May 25, 2025 9:07 pm
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

Re: IsMusicPaused command.

Posted: Thu Jun 05, 2025 7:20 pm
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()