Posted December 20, 20177 yr I using uFMOD to Play .xm chiptunes in my Project. It works already finde! When i start the program it plays the music and when i close the program it stop playing. But i like to have one Button where i can start and stop the music. Like.... If music is playing then Stop music else Play music ... I'm a newbie in Delphi. I Hope anybody can Help me!
December 20, 20177 yr I will quote Mr kao here Quote There is a search button in top right corner. You'll be amazed what you can find when you search for "xm player delphi"
December 20, 20177 yr Author I know this man. But dont know how i should write the code does it works. Sorry
April 11, 20187 yr In my project, I created a global boolean variable called playZik. var playZik: Boolean; In my FormCreate you should have something like the following. Here when the song plays I set my variable TRUE (Playing). procedure TForm1.FormCreate(Sender: TObject); begin XMPlayFromRes('FOND', 'ZIK'); playZik := True; end; I have a button on my form and enter the following for the OnClick event. This simply checks the flag (our global variable) and if it's TRUE it stops playing the song. If FALSE then it plays, it then just toggles the flag. If True make it False and vice-versa. procedure TForm1.btnMZKClick(Sender: TObject); begin if playZik then XMStop else XMPlay; playZik := not playZik; // toggle flag variable. end; Hope this helps. Better late than never lol. Edited April 11, 20187 yr by Croll code formatting
Create an account or sign in to comment