Recent

Author Topic: Lazarus Play constant Music in Background [SOLVED]  (Read 915 times)

AlphaInc.

  • Jr. Member
  • **
  • Posts: 93
Lazarus Play constant Music in Background [SOLVED]
« on: April 01, 2021, 07:08:30 am »

I've been working on a little tool the past few days and the functionality itself is fine. I wanted to make the tool a little nicer to work with (at least for me) and included a sound-file (called test.wav) which plays one of my favorite songs.

The idea was that the song constantly repeats itself but after one go through, the music stops. This is my code-snippet for the music-part:

Code: Pascal  [Select][+][-]
  1. procedure TForm1.music();
  2. begin
  3.     PlaySound('test.wav', 0, SND_ASYNC);
  4. end;
 

When i change SND_ASYNC to SND_LOOP and start debug my project my .exe-Windows does not appear but the music plays (also just once).

Also the Procedure is called at the project.lpr:

Code: Pascal  [Select][+][-]
  1. begin
  2.       ...
  3.       Form1.music();
  4.       Application.Run;

So how do I get the music to play in a constant loop? It doesn't have to be .wav btw.
« Last Edit: April 01, 2021, 09:39:20 am by AlphaInc. »

Mr.Madguy

  • Hero Member
  • *****
  • Posts: 844
Re: Lazarus Play constant Music in Background
« Reply #1 on: April 01, 2021, 09:20:21 am »
I guess you need to combine SND_ASYNC with SND_LOOP, i.e. "SND_ASYNC or SND_LOOP".
Is it healthy for project not to have regular stable releases?
Just for fun: Code::Blocks, GCC 13 and DOS - is it possible?

AlphaInc.

  • Jr. Member
  • **
  • Posts: 93
Re: Lazarus Play constant Music in Background
« Reply #2 on: April 01, 2021, 09:38:54 am »
Yeah, that was the solution. Thank you!

 

TinyPortal © 2005-2018