#include "ardour/tempo.h"
#include "ardour/plugin_insert.h"
#include "ardour/windows_vst_plugin.h"
-#include "ardour/vestige/aeffectx.h"
+#include "ardour/vestige/vestige.h"
#include "ardour/vst_types.h"
#ifdef WINDOWS_VST_SUPPORT
#include <fst.h>
X_("receiveVstMidiEvent"),
X_("supportShell"),
X_("shellCategory"),
- X_("shellCategorycurID")
+ X_("shellCategorycurID"),
+ X_("sizeWindow")
};
const int Session::vst_can_do_string_count = sizeof (vst_can_do_strings) / sizeof (char*);
VstTimeInfo* timeinfo;
int32_t newflags = 0;
- if (effect && effect->user) {
- plug = (VSTPlugin *) (effect->user);
+ if (effect && effect->ptr1) {
+ plug = (VSTPlugin *) (effect->ptr1);
session = &plug->session();
timeinfo = plug->timeinfo ();
DEBUG_TRACE (PBD::DEBUG::VSTCallbacks, string_compose ("am callback 0x%1%2, opcode = %3%4, plugin = \"%5\"\n",
timeinfo->nanoSeconds = g_get_monotonic_time () * 1000;
if (plug && session) {
- framepos_t now = plug->transport_frame();
+ samplepos_t now = plug->transport_sample();
timeinfo->samplePos = now;
- timeinfo->sampleRate = session->frame_rate();
+ timeinfo->sampleRate = session->sample_rate();
if (value & (kVstTempoValid)) {
- const Tempo& t (session->tempo_map().tempo_at_frame (now));
+ const Tempo& t (session->tempo_map().tempo_at_sample (now));
timeinfo->tempo = t.quarter_notes_per_minute ();
newflags |= (kVstTempoValid);
}
if (value & (kVstTimeSigValid)) {
- const MeterSection& ms (session->tempo_map().meter_section_at_frame (now));
+ const MeterSection& ms (session->tempo_map().meter_section_at_sample (now));
timeinfo->timeSigNumerator = ms.divisions_per_bar ();
timeinfo->timeSigDenominator = ms.note_divisor ();
newflags |= (kVstTimeSigValid);
Timecode::BBT_Time bbt;
try {
- bbt = session->tempo_map().bbt_at_frame_rt (now);
+ bbt = session->tempo_map().bbt_at_sample_rt (now);
bbt.beats = 1;
bbt.ticks = 0;
/* exact quarter note */
double ppqBar = session->tempo_map().quarter_note_at_bbt_rt (bbt);
- /* quarter note at frame position (not rounded to note subdivision) */
- double ppqPos = session->tempo_map().quarter_note_at_frame_rt (now);
+ /* quarter note at sample position (not rounded to note subdivision) */
+ double ppqPos = session->tempo_map().quarter_note_at_sample_rt (now);
if (value & (kVstPpqPosValid)) {
timeinfo->ppqPos = ppqPos;
newflags |= kVstPpqPosValid;
(t.frames) +
(t.subframes);
- timeinfo->smpteOffset *= 80.0; /* VST spec is 1/80th frames */
+ timeinfo->smpteOffset *= 80.0; /* VST spec is 1/80th samples */
if (session->timecode_drop_frames()) {
if (session->timecode_frames_per_second() == 30.0) {
newflags |= kVstTransportCycleActive;
Location * looploc = session->locations ()->auto_loop_location ();
if (looploc) try {
- timeinfo->cycleStartPos = session->tempo_map ().quarter_note_at_frame_rt (looploc->start ());
- timeinfo->cycleEndPos = session->tempo_map ().quarter_note_at_frame_rt (looploc->end ());
+ timeinfo->cycleStartPos = session->tempo_map ().quarter_note_at_sample_rt (looploc->start ());
+ timeinfo->cycleEndPos = session->tempo_map ().quarter_note_at_sample_rt (looploc->end ());
newflags |= kVstCyclePosValid;
} catch (...) { }
for (int n = 0 ; n < v->numEvents; ++n) {
VstMidiEvent *vme = (VstMidiEvent*) (v->events[n]->dump);
if (vme->type == kVstMidiType) {
- plug->midi_buffer()->push_back(vme->deltaFrames, 3, (uint8_t*)vme->midiData);
+ plug->midi_buffer()->push_back(vme->deltaSamples, 3, (uint8_t*)vme->midiData);
}
}
}
case audioMasterSetTime:
SHOW_CALLBACK ("audioMasterSetTime");
// VstTimenfo* in <ptr>, filter in <value>, not supported
+ return 0;
case audioMasterTempoAt:
SHOW_CALLBACK ("audioMasterTempoAt");
- // returns tempo (in bpm * 10000) at sample frame location passed in <value>
+ // returns tempo (in bpm * 10000) at sample sample location passed in <value>
if (session) {
- const Tempo& t (session->tempo_map().tempo_at_frame (value));
+ const Tempo& t (session->tempo_map().tempo_at_sample (value));
return t.quarter_notes_per_minute() * 1000;
} else {
return 0;
plug->VSTSizeWindow (); /* EMIT SIGNAL */
}
}
- return 0;
+ return 1;
case audioMasterGetSampleRate:
SHOW_CALLBACK ("audioMasterGetSampleRate");
if (session) {
- return session->frame_rate();
+ return session->sample_rate();
}
return 0;
case audioMasterGetNextPlug:
SHOW_CALLBACK ("audioMasterGetNextPlug");
// output pin in <value> (-1: first to come), returns cEffect*
+ return 0;
case audioMasterWillReplaceOrAccumulate:
SHOW_CALLBACK ("audioMasterWillReplaceOrAccumulate");
SHOW_CALLBACK ("audioMasterGetVendorString");
// fills <ptr> with a string identifying the vendor (max 64 char)
strcpy ((char*) ptr, "Linux Audio Systems");
- return 0;
+ return 1;
case audioMasterGetProductString:
SHOW_CALLBACK ("audioMasterGetProductString");
case audioMasterUpdateDisplay:
SHOW_CALLBACK ("audioMasterUpdateDisplay");
// something has changed, update 'multi-fx' display
- if (effect) {
- effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f);
+ /* TODO: consider emitting ParameterChangedExternally() for each ctrl input */
+ if (session) {
+ session->set_dirty ();
}
return 0;
case audioMasterBeginEdit:
SHOW_CALLBACK ("audioMasterBeginEdit");
// begin of automation session (when mouse down), parameter index in <index>
+ if (plug && plug->plugin_insert ()) {
+ boost::shared_ptr<AutomationControl> ac = plug->plugin_insert ()->automation_control (Evoral::Parameter (PluginAutomation, 0, index));
+ if (ac) {
+ ac->start_touch (ac->session().transport_sample());
+ }
+ }
return 0;
case audioMasterEndEdit:
SHOW_CALLBACK ("audioMasterEndEdit");
// end of automation session (when mouse up), parameter index in <index>
+ if (plug && plug->plugin_insert ()) {
+ boost::shared_ptr<AutomationControl> ac = plug->plugin_insert ()->automation_control (Evoral::Parameter (PluginAutomation, 0, index));
+ if (ac) {
+ ac->stop_touch (ac->session().transport_sample());
+ }
+ }
return 0;
case audioMasterOpenFileSelector: