I have a problem using Media Player to play a number of parts of .wav-files after each other. While one part is being played I don't want the program to wait.
If I set
Notify := true;
and
Wait := False;
then
Play;

I get no sound at all.
What's the trick?

Setting Wait := True; and not using Notify gives me tha sound, but the the computer is frozen until play is done.

Yes.
Every time OnNotify event is called I set Notify := true and Wait := False. Then I define a new sound and "Play", but it seems like all sounds are just passed, without I hear a sound.
Also I get a notify event in much less the time it should take to play my sound file. I specify start and end times in a sound file.

It seems like unless I set Wait := True there will be no sound. This however means the program can not do anything else while a sound is played. Is that realy the case??

It seems like unless I set Wait := True there will be no sound. This however means the program can not do anything else while a sound is played. Is that realy the case??

Nop! If mediaplayer behaves like this, acept it an try it other way: Create a new thread that launch the sound with wait:= true, when THIS thread recover the control, it can set a global variable to signal it is finish to the main thread.

-Make another thread, and call the media player.
-This thread, on completion, call a procedure or set a variable to true.
-The thread suicide.

When this variable is set to true, internally it can be a proerty with a write method, so basically, the thread calls a method, then die.

You can play the next sound after this method is called, and, in the menawhile, your app is live and working as expected.

Don't understand what you mean. According to the minimal help that I have found:
Wait determines whether a media control method returns control to the application only after it has been completed.

Can you give a simple sample code for what you mean?

No, I don0t use threads usually, but creating a new thread and playing the media player from it is like dividing your app. into 2 different tasks, one is the main one, and the other is the one that launch mediaplayer and has to wait until it finish.

Is like in firefox: While one tab is bussy, the others are not, and the main thread (the menus and so) are running even if all the tabs are bussy. FDirefox uses 1 thread per tab + a main thread.

Anyway, you should have to look for TThread help or use google, I always managed to live without it, but it is a good resource is you get used to this (and you can, for instance, use several CPU from your app using it!).

Many thanks BitFarmer for your assistance. I have already looked at TThread help and have some ideas about how I could benefit from it. Nice with new ideas.

Also I just some minutes ago happened to find a "Close" instruction after "Play" in my code controlling my MediaPlayer. After removing this Close it works fine with Notify as well.

Again thank you for your help.

Arne

This question has already been answered. Start a new discussion instead.