Browse Source

CoreMidi driver starting to work.

tags/1.9.8
Stephane Letz 13 years ago
parent
commit
bdde2d110b
4 changed files with 7 additions and 5 deletions
  1. +0
    -2
      common/JackMidiAsyncWaitQueue.cpp
  2. +3
    -0
      common/Jackdmp.cpp
  3. +1
    -0
      macosx/coremidi/JackCoreMidiInputPort.cpp
  4. +3
    -3
      macosx/coremidi/JackCoreMidiOutputPort.cpp

+ 0
- 2
common/JackMidiAsyncWaitQueue.cpp View File

@@ -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;
}


+ 3
- 0
common/Jackdmp.cpp View File

@@ -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;
}
}



+ 1
- 0
macosx/coremidi/JackCoreMidiInputPort.cpp View File

@@ -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)) {


+ 3
- 3
macosx/coremidi/JackCoreMidiOutputPort.cpp View File

@@ -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 "


Loading…
Cancel
Save