first VST version, unfortunately not working (crashes)

This commit is contained in:
Volker Fischer 2010-04-06 16:41:30 +00:00
parent 7540ca9d63
commit d8eb5a9752
3 changed files with 26 additions and 23 deletions

View file

@ -218,6 +218,11 @@ public:
CVector<QString> vstrIPAddress; CVector<QString> vstrIPAddress;
QString strName; QString strName;
#ifdef LLCON_VST_PLUGIN
// VST version must have direct access to sound object
CSound* GetSound() { return &Sound; }
#endif
protected: protected:
// callback function must be static, otherwise it does not work // callback function must be static, otherwise it does not work
static void AudioCallback ( CVector<short>& psData, void* arg ); static void AudioCallback ( CVector<short>& psData, void* arg );

View file

@ -84,9 +84,8 @@ void CLlconVST::processReplacing ( float** pvIn,
// check if client is running, if not, start it // check if client is running, if not, start it
if ( !Client.IsRunning() ) if ( !Client.IsRunning() )
{ {
// set buffer size and start
// TODO set iNumSamples in Sound class somehow Client.GetSound()->SetMonoBufferSize ( iNumSamples );
Client.Start(); Client.Start();
} }
@ -99,23 +98,18 @@ void CLlconVST::processReplacing ( float** pvIn,
// copy input data // copy input data
for ( i = 0, j = 0; i < iNumSamples; i++, j += 2 ) for ( i = 0, j = 0; i < iNumSamples; i++, j += 2 )
{ {
/* (*Client.GetSound()->GetBuffer())[j] = pfIn0[i];
pSound->vecsTmpAudioSndCrdStereo[j] = pfIn0[i]; (*Client.GetSound()->GetBuffer())[j + 1] = pfIn1[i];
pSound->vecsTmpAudioSndCrdStereo[j + 1] = pfIn1[i];
*/
} }
/*
// call processing callback function // call processing callback function
pSound->ProcessCallback ( pSound->vecsTmpAudioSndCrdStereo ); Client.GetSound()->VSTProcessCallback (
*/ *Client.GetSound()->GetBuffer() );
// copy output data // copy output data
for ( i = 0, j = 0; i < iNumSamples; i++, j += 2 ) for ( i = 0, j = 0; i < iNumSamples; i++, j += 2 )
{ {
/* pfOut0[i] = (*Client.GetSound()->GetBuffer())[j];
pfOut0[i] = pSound->vecsTmpAudioSndCrdStereo[j]; pfOut1[i] = (*Client.GetSound()->GetBuffer())[j + 1];
pfOut1[i] = pSound->vecsTmpAudioSndCrdStereo[j + 1];
*/
} }
} }

View file

@ -35,23 +35,27 @@ class CSound : public CSoundBase
{ {
public: public:
CSound ( void (*fpNewCallback) ( CVector<int16_t>& psData, void* arg ), void* arg ) : CSound ( void (*fpNewCallback) ( CVector<int16_t>& psData, void* arg ), void* arg ) :
CSoundBase ( true, fpNewCallback, arg ) CSoundBase ( true, fpNewCallback, arg ), iVSTMonoBufferSize ( 0 ) {}
{
// TODO
}
virtual ~CSound() {} virtual ~CSound() {}
virtual int Init ( const int iNewPrefMonoBufferSize ) // special VST functions
void SetMonoBufferSize ( const int iNVBS ) { iVSTMonoBufferSize = iNVBS; }
CVector<int16_t>* GetBuffer() { return &vecsAudioSndCrdStereo; }
void VSTProcessCallback ( CVector<int16_t>& psData )
{ {
// TODO we have to query the current VST frame size somehow CSoundBase::ProcessCallback ( psData );
}
const int iVSTMonoBufferSize = iNewPrefMonoBufferSize;
virtual int Init ( const int )
{
// init base class // init base class
CSoundBase::Init ( iVSTMonoBufferSize ); CSoundBase::Init ( iVSTMonoBufferSize );
return iVSTMonoBufferSize; return iVSTMonoBufferSize;
} }
protected:
int iVSTMonoBufferSize;
}; };
#endif // !defined ( _VSTSOUND_H__9518A346345768_11D3_8C0D_EEBF182CF549__INCLUDED_ ) #endif // !defined ( _VSTSOUND_H__9518A346345768_11D3_8C0D_EEBF182CF549__INCLUDED_ )