Browse Source

Fix M_PI; Implement basic VST timePos support

gh-pages
falkTX 11 years ago
parent
commit
3b225c6bc6
2 changed files with 23 additions and 6 deletions
  1. +6
    -0
      distrho/DistrhoPlugin.hpp
  2. +17
    -6
      distrho/src/DistrhoPluginVST.cpp

+ 6
- 0
distrho/DistrhoPlugin.hpp View File

@@ -19,6 +19,12 @@


#include "DistrhoUtils.hpp" #include "DistrhoUtils.hpp"


#include <cmath>

#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif

START_NAMESPACE_DISTRHO START_NAMESPACE_DISTRHO


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------


+ 17
- 6
distrho/src/DistrhoPluginVST.cpp View File

@@ -60,7 +60,7 @@ struct ERect {
# warning VST State still TODO (working but needs final testing) # warning VST State still TODO (working but needs final testing)
#endif #endif
#if DISTRHO_PLUGIN_WANT_TIMEPOS #if DISTRHO_PLUGIN_WANT_TIMEPOS
# warning VST TimePos still TODO
# warning VST TimePos still TODO (only basic BBT working)
#endif #endif


typedef std::map<d_string,d_string> StringMap; typedef std::map<d_string,d_string> StringMap;
@@ -670,13 +670,24 @@ public:
void vst_processReplacing(float** const inputs, float** const outputs, const int32_t sampleFrames) void vst_processReplacing(float** const inputs, float** const outputs, const int32_t sampleFrames)
{ {
#if DISTRHO_PLUGIN_WANT_TIMEPOS #if DISTRHO_PLUGIN_WANT_TIMEPOS
if (const VstTimeInfo* const timeInfo = (const VstTimeInfo*)fEffect->dispatcher(fEffect, audioMasterGetTime, 0, kVstTempoValid, nullptr, 0.0f))
static const int kWantedVstTimeFlags(kVstTransportPlaying|kVstTempoValid|kVstTimeSigValid);

if (const VstTimeInfo* const vstTimeInfo = (const VstTimeInfo*)fEffect->dispatcher(fEffect, audioMasterGetTime, 0, kWantedVstTimeFlags, nullptr, 0.0f))
{ {
fTimePos.playing = (timeInfo->flags & kVstTransportPlaying);
fTimePos.frame = timeInfo->samplePos;
fTimePos.playing = (vstTimeInfo->flags & kVstTransportPlaying);
fTimePos.frame = vstTimeInfo->samplePos;


// TODO: BBT
// timeInfo->tempo etc
if (vstTimeInfo->flags & kVstTempoValid)
{
fTimePos.bbt.valid = true;
fTimePos.bbt.beatsPerMinute = vstTimeInfo->tempo;
}
if (vstTimeInfo->flags & kVstTimeSigValid)
{
fTimePos.bbt.valid = true;
fTimePos.bbt.beatsPerBar = vstTimeInfo->timeSigNumerator;
fTimePos.bbt.beatType = vstTimeInfo->timeSigDenominator;
}


fPlugin.setTimePos(fTimePos); fPlugin.setTimePos(fTimePos);
} }


Loading…
Cancel
Save