How to free the players for real ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
60 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

fredvs
Administrator
> How can it be a procedure of my Form1 now ?

Huhm....

In unit1.pas

  { TForm1 }

  TForm1 = class(TForm)
  ....
   procedure TimerFadeTimer(Sender: TObject);
   procedure MyEndProc();                   // -----> add this
  ....

implementation

...

 procedure Tform1.MyEndProc();     // ----> add this
begin
// add your code
end;

______________________________

And with your player, define uos_EndProc like this:

 uos_EndProc(nPlayer, @MyEndProc);

Fre;D


Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

jeremzw
Ok, it's clearer now, thank you !

I have to try this but I have a bit of work before :
since I replaced all the uos files in my project by the ones from uos/src, the project cannot work anymore.

I think my uos files were old, and some things were updated in between. (uos_seek became uos_inputseek, things like that).
So I need to fix all of this first, unfortunately.
But maybe it will help to solve the problem !

I'll get back to you when this will be tried.
Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

fredvs
Administrator
> (uos_seek became uos_inputseek, things like that).

Ooops, then your uos version is **very** old.

Could it be that you did use a demo from a book or a Pascal-site ?

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

jeremzw
I downloaded examples somewhere, but can't remember...

Now I'll just look up in the multiplayer source code how they play a sound and try to change my code to make it more up-to-date.
Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

fredvs
Administrator
Take a look at MultiInput demo, maybe it could help you.

That way, you could prepare 5 songs in only one thread and play/mute the one you want with input.enable := true/false.

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

fredvs
Administrator
Hello.

I did find a little problem with MultiInput demo (and in uos code for this).

Could you use the new release of uos 0f453d5..2caedf5?
https://github.com/fredvs/uos/

Thanks.

Fre;D

Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

jeremzw
Thanks, I updated everything : Lazarus, uos, and tried MultiInput demo.

But I don't really think that's what I need :
MultiInput has several sounds in the same thread, and then you play the thread with one command.

But I need to be able to give orders to each sound separately (start them at different times, control the volume of each of them on the fly, ...)

I'm still going to try to find a way to use EndProc.
Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

jeremzw
By the way, as I'm updating all the syntax with all new procedures names in the new uos, I figured out that there's a problem with uos_InputPositionTime / uos_InputPositionSeconds... it's not working in my project, but it's not working either in your project "Simple Player" (Time is not displayed and trackbar is not moving...)
Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

jeremzw
Good news : it seems to all work better now, with freeing the threads since I'm using the most recent uos files in src folder.

One song plays, then automatically disappear from ALSA as soon as it ended.

But I can't fully control that everything's working, since there's a problem with uos_inputpositionseconds ...
Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

jeremzw
Nothing really works anymore with the "position" in the sound, so I can't control when to start the next sound anymore, until the current sound has completely stop.

I hope my syntax is right... But at the same time, I can't find any project within the examples where the "position" procedures are functional !!


Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

fredvs
Administrator
> ut at the same time, I can't find any project within the examples where the "position" procedures are functional !!

Huh, did you try SimplePlayer demo ?

Fre;D

Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

fredvs
Administrator
In reply to this post by jeremzw
> I hope my syntax is right...

Me too but in your Github site, the code is 6 days old.

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

jeremzw
Sorry, I just updated my files.

Although, on your Github site, the last version of Simple Player also has the procedure "inputposition" not working...
Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

jeremzw
It seems that it doesn't work because of uos_InputLengthTime which returns 0.
Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

fredvs
Administrator
OOOOOps.

You are **TOTALLY** right.

It seems that last commits was not ok.

Sorry for this, I will investigate tonight.

Fre;D

Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

fredvs
Administrator
Hello.

Could you try with last commit 2caedf5..e046077 ?
https://github.com/fredvs/uos/

Really sorry for the inconvenient.

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

jeremzw
MMmmh... just replacing uos.pas with the new one didn't change anything for now... maybe because uos_flat hasn't changed ?
Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

fredvs
Administrator
Hello.

The very last one (from 2 seconds ago) ?

Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

fredvs
Administrator
In reply to this post by jeremzw
> maybe because uos_flat hasn't changed ?

No, uos_flat.pas was not the guilty, only uos.pas

Did you try SimplePlayer demo ?
Reply | Threaded
Open this post in threaded view
|

Re: How to free the players for real ?

jeremzw
Still not working.
And I had the same problem with simple player...
123