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;
QString strName;
#ifdef LLCON_VST_PLUGIN
// VST version must have direct access to sound object
CSound* GetSound() { return &Sound; }
#endif
protected:
// callback function must be static, otherwise it does not work
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
if ( !Client.IsRunning() )
{
// TODO set iNumSamples in Sound class somehow
// set buffer size and start
Client.GetSound()->SetMonoBufferSize ( iNumSamples );
Client.Start();
}
@ -99,23 +98,18 @@ void CLlconVST::processReplacing ( float** pvIn,
// copy input data
for ( i = 0, j = 0; i < iNumSamples; i++, j += 2 )
{
/*
pSound->vecsTmpAudioSndCrdStereo[j] = pfIn0[i];
pSound->vecsTmpAudioSndCrdStereo[j + 1] = pfIn1[i];
*/
(*Client.GetSound()->GetBuffer())[j] = pfIn0[i];
(*Client.GetSound()->GetBuffer())[j + 1] = pfIn1[i];
}
/*
// call processing callback function
pSound->ProcessCallback ( pSound->vecsTmpAudioSndCrdStereo );
*/
Client.GetSound()->VSTProcessCallback (
*Client.GetSound()->GetBuffer() );
// copy output data
for ( i = 0, j = 0; i < iNumSamples; i++, j += 2 )
{
/*
pfOut0[i] = pSound->vecsTmpAudioSndCrdStereo[j];
pfOut1[i] = pSound->vecsTmpAudioSndCrdStereo[j + 1];
*/
pfOut0[i] = (*Client.GetSound()->GetBuffer())[j];
pfOut1[i] = (*Client.GetSound()->GetBuffer())[j + 1];
}
}

View file

@ -35,23 +35,27 @@ class CSound : public CSoundBase
{
public:
CSound ( void (*fpNewCallback) ( CVector<int16_t>& psData, void* arg ), void* arg ) :
CSoundBase ( true, fpNewCallback, arg )
{
// TODO
}
CSoundBase ( true, fpNewCallback, arg ), iVSTMonoBufferSize ( 0 ) {}
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
const int iVSTMonoBufferSize = iNewPrefMonoBufferSize;
CSoundBase::ProcessCallback ( psData );
}
virtual int Init ( const int )
{
// init base class
CSoundBase::Init ( iVSTMonoBufferSize );
return iVSTMonoBufferSize;
}
protected:
int iVSTMonoBufferSize;
};
#endif // !defined ( _VSTSOUND_H__9518A346345768_11D3_8C0D_EEBF182CF549__INCLUDED_ )