~ubuntu-branches/ubuntu/utopic/ardour3/utopic

« back to all changes in this revision

Viewing changes to libs/surfaces/mackie/surface.cc

  • Committer: Package Import Robot
  • Author(s): Adrian Knoth
  • Date: 2014-02-25 14:13:18 UTC
  • mfrom: (6.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20140225141318-y760kgxso78rduuf
Tags: 3.5.357~dfsg-1
* Imported Upstream version 3.5.357~dfsg
* Critical bugfix release. All users are recommended to upgrade.
* Details: https://community.ardour.org/node/8015

Show diffs side-by-side

added added

removed removed

Lines of Context:
369
369
                p->controller.connect_same_thread (*this, boost::bind (&Surface::handle_midi_controller_message, this, _1, _2));
370
370
                /* Button messages are NoteOn */
371
371
                p->note_on.connect_same_thread (*this, boost::bind (&Surface::handle_midi_note_on_message, this, _1, _2));
372
 
                /* Button messages are NoteOn. libmidi++ sends note-on w/velocity = 0 as note-off so catch them too */
 
372
                /* Button messages are NoteOn but libmidi++ sends note-on w/velocity = 0 as note-off so catch them too */
373
373
                p->note_off.connect_same_thread (*this, boost::bind (&Surface::handle_midi_note_on_message, this, _1, _2));
374
374
                /* Fader messages are Pitchbend */
375
375
                uint32_t i;
386
386
void
387
387
Surface::handle_midi_pitchbend_message (MIDI::Parser&, MIDI::pitchbend_t pb, uint32_t fader_id)
388
388
{
389
 
        /* Pitchbend messages are fader messages. Nothing in the data we get
 
389
        /* Pitchbend messages are fader position messages. Nothing in the data we get
390
390
         * from the MIDI::Parser conveys the fader ID, which was given by the
391
391
         * channel ID in the status byte.
392
392
         *
394
394
         * when we connected to the per-channel pitchbend events.
395
395
         */
396
396
 
397
 
 
398
397
        DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Surface::handle_midi_pitchbend_message on port %3, fader = %1 value = %2\n",
399
398
                                                           fader_id, pb, _number));
400
399
        
429
428
                turn_it_on ();
430
429
        }
431
430
 
 
431
        /* fader touch sense is given by "buttons" 0xe..0xe7 and 0xe8 for the
 
432
         * master. 
 
433
         */
 
434
 
 
435
        if (ev->note_number >= 0xE0 && ev->note_number <= 0xE8) {
 
436
                Fader* fader = faders[ev->note_number];
 
437
 
 
438
                DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Surface: fader touch message, fader = %1\n", fader));
 
439
 
 
440
                if (fader) {
 
441
 
 
442
                        Strip* strip = dynamic_cast<Strip*> (&fader->group());
 
443
 
 
444
                        if (ev->velocity > 64) {
 
445
                                strip->handle_fader_touch (*fader, true);
 
446
                        } else {
 
447
                                strip->handle_fader_touch (*fader, false);
 
448
                        }
 
449
                }
 
450
                return;
 
451
        }
 
452
 
432
453
        Button* button = buttons[ev->note_number];
433
454
 
434
455
        if (button) {
516
537
                   LCP: Connection Challenge 
517
538
                */
518
539
                if (bytes[4] == 0x10 || bytes[4] == 0x11) {
 
540
                        DEBUG_TRACE (DEBUG::MackieControl, "Logic Control Device connection challenge\n");
519
541
                        write_sysex (host_connection_query (bytes));
520
542
                } else {
 
543
                        DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Mackie Control Device ready, current status = %1\n", _active));
521
544
                        if (!_active) {
522
545
                                turn_it_on ();
523
546
                        }
525
548
                break;
526
549
 
527
550
        case 0x03: /* LCP Connection Confirmation */
 
551
                DEBUG_TRACE (DEBUG::MackieControl, "Logic Control Device confirms connection, ardour replies\n");
528
552
                if (bytes[4] == 0x10 || bytes[4] == 0x11) {
529
553
                        write_sysex (host_connection_confirmation (bytes));
530
554
                        _active = true;
532
556
                break;
533
557
 
534
558
        case 0x04: /* LCP: Confirmation Denied */
 
559
                DEBUG_TRACE (DEBUG::MackieControl, "Logic Control Device denies connection\n");
535
560
                _active = false;
536
561
                break;
537
562
        default:
610
635
 
611
636
        _active = true;
612
637
 
 
638
        _mcp.device_ready ();
 
639
 
613
640
        for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
614
641
                (*s)->notify_all ();
615
642
        }
739
766
        vector<boost::shared_ptr<Route> >::const_iterator r;
740
767
        Strips::iterator s = strips.begin();
741
768
 
 
769
        DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Mapping %1 routes", routes.size()));
 
770
 
742
771
        for (r = routes.begin(); r != routes.end() && s != strips.end(); ++s) {
743
772
 
744
773
                /* don't try to assign routes to a locked strip. it won't