- Call channel pressure channel pressure, not aftertouch (that's key specific).
authorDavid Robillard <d@drobilla.net>
Sun, 21 Sep 2008 18:08:18 +0000 (18:08 +0000)
committerDavid Robillard <d@drobilla.net>
Sun, 21 Sep 2008 18:08:18 +0000 (18:08 +0000)
- Add context menu items to add a bender or pressure automation track to a MIDI track.
- Now just need to figure out creation of program change events and you can create
  everything MIDI ardour understands from the GUI...

git-svn-id: svn://localhost/ardour2/branches/3.0@3782 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/audio_time_axis.cc
gtk2_ardour/audio_time_axis.h
gtk2_ardour/midi_time_axis.cc
gtk2_ardour/midi_time_axis.h
gtk2_ardour/route_time_axis.h
libs/ardour/ardour/parameter.h
libs/ardour/ardour/types.h
libs/ardour/audioengine.cc
libs/ardour/automatable.cc
libs/ardour/midi_track.cc
libs/ardour/parameter.cc

index 51aa2991283379a7d64f83fdd3acb1616fbaf307..a991bffe54f5742ee608f04dcf047297d6b76c08 100644 (file)
@@ -319,7 +319,7 @@ AudioTimeAxisView::set_waveform_scale (WaveformScale scale)
 }      
 
 void
-AudioTimeAxisView::create_automation_child (Parameter param, bool show)
+AudioTimeAxisView::create_automation_child (const Parameter& param, bool show)
 {
        if (param.type() == GainAutomation) {
 
index 1b090d881e6d4cdf8342c42f3d3a91de179c5288..ce5697d7c1ee10f113cfb12cbdc713b16028e666 100644 (file)
@@ -82,7 +82,7 @@ class AudioTimeAxisView : public RouteTimeAxisView
        guint32 show_at (double y, int& nth, Gtk::VBox *parent);
        void hide ();
        
-       void create_automation_child (ARDOUR::Parameter param, bool show);
+       void create_automation_child (const ARDOUR::Parameter& param, bool show);
        
        void first_idle ();
 
index b8f5da2ed9d781195f5b67895dcf31a9bb53ace9..7ef924dada5bbf4d459be8f6e82bf0edb8095c1d 100644 (file)
@@ -225,9 +225,15 @@ MidiTimeAxisView::build_automation_action_menu ()
        MenuList& automation_items = automation_action_menu->items();
        
        automation_items.push_back (SeparatorElem());
-
        automation_items.push_back (MenuElem (_("Controller..."), 
-                                                  mem_fun(*this, &MidiTimeAxisView::add_controller_track)));
+                       mem_fun(*this, &MidiTimeAxisView::add_cc_track)));
+       automation_items.push_back (MenuElem (_("Bender"), 
+                       sigc::bind(mem_fun(*this, &MidiTimeAxisView::add_parameter_track),
+                               Parameter(MidiPitchBenderAutomation))));
+       automation_items.push_back (MenuElem (_("Pressure"), 
+                       sigc::bind(mem_fun(*this, &MidiTimeAxisView::add_parameter_track),
+                               Parameter(MidiChannelPressureAutomation))));
+
 }
 
 Gtk::Menu*
@@ -319,7 +325,7 @@ MidiTimeAxisView::show_existing_automation ()
 /** Prompt for a controller with a dialog and add an automation track for it
  */
 void
-MidiTimeAxisView::add_controller_track()
+MidiTimeAxisView::add_cc_track()
 {
        int response;
        Parameter param;
@@ -337,13 +343,22 @@ MidiTimeAxisView::add_controller_track()
                create_automation_child(param, true);
 }
 
+
+/** Add an automation track for the given parameter (pitch bend, channel pressure).
+ */
+void
+MidiTimeAxisView::add_parameter_track(const Parameter& param)
+{
+       create_automation_child(param, true);
+}
+
 void
-MidiTimeAxisView::create_automation_child (Parameter param, bool show)
+MidiTimeAxisView::create_automation_child (const Parameter& param, bool show)
 {
        if (    param.type() == MidiCCAutomation ||
                        param.type() == MidiPgmChangeAutomation ||
                        param.type() == MidiPitchBenderAutomation ||
-                       param.type() == MidiChannelAftertouchAutomation
+                       param.type() == MidiChannelPressureAutomation
           ) {
        
                /* These controllers are region "automation", so we do not create
index e06e5cd5345f653853bcb8da74c96b0e7d5b6731..f56ce604d458c0df9a7169195d33f79f5fdaedc9 100644 (file)
@@ -68,8 +68,9 @@ class MidiTimeAxisView : public RouteTimeAxisView
 
        void show_all_automation ();
        void show_existing_automation ();
-       void add_controller_track ();
-       void create_automation_child (ARDOUR::Parameter param, bool show);
+       void add_cc_track ();
+       void add_parameter_track (const ARDOUR::Parameter& param);
+       void create_automation_child (const ARDOUR::Parameter& param, bool show);
 
        ARDOUR::NoteMode note_mode() const { return _note_mode; }
 
index 69dc47580aecfc6fc22d068e24053b0855790751..b098894d8ca3b6d818b0baebc784e8b64fef06b8 100644 (file)
@@ -117,7 +117,7 @@ public:
                    : param (par), menu_item (mi), track (tr) {}
        };
 
-       virtual void create_automation_child (ARDOUR::Parameter param, bool show) = 0;
+       virtual void create_automation_child (const ARDOUR::Parameter& param, bool show) = 0;
        
        /* make sure we get the right version of this */
 
index 9ffeb98995ec3bc3f729abd5c04b734ef409aa4e..5c390c1039eae0e0f2cebd41ef5024ab828ea2cb 100644 (file)
@@ -93,7 +93,7 @@ public:
                        break;
                case MidiCCAutomation:
                case MidiPgmChangeAutomation:
-               case MidiChannelAftertouchAutomation:
+               case MidiChannelPressureAutomation:
                        Evoral::MIDI::controller_range(min, max, normal); break;
                case MidiPitchBenderAutomation:
                        Evoral::MIDI::bender_range(min, max, normal); break;
@@ -108,7 +108,7 @@ public:
        std::string symbol() const;
 
        inline bool is_integer() const {
-               return (_type >= MidiCCAutomation && _type <= MidiChannelAftertouchAutomation);
+               return (_type >= MidiCCAutomation && _type <= MidiChannelPressureAutomation);
        }
 
        inline operator Parameter() { return (Parameter)*this; }
index 06c055bbe67334248e42dbcb5c0d15c5c6b0be84..ce76a247cbe0be855086fc211ff1d88ce3946017 100644 (file)
@@ -89,7 +89,7 @@ namespace ARDOUR {
                MidiCCAutomation = 0x20,
                MidiPgmChangeAutomation = 0x21,
                MidiPitchBenderAutomation = 0x22,
-               MidiChannelAftertouchAutomation = 0x23,
+               MidiChannelPressureAutomation = 0x23,
                FadeInAutomation = 0x40,
                FadeOutAutomation = 0x80,
                EnvelopeAutomation = 0x100
index 71481e695f0900272e11d2bb096af3cf43e5b408..956b95602028794d59f5e35ad91e2e5eb1a08812 100644 (file)
@@ -95,7 +95,7 @@ AudioEngine::AudioEngine (string client_name)
        Parameter::init_metadata(MidiCCAutomation);
        Parameter::init_metadata(MidiPgmChangeAutomation);
        Parameter::init_metadata(MidiPitchBenderAutomation);
-       Parameter::init_metadata(MidiChannelAftertouchAutomation);
+       Parameter::init_metadata(MidiChannelPressureAutomation);
        Parameter::init_metadata(FadeInAutomation);
        Parameter::init_metadata(FadeOutAutomation);
        Parameter::init_metadata(EnvelopeAutomation);
index f77975c303759def5a1ea5b83fed7b851898f194..a54bad5f6fba2d32413daf0283200591db69860f 100644 (file)
@@ -161,8 +161,8 @@ Automatable::describe_parameter (Parameter param)
                return string_compose("Program [%1]", int(param.channel()) + 1);
        } else if (param.type() == MidiPitchBenderAutomation) {
                return string_compose("Bender [%1]", int(param.channel()) + 1);
-       } else if (param.type() == MidiChannelAftertouchAutomation) {
-               return string_compose("Aftertouch [%1]", int(param.channel()) + 1);
+       } else if (param.type() == MidiChannelPressureAutomation) {
+               return string_compose("Pressure [%1]", int(param.channel()) + 1);
        } else {
                return param.symbol();
        }
@@ -392,7 +392,7 @@ Automatable::control_factory(const Evoral::Parameter& param)
 {
        boost::shared_ptr<AutomationList> list(new AutomationList(param));
        Evoral::Control* control = NULL;
-       if (param.type() >= MidiCCAutomation && param.type() <= MidiChannelAftertouchAutomation) {
+       if (param.type() >= MidiCCAutomation && param.type() <= MidiChannelPressureAutomation) {
                control = new MidiTrack::MidiControl((MidiTrack*)this, param);
        } else {
                control = new AutomationControl(_a_session, param);
index ffe8b203039924bfc7d43a34e7e7776bb1696842..745e5bf1b75975206266a5bfc1e623edb0222567 100644 (file)
@@ -764,7 +764,7 @@ MidiTrack::MidiControl::set_value(float val)
                        ev[1] = int(val);
                        break;
                        
-               case MidiChannelAftertouchAutomation:
+               case MidiChannelPressureAutomation:
                        size = 2;
                        ev[0] += MIDI_CMD_CHANNEL_PRESSURE;
                        ev[1] = int(val);
index 87b5d329a23827fe4d92a86f13ca6403c9fccd9d..d6e9d16db540f3140cda99bbdab0170430334944 100644 (file)
@@ -68,10 +68,10 @@ Parameter::Parameter(const std::string& str)
                assert(channel < 16);
                _id = 0;
                _channel = channel;
-       } else if (str.length() > 24 && str.substr(0, 24) == "midi-channel-aftertouch-") {
-               _type = MidiChannelAftertouchAutomation;
+       } else if (str.length() > 24 && str.substr(0, 24) == "midi-channel-pressure-") {
+               _type = MidiChannelPressureAutomation;
                uint32_t channel = 0;
-               sscanf(str.c_str(), "midi-channel-aftertouch-%d", &channel);
+               sscanf(str.c_str(), "midi-channel-pressure-%d", &channel);
                assert(channel < 16);
                _id = 0;
                _channel = channel;
@@ -111,8 +111,8 @@ Parameter::symbol() const
                return string_compose("midi-pgm-change-%1", int(_channel));
        } else if (_type == MidiPitchBenderAutomation) {
                return string_compose("midi-pitch-bender-%1", int(_channel));
-       } else if (_type == MidiChannelAftertouchAutomation) {
-               return string_compose("midi-channel-aftertouch-%1", int(_channel));
+       } else if (_type == MidiChannelPressureAutomation) {
+               return string_compose("midi-channel-pressure-%1", int(_channel));
        } else {
                PBD::warning << "Uninitialized Parameter symbol() called." << endmsg;
                return "";