more tranzport lowlevel fixes and rebinding
git-svn-id: svn://localhost/trunk/ardour2@488 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
3129b822b0
commit
e22a48723e
|
@ -1735,9 +1735,8 @@ AudioClock::set_mode (Mode m)
|
|||
started editing the clock and then we switch clock mode.
|
||||
*/
|
||||
|
||||
// GTK2FIX might need an equivalent here for drop focus
|
||||
|
||||
|
||||
clock_base.grab_focus ();
|
||||
|
||||
if (_mode == m) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -180,8 +180,6 @@ gnome_canvas_imageframe_init (GnomeCanvasImageFrame *image)
|
|||
image->height = 0.0;
|
||||
image->drawwidth = 0.0;
|
||||
image->anchor = GTK_ANCHOR_CENTER;
|
||||
// GTK2FIX
|
||||
// GNOME_CANVAS_ITEM(image)->object.flags |= GNOME_CANVAS_ITEM_NO_AUTO_REDRAW;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -163,9 +163,6 @@ gnome_canvas_ruler_init (GnomeCanvasRuler *ruler)
|
|||
ruler->frames_per_unit = 1;
|
||||
ruler->fill_color = 0;
|
||||
ruler->tick_color = 0;
|
||||
|
||||
// GTK2FIX
|
||||
//GNOME_CANVAS_ITEM(ruler)->object.flags |= GNOME_CANVAS_ITEM_NO_AUTO_REDRAW;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -172,8 +172,6 @@ gnome_canvas_simpleline_init (GnomeCanvasSimpleLine *simpleline)
|
|||
simpleline->y2 = 0.0;
|
||||
simpleline->color = RGBA_TO_UINT(98,123,174,241);
|
||||
simpleline->horizontal = TRUE; /* reset in the _update() method */
|
||||
// GTK2FIX
|
||||
// GNOME_CANVAS_ITEM(simpleline)->object.flags |= GNOME_CANVAS_ITEM_NO_AUTO_REDRAW;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -227,9 +227,6 @@ gnome_canvas_simplerect_init (GnomeCanvasSimpleRect *simplerect)
|
|||
simplerect->outline_color = 0;
|
||||
simplerect->outline_pixels = 1;
|
||||
simplerect->outline_what = 0xf;
|
||||
|
||||
// GTK2FIX
|
||||
// GNOME_CANVAS_ITEM(simplerect)->object.flags |= GNOME_CANVAS_ITEM_NO_AUTO_REDRAW;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -314,9 +314,6 @@ gnome_canvas_waveview_init (GnomeCanvasWaveView *waveview)
|
|||
waveview->reload_cache_in_render = FALSE;
|
||||
|
||||
waveview->wave_color = RGBA_TO_UINT(44,35,126,255);
|
||||
|
||||
// GTK2FIX
|
||||
// GNOME_CANVAS_ITEM(waveview)->object.flags |= GNOME_CANVAS_ITEM_NO_AUTO_REDRAW;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -60,11 +60,8 @@ Editor::add_named_selection_to_named_selection_display (NamedSelection& selectio
|
|||
void
|
||||
Editor::redisplay_named_selections ()
|
||||
{
|
||||
//GTK2FIX
|
||||
//named_selection_display.freeze ();
|
||||
named_selection_model->clear ();
|
||||
session->foreach_named_selection (*this, &Editor::add_named_selection_to_named_selection_display);
|
||||
//named_selection_display.thaw ();
|
||||
}
|
||||
|
||||
gint
|
||||
|
|
|
@ -347,9 +347,6 @@ Editor::edit_meter_section (MeterSection* section)
|
|||
MeterDialog meter_dialog (*section, _("done"));
|
||||
|
||||
meter_dialog.set_position (Gtk::WIN_POS_MOUSE);
|
||||
// GTK2FIX
|
||||
// meter_dialog.realize ();
|
||||
// meter_dialog.get_window()->set_decorations (Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH));
|
||||
|
||||
ensure_float (meter_dialog);
|
||||
|
||||
|
@ -378,9 +375,6 @@ Editor::edit_tempo_section (TempoSection* section)
|
|||
TempoDialog tempo_dialog (*section, _("done"));
|
||||
|
||||
tempo_dialog.set_position (Gtk::WIN_POS_MOUSE);
|
||||
// GTK2FIX
|
||||
// tempo_dialog.realize ();
|
||||
// tempo_dialog.get_window()->set_decorations (Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH));
|
||||
|
||||
ensure_float (tempo_dialog);
|
||||
|
||||
|
|
|
@ -64,8 +64,6 @@ ImageFrameTimeAxis::ImageFrameTimeAxis(const string & track_id, PublicEditor& ed
|
|||
{
|
||||
_color = unique_random_color() ;
|
||||
|
||||
//GTK2FIX -- how to get the group? is the canvas display really a group?
|
||||
//selection_group = gnome_canvas_item_new (GNOME_CANVAS_GROUP(canvas_display), gnome_canvas_group_get_type (), NULL) ;
|
||||
selection_group = new ArdourCanvas::Group (*canvas_display);
|
||||
selection_group->hide();
|
||||
|
||||
|
|
|
@ -52,8 +52,6 @@ MarkerTimeAxisView::MarkerTimeAxisView(MarkerTimeAxis& tv)
|
|||
region_color = _trackview.color();
|
||||
stream_base_color = color_map[cMarkerTrackBase];
|
||||
|
||||
//GTK2FIX -- how to get the group? is the canvas display really a group?
|
||||
//canvas_group = gnome_canvas_item_new (GNOME_CANVAS_GROUP(_trackview.canvas_display), gnome_canvas_group_get_type (), 0);
|
||||
canvas_group = new ArdourCanvas::Group (*_trackview.canvas_display);
|
||||
|
||||
canvas_rect = new ArdourCanvas::SimpleRect (*canvas_group);
|
||||
|
|
|
@ -424,10 +424,6 @@ RedirectBox::wierd_plugin_dialog (Plugin& p, uint32_t streams, IO& io)
|
|||
dialog.set_modal (true);
|
||||
dialog.show_all ();
|
||||
|
||||
// GTK2FIX
|
||||
//dialog.realize();
|
||||
//dialog.get_window()->set_decorations (Gdk::WMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH));
|
||||
|
||||
dialog.run ();
|
||||
}
|
||||
|
||||
|
|
|
@ -356,9 +356,6 @@ RouteParams_UI::set_session (Session *sess)
|
|||
{
|
||||
ArdourDialog::set_session (sess);
|
||||
|
||||
// GTK2FIX
|
||||
// route_select_list.freeze ();
|
||||
|
||||
route_display_model->clear();
|
||||
|
||||
if (session) {
|
||||
|
|
|
@ -259,9 +259,9 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova
|
|||
else
|
||||
note_types.set_active_text (_("quarter (4)"));
|
||||
|
||||
/* strings.back() just happens to be the longest one to display */
|
||||
// GTK2FIX
|
||||
//Gtkmm2ext::set_size_request_to_display_given_text (note_types, "thirty-second (32)", 7, 7);
|
||||
/* the string here needs to be the longest one to display */
|
||||
const guint32 FUDGE = 20; // Combo's are stupid - they steal space from the entry for the button
|
||||
Gtkmm2ext::set_size_request_to_display_given_text (note_types, "thirty-second (32)", 7+FUDGE, 7);
|
||||
|
||||
hspacer1.set_border_width (5);
|
||||
hspacer1.pack_start (note_types, false, false);
|
||||
|
|
|
@ -26,6 +26,8 @@ class BasicUI {
|
|||
void undo ();
|
||||
void redo ();
|
||||
void toggle_all_rec_enables ();
|
||||
void toggle_punch_in ();
|
||||
void toggle_punch_out ();
|
||||
|
||||
protected:
|
||||
ARDOUR::Session& session;
|
||||
|
|
|
@ -184,6 +184,14 @@ BasicUI::toggle_all_rec_enables ()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
BasicUI::toggle_punch_in ()
|
||||
{
|
||||
session.set_punch_in (!session.get_punch_in());
|
||||
}
|
||||
|
||||
void
|
||||
BasicUI::toggle_punch_out ()
|
||||
{
|
||||
session.set_punch_out (!session.get_punch_out());
|
||||
}
|
||||
|
|
|
@ -3212,7 +3212,7 @@ void
|
|||
Session::set_dirty ()
|
||||
{
|
||||
bool was_dirty = dirty();
|
||||
|
||||
|
||||
_state_of_the_state = StateOfTheState (_state_of_the_state | Dirty);
|
||||
|
||||
if (!was_dirty) {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include <float.h>
|
||||
#include <sys/time.h>
|
||||
|
@ -47,6 +48,23 @@ BaseUI::RequestType LEDChange = BaseUI::new_request_type ();
|
|||
BaseUI::RequestType Print = BaseUI::new_request_type ();
|
||||
BaseUI::RequestType SetCurrentTrack = BaseUI::new_request_type ();
|
||||
|
||||
static inline double
|
||||
gain_to_slider_position (ARDOUR::gain_t g)
|
||||
{
|
||||
if (g == 0) return 0;
|
||||
return pow((6.0*log(g)/log(2.0)+192.0)/198.0, 8.0);
|
||||
|
||||
}
|
||||
|
||||
static inline ARDOUR::gain_t
|
||||
slider_position_to_gain (double pos)
|
||||
{
|
||||
/* XXX Marcus writes: this doesn't seem right to me. but i don't have a better answer ... */
|
||||
if (pos == 0.0) return 0;
|
||||
return pow (2.0,(sqrt(sqrt(sqrt(pos)))*198.0-192.0)/6.0);
|
||||
}
|
||||
|
||||
|
||||
TranzportControlProtocol::TranzportControlProtocol (Session& s)
|
||||
: ControlProtocol (s, X_("Tranzport")),
|
||||
AbstractUI<TranzportRequest> (X_("Tranzport"), false)
|
||||
|
@ -66,6 +84,7 @@ TranzportControlProtocol::TranzportControlProtocol (Session& s)
|
|||
last_wheel_dir = 1;
|
||||
last_track_gain = FLT_MAX;
|
||||
display_mode = DisplayNormal;
|
||||
gain_fraction = 0.0;
|
||||
|
||||
memset (current_screen, 0, sizeof (current_screen));
|
||||
memset (pending_screen, 0, sizeof (pending_screen));
|
||||
|
@ -102,11 +121,15 @@ TranzportControlProtocol::set_active (bool yn)
|
|||
}
|
||||
|
||||
} else {
|
||||
|
||||
cerr << "Begin tranzport shutdown\n";
|
||||
pthread_cancel_one (thread);
|
||||
lcd_clear ();
|
||||
cerr << "Thread dead\n";
|
||||
// lcd_clear ();
|
||||
// lights_off ();
|
||||
// cerr << "dev reset\n";
|
||||
close ();
|
||||
_active = false;
|
||||
cerr << "End tranzport shutdown\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +143,7 @@ TranzportControlProtocol::show_track_gain ()
|
|||
gain_t g = current_route->gain();
|
||||
if (g != last_track_gain) {
|
||||
char buf[16];
|
||||
snprintf (buf, sizeof (buf), "%6.1fdB", coefficient_to_dB (current_route->gain()));
|
||||
snprintf (buf, sizeof (buf), "%6.1fdB", coefficient_to_dB (current_route->effective_gain()));
|
||||
print (0, 9, buf);
|
||||
last_track_gain = g;
|
||||
}
|
||||
|
@ -411,7 +434,7 @@ TranzportControlProtocol::lcd_clear ()
|
|||
|
||||
for (uint8_t i = 0; i < 10; ++i) {
|
||||
cmd[2] = i;
|
||||
usb_interrupt_write (udev, WRITE_ENDPOINT, (char*) cmd, 8, 500);
|
||||
usb_interrupt_write (udev, WRITE_ENDPOINT, (char*) cmd, 8, 1000);
|
||||
}
|
||||
|
||||
memset (current_screen, ' ', sizeof (current_screen));
|
||||
|
@ -432,31 +455,31 @@ TranzportControlProtocol::lights_off ()
|
|||
cmd[7] = 0x00;
|
||||
|
||||
cmd[2] = LightRecord;
|
||||
if (write (cmd, 500) == 0) {
|
||||
if (write (cmd, 1000) == 0) {
|
||||
lights[LightRecord] = false;
|
||||
}
|
||||
cmd[2] = LightTrackrec;
|
||||
if (write (cmd, 500) == 0) {
|
||||
if (write (cmd, 1000) == 0) {
|
||||
lights[LightTrackrec] = false;
|
||||
}
|
||||
cmd[2] = LightTrackmute;
|
||||
if (write (cmd, 500) == 0) {
|
||||
if (write (cmd, 1000) == 0) {
|
||||
lights[LightTrackmute] = false;
|
||||
}
|
||||
cmd[2] = LightTracksolo;
|
||||
if (write (cmd, 500) == 0) {
|
||||
if (write (cmd, 1000) == 0) {
|
||||
lights[LightTracksolo] = false;
|
||||
}
|
||||
cmd[2] = LightAnysolo;
|
||||
if (write (cmd, 500) == 0) {
|
||||
if (write (cmd, 1000) == 0) {
|
||||
lights[LightAnysolo] = false;
|
||||
}
|
||||
cmd[2] = LightLoop;
|
||||
if (write (cmd, 500) == 0) {
|
||||
if (write (cmd, 1000) == 0) {
|
||||
lights[LightLoop] = false;
|
||||
}
|
||||
cmd[2] = LightPunch;
|
||||
if (write (cmd, 500) == 0) {
|
||||
if (write (cmd, 1000) == 0) {
|
||||
lights[LightPunch] = false;
|
||||
}
|
||||
}
|
||||
|
@ -477,7 +500,7 @@ TranzportControlProtocol::light_on (LightID light)
|
|||
cmd[6] = 0x00;
|
||||
cmd[7] = 0x00;
|
||||
|
||||
if (write (cmd, 500) == 0) {
|
||||
if (write (cmd, 1000) == 0) {
|
||||
lights[light] = true;
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -505,7 +528,7 @@ TranzportControlProtocol::light_off (LightID light)
|
|||
cmd[6] = 0x00;
|
||||
cmd[7] = 0x00;
|
||||
|
||||
if (write (cmd, 500) == 0) {
|
||||
if (write (cmd, 1000) == 0) {
|
||||
lights[light] = false;
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -524,6 +547,7 @@ TranzportControlProtocol::monitor_work ()
|
|||
int err;
|
||||
uint8_t buf[8];
|
||||
int val;
|
||||
bool first_time = true;
|
||||
|
||||
PBD::ThreadCreated (pthread_self(), X_("Tranzport"));
|
||||
|
||||
|
@ -538,26 +562,22 @@ TranzportControlProtocol::monitor_work ()
|
|||
pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, 0);
|
||||
pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, 0);
|
||||
|
||||
/* set initial state */
|
||||
|
||||
lcd_clear ();
|
||||
lights_off ();
|
||||
|
||||
show_wheel_mode();
|
||||
next_track ();
|
||||
show_transport_time ();
|
||||
|
||||
while (true) {
|
||||
|
||||
/* bInterval for this beastie is 10ms */
|
||||
|
||||
pthread_testcancel();
|
||||
usleep (20000);
|
||||
pthread_testcancel();
|
||||
|
||||
/* anything to read ? */
|
||||
|
||||
val = usb_interrupt_read (udev, READ_ENDPOINT, (char*) buf, 8, 0);
|
||||
if (_device_status == STATUS_OFFLINE) {
|
||||
light_off (LightRecord);
|
||||
first_time = true;
|
||||
}
|
||||
|
||||
pthread_testcancel();
|
||||
val = usb_interrupt_read (udev, READ_ENDPOINT, (char*) buf, 8, 10);
|
||||
pthread_testcancel();
|
||||
|
||||
/* any requests to handle? */
|
||||
|
||||
|
@ -567,9 +587,15 @@ TranzportControlProtocol::monitor_work ()
|
|||
process (buf);
|
||||
}
|
||||
|
||||
/* update whatever needs updating */
|
||||
|
||||
update_state ();
|
||||
if (_device_status != STATUS_OFFLINE) {
|
||||
if (first_time) {
|
||||
lcd_clear ();
|
||||
lights_off ();
|
||||
first_time = false;
|
||||
}
|
||||
/* update whatever needs updating */
|
||||
update_state ();
|
||||
}
|
||||
}
|
||||
|
||||
return (void*) 0;
|
||||
|
@ -620,7 +646,7 @@ TranzportControlProtocol::update_state ()
|
|||
cmd[6] = pending_screen[row][col_base+3];
|
||||
cmd[7] = 0x00;
|
||||
|
||||
if (usb_interrupt_write (udev, WRITE_ENDPOINT, (char *) cmd, 8, 500) == 8) {
|
||||
if (usb_interrupt_write (udev, WRITE_ENDPOINT, (char *) cmd, 8, 1000) == 8) {
|
||||
/* successful write: copy to current */
|
||||
memcpy (¤t_screen[row][col_base], &pending_screen[row][col_base], 4);
|
||||
}
|
||||
|
@ -1049,6 +1075,8 @@ void
|
|||
TranzportControlProtocol::button_event_in_press (bool shifted)
|
||||
{
|
||||
if (shifted) {
|
||||
toggle_punch_in ();
|
||||
} else {
|
||||
ControlProtocol::ZoomIn (); /* EMIT SIGNAL */
|
||||
}
|
||||
}
|
||||
|
@ -1062,6 +1090,8 @@ void
|
|||
TranzportControlProtocol::button_event_out_press (bool shifted)
|
||||
{
|
||||
if (shifted) {
|
||||
toggle_punch_out ();
|
||||
} else {
|
||||
ControlProtocol::ZoomOut (); /* EMIT SIGNAL */
|
||||
}
|
||||
}
|
||||
|
@ -1353,20 +1383,32 @@ void
|
|||
TranzportControlProtocol::step_gain_up ()
|
||||
{
|
||||
if (buttonmask & ButtonStop) {
|
||||
current_route->inc_gain (0.01, this);
|
||||
gain_fraction += 0.001;
|
||||
} else {
|
||||
current_route->inc_gain (0.1, this);
|
||||
gain_fraction += 0.01;
|
||||
}
|
||||
|
||||
if (gain_fraction > 2.0) {
|
||||
gain_fraction = 2.0;
|
||||
}
|
||||
|
||||
current_route->set_gain (slider_position_to_gain (gain_fraction), this);
|
||||
}
|
||||
|
||||
void
|
||||
TranzportControlProtocol::step_gain_down ()
|
||||
{
|
||||
if (buttonmask & ButtonStop) {
|
||||
current_route->inc_gain (-0.01, this);
|
||||
gain_fraction -= 0.001;
|
||||
} else {
|
||||
current_route->inc_gain (-0.1, this);
|
||||
gain_fraction -= 0.01;
|
||||
}
|
||||
|
||||
if (gain_fraction < 0.0) {
|
||||
gain_fraction = 0.0;
|
||||
}
|
||||
|
||||
current_route->set_gain (slider_position_to_gain (gain_fraction), this);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1444,6 +1486,7 @@ TranzportControlProtocol::next_track ()
|
|||
}
|
||||
|
||||
current_route = cr;
|
||||
gain_fraction = gain_to_slider_position (current_route->effective_gain());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1477,6 +1520,7 @@ TranzportControlProtocol::prev_track ()
|
|||
}
|
||||
|
||||
current_route = cr;
|
||||
gain_fraction = gain_to_slider_position (current_route->effective_gain());
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -100,11 +100,13 @@ class TranzportControlProtocol : public ARDOUR::ControlProtocol, public Abstract
|
|||
uint8_t _datawheel;
|
||||
uint8_t _device_status;
|
||||
usb_dev_handle* udev;
|
||||
|
||||
ARDOUR::Route* current_route;
|
||||
uint32_t current_track_id;
|
||||
WheelMode wheel_mode;
|
||||
WheelShiftMode wheel_shift_mode;
|
||||
DisplayMode display_mode;
|
||||
ARDOUR::gain_t gain_fraction;
|
||||
|
||||
void do_request (TranzportRequest*);
|
||||
|
||||
|
|
Loading…
Reference in New Issue