change Control::{set,get}_float to Control::{set,get}_double and make almost all...
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 27 Jul 2010 14:09:16 +0000 (14:09 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 27 Jul 2010 14:09:16 +0000 (14:09 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7514 d708f5d6-7413-0410-9779-e7cbd77b26cf

34 files changed:
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/canvas-program-change.cc
gtk2_ardour/canvas-program-change.h
gtk2_ardour/midi_region_view.cc
gtk2_ardour/midi_region_view.h
libs/ardour/amp.cc
libs/ardour/ardour/amp.h
libs/ardour/ardour/automation_control.h
libs/ardour/ardour/midi_track.h
libs/ardour/ardour/monitor_processor.h
libs/ardour/ardour/panner.h
libs/ardour/ardour/plugin_insert.h
libs/ardour/ardour/route.h
libs/ardour/ardour/track.h
libs/ardour/automatable.cc
libs/ardour/automation_control.cc
libs/ardour/midi_buffer.cc
libs/ardour/midi_port.cc
libs/ardour/midi_source.cc
libs/ardour/midi_track.cc
libs/ardour/monitor_processor.cc
libs/ardour/panner.cc
libs/ardour/plugin_insert.cc
libs/ardour/route.cc
libs/ardour/track.cc
libs/evoral/evoral/Control.hpp
libs/evoral/evoral/ControlSet.hpp
libs/evoral/evoral/Parameter.hpp
libs/evoral/evoral/types.hpp
libs/evoral/src/Control.cpp
libs/evoral/src/ControlSet.cpp
libs/evoral/src/Sequence.cpp
libs/pbd/pbd/controllable.h

index 9d789c20be49810d989cf112b1d3464bf96b925d..004f37075d26d0ae2958ff62927ac5352f444e99 100644 (file)
@@ -3425,18 +3425,18 @@ ARDOUR_UI::TransportControllable::TransportControllable (std::string name, ARDOU
 }
 
 void
-ARDOUR_UI::TransportControllable::set_value (float val)
+ARDOUR_UI::TransportControllable::set_value (double val)
 {
        if (type == ShuttleControl) {
                double fract;
 
-               if (val == 0.5f) {
+               if (val == 0.5) {
                        fract = 0.0;
                } else {
-                       if (val < 0.5f) {
-                               fract = -((0.5f - val)/0.5f);
+                       if (val < 0.5) {
+                               fract = -((0.5 - val)/0.5);
                        } else {
-                               fract = ((val - 0.5f)/0.5f);
+                               fract = ((val - 0.5)/0.5);
                        }
                }
 
@@ -3444,7 +3444,7 @@ ARDOUR_UI::TransportControllable::set_value (float val)
                return;
        }
 
-       if (val < 0.5f) {
+       if (val < 0.5) {
                /* do nothing: these are radio-style actions */
                return;
        }
@@ -3488,10 +3488,10 @@ ARDOUR_UI::TransportControllable::set_value (float val)
        }
 }
 
-float
+double
 ARDOUR_UI::TransportControllable::get_value (void) const
 {
-       float val = 0.0f;
+       float val = 0.0;
 
        switch (type) {
        case Roll:
index 04cd080ac3f6a9ad8cf4ff6dc22fd968208e6f5b..b960af207417e171e6c71a084df4bba9296617d3 100644 (file)
@@ -368,8 +368,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
            };
 
            TransportControllable (std::string name, ARDOUR_UI&, ToggleType);
-           void set_value (float);
-           float get_value (void) const;
+           void set_value (double);
+           double get_value (void) const;
 
            void set_id (const std::string&);
 
index 27a163ef7c633fc8bf7604672c362003ec12ab66..77169ce8ecdcac72e2ceca937013557882d14e1b 100644 (file)
@@ -20,7 +20,7 @@ CanvasProgramChange::CanvasProgramChange(
                double          y,
                string&         model_name,
                string&         custom_device_mode,
-               nframes_t       event_time,
+                double          event_time,
                uint8_t         channel,
                uint8_t         program)
        : CanvasFlag(
@@ -113,11 +113,28 @@ CanvasProgramChange::on_event(GdkEvent* ev)
                                initialize_popup_menus();
                                _popup_initialized = true;
                        }
-                   _popup.popup(ev->button.button, ev->button.time);
+                        _popup.popup(ev->button.button, ev->button.time);
                        return true;
                }
                break;
 
+        case GDK_KEY_PRESS:
+                switch (ev->key.keyval) {
+                case GDK_Up:
+                case GDK_KP_Up:
+                case GDK_uparrow:
+                       _region.previous_program(*this);
+                        break;
+                case GDK_Down:
+                case GDK_KP_Down:
+                case GDK_downarrow:
+                       _region.next_program(*this);
+                        break;
+                default:
+                        break;
+                }
+                break;
+
        case GDK_SCROLL:
                if (ev->scroll.direction == GDK_SCROLL_UP) {
                        _region.previous_program(*this);
index cddd78059b5223b8627cbb1dcfa4f9d28bbe477e..40939845557b97b6f38bfde56321563af17bee1f 100644 (file)
@@ -26,7 +26,7 @@ public:
                double          y,
                string&         model_name,
                string&         custom_device_mode,
-               nframes_t       event_time,
+               double          _event_time,
                uint8_t         channel,
                uint8_t         program
        );
@@ -41,8 +41,8 @@ public:
        string custom_device_mode() const { return _custom_device_mode; }
        void set_custom_device_mode(string custom_device_mode) { _custom_device_mode = custom_device_mode; }
 
-       nframes_t event_time() const { return _event_time; }
-       void set_event_time(nframes_t new_time) { _event_time = new_time; };
+       double event_time() const { return _event_time; }
+       void set_event_time(double new_time) { _event_time = new_time; };
 
        uint8_t program() const { return _program; }
        void set_program(uint8_t new_program) { _program = new_program; };
@@ -57,7 +57,7 @@ public:
 private:
        string        _model_name;
        string        _custom_device_mode;
-       nframes_t     _event_time;
+        double        _event_time;
        uint8_t       _channel;
        uint8_t       _program;
        Gtk::Menu     _popup;
index b7fd04765c30bff1823865625eba18cff54b1798..086fb83ad3d6bf9c0ede35e3eb1d5a32ac286158 100644 (file)
@@ -40,6 +40,7 @@
 #include "ardour/session.h"
 
 #include "evoral/Parameter.hpp"
+#include "evoral/MIDIParameters.hpp"
 #include "evoral/Control.hpp"
 #include "evoral/midi_util.h"
 
@@ -988,15 +989,28 @@ MidiRegionView::redisplay_model()
 void
 MidiRegionView::display_program_changes()
 {
-       boost::shared_ptr<Evoral::Control> control = _model->control(MidiPgmChangeAutomation);
+       MidiTimeAxisView* const mtv = dynamic_cast<MidiTimeAxisView*>(&trackview);
+       uint16_t chn_mask = mtv->channel_selector().get_selected_channels();
+
+        for (uint8_t i = 0; i < 16; ++i) {
+                if (chn_mask & (1<<i)) {
+                        display_program_changes_on_channel (i);
+                }
+        }
+}
+
+void
+MidiRegionView::display_program_changes_on_channel(uint8_t channel)
+{
+       boost::shared_ptr<Evoral::Control> control = 
+                _model->control(Evoral::MIDI::ProgramChange (MidiPgmChangeAutomation, channel));
+
        if (!control) {
                return;
        }
 
        Glib::Mutex::Lock lock (control->list()->lock());
 
-       uint8_t channel = control->parameter().channel();
-
        for (AutomationList::const_iterator event = control->list()->begin();
                        event != control->list()->end(); ++event) {
                double event_time     = (*event)->when;
@@ -1007,7 +1021,7 @@ MidiRegionView::display_program_changes()
                boost::shared_ptr<Evoral::Control> msb_control = _model->control(bank_select_msb);
                uint8_t msb = 0;
                if (msb_control != 0) {
-                       msb = uint8_t(floor(msb_control->get_float(true, event_time) + 0.5));
+                       msb = uint8_t(floor(msb_control->get_double(true, event_time) + 0.5));
                }
 
                // Get current value of bank select LSB at time of the program change
@@ -1015,7 +1029,7 @@ MidiRegionView::display_program_changes()
                boost::shared_ptr<Evoral::Control> lsb_control = _model->control(bank_select_lsb);
                uint8_t lsb = 0;
                if (lsb_control != 0) {
-                       lsb = uint8_t(floor(lsb_control->get_float(true, event_time) + 0.5));
+                       lsb = uint8_t(floor(lsb_control->get_double(true, event_time) + 0.5));
                }
 
                MIDI::Name::PatchPrimaryKey patch_key(msb, lsb, program_number);
@@ -1030,7 +1044,8 @@ MidiRegionView::display_program_changes()
                        add_pgm_change(program_change, patch->name());
                } else {
                        char buf[4];
-                       snprintf(buf, 4, "%d", int(program_number));
+                        // program_number is zero-based: convert to one-based
+                       snprintf(buf, 4, "%d", int(program_number+1));
                        add_pgm_change(program_change, buf);
                }
        }
@@ -1504,29 +1519,25 @@ MidiRegionView::add_pgm_change(PCEvent& program, const string& displaytext)
 void
 MidiRegionView::get_patch_key_at(double time, uint8_t channel, MIDI::Name::PatchPrimaryKey& key)
 {
-       cerr << "getting patch key at " << time << " for channel " << channel << endl;
        Evoral::Parameter bank_select_msb(MidiCCAutomation, channel, MIDI_CTL_MSB_BANK);
        boost::shared_ptr<Evoral::Control> msb_control = _model->control(bank_select_msb);
-       float msb = -1.0;
+       double msb = 0.0;
        if (msb_control != 0) {
-               msb = int(msb_control->get_float(true, time));
-               cerr << "got msb " << msb;
+               msb = int(msb_control->get_double(true, time));
        }
 
        Evoral::Parameter bank_select_lsb(MidiCCAutomation, channel, MIDI_CTL_LSB_BANK);
        boost::shared_ptr<Evoral::Control> lsb_control = _model->control(bank_select_lsb);
-       float lsb = -1.0;
+       double lsb = 0.0;
        if (lsb_control != 0) {
-               lsb = lsb_control->get_float(true, time);
-               cerr << " got lsb " << lsb;
+               lsb = lsb_control->get_double(true, time);
        }
 
        Evoral::Parameter program_change(MidiPgmChangeAutomation, channel, 0);
        boost::shared_ptr<Evoral::Control> program_control = _model->control(program_change);
-       float program_number = -1.0;
+       double program_number = -1.0;
        if (program_control != 0) {
-               program_number = program_control->get_float(true, time);
-               cerr << " got program " << program_number << endl;
+               program_number = program_control->get_double(true, time);
        }
 
        key.msb = (int) floor(msb + 0.5);
@@ -1543,23 +1554,24 @@ MidiRegionView::alter_program_change(PCEvent& old_program, const MIDI::Name::Pat
        Evoral::Parameter bank_select_msb(MidiCCAutomation, old_program.channel, MIDI_CTL_MSB_BANK);
        boost::shared_ptr<Evoral::Control> msb_control = _model->control(bank_select_msb);
        if (msb_control != 0) {
-               msb_control->set_float(float(new_patch.msb), true, old_program.time);
+               msb_control->set_double(double(new_patch.msb), true, old_program.time);
        }
 
        // TODO: Get the real event here and alter them at the original times
        Evoral::Parameter bank_select_lsb(MidiCCAutomation, old_program.channel, MIDI_CTL_LSB_BANK);
        boost::shared_ptr<Evoral::Control> lsb_control = _model->control(bank_select_lsb);
        if (lsb_control != 0) {
-               lsb_control->set_float(float(new_patch.lsb), true, old_program.time);
+               lsb_control->set_double(double(new_patch.lsb), true, old_program.time);
        }
 
        Evoral::Parameter program_change(MidiPgmChangeAutomation, old_program.channel, 0);
        boost::shared_ptr<Evoral::Control> program_control = _model->control(program_change);
 
        assert(program_control != 0);
-       program_control->set_float(float(new_patch.program_number), true, old_program.time);
+       program_control->set_double(float(new_patch.program_number), true, old_program.time);
 
-       redisplay_model();
+        _pgm_changes.clear ();
+        display_program_changes (); // XXX would be nice to limit to just old_program.channel
 }
 
 void
@@ -1572,39 +1584,27 @@ MidiRegionView::program_selected(CanvasProgramChange& program, const MIDI::Name:
 void
 MidiRegionView::previous_program(CanvasProgramChange& program)
 {
-       MIDI::Name::PatchPrimaryKey key;
-       get_patch_key_at(program.event_time(), program.channel(), key);
-
-       boost::shared_ptr<MIDI::Name::Patch> patch =
-               MIDI::Name::MidiPatchManager::instance().previous_patch(
-                               _model_name,
-                               _custom_device_mode,
-                               program.channel(),
-                               key);
+        if (program.program() < 127) {
+                MIDI::Name::PatchPrimaryKey key;
+                get_patch_key_at(program.event_time(), program.channel(), key);
+                PCEvent program_change_event(program.event_time(), program.program(), program.channel());
 
-       PCEvent program_change_event(program.event_time(), program.program(), program.channel());
-       if (patch) {
-               alter_program_change(program_change_event, patch->patch_primary_key());
-       }
+                key.program_number++;
+                alter_program_change(program_change_event, key);
+        }
 }
 
 void
 MidiRegionView::next_program(CanvasProgramChange& program)
 {
-       MIDI::Name::PatchPrimaryKey key;
-       get_patch_key_at(program.event_time(), program.channel(), key);
-
-       boost::shared_ptr<MIDI::Name::Patch> patch =
-               MIDI::Name::MidiPatchManager::instance().next_patch(
-                               _model_name,
-                               _custom_device_mode,
-                               program.channel(),
-                               key);
+        if (program.program() > 0) {
+                MIDI::Name::PatchPrimaryKey key;
+                get_patch_key_at(program.event_time(), program.channel(), key);
+                PCEvent program_change_event(program.event_time(), program.program(), program.channel());
 
-       PCEvent program_change_event(program.event_time(), program.program(), program.channel());
-       if (patch) {
-               alter_program_change(program_change_event, patch->patch_primary_key());
-       }
+                key.program_number--;
+                alter_program_change(program_change_event, key);
+        }
 }
 
 void
index b45d2b532f0498dea8bf5fff0b1a6c27b841525a..1f77cf3741de68a08b7f3ba9ce9457a1e16c6668 100644 (file)
@@ -420,6 +420,9 @@ class MidiRegionView : public RegionView
         void drop_down_keys ();
         void maybe_select_by_position (GdkEventButton* ev, double x, double y);
         void get_events (Events& e, Evoral::Sequence<Evoral::MusicalTime>::NoteOperator op, uint8_t val, int chan_mask = 0);
+
+       void display_program_changes_on_channel (uint8_t);
+
 };
 
 
index 36d0c6bf331c08ea68ccb9ede9a8a8bfb8fd7743..f2448c06aa41a01f0f0f37a0bd2cecbbcc83b2ca 100644 (file)
@@ -93,7 +93,7 @@ Amp::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_frame*/, n
 
                } else { /* manual (scalar) gain */
 
-                       gain_t const dg = _gain_control->user_float();
+                       gain_t const dg = _gain_control->user_double();
 
                        if (_current_gain != dg) {
 
@@ -353,7 +353,7 @@ Amp::apply_simple_gain (AudioBuffer& buf, nframes_t nframes, gain_t target)
 void
 Amp::inc_gain (gain_t factor, void *src)
 {
-       float desired_gain = _gain_control->user_float();
+       float desired_gain = _gain_control->user_double();
 
        if (desired_gain == 0.0f) {
                set_gain (0.000001f + (0.000001f * factor), src);
@@ -379,7 +379,7 @@ Amp::set_gain (gain_t val, void *src)
                return;
        }
 
-       _gain_control->set_float(val, false);
+       _gain_control->set_double(val, false);
        _session.set_dirty();
 }
 
@@ -416,7 +416,7 @@ Amp::set_state (const XMLNode& node, int version)
 }
 
 void
-Amp::GainControl::set_value (float val)
+Amp::GainControl::set_value (double val)
 {
        // max gain at about +6dB (10.0 ^ ( 6 dB * 0.05))
        if (val > 1.99526231f)
@@ -427,7 +427,7 @@ Amp::GainControl::set_value (float val)
        AutomationControl::set_value(val);
 }
 
-float
+double
 Amp::GainControl::get_value (void) const
 {
        return AutomationControl::get_value();
index 1b6baaebd107e636291748430f791054e86feef0..52aceaf85fe0a5294098abfe9e8d171a38aef71e 100644 (file)
@@ -64,7 +64,7 @@ public:
 
        static void declick (BufferSet& bufs, nframes_t nframes, int dir);
 
-       gain_t         gain () const { return _gain_control->user_float(); }
+       gain_t         gain () const { return _gain_control->user_double(); }
 
        virtual void   set_gain (gain_t g, void *src);
        void           inc_gain (gain_t delta, void *src);
@@ -81,8 +81,8 @@ public:
                        set_flags (Controllable::Flag (flags() | Controllable::GainLike));
                }
 
-               void set_value (float val);
-               float get_value (void) const;
+               void set_value (double val);
+               double get_value (void) const;
 
                Amp* _amp;
        };
index 3c832ae704cd4b016b61dfcaccdccc7392b29b26..2d22b9e661255d53a923b24fcc3223581fc3b636 100644 (file)
@@ -77,14 +77,14 @@ public:
        /** Set the value and do the right thing based on automation state
         * (e.g. record if necessary, etc.)
         */
-       void set_value(float val);
+       void set_value(double val);
 
        /** Get the current effective value based on automation state.
         */
-       float get_value() const;
+       double get_value() const;
 
-        float lower() const { return parameter().min(); }
-        float upper() const { return parameter().max(); }
+        double lower() const { return parameter().min(); }
+        double upper() const { return parameter().max(); }
 
 protected:
        ARDOUR::Session& _session;
index df1d2e11df7757d3262fb2cd76d96e72243fac62..6236667650ec242cd56033d5cab70466bbb1feef 100644 (file)
@@ -72,7 +72,7 @@ public:
                        , _route (route)
                {}
 
-               void set_value (float val);
+               void set_value (double val);
 
                MidiTrack* _route;
        };
index 4bf399c16a657a9eefde0d0d6747baded1930d46..e453551b0be5bd7d4eaca23229553d9a5ecbae26 100644 (file)
@@ -48,7 +48,7 @@ template<typename T> class MPControl : public PBD::Controllable {
         
         /* Controllable API */
         
-        void set_value (float v) { 
+        void set_value (double v) { 
                 T newval = (T) v;
                 if (newval != _value) {
                         _value = newval;
@@ -56,12 +56,12 @@ template<typename T> class MPControl : public PBD::Controllable {
                 }
         }
         
-        float get_value () const { 
+        double get_value () const { 
                 return (float) _value;
         }
         
-        float lower () const { return _lower; }
-        float upper () const { return _upper; }
+        double lower () const { return _lower; }
+        double upper () const { return _upper; }
 
         /* "access as T" API */
         
index 2b2801841d812570bbb8441600ff4afd3dcd7dc9..abee3431ce351e24568645f4cf7e43e059a45e6d 100644 (file)
@@ -291,8 +291,8 @@ public:
                AutomationList* alist() { return (AutomationList*)_list.get(); }
                Panner& panner;
 
-               void set_value (float);
-               float get_value (void) const;
+               void set_value (double);
+               double get_value (void) const;
        };
 
        boost::shared_ptr<AutomationControl> pan_control (int id, int chan=0) {
index 2e24bdd707407b1591df1852db89b684383f00ad..c962832eb1864d2ea79532127dd680ab22d9192c 100644 (file)
@@ -78,8 +78,8 @@ class PluginInsert : public Processor
                PluginControl (PluginInsert* p, const Evoral::Parameter &param,
                                boost::shared_ptr<AutomationList> list = boost::shared_ptr<AutomationList>());
 
-               void set_value (float val);
-               float get_value (void) const;
+               void set_value (double val);
+               double get_value (void) const;
 
        private:
                PluginInsert* _plugin;
index 54eb41f97b9b9109ba657335b86624591993a184..b54ef74ca656aa6b544610d9340630029be53723 100644 (file)
@@ -319,16 +319,16 @@ class Route : public SessionObject, public Automatable, public RouteGroupMember,
 
        struct SoloControllable : public AutomationControl {
                SoloControllable (std::string name, Route&);
-               void set_value (float);
-               float get_value (void) const;
+               void set_value (double);
+               double get_value (void) const;
 
                Route& route;
        };
 
        struct MuteControllable : public AutomationControl {
                MuteControllable (std::string name, Route&);
-               void set_value (float);
-               float get_value (void) const;
+               void set_value (double);
+               double get_value (void) const;
 
                Route& route;
        };
index b3d69e440333a29ebc7e6bacb7fde54de9a69824..e40f197436aa04c111eb8e82a4217d6aabad01e2 100644 (file)
@@ -185,8 +185,8 @@ class Track : public Route, public PublicDiskstream
        struct RecEnableControllable : public PBD::Controllable {
                RecEnableControllable (Track&);
 
-               void set_value (float);
-               float get_value (void) const;
+               void set_value (double);
+               double get_value (void) const;
 
                Track& track;
        };
index be3701fc9399e903ff14bac547f65b0fb3e1daf6..c71fabda3794564049a7f28b4e31c87a2a34f81f 100644 (file)
@@ -398,7 +398,7 @@ Automatable::automation_snapshot (nframes_t now, bool force)
                        boost::shared_ptr<AutomationControl> c
                                        = boost::dynamic_pointer_cast<AutomationControl>(i->second);
                        if (c->automation_write()) {
-                               c->list()->rt_add (now, i->second->user_float());
+                               c->list()->rt_add (now, i->second->user_double());
                        }
                }
 
index 1460c42c7bd75420089b5f37c21657a5cf810e97..a4e0a7bbc088e700b08a5365f535eeb3d6606095 100644 (file)
@@ -40,22 +40,20 @@ AutomationControl::AutomationControl(
 {
 }
 
-
-float
+double
 AutomationControl::get_value() const
 {
        bool from_list = _list && ((AutomationList*)_list.get())->automation_playback();
-       return Control::get_float(from_list, _session.transport_frame());
+       return Control::get_double (from_list, _session.transport_frame());
 }
 
-
 void
-AutomationControl::set_value(float value)
+AutomationControl::set_value(double value)
 {
        bool to_list = _list && _session.transport_stopped()
                && ((AutomationList*)_list.get())->automation_write();
 
-       Control::set_float(value, to_list, _session.transport_frame());
+       Control::set_double(value, to_list, _session.transport_frame());
 
        Changed(); /* EMIT SIGNAL */
 }
index 8299d811f61a4ece460c1dd382db4978a1bc6880..2eb9df8c5c01e04b3b31c26a07c84ad324047b4d 100644 (file)
@@ -170,9 +170,6 @@ MidiBuffer::push_back(TimeType time, size_t size, const uint8_t* data)
                 DEBUG_TRACE (DEBUG::MidiIO, DEBUG_STR(a).str());
 #endif
 
-       // cerr << "MidiBuffer: pushing event @ " << time
-        // << " size = " << size << endl;
-
        if (_size + stamp_size + size >= _capacity) {
                cerr << "MidiBuffer::push_back failed (buffer is full)" << endl;
                return false;
index 6858fd1cbd0e9941a32d768ccf86b180a5c3e399..4c57b2918e61d728dd00545dc5ae5d2f9ef08a97 100644 (file)
@@ -75,12 +75,11 @@ MidiPort::get_midi_buffer (nframes_t nframes, nframes_t offset)
 
                        jack_midi_event_get (&ev, jack_buffer, i);
 
-#if 0
                         if (ev.buffer[0] == 0xfe) {
                                 /* throw away active sensing */
                                 continue;
                         }
-#endif                       
+
                        if (ev.time > off && ev.time < off+nframes) {
                                _buffer->push_back (ev);
                        }
index fe6c733a826857cf9fdb90fe462ab41a8f515e72..5a823d332eb634c4bb91669be2b36493263385be 100644 (file)
@@ -206,10 +206,11 @@ MidiSource::midi_read (Evoral::EventSink<nframes_t>& dst, sframes_t source_start
                        if (time_frames < start + cnt) {
                                dst.write(time_frames + stamp_offset - negative_stamp_offset,
                                           i->event_type(), i->size(), i->buffer());
+
                                if (tracker) {
                                        Evoral::MIDIEvent<Evoral::MusicalTime>& ev (*(Evoral::MIDIEvent<Evoral::MusicalTime>*) (&(*i)));
                                        if (ev.is_note_on()) {
-                                               DEBUG_TRACE (DEBUG::MidiSourceIO, string_compose ("\t%1 add note on %2 @ %3\n", _name, ev.note(), time_frames));
+                                               DEBUG_TRACE (DEBUG::MidiSourceIO, string_compose ("\t%1 add note on %2 @ %3 velocity %4\n", _name, ev.note(), time_frames, (int) ev.velocity()));
                                                tracker->add (ev.note(), ev.channel());
                                        } else if (ev.is_note_off()) {
                                                DEBUG_TRACE (DEBUG::MidiSourceIO, string_compose ("\t%1 add note off %2 @ %3\n", _name, ev.note(), time_frames));
index b1a8b1f2108120bd94d17bd3a70055146b1f87f4..83e42800be0d12d2d9840c507f92d000592527fe 100644 (file)
@@ -527,7 +527,7 @@ MidiTrack::write_immediate_event(size_t size, const uint8_t* buf)
 }
 
 void
-MidiTrack::MidiControl::set_value(float val)
+MidiTrack::MidiControl::set_value(double val)
 {
        bool valid = false;
        if (isinf(val)) {
index 6faf46a64de858f069d0a069c6092bb4a3c65f62..bcdc28a4ae8d507de05ae4df0fda3882fdb51c01 100644 (file)
@@ -18,7 +18,7 @@ using namespace std;
 /* specialize for bool because of set_value() semantics */
 
 namespace ARDOUR {
-        template<> void MPControl<bool>::set_value (float v) {
+        template<> void MPControl<bool>::set_value (double v) {
                 bool newval = fabs (v) >= 0.5;
                 if (newval != _value) {
                         _value = newval;
index 9921936cf7121c4fda33c49357238ed62861d0c1..b224bf558eca395c22a85491517e4a463c06960d 100644 (file)
@@ -100,13 +100,13 @@ StreamPanner::set_mono (bool yn)
 }
 
 void
-Panner::PanControllable::set_value (float val)
+Panner::PanControllable::set_value (double val)
 {
        panner.streampanner (parameter().id()).set_position (direct_control_to_pan (val));
        AutomationControl::set_value(val);
 }
 
-float
+double
 Panner::PanControllable::get_value (void) const
 {
        return AutomationControl::get_value();
index f50483beaf2e143f18424c439d5543f34766b67e..8322770d31dffc2417e3d93a3bc076182df9d3c7 100644 (file)
@@ -979,7 +979,7 @@ PluginInsert::PluginControl::PluginControl (PluginInsert* p, const Evoral::Param
 }
 
 void
-PluginInsert::PluginControl::set_value (float val)
+PluginInsert::PluginControl::set_value (double val)
 {
        /* FIXME: probably should be taking out some lock here.. */
 
@@ -1020,12 +1020,12 @@ PluginInsert::PluginControl::set_value (float val)
        AutomationControl::set_value(val);
 }
 
-float
+double
 PluginInsert::PluginControl::get_value (void) const
 {
        /* FIXME: probably should be taking out some lock here.. */
 
-       float val = _plugin->get_parameter (_list->parameter());
+       double val = _plugin->get_parameter (_list->parameter());
 
        return val;
 
index 1d8f3ca18e671611d9cfa33cccd2c067c8c95372..2dc19fbf0b83dc549bf79f2ef96b82d18040ab22 100644 (file)
@@ -3018,7 +3018,7 @@ Route::SoloControllable::SoloControllable (std::string name, Route& r)
 }
 
 void
-Route::SoloControllable::set_value (float val)
+Route::SoloControllable::set_value (double val)
 {
        bool bval = ((val >= 0.5f) ? true: false);
 # if 0
@@ -3037,7 +3037,7 @@ Route::SoloControllable::set_value (float val)
 #endif
 }
 
-float
+double
 Route::SoloControllable::get_value (void) const
 {
        if (Config->get_solo_control_is_listen_control()) {
@@ -3057,7 +3057,7 @@ Route::MuteControllable::MuteControllable (std::string name, Route& r)
 }
 
 void
-Route::MuteControllable::set_value (float val)
+Route::MuteControllable::set_value (double val)
 {
        bool bval = ((val >= 0.5f) ? true: false);
 # if 0
@@ -3071,7 +3071,7 @@ Route::MuteControllable::set_value (float val)
 #endif
 }
 
-float
+double
 Route::MuteControllable::get_value (void) const
 {
        return route.muted() ? 1.0f : 0.0f;
index 145251a02155eefed1f0259a3ddd956be063b0ea..0e1248db49bf61fe1e852899758589a6e7271858 100644 (file)
@@ -129,17 +129,17 @@ Track::RecEnableControllable::RecEnableControllable (Track& s)
 }
 
 void
-Track::RecEnableControllable::set_value (float val)
+Track::RecEnableControllable::set_value (double val)
 {
-       bool bval = ((val >= 0.5f) ? true: false);
+       bool bval = ((val >= 0.5) ? true: false);
        track.set_record_enabled (bval, this);
 }
 
-float
+double
 Track::RecEnableControllable::get_value (void) const
 {
-       if (track.record_enabled()) { return 1.0f; }
-       return 0.0f;
+       if (track.record_enabled()) { return 1.0; }
+       return 0.0;
 }
 
 bool
index 210ee7c32221dc55a36b0aa53aada566bebf6cb1..bcb9acb78a87cffbcb1829f70b388cdd8eef7585 100644 (file)
@@ -37,8 +37,8 @@ public:
        Control(const Parameter& parameter, boost::shared_ptr<ControlList>);
        virtual ~Control() {}
 
-       virtual void  set_float(float val, bool to_list=false, FrameTime frame=0);
-       virtual float get_float(bool from_list=false, FrameTime frame=0) const;
+       virtual void   set_double(double val, bool to_list=false, double frame=0);
+       virtual double get_double(bool from_list=false, double frame=0) const;
 
 
        /** Get the latest user-set value
@@ -47,10 +47,11 @@ public:
         * Automation write/touch works by periodically sampling this value
         * and adding it to the ControlList.
         */
-       float user_float() const { return _user_value; }
+        double user_double() const { return _user_value; }
 
        void set_list(boost::shared_ptr<ControlList>);
 
+
        boost::shared_ptr<ControlList>       list()       { return _list; }
        boost::shared_ptr<const ControlList> list() const { return _list; }
 
@@ -62,7 +63,7 @@ public:
 protected:
        Parameter                      _parameter;
        boost::shared_ptr<ControlList> _list;
-       float                          _user_value;
+        double                         _user_value;
        PBD::ScopedConnection          _list_marked_dirty_connection;
 
 private:
index 95de58dead03f14a231001fa9af3052a4b85cef1..090499e83835a731a47b83989796e190e7a369a0 100644 (file)
@@ -58,7 +58,7 @@ public:
 
        virtual void add_control(boost::shared_ptr<Control>);
 
-       bool find_next_event(FrameTime start, FrameTime end, ControlEvent& ev) const;
+       bool find_next_event(double start, double end, ControlEvent& ev) const;
 
        virtual bool controls_empty() const { return _controls.size() == 0; }
        virtual void clear_controls();
index 35fae2dee21815bb1302dfe3356efea2a396f070..95ee5daa8e344242b32c773c53fe1207f6d87c90 100644 (file)
@@ -61,33 +61,7 @@ public:
 
        /** Strict weak ordering
         * See: http://www.sgi.com/tech/stl/StrictWeakOrdering.html
-        * Sort Parameters first according to type then to id and lastly to channel.
-        *
-        * Proof:
-        * <ol>
-        * <li>Irreflexivity: f(x, x) is false because of the irreflexivity of \c < in each branch.</li>
-        * <li>Antisymmetry: given x != y, f(x, y) implies !f(y, x) because of the same
-        *     property of \c < in each branch and the symmetry of operator==. </li>
-        * <li>Transitivity: let f(x, y) and f(y, z) => f(x, z) be true.
-        *    We prove by contradiction, assuming the contrary:
-        *    f(x, y) and f(x, z) hold => !f(x, z)
-        *
-        *    That implies one of the following:
-        *    <ol>
-        *      <li> x == z which contradicts the assumption f(x, y) and f(y, x)
-        *                 because of antisymmetry.
-        *      </li>
-        *      <li> f(z, x) is true. That would imply that one of the ivars (we call it i)
-        *           of x is greater than the same ivar in z while all "previous" ivars
-        *           are equal. That would imply that also in y all those "previous"
-        *           ivars are equal and because if x.i > z.i it is impossible
-        *           that there is an y that satisfies x.i < y.i < z.i at the same
-        *           time which contradicts the assumption.
-        *      </li>
-        *      Therefore f(x, z) is true (transitivity)
-        *    </ol>
-        * </li>
-        * </ol>
+        * Sort Parameters first according to type then to channel and lastly to ID.
         */
        inline bool operator<(const Parameter& other) const {
                if (_type < other._type) {
index 4df560465f8ba7860356089a41f2746a467aa3c1..fe5217da5aa08c9f57bfe07997fde0b353623e0a 100644 (file)
@@ -34,9 +34,6 @@ namespace Evoral {
 
 typedef int32_t event_id_t;
 
-/** Frame count (i.e. length of time in audio frames) */
-typedef uint32_t FrameTime;
-
 /** Musical time: beats relative to some defined origin */
 typedef double MusicalTime;
 const MusicalTime MaxMusicalTime = DBL_MAX;
@@ -53,9 +50,9 @@ typedef uint32_t EventType;
 /** Type to describe the movement of a time range */
 template<typename T>
 struct RangeMove {
-       RangeMove (T f, FrameTime l, T t) : from (f), length (l), to (t) {}
+       RangeMove (T f, double l, T t) : from (f), length (l), to (t) {}
        T         from;   ///< start of the range
-       FrameTime length; ///< length of the range
+        double    length; ///< length of the range
        T         to;     ///< new start of the range
 };
 
index 985c7b13520aaf1ba4c0a809e7bb6688a203f54a..e83343b7146053218be418b75d6ce280cb29d4e7 100644 (file)
@@ -34,8 +34,8 @@ Control::Control(const Parameter& parameter, boost::shared_ptr<ControlList> list
 
 /** Get the currently effective value (ie the one that corresponds to current output)
  */
-float
-Control::get_float(bool from_list, FrameTime frame) const
+double
+Control::get_double (bool from_list, double frame) const
 {
        if (from_list) {
                return _list->eval(frame);
@@ -46,12 +46,12 @@ Control::get_float(bool from_list, FrameTime frame) const
 
 
 void
-Control::set_float(float value, bool to_list, FrameTime frame)
+Control::set_double (double value, bool to_list, double frame)
 {
        _user_value = value;
 
        if (to_list) {
-               _list->add(frame, value);
+               _list->add (frame, value);
        }
 }
 
index 6142f08870f2ff3152b2d0aa2cb2583334fd9746..c042b21ec25d225f07633ffcf2fca058398d3dbb 100644 (file)
@@ -82,11 +82,11 @@ ControlSet::control (const Parameter& parameter, bool create_if_missing)
 }
 
 bool
-ControlSet::find_next_event (FrameTime now, FrameTime end, ControlEvent& next_event) const
+ControlSet::find_next_event (double now, double end, ControlEvent& next_event) const
 {
        Controls::const_iterator li;
 
-       next_event.when = std::numeric_limits<FrameTime>::max();
+       next_event.when = std::numeric_limits<double>::max();
 
        for (li = _controls.begin(); li != _controls.end(); ++li) {
                ControlList::const_iterator i;
@@ -107,7 +107,7 @@ ControlSet::find_next_event (FrameTime now, FrameTime end, ControlEvent& next_ev
                }
        }
 
-       return next_event.when != std::numeric_limits<FrameTime>::max();
+       return next_event.when != std::numeric_limits<double>::max();
 }
 
 void
index cf0ea1ae38591fda26574f54abd994415ea6a8dc..81f72dd7ffbab884116844f98f0e688d422e58ed 100644 (file)
@@ -693,7 +693,6 @@ Sequence<Time>::append(const Event<Time>& event, event_id_t evid)
                 return;
         }
 
-
         if (ev.is_note_on()) {
                 NotePtr note(new Note<Time>(ev.channel(), ev.time(), 0, ev.note(), ev.velocity()));
                 append_note_on_unlocked (note, evid);
index 9f5ed5251b125294f203770c8bced207eca65398..3ae27f72c2f2650558492ff34ea8220105ab27b9 100644 (file)
@@ -45,8 +45,8 @@ class Controllable : public PBD::StatefulDestructible {
        Controllable (const std::string& name, Flag f = Flag (0));
        virtual ~Controllable() { Destroyed (this); }
 
-       virtual void set_value (float) = 0;
-       virtual float get_value (void) const = 0;
+       virtual void set_value (double) = 0;
+       virtual double get_value (void) const = 0;
 
        PBD::Signal0<void> LearningFinished;
        static PBD::Signal3<void,PBD::Controllable*,int,int> CreateBinding;
@@ -72,8 +72,8 @@ class Controllable : public PBD::StatefulDestructible {
        bool is_gain_like() const { return _flags & GainLike; }
        bool is_integral_only() const { return _flags & IntegerOnly; }
 
-        virtual float lower() const { return 0.0f; }
-        virtual float upper() const { return 1.0f; }
+        virtual double lower() const { return 0.0; }
+        virtual double upper() const { return 1.0; }
 
        Flag flags() const { return _flags; }
        void set_flags (Flag f);
@@ -107,8 +107,8 @@ class IgnorableControllable : public Controllable
        IgnorableControllable () : PBD::Controllable ("ignoreMe") {}
        ~IgnorableControllable () {}
     
-       void set_value (float /*v*/) {}
-       float get_value () const { return 0.0; }
+       void set_value (double /*v*/) {}
+       double get_value () const { return 0.0; }
 };
 
 }