From 1693e57e0ee37c6cd74f2feadb3af6249ac6c29d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 30 Nov 2014 18:51:24 -0500 Subject: Move EventRingBuffer to libardour. This is not used anywhere in Evoral and is just a wrapper around the PBD RingBuffer anyway. Towards a (once again?) independently buildable/testable Evoral and fewer cross-dependencies. --- libs/ardour/MSVClibardour/ardour.vcproj | 4 + libs/ardour/ardour/async_midi_port.h | 4 +- libs/ardour/ardour/event_ring_buffer.h | 133 ++++++++++++++++++++++++++++++++ libs/ardour/ardour/midi_diskstream.h | 3 +- libs/ardour/ardour/midi_model.h | 1 - libs/ardour/ardour/midi_ring_buffer.h | 11 +-- libs/ardour/async_midi_port.cc | 4 - libs/ardour/midi_diskstream.cc | 1 + libs/ardour/midi_playlist.cc | 1 + libs/ardour/midi_source.cc | 2 + 10 files changed, 149 insertions(+), 15 deletions(-) create mode 100644 libs/ardour/ardour/event_ring_buffer.h (limited to 'libs/ardour') diff --git a/libs/ardour/MSVClibardour/ardour.vcproj b/libs/ardour/MSVClibardour/ardour.vcproj index 724d1b1c34..5965410763 100644 --- a/libs/ardour/MSVClibardour/ardour.vcproj +++ b/libs/ardour/MSVClibardour/ardour.vcproj @@ -1521,6 +1521,10 @@ RelativePath="..\ardour\element_importer.h" > + + diff --git a/libs/ardour/ardour/async_midi_port.h b/libs/ardour/ardour/async_midi_port.h index d822081bd3..7fab9e4186 100644 --- a/libs/ardour/ardour/async_midi_port.h +++ b/libs/ardour/ardour/async_midi_port.h @@ -30,13 +30,13 @@ #include "pbd/ringbuffer.h" #include "evoral/Event.hpp" -#include "evoral/EventRingBuffer.hpp" #include "midi++/types.h" #include "midi++/parser.h" #include "midi++/port.h" #include "ardour/libardour_visibility.h" +#include "ardour/event_ring_buffer.h" #include "ardour/midi_port.h" namespace ARDOUR { @@ -88,7 +88,7 @@ class LIBARDOUR_API AsyncMIDIPort : public ARDOUR::MidiPort, public MIDI::Port { bool have_timer; boost::function timer; RingBuffer< Evoral::Event > output_fifo; - Evoral::EventRingBuffer input_fifo; + EventRingBuffer input_fifo; Glib::Threads::Mutex output_fifo_lock; #ifndef PLATFORM_WINDOWS CrossThreadChannel xthread; diff --git a/libs/ardour/ardour/event_ring_buffer.h b/libs/ardour/ardour/event_ring_buffer.h new file mode 100644 index 0000000000..c7344c5ca7 --- /dev/null +++ b/libs/ardour/ardour/event_ring_buffer.h @@ -0,0 +1,133 @@ +/* + Copyright (C) 2006-2014 Paul Davis + Author: David Robillard + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __ardour_event_ring_buffer_h__ +#define __ardour_event_ring_buffer_h__ + +#include +#include + +#include "pbd/ringbufferNPT.h" + +#include "evoral/EventSink.hpp" +#include "evoral/types.hpp" + +namespace ARDOUR { + +/** A RingBuffer of events (generic time-stamped binary "blobs"). + * + * This packs a timestamp, size, and size bytes of data flat into the buffer. + * Useful for MIDI events, OSC messages, etc. + * + * Note: the uint8_t template argument to RingBufferNPT<> indicates "byte + * oriented data", not anything particular linked to MIDI or any other + * possible interpretation of uint8_t. + */ +template +class EventRingBuffer : public PBD::RingBufferNPT + , public Evoral::EventSink