/*
- Copyright (C) 2009 Paul Davis
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+ * Copyright (C) 2009-2015 David Robillard <d@drobilla.net>
+ * Copyright (C) 2009-2017 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2014-2016 Robin Gareus <robin@gareus.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
#include <cmath>
#include <map>
#include <gtkmm/cellrenderercombo.h>
#include "evoral/midi_util.h"
-#include "evoral/Note.hpp"
+#include "evoral/Note.h"
-#include "ardour/beats_frames_converter.h"
+#include "ardour/beats_samples_converter.h"
#include "ardour/midi_model.h"
#include "ardour/midi_region.h"
#include "ardour/midi_source.h"
#include "note_player.h"
#include "ui_config.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
using namespace std;
using namespace Gtk;
if (note->time() + fdelta >= 0) {
cmd->change (note, prop, note->time() + fdelta);
} else {
- cmd->change (note, prop, Evoral::Beats());
+ cmd->change (note, prop, Temporal::Beats());
}
break;
case MidiModel::NoteDiffCommand::Velocity:
break;
case MidiModel::NoteDiffCommand::Length:
if (note->length().to_double() + fdelta >=
- Evoral::Beats::tick().to_double()) {
+ Temporal::Beats::tick().to_double()) {
cmd->change (note, prop, note->length() + fdelta);
} else {
- cmd->change (note, prop, Evoral::Beats::tick());
+ cmd->change (note, prop, Temporal::Beats::tick());
}
break;
case MidiModel::NoteDiffCommand::Channel:
if (note->time() + fdelta >= 0) {
cmd->change (note, prop, note->time() + fdelta);
} else {
- cmd->change (note, prop, Evoral::Beats());
+ cmd->change (note, prop, Temporal::Beats());
}
break;
case MidiModel::NoteDiffCommand::Velocity:
break;
case MidiModel::NoteDiffCommand::Length:
if (note->length() + fdelta >=
- Evoral::Beats::tick().to_double()) {
+ Temporal::Beats::tick().to_double()) {
cmd->change (note, prop, note->length() + fdelta);
} else {
- cmd->change (note, prop, Evoral::Beats::tick());
+ cmd->change (note, prop, Temporal::Beats::tick());
}
break;
case MidiModel::NoteDiffCommand::Channel:
}
break;
case 3: // name
+ ival = ParameterDescriptor::midi_note_num (text);
+ if (ival < 128) {
+ idelta = ival - note->note();
+ prop = MidiModel::NoteDiffCommand::NoteNumber;
+ opname = _("change note number");
+ apply = true;
+ }
break;
case 4: // velocity
if (sscanf (text.c_str(), "%d", &ival) == 1 && ival != note->velocity()) {
if (_session) {
- BeatsFramesConverter conv (_session->tempo_map(), region->position());
+ BeatsSamplesConverter conv (_session->tempo_map(), region->position());
MidiModel::Notes notes = region->midi_source(0)->model()->notes();
TreeModel::Row row;
stringstream ss;
for (MidiModel::Notes::iterator i = notes.begin(); i != notes.end(); ++i) {
row = *(model->append());
row[columns.channel] = (*i)->channel() + 1;
- row[columns.note_name] = Evoral::midi_note_name ((*i)->note());
+ row[columns.note_name] = ParameterDescriptor::midi_note_name ((*i)->note());
row[columns.note] = (*i)->note();
row[columns.velocity] = (*i)->velocity();
- Timecode::BBT_Time bbt (_session->tempo_map().bbt_at_frame (conv.to ((*i)->time())));
+ Timecode::BBT_Time bbt (_session->tempo_map().bbt_at_sample (region->position() + conv.to ((*i)->time())));
ss.str ("");
ss << bbt;
row[columns.start] = ss.str();
bbt.bars = 0;
- const Evoral::Beats dur = (*i)->end_time() - (*i)->time();
+ const Temporal::Beats dur = (*i)->end_time() - (*i)->time();
bbt.beats = dur.get_beats ();
bbt.ticks = dur.get_ticks ();