VST sync patch: compatibility fix for 64bit builds

It seems 64bit builds for some reason have problems with VST Sync feature on,
workaround seems to be converting VST sync patch from double to floats,
which does work both with 32 and 64bit builds. Double precision
seems to produce odd numbers with 64bit build. (tested on VirtualBox Linux
Mint 14.1 64 bit OS)
(cherry picked from commit 011f87e6e60cccd16f3783e9c4885e03d95c1e56)

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
This commit is contained in:
Mike Choi
2013-02-11 00:19:08 +01:00
committed by Tobias Doerffel
parent 0b39426953
commit 50c2242caa
3 changed files with 16 additions and 16 deletions

View File

@@ -39,19 +39,19 @@
struct sncVST
{
bool isPlayin;
double ppqPos;
float ppqPos;
int timeSigNumer;
int timeSigDenom;
bool isCycle;
bool hasSHM;
double cycleStart;
double cycleEnd;
float cycleStart;
float cycleEnd;
int m_bufferSize;
int m_sampleRate;
int m_bpm;
#ifdef VST_SNC_LATENCY
double m_latency;
float m_latency;
#endif
} ;

View File

@@ -319,8 +319,8 @@ private:
// host to plugin synchronisation data structure
struct in
{
double lastppqPos;
double m_Timestamp;
float lastppqPos;
float m_Timestamp;
} ;
in * m_in;
@@ -1482,7 +1482,7 @@ intptr_t RemoteVstPlugin::hostCallback( AEffect * _effect, int32_t _opcode,
__plugin->m_in->lastppqPos += (
__plugin->m_SncVSTplug->hasSHM ?
__plugin->m_SncVSTplug->m_bpm :
__plugin->m_bpm ) / (double)10340;
__plugin->m_bpm ) / (float)10340;
_timeInfo.ppqPos = __plugin->m_in->lastppqPos;
}
// _timeInfo.ppqPos = __plugin->m_SncVSTplug->ppqPos;

View File

@@ -243,7 +243,7 @@ void song::setTempo()
#ifdef VST_SNC_LATENCY
m_SncVSTplug->m_latency = m_SncVSTplug->m_bufferSize * tempo /
( (double) m_SncVSTplug->m_sampleRate * 60 );
( (float) m_SncVSTplug->m_sampleRate * 60 );
#endif
emit tempoChanged( tempo );
@@ -471,7 +471,7 @@ void song::processNextBuffer()
#ifdef VST_SNC_LATENCY
m_SncVSTplug->m_latency = m_SncVSTplug->m_bufferSize *
m_SncVSTplug->m_bpm /
( (double) m_SncVSTplug->m_sampleRate * 60 );
( (float) m_SncVSTplug->m_sampleRate * 60 );
#endif
float current_frame = m_playPos[m_playMode].currentFrame();
@@ -482,10 +482,10 @@ void song::processNextBuffer()
+ (int)( current_frame / frames_per_tick );
#ifdef VST_SNC_LATENCY
m_SncVSTplug->ppqPos = ( ( ticks + 0 ) / (double)48 ) -
m_SncVSTplug->ppqPos = ( ( ticks + 0 ) / (float)48 ) -
m_SncVSTplug->m_latency;
#else
m_SncVSTplug->ppqPos = ( ( ticks + 0 ) / (double)48 );
m_SncVSTplug->ppqPos = ( ( ticks + 0 ) / (float)48 );
#endif
// did we play a whole tact?
@@ -523,11 +523,11 @@ void song::processNextBuffer()
midiTime::ticksPerTact() );
#ifdef VST_SNC_LATENCY
m_SncVSTplug->ppqPos = ( ( ticks + 0 )
/ (double)48 )
/ (float)48 )
- m_SncVSTplug->m_latency;
#else
m_SncVSTplug->ppqPos = ( ( ticks + 0 )
/ (double)48 );
/ (float)48 );
#endif
}
}
@@ -538,10 +538,10 @@ void song::processNextBuffer()
m_SncVSTplug->isCycle = true;
m_SncVSTplug->cycleStart =
( tl->loopBegin().getTicks() )
/ (double)48;
/ (float)48;
m_SncVSTplug->cycleEnd =
( tl->loopEnd().getTicks() )
/ (double)48;
/ (float)48;
if( m_playPos[m_playMode] >= tl->loopEnd() )
{
m_playPos[m_playMode].setTicks(
@@ -1362,7 +1362,7 @@ void song::updateSampleRateSHM()
#ifdef VST_SNC_LATENCY
m_SncVSTplug->m_latency = m_SncVSTplug->m_bufferSize * m_SncVSTplug->m_bpm /
( (double) m_SncVSTplug->m_sampleRate * 60 );
( (float) m_SncVSTplug->m_sampleRate * 60 );
#endif
}