[Gambas-user] gb.media - Pipelines with local declarations don't work
Claus Dietrich
claus.dietrich at freenet.de
Mon Jan 15 13:59:45 CET 2024
Am 15.01.24 um 11:56 schrieb Benoît Minisini:
> 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.
Thanks! The penny dropped after "WAIT 5".
Best regards
Claus
More information about the User
mailing list