- Call channel pressure channel pressure, not aftertouch (that's key specific).

- 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
This commit is contained in:
David Robillard 2008-09-21 18:08:18 +00:00
parent ca12fe9733
commit a43d53e3b9
11 changed files with 39 additions and 23 deletions

View 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) {

View 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 ();

View 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::create_automation_child (Parameter param, bool show)
MidiTimeAxisView::add_parameter_track(const Parameter& param)
{
create_automation_child(param, true);
}
void
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

View 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; }

View 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 */

View 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; }

View file

@ -89,7 +89,7 @@ namespace ARDOUR {
MidiCCAutomation = 0x20,
MidiPgmChangeAutomation = 0x21,
MidiPitchBenderAutomation = 0x22,
MidiChannelAftertouchAutomation = 0x23,
MidiChannelPressureAutomation = 0x23,
FadeInAutomation = 0x40,
FadeOutAutomation = 0x80,
EnvelopeAutomation = 0x100

View 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);

View 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);

View 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);

View 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 "";