New test.
[ardour.git] / libs / ardour / session_vst.cc
index 7f13d3e18bfebf47fd74d08b25a82caeee9b68a5..fa0641a6ab7ef4b12a531b6e78faae6c6e5a4e7e 100644 (file)
 #include <stdbool.h>
 #include <cstdio>
 
-#include <fst.h>
-#include <fst/vestige/aeffectx.h>
-
 #include "ardour/session.h"
 #include "ardour/tempo.h"
-#include "ardour/vst_plugin.h"
+#include "ardour/windows_vst_plugin.h"
+#include "ardour/vestige/aeffectx.h"
+#include "ardour/vst_types.h"
 
 #include "i18n.h"
 
@@ -40,12 +39,14 @@ static int debug_callbacks = -1;
 
 using namespace ARDOUR;
 
-long Session::vst_callback (AEffect* effect,
-                           long opcode,
-                           long index,
-                           long value,
-                           void* ptr,
-                           float opt)
+intptr_t Session::vst_callback (
+       AEffect* effect,
+       int32_t opcode,
+       int32_t index,
+       intptr_t value,
+       void* ptr,
+       float opt
+       )
 {
        static VstTimeInfo _timeInfo;
        VSTPlugin* plug;
@@ -56,13 +57,13 @@ long Session::vst_callback (AEffect* effect,
        }
 
        if (effect && effect->user) {
-               plug = (VSTPlugin*) (effect->user);
+               plug = (VSTPlugin *) (effect->user);
                session = &plug->session();
-               SHOW_CALLBACK ("am callback 0x%x, opcode = %ld, plugin = \"%s\" ", pthread_self(), opcode, plug->name());
+               SHOW_CALLBACK ("am callback 0x%x, opcode = %d, plugin = \"%s\" ", (int) pthread_self(), opcode, plug->name());
        } else {
                plug = 0;
                session = 0;
-               SHOW_CALLBACK ("am callback 0x%x, opcode = %ld", pthread_self(), opcode);
+               SHOW_CALLBACK ("am callback 0x%x, opcode = %d", (int) pthread_self(), opcode);
        }
 
        switch(opcode){
@@ -70,8 +71,8 @@ long Session::vst_callback (AEffect* effect,
        case audioMasterAutomate:
                SHOW_CALLBACK ("amc: audioMasterAutomate\n");
                // index, value, returns 0
-               if (effect) {
-                       effect->setParameter (effect, index, opt);
+               if (plug) {
+                       plug->set_parameter (index, opt);
                }
                return 0;
 
@@ -107,6 +108,9 @@ long Session::vst_callback (AEffect* effect,
        case audioMasterWantMidi:
                SHOW_CALLBACK ("amc: audioMasterWantMidi\n");
                // <value> is a filter which is currently ignored
+               if (plug) {
+                       plug->get_info()->n_inputs.set_midi (1);
+               }
                return 0;
 
        case audioMasterGetTime:
@@ -128,7 +132,7 @@ long Session::vst_callback (AEffect* effect,
                        }
                        if (value & (kVstBarsValid)) {
                                const Meter& m (session->tempo_map().meter_at (session->transport_frame()));
-                               _timeInfo.timeSigNumerator = m.beats_per_bar ();
+                               _timeInfo.timeSigNumerator = m.divisions_per_bar ();
                                _timeInfo.timeSigDenominator = m.note_divisor ();
                                _timeInfo.flags |= (kVstBarsValid);
                        }
@@ -180,7 +184,7 @@ long Session::vst_callback (AEffect* effect,
                SHOW_CALLBACK ("amc: audioMasterNeedIdle\n");
                // plug needs idle calls (outside its editor window)
                if (plug) {
-                       plug->fst()->wantIdle = 1;
+                       plug->state()->wantIdle = 1;
                }
                return 0;