summaryrefslogtreecommitdiff
path: root/common/JackMidiAsyncQueue.cpp
diff options
context:
space:
mode:
authorDevin Anderson <surfacepatterns (at) gmail (dot) com>2011-03-22 15:13:10 -0700
committerDevin Anderson <surfacepatterns (at) gmail (dot) com>2011-03-22 15:13:10 -0700
commit4ced89b41c7bb0d67d074439044e3fcd29e51d00 (patch)
tree9a48cc22c6aba4cce4389cd4155b85cc28fa64a3 /common/JackMidiAsyncQueue.cpp
parent6e92bd8020ecf88fc8ccb6c3bec8b7ef6727480c (diff)
downloadjack2-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.cpp7
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);
+}