13
0

* First prototype of SysEx GUI

git-svn-id: svn://localhost/ardour2/branches/3.0@4604 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Hans Baier 2009-02-16 09:51:40 +00:00
parent 64bf6f004a
commit 80e3845982
4 changed files with 58 additions and 10 deletions

View File

@ -14,8 +14,7 @@ CanvasSysEx<Time>::CanvasSysEx(
string& text,
double height,
double x,
double y,
boost::shared_ptr<Evoral::MIDIEvent<Time> > event
double y
)
: CanvasFlag(
region,
@ -61,4 +60,4 @@ CanvasSysEx<Time>::on_event(GdkEvent* ev)
return false;
}
template class CanvasSysEx<nframes_t>;
template class CanvasSysEx<double>;

View File

@ -19,9 +19,7 @@ public:
string& text,
double height,
double x,
double y,
boost::shared_ptr<Evoral::MIDIEvent<Time> > event
);
double y);
virtual ~CanvasSysEx();

View File

@ -20,6 +20,7 @@
#include <cmath>
#include <cassert>
#include <algorithm>
#include <ostream>
#include <gtkmm.h>
@ -474,6 +475,7 @@ MidiRegionView::clear_events()
_events.clear();
_pgm_changes.clear();
_sys_exes.clear();
}
@ -561,7 +563,9 @@ MidiRegionView::redisplay_model()
add_note(_model->note_at(i));
}
display_program_change_flags();
display_sysexes();
display_program_changes();
_model->read_unlock();
@ -571,7 +575,7 @@ MidiRegionView::redisplay_model()
}
void
MidiRegionView::display_program_change_flags()
MidiRegionView::display_program_changes()
{
boost::shared_ptr<Evoral::Control> control = _model->control(MidiPgmChangeAutomation);
if (!control) {
@ -621,6 +625,46 @@ MidiRegionView::display_program_change_flags()
}
}
void
MidiRegionView::display_sysexes()
{
for(MidiModel::SysExes::const_iterator i = _model->sysexes().begin(); i != _model->sysexes().end(); ++i) {
ARDOUR::MidiModel::TimeType time = (*i)->time();
assert(time >= 0);
ostringstream str;
str << hex;
for (uint32_t b = 0; b < (*i)->size(); ++b) {
str << int((*i)->buffer()[b]);
if (b != (*i)->size() -1) {
str << " ";
}
}
string text = str.str();
ArdourCanvas::Group* const group = (ArdourCanvas::Group*)get_canvas_group();
const double x = trackview.editor().frame_to_pixel(beats_to_frames(time));
double height = midi_stream_view()->contents_height();
boost::shared_ptr<CanvasSysEx<ARDOUR::MidiModel::TimeType> > sysex =
boost::shared_ptr<CanvasSysEx<ARDOUR::MidiModel::TimeType> >(
new CanvasSysEx<ARDOUR::MidiModel::TimeType>(*this, *group,
text,
height,
x, 1.0));
// Show unless program change is beyond the region bounds
if (time - _region->start() >= _region->length() || time < _region->start()) {
sysex->hide();
} else {
sysex->show();
}
_sys_exes.push_back(sysex);
}
}
MidiRegionView::~MidiRegionView ()
{

View File

@ -39,6 +39,7 @@
#include "canvas-note.h"
#include "canvas-note-event.h"
#include "canvas-program-change.h"
#include "canvas-sysex.h"
namespace ARDOUR {
class MidiRegion;
@ -141,9 +142,13 @@ class MidiRegionView : public RegionView
*/
void next_program(ArdourCanvas::CanvasProgramChange& program);
/** Displays all program changed events in the region as flags on the canvas.
/** Displays all program change events in the region as flags on the canvas.
*/
void display_program_change_flags();
void display_program_changes();
/** Displays all system exclusive events in the region as flags on the canvas.
*/
void display_sysexes();
void begin_write();
void end_write();
@ -308,10 +313,12 @@ class MidiRegionView : public RegionView
typedef std::vector<ArdourCanvas::CanvasNoteEvent*> Events;
typedef std::vector< boost::shared_ptr<ArdourCanvas::CanvasProgramChange> > PgmChanges;
typedef std::vector< boost::shared_ptr<ArdourCanvas::CanvasSysEx<ARDOUR::MidiModel::TimeType> > > SysExes;
boost::shared_ptr<ARDOUR::MidiModel> _model;
Events _events;
PgmChanges _pgm_changes;
SysExes _sys_exes;
ArdourCanvas::CanvasNote** _active_notes;
ArdourCanvas::Group* _note_group;
ARDOUR::MidiModel::DeltaCommand* _delta_command;