mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-21 06:06:25 +01:00
Merge branch 'ovenwerks-master'
This commit is contained in:
commit
1d0bff865b
7 changed files with 113 additions and 6 deletions
|
|
@ -69,6 +69,7 @@ namespace PBD {
|
|||
LIBARDOUR_API extern DebugBits AudioEngine;
|
||||
LIBARDOUR_API extern DebugBits Soundcloud;
|
||||
LIBARDOUR_API extern DebugBits Butler;
|
||||
LIBARDOUR_API extern DebugBits GenericMidi;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,5 +65,6 @@ PBD::DebugBits PBD::DEBUG::Ports = PBD::new_debug_bit ("Ports");
|
|||
PBD::DebugBits PBD::DEBUG::AudioEngine = PBD::new_debug_bit ("AudioEngine");
|
||||
PBD::DebugBits PBD::DEBUG::Soundcloud = PBD::new_debug_bit ("Soundcloud");
|
||||
PBD::DebugBits PBD::DEBUG::Butler = PBD::new_debug_bit ("Butler");
|
||||
PBD::DebugBits PBD::DEBUG::GenericMidi = PBD::new_debug_bit ("genericmidi");
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "pbd/failed_constructor.h"
|
||||
#include "pbd/file_utils.h"
|
||||
#include "pbd/xml++.h"
|
||||
#include "pbd/compose.h"
|
||||
|
||||
#include "midi++/port.h"
|
||||
|
||||
|
|
@ -40,6 +41,7 @@
|
|||
#include "ardour/midi_ui.h"
|
||||
#include "ardour/rc_configuration.h"
|
||||
#include "ardour/midiport_manager.h"
|
||||
#include "ardour/debug.h"
|
||||
|
||||
#include "generic_midi_control_protocol.h"
|
||||
#include "midicontrollable.h"
|
||||
|
|
@ -174,6 +176,7 @@ GenericMidiControlProtocol::reload_maps ()
|
|||
void
|
||||
GenericMidiControlProtocol::drop_all ()
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, "Drop all bindings\n");
|
||||
Glib::Threads::Mutex::Lock lm (pending_lock);
|
||||
Glib::Threads::Mutex::Lock lm2 (controllables_lock);
|
||||
|
||||
|
|
@ -201,6 +204,7 @@ GenericMidiControlProtocol::drop_all ()
|
|||
void
|
||||
GenericMidiControlProtocol::drop_bindings ()
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, "Drop bindings, leave learned\n");
|
||||
Glib::Threads::Mutex::Lock lm2 (controllables_lock);
|
||||
|
||||
for (MIDIControllables::iterator i = controllables.begin(); i != controllables.end(); ) {
|
||||
|
|
@ -453,7 +457,7 @@ GenericMidiControlProtocol::create_binding (PBD::Controllable* control, int pos,
|
|||
// Update the MIDI Controllable based on the the pos param
|
||||
// Here is where a table lookup for user mappings could go; for now we'll just wing it...
|
||||
mc->bind_midi(channel, MIDI::controller, value);
|
||||
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("Create binding: Channel: %1 Controller: %2 Value: %3 \n", channel, MIDI::controller, value));
|
||||
controllables.push_back (mc);
|
||||
}
|
||||
}
|
||||
|
|
@ -597,6 +601,7 @@ GenericMidiControlProtocol::get_feedback () const
|
|||
int
|
||||
GenericMidiControlProtocol::load_bindings (const string& xmlpath)
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, "Load bindings: Reading midi map\n");
|
||||
XMLTree state_tree;
|
||||
|
||||
if (!state_tree.read (xmlpath.c_str())) {
|
||||
|
|
@ -632,6 +637,7 @@ GenericMidiControlProtocol::load_bindings (const string& xmlpath)
|
|||
|
||||
drop_all ();
|
||||
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, "Loading bindings\n");
|
||||
for (citer = children.begin(); citer != children.end(); ++citer) {
|
||||
|
||||
if ((*citer)->name() == "DeviceInfo") {
|
||||
|
|
|
|||
|
|
@ -19,11 +19,14 @@
|
|||
#include <cstring>
|
||||
|
||||
#include "midi++/port.h"
|
||||
#include "pbd/compose.h"
|
||||
#include "ardour/debug.h"
|
||||
|
||||
#include "midiaction.h"
|
||||
#include "generic_midi_control_protocol.h"
|
||||
|
||||
using namespace MIDI;
|
||||
using namespace PBD;
|
||||
|
||||
MIDIAction::MIDIAction (MIDI::Parser& p)
|
||||
: MIDIInvokable (p)
|
||||
|
|
@ -44,6 +47,7 @@ MIDIAction::init (GenericMidiControlProtocol& ui, const std::string& invokable_n
|
|||
void
|
||||
MIDIAction::execute ()
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("Action: '%1'\n", _invokable_name));
|
||||
_ui->access_action (_invokable_name);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "pbd/controllable_descriptor.h"
|
||||
#include "pbd/xml++.h"
|
||||
#include "pbd/stacktrace.h"
|
||||
#include "pbd/compose.h"
|
||||
|
||||
#include "midi++/types.h" // Added by JE - 06-01-2009. All instances of 'byte' changed to 'MIDI::byte' (for clarification)
|
||||
#include "midi++/port.h"
|
||||
|
|
@ -35,6 +36,7 @@
|
|||
#include "ardour/automation_control.h"
|
||||
#include "ardour/midi_ui.h"
|
||||
#include "ardour/utils.h"
|
||||
#include "ardour/debug.h"
|
||||
|
||||
#include "midicontrollable.h"
|
||||
#include "generic_midi_control_protocol.h"
|
||||
|
|
@ -268,10 +270,13 @@ MIDIControllable::midi_sense_note (Parser &, EventTwoBytes *msg, bool /*is_on*/)
|
|||
if (!controllable->is_toggle()) {
|
||||
if (control_additional == msg->note_number) {
|
||||
controllable->set_value (midi_to_control (msg->velocity));
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("Note %1 value %2 %3\n", (int) msg->note_number, (float) midi_to_control (msg->velocity), current_uri() ));
|
||||
}
|
||||
} else {
|
||||
if (control_additional == msg->note_number) {
|
||||
controllable->set_value (controllable->get_value() > 0.5f ? 0.0f : 1.0f);
|
||||
float new_value = controllable->get_value() > 0.5f ? 0.0f : 1.0f;
|
||||
controllable->set_value (new_value);
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("Note %1 Value %2 %3\n", (int) msg->note_number, (float) new_value, current_uri()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -317,13 +322,16 @@ MIDIControllable::midi_sense_controller (Parser &, EventTwoBytes *msg)
|
|||
if (in_sync || _surface->motorised ()) {
|
||||
controllable->set_value (midi_to_control (new_value));
|
||||
}
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("MIDI CC %1 value %2 %3\n", (int) msg->controller_number, (float) midi_to_control(new_value), current_uri() ));
|
||||
|
||||
last_controllable_value = new_value;
|
||||
} else {
|
||||
if (msg->value > 64.0f) {
|
||||
controllable->set_value (1);
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("Midi CC %1 value 1 %2\n", (int) msg->controller_number, current_uri()));
|
||||
} else {
|
||||
controllable->set_value (0);
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("Midi CC %1 value 0 %2\n", (int) msg->controller_number, current_uri()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -342,8 +350,11 @@ MIDIControllable::midi_sense_program_change (Parser &, MIDI::byte msg)
|
|||
|
||||
if (!controllable->is_toggle()) {
|
||||
controllable->set_value (midi_to_control (msg));
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("MIDI program %1 value %2 %3\n", (int) msg, (float) midi_to_control (msg), current_uri() ));
|
||||
} else if (msg == control_additional) {
|
||||
controllable->set_value (controllable->get_value() > 0.5f ? 0.0f : 1.0f);
|
||||
float new_value = controllable->get_value() > 0.5f ? 0.0f : 1.0f;
|
||||
controllable->set_value (new_value);
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("MIDI program %1 value %2 %3\n", (int) msg, (float) new_value, current_uri()));
|
||||
}
|
||||
|
||||
last_value = (MIDI::byte) (controllable->get_value() * 127.0); // to prevent feedback fights
|
||||
|
|
@ -360,8 +371,15 @@ MIDIControllable::midi_sense_pitchbend (Parser &, pitchbend_t pb)
|
|||
|
||||
if (!controllable->is_toggle()) {
|
||||
controllable->set_value (midi_to_control (pb));
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("MIDI pitchbend %1 value %2 %3\n", (int) control_channel, (float) midi_to_control (pb), current_uri() ));
|
||||
} else {
|
||||
controllable->set_value (controllable->get_value() > 0.5f ? 0.0f : 1.0f);
|
||||
if (pb > 8065.0f) {
|
||||
controllable->set_value (1);
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("Midi pitchbend %1 value 1 %2\n", (int) control_channel, current_uri()));
|
||||
} else {
|
||||
controllable->set_value (0);
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("Midi pitchbend %1 value 0 %2\n", (int) control_channel, current_uri()));
|
||||
}
|
||||
}
|
||||
|
||||
last_value = control_to_midi (controllable->get_value ());
|
||||
|
|
@ -437,6 +455,7 @@ MIDIControllable::bind_midi (channel_t chn, eventType ev, MIDI::byte additional)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("Controlable: bind_midi: %1 on Channel %2 value %3 \n", _control_description, chn_i + 1, (int) additional));
|
||||
}
|
||||
|
||||
MIDI::byte*
|
||||
|
|
@ -452,21 +471,28 @@ MIDIControllable::write_feedback (MIDI::byte* buf, int32_t& bufsize, bool /*forc
|
|||
return buf;
|
||||
}
|
||||
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("Feedback: %1 %2\n", control_description(), current_uri()));
|
||||
|
||||
*buf++ = (0xF0 & control_type) | (0xF & control_channel);
|
||||
|
||||
int ev_size = 3;
|
||||
switch (control_type) {
|
||||
case MIDI::pitchbend:
|
||||
*buf++ = int (gm) & 127;
|
||||
*buf++ = (int (gm) >> 7) & 127;
|
||||
break;
|
||||
case MIDI::program:
|
||||
*buf++ = control_additional; /* program number */
|
||||
ev_size = 2;
|
||||
break;
|
||||
default:
|
||||
*buf++ = control_additional; /* controller number */
|
||||
*buf++ = gm;
|
||||
break;
|
||||
}
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("MIDI out: Type %1 Channel %2 Bytes %3 %4\n", (int) control_type, (int) control_channel , (int) *(buf - 2), (int) *(buf - 1)));
|
||||
|
||||
last_value = gm;
|
||||
bufsize -= 3;
|
||||
bufsize -= ev_size;
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,12 @@
|
|||
#include "midifunction.h"
|
||||
#include "generic_midi_control_protocol.h"
|
||||
|
||||
#include "pbd/compose.h"
|
||||
|
||||
#include "ardour/debug.h"
|
||||
|
||||
using namespace MIDI;
|
||||
using namespace PBD;
|
||||
|
||||
MIDIFunction::MIDIFunction (MIDI::Parser& p)
|
||||
: MIDIInvokable (p)
|
||||
|
|
@ -94,10 +99,12 @@ MIDIFunction::execute ()
|
|||
switch (_function) {
|
||||
case NextBank:
|
||||
_ui->next_bank();
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, "Function: next_bank\n");
|
||||
break;
|
||||
|
||||
case PrevBank:
|
||||
_ui->prev_bank();
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, "Function: prev_bank\n");
|
||||
break;
|
||||
|
||||
case SetBank:
|
||||
|
|
@ -105,39 +112,48 @@ MIDIFunction::execute ()
|
|||
uint32_t bank;
|
||||
sscanf (_argument.c_str(), "%d", &bank);
|
||||
_ui->set_current_bank (bank);
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("Function: set_current_bank = %1\n", (int) bank));
|
||||
}
|
||||
break;
|
||||
|
||||
case TransportStop:
|
||||
_ui->transport_stop ();
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, "Function: transport_stop\n");
|
||||
break;
|
||||
|
||||
case TransportRoll:
|
||||
_ui->transport_play ();
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, "Function: transport_play\n");
|
||||
break;
|
||||
|
||||
case TransportStart:
|
||||
_ui->goto_start ();
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, "Function: goto_start\n");
|
||||
break;
|
||||
|
||||
case TransportZero:
|
||||
// need this in BasicUI
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, "Function: goto_zero-not implemented\n");
|
||||
break;
|
||||
|
||||
case TransportEnd:
|
||||
_ui->goto_end ();
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, "Function: goto_end\n");
|
||||
break;
|
||||
|
||||
case TransportLoopToggle:
|
||||
_ui->loop_toggle ();
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, "Function: loop_toggle\n");
|
||||
break;
|
||||
|
||||
case TransportRecordEnable:
|
||||
_ui->set_record_enable (true);
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, "Function: set_record_enable = true\n");
|
||||
break;
|
||||
|
||||
case TransportRecordDisable:
|
||||
_ui->set_record_enable (false);
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, "Function: set_record_enable = false\n");
|
||||
break;
|
||||
|
||||
case Select:
|
||||
|
|
@ -145,6 +161,7 @@ MIDIFunction::execute ()
|
|||
uint32_t rid;
|
||||
sscanf (_argument.c_str(), "%d", &rid);
|
||||
_ui->SetRouteSelection (rid);
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("Function: SetRouteSelection = %1\n", rid));
|
||||
}
|
||||
break;
|
||||
case TrackSetMute:
|
||||
|
|
@ -165,6 +182,7 @@ MIDIFunction::execute ()
|
|||
XMLNode&
|
||||
MIDIFunction::get_state ()
|
||||
{
|
||||
|
||||
XMLNode* node = new XMLNode ("MIDIFunction");
|
||||
return *node;
|
||||
}
|
||||
|
|
|
|||
51
midi_maps/midikb_wiimote.map
Normal file
51
midi_maps/midikb_wiimote.map
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ArdourMIDIBindings version="1.0.0" name="WiiMote via midikb">
|
||||
|
||||
<!-- OvenWerks June 27 2015 -->
|
||||
<!-- This tries to do what the old WiiMote setup in Ardour did -->
|
||||
<!-- B + A -->
|
||||
<Binding channel="1" note="16" action="Transport/ToggleRollForgetCapture"/>
|
||||
<!-- B + left -->
|
||||
<Binding channel="1" note="17" action="Editor/playhead-to-previous-region-boundary"/>
|
||||
<!-- B + right -->
|
||||
<Binding channel="1" note="18" action="Editor/playhead-to-next-region-boundary"/>
|
||||
<!-- B + up -->
|
||||
<Binding channel="1" note="19" action="Editor/jump-forward-to-mark"/>
|
||||
<!-- B + down -->
|
||||
<Binding channel="1" note="20" action="Editor/jump-backward-to-mark"/>
|
||||
<!-- B + home -->
|
||||
<Binding channel="1" note="21" action="Editor/add-location-from-playhead"/>
|
||||
<!-- B + minus -->
|
||||
<Binding channel="1" note="22" action="Transport/GotoStart"/>
|
||||
<!-- B + plus -->
|
||||
<Binding channel="1" note="23" action="Transport/GotoEnd"/>
|
||||
<!-- B + one Not used add as you wish -->
|
||||
<!--Binding channel="1" note="24" action=""/-->
|
||||
<!-- B + Two -->
|
||||
<Binding channel="1" note="25" function="rec-disable"/>
|
||||
|
||||
<!-- A -->
|
||||
<Binding channel="1" note="32" action="Transport/ToggleRoll"/>
|
||||
<!-- left -->
|
||||
<Binding channel="1" note="33" action="Editor/nudge-playhead-backward"/>
|
||||
<!-- right -->
|
||||
<Binding channel="1" note="34" action="Editor/nudge-playhead-forward"/>
|
||||
<!-- up -->
|
||||
<Binding channel="1" note="35" action="Editor/select-prev-route"/>
|
||||
<!-- down -->
|
||||
<Binding channel="1" note="36" action="Editor/select-next-route"/>
|
||||
<!-- home -->
|
||||
<Binding channel="1" note="37" action="Editor/playhead-to-edit"/>
|
||||
<!-- minus -->
|
||||
<Binding channel="1" note="38" action="Editor/temporal-zoom-out"/>
|
||||
<!-- plus -->
|
||||
<Binding channel="1" note="39" action="Editor/temporal-zoom-in"/>
|
||||
<!-- one -->
|
||||
<Binding channel="1" note="40" action="Editor/track-record-enable-toggle"/>
|
||||
<!-- Two -->
|
||||
<Binding channel="1" note="41" function="rec-enable"/>
|
||||
|
||||
|
||||
|
||||
|
||||
</ArdourMIDIBindings>
|
||||
Loading…
Add table
Add a link
Reference in a new issue