Browse Source

Minor library change that I forgot to add to the last commit. Adds a method to asynchronous queues that checks to available write space in the queue.

tags/1.9.8
Devin Anderson 14 years ago
parent
commit
4ced89b41c
2 changed files with 14 additions and 0 deletions
  1. +7
    -0
      common/JackMidiAsyncQueue.cpp
  2. +7
    -0
      common/JackMidiAsyncQueue.h

+ 7
- 0
common/JackMidiAsyncQueue.cpp View File

@@ -94,3 +94,10 @@ JackMidiAsyncQueue::EnqueueEvent(jack_nframes_t time, size_t size,
jack_ringbuffer_write(info_ring, (const char *) (&size), sizeof(size_t));
return OK;
}

size_t
JackMidiAsyncQueue::GetAvailableSpace()
{
return jack_ringbuffer_write_space(info_ring) < INFO_SIZE ? 0 :
max_bytes - jack_ringbuffer_read_space(byte_ring);
}

+ 7
- 0
common/JackMidiAsyncQueue.h View File

@@ -84,6 +84,13 @@ namespace Jack {
EnqueueEvent(jack_nframes_t time, size_t size,
jack_midi_data_t *buffer);

/**
* Returns the maximum size event that can be enqueued right *now*.
*/

size_t
GetAvailableSpace();

};

}


Loading…
Cancel
Save