diff options
Diffstat (limited to 'src/libs/engine')
-rw-r--r-- | src/libs/engine/AlsaMidiDriver.cpp | 7 | ||||
-rw-r--r-- | src/libs/engine/AlsaMidiDriver.h | 6 | ||||
-rw-r--r-- | src/libs/engine/Engine.cpp | 2 |
3 files changed, 10 insertions, 5 deletions
diff --git a/src/libs/engine/AlsaMidiDriver.cpp b/src/libs/engine/AlsaMidiDriver.cpp index 78d032be..3f6b060d 100644 --- a/src/libs/engine/AlsaMidiDriver.cpp +++ b/src/libs/engine/AlsaMidiDriver.cpp @@ -118,7 +118,7 @@ void AlsaMidiPort::event(snd_seq_event_t* const ev) { // Abuse the tick field to hold the timestamp - ev->time.tick = _driver->clock()->time_stamp(); + ev->time.tick = _driver->audio_driver()->frame_time(); // Fix noteons with velocity 0 (required for DSSI spec) if (ev->type == SND_SEQ_EVENT_NOTEON && ev->data.note.velocity == 0) @@ -187,8 +187,9 @@ AlsaMidiPort::prepare_block(const SampleCount block_start, const SampleCount blo bool AlsaMidiDriver::_midi_thread_exit_flag = true; -AlsaMidiDriver::AlsaMidiDriver() -: _seq_handle(NULL), +AlsaMidiDriver::AlsaMidiDriver(AudioDriver* audio_driver) +: _audio_driver(audio_driver), + _seq_handle(NULL), _event_coder(NULL), _is_activated(false) { diff --git a/src/libs/engine/AlsaMidiDriver.h b/src/libs/engine/AlsaMidiDriver.h index ad40ed17..bc5e6203 100644 --- a/src/libs/engine/AlsaMidiDriver.h +++ b/src/libs/engine/AlsaMidiDriver.h @@ -27,6 +27,7 @@ namespace Ingen { class Node; class SetPortValueEvent; class AlsaMidiDriver; +class AudioDriver; template <typename T> class DuplexPort; static const int MAX_MIDI_EVENT_SIZE = 3; @@ -76,7 +77,7 @@ private: class AlsaMidiDriver : public MidiDriver { public: - AlsaMidiDriver(); + AlsaMidiDriver(AudioDriver* audio_driver); ~AlsaMidiDriver(); void activate(); @@ -86,6 +87,8 @@ public: void prepare_block(const SampleCount block_start, const SampleCount block_end); + AudioDriver* audio_driver() { return _audio_driver; } + DriverPort* create_port(DuplexPort<MidiMessage>* patch_port) { return new AlsaMidiPort(this, patch_port); } @@ -113,6 +116,7 @@ private: // MIDI thread static void* process_midi_in(void* me); + AudioDriver* _audio_driver; snd_seq_t* _seq_handle; snd_midi_event_t* _event_coder; pthread_t _process_thread; diff --git a/src/libs/engine/Engine.cpp b/src/libs/engine/Engine.cpp index 94f964dc..5d064d49 100644 --- a/src/libs/engine/Engine.cpp +++ b/src/libs/engine/Engine.cpp @@ -54,7 +54,7 @@ Engine::Engine(AudioDriver* audio_driver) #ifdef HAVE_JACK_MIDI m_midi_driver(new JackMidiDriver(((JackAudioDriver*)m_audio_driver)->jack_client())), #elif HAVE_ALSA_MIDI - m_midi_driver(new AlsaMidiDriver()), + m_midi_driver(new AlsaMidiDriver(m_audio_driver)), #else m_midi_driver(new DummyMidiDriver()), #endif |