[Gambas-user] gb.media - Pipelines with local declarations don't work
Benoît Minisini
benoit.minisini at gambas-basic.org
Mon Jan 15 11:56:56 CET 2024
Le 15/01/2024 à 10:34, Claus Dietrich a écrit :
> I found that gb.media-pipelines with local declarations don't work on
> V3.18.4 and the master. Here an example which doesn't show any error but
> doesn't produce the expected default 440 Hz output tone:
>
> Public Sub Form_Open()
>
> Dim pl As MediaPipeline
> Dim src As MediaControl
> Dim cnv As MediaControl
> Dim snk As MediaControl
>
> pl = New MediaPipeline
> src = New MediaControl(pl, "audiotestsrc")
> cnv = New MediaControl(pl, "audioconvert")
> snk = New MediaControl(pl, "autoaudiosink")
>
> src.LinkTo(cnv)
> cnv.LinkTo(snk)
>
> pl.play
>
> End
>
If you don't keep a reference on a MediaControl, it is destroyed.
This is what happened once pl.play() is called and the function exits:
all your control are destroyed.
Just add WAIT 5 after pl.play() to understand.
--
Benoît Minisini.
More information about the User
mailing list