diff options
author | Devin Anderson <surfacepatterns (at) gmail (dot) com> | 2011-03-22 15:13:10 -0700 |
---|---|---|
committer | Devin Anderson <surfacepatterns (at) gmail (dot) com> | 2011-03-22 15:13:10 -0700 |
commit | 4ced89b41c7bb0d67d074439044e3fcd29e51d00 (patch) | |
tree | 9a48cc22c6aba4cce4389cd4155b85cc28fa64a3 /common/JackMidiAsyncQueue.cpp | |
parent | 6e92bd8020ecf88fc8ccb6c3bec8b7ef6727480c (diff) | |
download | jack2-4ced89b41c7bb0d67d074439044e3fcd29e51d00.tar.gz |
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.
Diffstat (limited to 'common/JackMidiAsyncQueue.cpp')
-rw-r--r-- | common/JackMidiAsyncQueue.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/common/JackMidiAsyncQueue.cpp b/common/JackMidiAsyncQueue.cpp index 85a93b18..0cfa42dc 100644 --- a/common/JackMidiAsyncQueue.cpp +++ b/common/JackMidiAsyncQueue.cpp @@ -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); +} |