* 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:
parent
64bf6f004a
commit
80e3845982
@ -14,8 +14,7 @@ CanvasSysEx<Time>::CanvasSysEx(
|
|||||||
string& text,
|
string& text,
|
||||||
double height,
|
double height,
|
||||||
double x,
|
double x,
|
||||||
double y,
|
double y
|
||||||
boost::shared_ptr<Evoral::MIDIEvent<Time> > event
|
|
||||||
)
|
)
|
||||||
: CanvasFlag(
|
: CanvasFlag(
|
||||||
region,
|
region,
|
||||||
@ -61,4 +60,4 @@ CanvasSysEx<Time>::on_event(GdkEvent* ev)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
template class CanvasSysEx<nframes_t>;
|
template class CanvasSysEx<double>;
|
||||||
|
@ -19,9 +19,7 @@ public:
|
|||||||
string& text,
|
string& text,
|
||||||
double height,
|
double height,
|
||||||
double x,
|
double x,
|
||||||
double y,
|
double y);
|
||||||
boost::shared_ptr<Evoral::MIDIEvent<Time> > event
|
|
||||||
);
|
|
||||||
|
|
||||||
virtual ~CanvasSysEx();
|
virtual ~CanvasSysEx();
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <ostream>
|
||||||
|
|
||||||
#include <gtkmm.h>
|
#include <gtkmm.h>
|
||||||
|
|
||||||
@ -474,6 +475,7 @@ MidiRegionView::clear_events()
|
|||||||
|
|
||||||
_events.clear();
|
_events.clear();
|
||||||
_pgm_changes.clear();
|
_pgm_changes.clear();
|
||||||
|
_sys_exes.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -561,7 +563,9 @@ MidiRegionView::redisplay_model()
|
|||||||
add_note(_model->note_at(i));
|
add_note(_model->note_at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
display_program_change_flags();
|
display_sysexes();
|
||||||
|
|
||||||
|
display_program_changes();
|
||||||
|
|
||||||
_model->read_unlock();
|
_model->read_unlock();
|
||||||
|
|
||||||
@ -571,7 +575,7 @@ MidiRegionView::redisplay_model()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MidiRegionView::display_program_change_flags()
|
MidiRegionView::display_program_changes()
|
||||||
{
|
{
|
||||||
boost::shared_ptr<Evoral::Control> control = _model->control(MidiPgmChangeAutomation);
|
boost::shared_ptr<Evoral::Control> control = _model->control(MidiPgmChangeAutomation);
|
||||||
if (!control) {
|
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 ()
|
MidiRegionView::~MidiRegionView ()
|
||||||
{
|
{
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "canvas-note.h"
|
#include "canvas-note.h"
|
||||||
#include "canvas-note-event.h"
|
#include "canvas-note-event.h"
|
||||||
#include "canvas-program-change.h"
|
#include "canvas-program-change.h"
|
||||||
|
#include "canvas-sysex.h"
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
class MidiRegion;
|
class MidiRegion;
|
||||||
@ -141,9 +142,13 @@ class MidiRegionView : public RegionView
|
|||||||
*/
|
*/
|
||||||
void next_program(ArdourCanvas::CanvasProgramChange& program);
|
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 begin_write();
|
||||||
void end_write();
|
void end_write();
|
||||||
@ -308,10 +313,12 @@ class MidiRegionView : public RegionView
|
|||||||
|
|
||||||
typedef std::vector<ArdourCanvas::CanvasNoteEvent*> Events;
|
typedef std::vector<ArdourCanvas::CanvasNoteEvent*> Events;
|
||||||
typedef std::vector< boost::shared_ptr<ArdourCanvas::CanvasProgramChange> > PgmChanges;
|
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;
|
boost::shared_ptr<ARDOUR::MidiModel> _model;
|
||||||
Events _events;
|
Events _events;
|
||||||
PgmChanges _pgm_changes;
|
PgmChanges _pgm_changes;
|
||||||
|
SysExes _sys_exes;
|
||||||
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user