Commit bdde2d11 authored by Stephane Letz's avatar Stephane Letz
Browse files

CoreMidi driver starting to work.

parent 950945cd
......@@ -68,8 +68,6 @@ JackMidiAsyncWaitQueue::DequeueEvent(jack_nframes_t frame)
jack_midi_event_t *
JackMidiAsyncWaitQueue::DequeueEvent(long usec)
{
printf("JackMidiAsyncWaitQueue::DequeueEvent 0 %d\n", semaphore);
return ((usec < 0) ? semaphore.Wait() : semaphore.TimedWait(usec)) ?
JackMidiAsyncQueue::DequeueEvent() : 0;
}
......
......@@ -478,6 +478,7 @@ int main(int argc, char* argv[])
}
if (!jackctl_server_add_slave(server_ctl, slave_driver_ctl)) {
fprintf(stderr, "Driver \"%s\" cannot be loaded\n", *it);
goto close_server;
}
}
......@@ -495,6 +496,7 @@ int main(int argc, char* argv[])
}
if (!jackctl_server_add_slave(server_ctl, loopback_driver_ctl)) {
fprintf(stderr, "Driver \"loopback\" cannot be loaded\n");
goto close_server;
}
}
......@@ -515,6 +517,7 @@ int main(int argc, char* argv[])
}
if (!jackctl_server_load_internal(server_ctl, internal_driver_ctl)) {
fprintf(stderr, "Internal client \"%s\" cannot be loaded\n", *it);
goto stop_server;
}
}
......
......@@ -147,6 +147,7 @@ JackCoreMidiInputPort::ProcessJack(JackMidiBuffer *port_buffer,
if (! jack_event) {
jack_event = thread_queue->DequeueEvent();
}
for (; jack_event; jack_event = thread_queue->DequeueEvent()) {
// Add 'frames' to MIDI events to align with audio.
switch (write_queue->EnqueueEvent(jack_event, frames)) {
......
......@@ -36,10 +36,10 @@ JackCoreMidiOutputPort::JackCoreMidiOutputPort(double time_ratio,
read_queue = new JackMidiBufferReadQueue();
std::auto_ptr<JackMidiBufferReadQueue> read_queue_ptr(read_queue);
thread_queue = new JackMidiAsyncQueue(max_bytes, max_messages);
std::auto_ptr<JackMidiAsyncWaitQueue> thread_queue_ptr(thread_queue);
std::auto_ptr<JackMidiAsyncQueue> thread_queue_ptr(thread_queue);
thread = new JackThread(this);
std::auto_ptr<JackThread> thread_ptr(thread);
sprintf(semaphore_name, "coremidi_thread_queue_semaphore_%p", this);
sprintf(semaphore_name, "coremidi_%p", this);
thread_queue_semaphore = sem_open(semaphore_name, O_CREAT, 0777, 0);
if (thread_queue_semaphore == (sem_t *) SEM_FAILED) {
throw std::runtime_error(strerror(errno));
......@@ -202,7 +202,7 @@ JackCoreMidiOutputPort::ProcessJack(JackMidiBuffer *port_buffer,
{
read_queue->ResetMidiBuffer(port_buffer);
for (jack_midi_event_t *event = read_queue->DequeueEvent(); event;
event = read_queue->DequeueEvent()) {
event = read_queue->DequeueEvent()) {
switch (thread_queue->EnqueueEvent(event, frames)) {
case JackMidiWriteQueue::BUFFER_FULL:
jack_error("JackCoreMidiOutputPort::ProcessJack - The thread "
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment