From 5d067a45ee7040be0cb28ef2e846d90b0faf59ef Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sun, 28 Mar 2010 16:19:59 +0000 Subject: [PATCH] started implementing stop mechanism for vst --- src/vstmain.cpp | 14 +++++++++++++- src/vstmain.h | 5 +++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/vstmain.cpp b/src/vstmain.cpp index 18651215..0be71ff8 100755 --- a/src/vstmain.cpp +++ b/src/vstmain.cpp @@ -49,6 +49,11 @@ CLlconVST::CLlconVST ( audioMasterCallback AudioMaster ) : // set default program name GetName ( strProgName ); + // we want a single shot timer to shut down the connection if no + // processing is done anymore (VST host has stopped the stream) + TimerOnOff.setSingleShot ( true ); + TimerOnOff.setInterval ( VST_STOP_TIMER_INTERVAL ); + // connect timer event connect ( &TimerOnOff, SIGNAL ( timeout() ), this, SLOT ( OnTimerOnOff() ) ); @@ -64,13 +69,17 @@ bool CLlconVST::GetName ( char* cName ) void CLlconVST::OnTimerOnOff() { - // TODO + // stop client since VST host seems to have stopped + Client.Stop(); } void CLlconVST::processReplacing ( float** pvIn, float** pvOut, VstInt32 iNumSamples ) { + // reset stop timer + TimerOnOff.start(); + // get pointers to actual buffers float* pfIn0 = pvIn[0]; float* pfIn1 = pvIn[1]; @@ -91,6 +100,9 @@ void CLlconVST::processDoubleReplacing ( double** pvIn, double** pvOut, VstInt32 iNumSamples ) { + // reset stop timer + TimerOnOff.start(); + // get pointers to actual buffers double* pdIn0 = pvIn[0]; double* pdIn1 = pvIn[1]; diff --git a/src/vstmain.h b/src/vstmain.h index c66ff86d..5a642d3a 100755 --- a/src/vstmain.h +++ b/src/vstmain.h @@ -33,6 +33,11 @@ #include "client.h" +/* Definitions ****************************************************************/ +// timeout after which the llcon client is stopped +#define VST_STOP_TIMER_INTERVAL 1000 + + /* Classes ********************************************************************/ class CLlconVST : public QObject, public AudioEffectX {