I have a simple test application to play with the Mitov AudioLab components (www.mitov.com) version 7 in Delphi XE6.
On my form, there is a TALWavePlayer, a TALSpeexCompressor, a TALSpeexDecompressor, a TALAudioMixer and a TALAudioOut, building a simple audio processing chain. I can connect the inputs and outputs visually at design time (in the OpenWire view). When I run my test application, I can hear the wave file through the speaker - whithout a single line of code. That's the easy (working) part.
Now, I disconnect the TALSpeexDecompressor output pin from the TALAudioMixer input pin visually at design time (OpenWire view). I want to replace this same connection in code at run time. (For the sake of simplicity I keep the single input pin and channel of the TALAudioMixer, so they do not need to be created in code).
I tried exactly the same options that work to connect other AudioLab components at runtime (audio output pin -> audio input pin).
1.) decomp.OutputPin.Connect(mixer.InputPins[0]);
2.) decomp.OutputPin.Connect(mixer.Channels.Items[0].InputPin);
But with the TALSpeexDecompressor, this does not work - there is no signal leaving the decompressor. I do not have the source code of the components, so I cannot debug the application to find out what's going wrong.
Stop and then start the wave player again after connecting the decompressor and the mixer dynamically.
I do not know what happens under the hood, but after restarting the TALWavePlayer, the signal leaves the TALSpeexDecompressor and enters the TALAudioMixer.
I stumbled over the solution when I set the "filename" property of the TALWavePlayer component in code, not in the property editor. Because of another (default) setting "RestartOnNewFile" = True
, the wave player was restarted internally and the signal flow worked.
procedure Tform1.Button1Click(Sender: TObject);
var
channel: TALAudioMixerChannelItem;
begin
channel := mixer.Channels.Add;
waveplayer.Stop;
channel.InputPin.Connect(decomp.OutputPin);
waveplayer.Start;
end;