make transport buttons and shuttle controller work with MIDI CC's

git-svn-id: svn://localhost/ardour2/trunk@1477 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2007-02-19 23:09:20 +00:00
parent 6b459529ce
commit f22f22b599
5 changed files with 36 additions and 11 deletions

View file

@ -2610,23 +2610,22 @@ void
ARDOUR_UI::TransportControllable::set_value (float val)
{
if (type == ShuttleControl) {
double fract;
if (val == 63.0f) {
if (val == 0.5f) {
fract = 0.0;
} else {
if (val < 63.0f) {
fract = -((63.0f - val)/63.0f);
if (val < 0.5f) {
fract = -((0.5f - val)/0.5f);
} else {
fract = ((val - 63.0f)/63.0f);
fract = ((val - 0.5f)/0.5f);
}
}
ui.set_shuttle_fract (fract);
return;
}
if (val < 0.5f) {
/* do nothing: these are radio-style actions */
return;
@ -2664,7 +2663,7 @@ ARDOUR_UI::TransportControllable::set_value (float val)
return;
}
Glib::RefPtr<Action> act = ActionManager::get_action ("transport", action);
Glib::RefPtr<Action> act = ActionManager::get_action ("Transport", action);
if (act) {
act->activate ();

View file

@ -158,6 +158,9 @@ Editor::set_selected_mixer_strip (TimeAxisView& view)
}
}
double current = 0.0;
bool currentInitialized = 0;
void
Editor::update_current_screen ()
{
@ -194,7 +197,7 @@ Editor::update_current_screen ()
playhead_cursor->set_position (frame);
#undef CONTINUOUS_SCROLL
#define CONTINUOUS_SCROLL
#ifdef CONTINUOUS_SCROLL
/* don't do continuous scroll till the new position is in the rightmost quarter of the
@ -213,7 +216,15 @@ Editor::update_current_screen ()
}
}
#else
horizontal_adjustment.set_value (frame / frames_per_unit);
if (!currentInitialized) {
current = (frame - current_page_frames()/2) / frames_per_unit;
currentInitialized = 1;
}
double target = (frame - current_page_frames()/2) / frames_per_unit;
target = (target * 0.1) + (current * 0.9);
horizontal_adjustment.set_value ( target );
current = target;
#endif
#endif // CONTINUOUS_SCROLL

View file

@ -582,7 +582,7 @@ class Session : public PBD::StatefulDestructible
struct cleanup_report {
vector<string> paths;
int32_t space;
int64_t space;
};
int cleanup_sources (cleanup_report&);

View file

@ -126,7 +126,18 @@ GenericMidiControlProtocol::start_learning (Controllable* c)
return false;
}
MIDIControllable* mc = new MIDIControllable (*_port, *c);
MIDIControllable* mc = 0;
for (MIDIControllables::iterator i = controllables.begin(); i != controllables.end(); ++i) {
if ((*i)->get_controllable().id() == c->id()) {
mc = *i;
break;
}
}
if (!mc) {
mc = new MIDIControllable (*_port, *c);
}
{
Glib::Mutex::Lock lm (pending_lock);

View file

@ -99,6 +99,8 @@ MIDIControllable::stop_learning ()
void
MIDIControllable::drop_external_control ()
{
cerr << "Dropping existing control using " << connections << " connections\n";
if (connections > 0) {
midi_sense_connection[0].disconnect ();
}
@ -279,6 +281,8 @@ MIDIControllable::bind_midi (channel_t chn, eventType ev, MIDI::byte additional)
default:
break;
}
cerr << "MIDI bound with " << connections << endl;
}
void