mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 08:14:58 +01:00
* renamed canvas-midi-event.* into canvas-note-event.*
* make MidiModel keep track of its CanvasProgramChange instances git-svn-id: svn://localhost/ardour2/branches/3.0@3297 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
d3cc2981b0
commit
38eb5f4539
11 changed files with 25 additions and 23 deletions
|
|
@ -132,7 +132,7 @@ automation_time_axis.cc
|
||||||
axis_view.cc
|
axis_view.cc
|
||||||
bundle_manager.cc
|
bundle_manager.cc
|
||||||
canvas-program-change.cc
|
canvas-program-change.cc
|
||||||
canvas-midi-event.cc
|
canvas-note-event.cc
|
||||||
canvas-note.cc
|
canvas-note.cc
|
||||||
canvas-simpleline.c
|
canvas-simpleline.c
|
||||||
canvas-simplerect.c
|
canvas-simplerect.c
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "canvas-midi-event.h"
|
#include "canvas-note-event.h"
|
||||||
#include "midi_region_view.h"
|
#include "midi_region_view.h"
|
||||||
#include "public_editor.h"
|
#include "public_editor.h"
|
||||||
#include "editing_syms.h"
|
#include "editing_syms.h"
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "simplerect.h"
|
#include "simplerect.h"
|
||||||
#include "canvas-midi-event.h"
|
#include "canvas-note-event.h"
|
||||||
#include "midi_util.h"
|
#include "midi_util.h"
|
||||||
|
|
||||||
namespace Gnome {
|
namespace Gnome {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
#include "canvas-program-change.h"
|
#include "canvas-program-change.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include "ardour_ui.h"
|
||||||
|
|
||||||
using namespace ArdourCanvas;
|
using namespace Gnome::Canvas;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
CanvasProgramChange::CanvasProgramChange(
|
CanvasProgramChange::CanvasProgramChange(
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,14 @@
|
||||||
#include <libgnomecanvasmm/group.h>
|
#include <libgnomecanvasmm/group.h>
|
||||||
#include "simplerect.h"
|
#include "simplerect.h"
|
||||||
#include "simpleline.h"
|
#include "simpleline.h"
|
||||||
#include "midi_region_view.h"
|
|
||||||
#include <libgnomecanvasmm/text.h>
|
#include <libgnomecanvasmm/text.h>
|
||||||
#include <libgnomecanvasmm/widget.h>
|
#include <libgnomecanvasmm/widget.h>
|
||||||
#include <ardour/midi_model.h>
|
#include <ardour/midi_model.h>
|
||||||
|
|
||||||
namespace Gnome
|
class MidiRegionView;
|
||||||
{
|
|
||||||
namespace Canvas
|
namespace Gnome {
|
||||||
{
|
namespace Canvas {
|
||||||
|
|
||||||
class CanvasProgramChange : public Group
|
class CanvasProgramChange : public Group
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#define __ardour_diamond_h__
|
#define __ardour_diamond_h__
|
||||||
|
|
||||||
#include <libgnomecanvasmm/polygon.h>
|
#include <libgnomecanvasmm/polygon.h>
|
||||||
#include "canvas-midi-event.h"
|
#include "canvas-note-event.h"
|
||||||
|
|
||||||
namespace Gnome {
|
namespace Gnome {
|
||||||
namespace Canvas {
|
namespace Canvas {
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
#include "control_point.h"
|
#include "control_point.h"
|
||||||
#include "canvas_impl.h"
|
#include "canvas_impl.h"
|
||||||
#include "simplerect.h"
|
#include "simplerect.h"
|
||||||
#include "canvas-midi-event.h"
|
#include "canvas-note-event.h"
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -431,6 +431,7 @@ MidiRegionView::clear_events()
|
||||||
delete *i;
|
delete *i;
|
||||||
|
|
||||||
_events.clear();
|
_events.clear();
|
||||||
|
_pgm_changes.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -476,14 +477,8 @@ MidiRegionView::redisplay_model()
|
||||||
}
|
}
|
||||||
|
|
||||||
MidiModel::PgmChanges& pgm_changes = _model->pgm_changes();
|
MidiModel::PgmChanges& pgm_changes = _model->pgm_changes();
|
||||||
/*
|
for_each(pgm_changes.begin(), pgm_changes.end(),
|
||||||
for (MidiModel::PgmChanges::const_iterator i = pgm_changes.begin();
|
sigc::mem_fun(this, &MidiRegionView::add_pgm_change));
|
||||||
i != pgm_changes.end();
|
|
||||||
++i) {
|
|
||||||
add_pgm_change()
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
for_each(pgm_changes.begin(), pgm_changes.end(), sigc::mem_fun(this, &MidiRegionView::add_pgm_change));
|
|
||||||
|
|
||||||
end_write();
|
end_write();
|
||||||
|
|
||||||
|
|
@ -820,8 +815,9 @@ MidiRegionView::add_pgm_change(boost::shared_ptr<MIDI::Event> event)
|
||||||
const double x = trackview.editor.frame_to_pixel((nframes_t)event->time() - _region->start());
|
const double x = trackview.editor.frame_to_pixel((nframes_t)event->time() - _region->start());
|
||||||
|
|
||||||
double height = midi_stream_view()->contents_height();
|
double height = midi_stream_view()->contents_height();
|
||||||
new CanvasProgramChange(*this, *group, event, height, x, 1.0);
|
_pgm_changes.push_back(
|
||||||
//TODO : keep track of pgm changes
|
boost::shared_ptr<CanvasProgramChange>(
|
||||||
|
new CanvasProgramChange(*this, *group, event, height, x, 1.0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
#include "enums.h"
|
#include "enums.h"
|
||||||
#include "canvas.h"
|
#include "canvas.h"
|
||||||
#include "canvas-note.h"
|
#include "canvas-note.h"
|
||||||
#include "canvas-midi-event.h"
|
#include "canvas-note-event.h"
|
||||||
#include "canvas-program-change.h"
|
#include "canvas-program-change.h"
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
|
|
@ -254,6 +254,7 @@ class MidiRegionView : public RegionView
|
||||||
|
|
||||||
boost::shared_ptr<ARDOUR::MidiModel> _model;
|
boost::shared_ptr<ARDOUR::MidiModel> _model;
|
||||||
std::vector<ArdourCanvas::CanvasNoteEvent*> _events;
|
std::vector<ArdourCanvas::CanvasNoteEvent*> _events;
|
||||||
|
std::vector< boost::shared_ptr<ArdourCanvas::CanvasProgramChange> > _pgm_changes;
|
||||||
ArdourCanvas::CanvasNote** _active_notes;
|
ArdourCanvas::CanvasNote** _active_notes;
|
||||||
ArdourCanvas::Group* _note_group;
|
ArdourCanvas::Group* _note_group;
|
||||||
ARDOUR::MidiModel::DeltaCommand* _delta_command;
|
ARDOUR::MidiModel::DeltaCommand* _delta_command;
|
||||||
|
|
|
||||||
|
|
@ -362,11 +362,13 @@ MidiModel::read(MidiRingBuffer& dst, nframes_t start, nframes_t nframes, nframes
|
||||||
assert(_read_iter->size() > 0);
|
assert(_read_iter->size() > 0);
|
||||||
dst.write(_read_iter->time() + stamp_offset - negative_stamp_offset, _read_iter->size(), _read_iter->buffer());
|
dst.write(_read_iter->time() + stamp_offset - negative_stamp_offset, _read_iter->size(), _read_iter->buffer());
|
||||||
|
|
||||||
|
/*
|
||||||
cerr << this << " MidiModel::read event @ " << _read_iter->time()
|
cerr << this << " MidiModel::read event @ " << _read_iter->time()
|
||||||
<< " type: " << hex << int(_read_iter->type()) << dec
|
<< " type: " << hex << int(_read_iter->type()) << dec
|
||||||
<< " note: " << int(_read_iter->note())
|
<< " note: " << int(_read_iter->note())
|
||||||
<< " velocity: " << int(_read_iter->velocity())
|
<< " velocity: " << int(_read_iter->velocity())
|
||||||
<< endl;
|
<< endl;
|
||||||
|
*/
|
||||||
|
|
||||||
++_read_iter;
|
++_read_iter;
|
||||||
++read_events;
|
++read_events;
|
||||||
|
|
@ -573,7 +575,7 @@ MidiModel::append_cc_unlocked(uint8_t chan, double time, uint8_t number, uint8_t
|
||||||
void
|
void
|
||||||
MidiModel::append_pgm_change_unlocked(uint8_t chan, double time, uint8_t number)
|
MidiModel::append_pgm_change_unlocked(uint8_t chan, double time, uint8_t number)
|
||||||
{
|
{
|
||||||
cerr << "MidiModel::append_pgm_change_unlocked: channel " << int(chan) << " time: " << time << " program number: " << int(number) <<endl;
|
//cerr << "MidiModel::append_pgm_change_unlocked: channel " << int(chan) << " time: " << time << " program number: " << int(number) <<endl;
|
||||||
assert(chan < 16);
|
assert(chan < 16);
|
||||||
assert(_writing);
|
assert(_writing);
|
||||||
_edited = true;
|
_edited = true;
|
||||||
|
|
@ -603,6 +605,9 @@ MidiModel::remove_note_unlocked(const boost::shared_ptr<const Note> note)
|
||||||
for(Notes::iterator n = _notes.begin(); n != _notes.end(); ++n) {
|
for(Notes::iterator n = _notes.begin(); n != _notes.end(); ++n) {
|
||||||
Note& _n = *(*n);
|
Note& _n = *(*n);
|
||||||
const Note& _note = *note;
|
const Note& _note = *note;
|
||||||
|
// TODO: There is still the issue, that after restarting ardour
|
||||||
|
// persisted undo does not work, because of rounding errors in the
|
||||||
|
// event times after saving/restoring to/from MIDI files
|
||||||
cerr << "======================================= " << endl;
|
cerr << "======================================= " << endl;
|
||||||
cerr << int(_n.note()) << "@" << int(_n.time()) << "[" << int(_n.channel()) << "] --" << int(_n.duration()) << "-- #" << int(_n.velocity()) << endl;
|
cerr << int(_n.note()) << "@" << int(_n.time()) << "[" << int(_n.channel()) << "] --" << int(_n.duration()) << "-- #" << int(_n.velocity()) << endl;
|
||||||
cerr << int(_note.note()) << "@" << int(_note.time()) << "[" << int(_note.channel()) << "] --" << int(_note.duration()) << "-- #" << int(_note.velocity()) << endl;
|
cerr << int(_note.note()) << "@" << int(_note.time()) << "[" << int(_note.channel()) << "] --" << int(_note.duration()) << "-- #" << int(_note.velocity()) << endl;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue