mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-15 11:06:32 +01:00
Make SMFSource suck significantly less.
Read from MidiRingbuffer directly into model, don't read MidiRingBuffer into a new midi buffer, then into the model. Pass rec data to UI via model instead of a separate buffer. Read MIDI CC data into MidiModel (though not actually used yet). Made quantization toggle edited flag so model is saved. git-svn-id: svn://localhost/ardour2/trunk@2308 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
356f9ba80a
commit
f9a7388d7a
15 changed files with 295 additions and 166 deletions
|
|
@ -50,7 +50,6 @@ MidiSource::MidiSource (Session& s, string name)
|
|||
: Source (s, name, DataType::MIDI)
|
||||
, _timeline_position(0)
|
||||
, _model(new MidiModel(s))
|
||||
, _model_loaded (false)
|
||||
, _writing (false)
|
||||
{
|
||||
_read_data_count = 0;
|
||||
|
|
@ -61,7 +60,6 @@ MidiSource::MidiSource (Session& s, const XMLNode& node)
|
|||
: Source (s, node)
|
||||
, _timeline_position(0)
|
||||
, _model(new MidiModel(s))
|
||||
, _model_loaded (false)
|
||||
, _writing (false)
|
||||
{
|
||||
_read_data_count = 0;
|
||||
|
|
@ -106,7 +104,7 @@ nframes_t
|
|||
MidiSource::read (MidiRingBuffer& dst, nframes_t start, nframes_t cnt, nframes_t stamp_offset) const
|
||||
{
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
if (_model_loaded && _model) {
|
||||
if (_model) {
|
||||
/*const size_t n_events = */_model->read(dst, start, cnt, stamp_offset);
|
||||
//cout << "Read " << n_events << " events from model." << endl;
|
||||
return cnt;
|
||||
|
|
@ -164,9 +162,10 @@ MidiSource::mark_streaming_write_completed ()
|
|||
void
|
||||
MidiSource::session_saved()
|
||||
{
|
||||
flush();
|
||||
flush_header();
|
||||
flush_footer();
|
||||
|
||||
if (_model && _model_loaded && _model->edited()) {
|
||||
if (_model && _model->edited()) {
|
||||
string newname;
|
||||
const string basename = PBD::basename_nosuffix(_name);
|
||||
string::size_type last_dash = basename.find_last_of("-");
|
||||
|
|
@ -193,9 +192,9 @@ MidiSource::session_saved()
|
|||
|
||||
newsrc->set_model(_model);
|
||||
_model.reset();
|
||||
_model_loaded = false;
|
||||
|
||||
newsrc->flush();
|
||||
newsrc->flush_header();
|
||||
newsrc->flush_footer();
|
||||
|
||||
Switched.emit(newsrc);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue