enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h
[ardour.git] / libs / evoral / src / Sequence.cpp
index e153cea9b4ab7c617096c94b2efce645470008ca..19a0fb140962990049444283f3d1e421666163a1 100644 (file)
@@ -31,6 +31,7 @@
 #include "pbd/compose.h"
 #include "pbd/error.h"
 
+#include "evoral/Beats.hpp"
 #include "evoral/Control.hpp"
 #include "evoral/ControlList.hpp"
 #include "evoral/ControlSet.hpp"
@@ -40,7 +41,7 @@
 #include "evoral/TypeMap.hpp"
 #include "evoral/midi_util.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace PBD;
@@ -284,18 +285,18 @@ Sequence<Time>::const_iterator::set_event()
        switch (_type) {
        case NOTE_ON:
                DEBUG_TRACE(DEBUG::Sequence, "iterator = note on\n");
-               *_event = (*_note_iter)->on_event();
+               _event->assign ((*_note_iter)->on_event());
                _active_notes.push(*_note_iter);
                break;
        case NOTE_OFF:
                DEBUG_TRACE(DEBUG::Sequence, "iterator = note off\n");
                assert(!_active_notes.empty());
-               *_event = _active_notes.top()->off_event();
+               _event->assign (_active_notes.top()->off_event());
                // We don't pop the active note until we increment past it
                break;
        case SYSEX:
                DEBUG_TRACE(DEBUG::Sequence, "iterator = sysex\n");
-               *_event = *(*_sysex_iter);
+               _event->assign (*(*_sysex_iter));
                break;
        case CONTROL:
                DEBUG_TRACE(DEBUG::Sequence, "iterator = control\n");
@@ -303,7 +304,7 @@ Sequence<Time>::const_iterator::set_event()
                break;
        case PATCH_CHANGE:
                DEBUG_TRACE(DEBUG::Sequence, "iterator = program change\n");
-               *_event = (*_patch_change_iter)->message (_active_patch_change_message);
+               _event->assign ((*_patch_change_iter)->message (_active_patch_change_message));
                break;
        default:
                _is_end = true;
@@ -534,6 +535,7 @@ Sequence<Time>::control_to_midi_event(
 
        uint8_t midi_type = _type_map.parameter_midi_type(iter.list->parameter());
        ev->set_event_type(_type_map.midi_event_type(midi_type));
+       ev->set_id(-1);
        switch (midi_type) {
        case MIDI_CMD_CONTROL:
                assert(iter.list.get());
@@ -722,7 +724,7 @@ Sequence<Time>::remove_note_unlocked(const constNotePtr note)
         */
 
        typename Sequence<Time>::Notes::iterator i;
-               
+
        for (i = note_lower_bound(note->time()); i != _notes.end() && (*i)->time() == note->time(); ++i) {
 
                if (*i == note) {
@@ -762,19 +764,19 @@ Sequence<Time>::remove_note_unlocked(const constNotePtr note)
                 * in this scenario, we have no choice other than to linear
                 * search the list of notes and find the note by ID.
                 */
-               
+
                for (i = _notes.begin(); i != _notes.end(); ++i) {
 
                        if ((*i)->id() == note->id()) {
-                               
+
                                DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1\tID-based pass, erasing note #%2 %3 @ %4\n", this, (*i)->id(), (int)(*i)->note(), (*i)->time()));
                                _notes.erase (i);
-                               
+
                                if (note->note() == _lowest_note || note->note() == _highest_note) {
-                                       
+
                                        _lowest_note = 127;
                                        _highest_note = 0;
-                                       
+
                                        for (typename Sequence<Time>::Notes::iterator ii = _notes.begin(); ii != _notes.end(); ++ii) {
                                                if ((*ii)->note() < _lowest_note)
                                                        _lowest_note = (*ii)->note();
@@ -782,18 +784,18 @@ Sequence<Time>::remove_note_unlocked(const constNotePtr note)
                                                        _highest_note = (*ii)->note();
                                        }
                                }
-                               
+
                                erased = true;
                                id_matched = true;
                                break;
                        }
                }
        }
-       
+
        if (erased) {
 
                Pitches& p (pitches (note->channel()));
-               
+
                typename Pitches::iterator j;
 
                /* if we had to ID-match above, we can't expect to find it in
@@ -817,11 +819,11 @@ Sequence<Time>::remove_note_unlocked(const constNotePtr note)
                         * notes by channel+time. We care only about its note number
                         * so the search_note has all other properties unset.
                         */
-                       
+
                        NotePtr search_note (new Note<Time>(0, Time(), Time(), note->note(), 0));
 
                        for (j = p.lower_bound (search_note); j != p.end() && (*j)->note() == note->note(); ++j) {
-                               
+
                                if ((*j) == note) {
                                        DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1\terasing pitch %2 @ %3\n", this, (int)(*j)->note(), (*j)->time()));
                                        p.erase (j);
@@ -835,7 +837,7 @@ Sequence<Time>::remove_note_unlocked(const constNotePtr note)
                }
 
                _edited = true;
-       
+
        } else {
                cerr << "Unable to find note to erase matching " << *note.get() << endmsg;
        }