Optimize plugin-processing for non-automated params
[ardour.git] / libs / ardour / ardour / auditioner.h
index 0b04ab711d1bfd3c06d8e0ca7fc0dbd5f160f38a..d849eaecb5d8d7939a4d264faf528232b2bb6df8 100644 (file)
 #include <glibmm/threads.h>
 
 #include "ardour/ardour.h"
-#include "ardour/audio_track.h"
+#include "ardour/plugin.h"
+#include "ardour/track.h"
 
 namespace ARDOUR {
 
 class Session;
 class AudioRegion;
 class AudioPlaylist;
+class MidiRegion;
 
-class LIBARDOUR_API Auditioner : public AudioTrack
+class LIBARDOUR_API Auditioner : public Track
 {
-  public:
+public:
        Auditioner (Session&);
        ~Auditioner ();
 
        int init ();
+       int connect ();
 
+       bool auditioning() const;
        void audition_region (boost::shared_ptr<Region>);
+       int play_audition (samplecnt_t nframes);
+       void cancel_audition ();
 
-       ARDOUR::AudioPlaylist& prepare_playlist ();
-
-       int play_audition (framecnt_t nframes);
+       void seek_to_sample (sampleoffset_t pos);
+       void seek_to_percent (float const pos);
+       sampleoffset_t seek_sample() const { return _seeking ? _seek_sample : -1;}
+       void seek_response(sampleoffset_t pos);
 
        MonitorState monitoring_state () const;
 
-       void cancel_audition () {
-               g_atomic_int_set (&_auditioning, 0);
-       }
-
-       bool auditioning() const { return g_atomic_int_get (&_auditioning); }
        bool needs_monitor() const { return via_monitor; }
 
        virtual ChanCount input_streams () const;
 
-  private:
+       PBD::Signal2<void, ARDOUR::samplecnt_t, ARDOUR::samplecnt_t> AuditionProgress;
+
+       /* Track */
+       int roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool& need_butler);
+       DataType data_type () const;
+
+       int roll_audio (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool& need_butler);
+       int roll_midi (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool& need_butler);
+
+       /* fake track */
+       void set_state_part_two () {}
+       int set_state (const XMLNode&, int) { return 0; }
+       bool bounceable (boost::shared_ptr<Processor>, bool) const { return false; }
+       void freeze_me (InterThreadInfo&) {}
+       void unfreeze () {}
+
+       boost::shared_ptr<Region> bounce (InterThreadInfo&) {
+               return boost::shared_ptr<Region> ();
+       }
+
+       boost::shared_ptr<Region> bounce_range (samplepos_t, samplepos_t, InterThreadInfo&, boost::shared_ptr<Processor>, bool) {
+               return boost::shared_ptr<Region> ();
+       }
+
+       int export_stuff (BufferSet&, samplepos_t, samplecnt_t, boost::shared_ptr<Processor>, bool, bool, bool) { return -1; }
+
+private:
        boost::shared_ptr<AudioRegion> the_region;
-       framepos_t current_frame;
+       boost::shared_ptr<MidiRegion> midi_region;
+       samplepos_t current_sample;
        mutable gint _auditioning;
        Glib::Threads::Mutex lock;
-       framecnt_t length;
+       samplecnt_t length;
+       sampleoffset_t _seek_sample;
+       bool _seeking;
+       bool _seek_complete;
        bool via_monitor;
+       bool _midi_audition;
+       bool _queue_panic;
+
+       boost::shared_ptr<Processor> asynth;
 
+       PluginInfoPtr lookup_synth_plugin_info (std::string const&) const;
        void drop_ports ();
-       static void *_drop_ports (void *);
+       void lookup_synth (bool);
+       void unload_synth (bool);
+       static void*_drop_ports (void*);
        void actually_drop_ports ();
        void output_changed (IOChange, void*);
+       sampleoffset_t _import_position;
 };
 
 }; /* namespace ARDOUR */