Namespace PBD::RingBuffer
class RingBuffer<> is a very generic name and should not pollute the global namespace.
This commit is contained in:
parent
ae0dcdc0c5
commit
7258c6334d
|
@ -84,7 +84,7 @@ class LIBARDOUR_API AsyncMIDIPort : public ARDOUR::MidiPort, public MIDI::Port {
|
|||
bool _flush_at_cycle_start;
|
||||
bool have_timer;
|
||||
boost::function<framecnt_t (void)> timer;
|
||||
RingBuffer< Evoral::Event<double> > output_fifo;
|
||||
PBD::RingBuffer< Evoral::Event<double> > output_fifo;
|
||||
EventRingBuffer<MIDI::timestamp_t> input_fifo;
|
||||
Glib::Threads::Mutex output_fifo_lock;
|
||||
CrossThreadChannel _xthread;
|
||||
|
|
|
@ -85,7 +85,7 @@ class LIBARDOUR_API Butler : public SessionHandleRef
|
|||
framecnt_t audio_dstream_capture_buffer_size;
|
||||
framecnt_t audio_dstream_playback_buffer_size;
|
||||
uint32_t midi_dstream_buffer_size;
|
||||
RingBuffer<CrossThreadPool*> pool_trash;
|
||||
PBD::RingBuffer<CrossThreadPool*> pool_trash;
|
||||
|
||||
private:
|
||||
void empty_pool_trash ();
|
||||
|
|
|
@ -264,15 +264,15 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
|
|||
uint32_t size,
|
||||
const uint8_t* body);
|
||||
|
||||
bool write_to(RingBuffer<uint8_t>* dest,
|
||||
bool write_to(PBD::RingBuffer<uint8_t>* dest,
|
||||
uint32_t index,
|
||||
uint32_t protocol,
|
||||
uint32_t size,
|
||||
const uint8_t* body);
|
||||
|
||||
// Created on demand so the space is only consumed if necessary
|
||||
RingBuffer<uint8_t>* _to_ui;
|
||||
RingBuffer<uint8_t>* _from_ui;
|
||||
PBD::RingBuffer<uint8_t>* _to_ui;
|
||||
PBD::RingBuffer<uint8_t>* _from_ui;
|
||||
|
||||
Glib::Threads::Mutex _work_mutex;
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ class LIBARDOUR_API PortManager
|
|||
void remove_all_ports ();
|
||||
void clear_pending_port_deletions ();
|
||||
virtual void add_pending_port_deletion (Port*) = 0;
|
||||
RingBuffer<Port*>& port_deletions_pending () { return _port_deletions_pending; }
|
||||
PBD::RingBuffer<Port*>& port_deletions_pending () { return _port_deletions_pending; }
|
||||
|
||||
/* per-Port monitoring */
|
||||
|
||||
|
@ -172,7 +172,7 @@ class LIBARDOUR_API PortManager
|
|||
boost::shared_ptr<AudioBackend> _backend;
|
||||
SerializedRCUManager<Ports> ports;
|
||||
bool _port_remove_in_progress;
|
||||
RingBuffer<Port*> _port_deletions_pending;
|
||||
PBD::RingBuffer<Port*> _port_deletions_pending;
|
||||
|
||||
boost::shared_ptr<Port> register_port (DataType type, const std::string& portname, bool input, bool async = false, PortFlags extra_flags = PortFlags (0));
|
||||
void port_registration_failure (const std::string& portname);
|
||||
|
|
|
@ -161,7 +161,7 @@ public:
|
|||
void clear_events (SessionEvent::Type type, boost::function<void (void)> after);
|
||||
|
||||
protected:
|
||||
RingBuffer<SessionEvent*> pending_events;
|
||||
PBD::RingBuffer<SessionEvent*> pending_events;
|
||||
typedef std::list<SessionEvent *> Events;
|
||||
Events events;
|
||||
Events immediate_events;
|
||||
|
|
|
@ -102,11 +102,11 @@ private:
|
|||
@param rb the ringbuffer to check
|
||||
@return true if the message is complete, false otherwise
|
||||
*/
|
||||
bool verify_message_completeness(RingBuffer<uint8_t>* rb);
|
||||
bool verify_message_completeness(PBD::RingBuffer<uint8_t>* rb);
|
||||
|
||||
Workee* _workee;
|
||||
RingBuffer<uint8_t>* _requests;
|
||||
RingBuffer<uint8_t>* _responses;
|
||||
PBD::RingBuffer<uint8_t>* _requests;
|
||||
PBD::RingBuffer<uint8_t>* _responses;
|
||||
uint8_t* _response;
|
||||
PBD::Semaphore _sem;
|
||||
Glib::Threads::Thread* _thread;
|
||||
|
|
|
@ -30,8 +30,8 @@ namespace ARDOUR {
|
|||
|
||||
Worker::Worker(Workee* workee, uint32_t ring_size, bool threaded)
|
||||
: _workee(workee)
|
||||
, _requests(threaded ? new RingBuffer<uint8_t>(ring_size) : NULL)
|
||||
, _responses(new RingBuffer<uint8_t>(ring_size))
|
||||
, _requests(threaded ? new PBD::RingBuffer<uint8_t>(ring_size) : NULL)
|
||||
, _responses(new PBD::RingBuffer<uint8_t>(ring_size))
|
||||
, _response((uint8_t*)malloc(ring_size))
|
||||
, _sem(string_compose ("worker_semaphore%1", this).c_str(), 0)
|
||||
, _thread(NULL)
|
||||
|
@ -92,11 +92,11 @@ Worker::respond(uint32_t size, const void* data)
|
|||
}
|
||||
|
||||
bool
|
||||
Worker::verify_message_completeness(RingBuffer<uint8_t>* rb)
|
||||
Worker::verify_message_completeness(PBD::RingBuffer<uint8_t>* rb)
|
||||
{
|
||||
uint32_t read_space = rb->read_space();
|
||||
uint32_t size;
|
||||
RingBuffer<uint8_t>::rw_vector vec;
|
||||
PBD::RingBuffer<uint8_t>::rw_vector vec;
|
||||
rb->get_read_vector (&vec);
|
||||
if (vec.len[0] + vec.len[1] < sizeof(size)) {
|
||||
return false;
|
||||
|
|
|
@ -124,7 +124,7 @@ class TmpFileRt
|
|||
|
||||
bool _capture;
|
||||
framecnt_t _chunksize;
|
||||
RingBuffer<T> _rb;
|
||||
PBD::RingBuffer<T> _rb;
|
||||
|
||||
pthread_mutex_t _disk_thread_lock;
|
||||
pthread_cond_t _data_ready;
|
||||
|
|
|
@ -50,7 +50,7 @@ AlsaMidiIO::AlsaMidiIO ()
|
|||
// worst case here is 8192 SPP and 8KSPS for which we'd need
|
||||
// 4000 bytes sans MidiEventHeader.
|
||||
// since we're not always in sync, let's use 4096.
|
||||
_rb = new RingBuffer<uint8_t>(4096 + 4096 * sizeof(MidiEventHeader));
|
||||
_rb = new PBD::RingBuffer<uint8_t>(4096 + 4096 * sizeof(MidiEventHeader));
|
||||
}
|
||||
|
||||
AlsaMidiIO::~AlsaMidiIO ()
|
||||
|
@ -178,7 +178,7 @@ AlsaMidiIn::recv_event (pframes_t &time, uint8_t *data, size_t &size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
RingBuffer<uint8_t>::rw_vector vector;
|
||||
PBD::RingBuffer<uint8_t>::rw_vector vector;
|
||||
_rb->get_read_vector(&vector);
|
||||
if (vector.len[0] >= sizeof(MidiEventHeader)) {
|
||||
memcpy((uint8_t*)&h, vector.buf[0], sizeof(MidiEventHeader));
|
||||
|
|
|
@ -72,7 +72,7 @@ protected:
|
|||
, size(s) {}
|
||||
};
|
||||
|
||||
RingBuffer<uint8_t>* _rb;
|
||||
PBD::RingBuffer<uint8_t>* _rb;
|
||||
|
||||
std::string _name;
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ static void midiInputCallback(const MIDIPacketList *list, void *procRef, void *s
|
|||
#endif
|
||||
return;
|
||||
}
|
||||
RingBuffer<uint8_t> * rb = static_cast<RingBuffer < uint8_t > *> (srcRef);
|
||||
PBD::RingBuffer<uint8_t> * rb = static_cast<PBD::RingBuffer < uint8_t > *> (srcRef);
|
||||
if (!rb) {
|
||||
#ifndef NDEBUG
|
||||
if (_debug_mode & 4) {
|
||||
|
@ -450,7 +450,7 @@ CoreMidiIo::discover()
|
|||
_input_ports = (MIDIPortRef *) malloc (srcCount * sizeof(MIDIPortRef));
|
||||
_input_endpoints = (MIDIEndpointRef*) malloc (srcCount * sizeof(MIDIEndpointRef));
|
||||
_input_queue = (CoreMIDIQueue*) calloc (srcCount, sizeof(CoreMIDIQueue));
|
||||
_rb = (RingBuffer<uint8_t> **) malloc (srcCount * sizeof(RingBuffer<uint8_t>*));
|
||||
_rb = (PBD::RingBuffer<uint8_t> **) malloc (srcCount * sizeof(PBD::RingBuffer<uint8_t>*));
|
||||
}
|
||||
if (dstCount > 0) {
|
||||
_output_ports = (MIDIPortRef *) malloc (dstCount * sizeof(MIDIPortRef));
|
||||
|
@ -473,7 +473,7 @@ CoreMidiIo::discover()
|
|||
fprintf(stderr, "Cannot create Midi Output\n");
|
||||
continue;
|
||||
}
|
||||
_rb[_n_midi_in] = new RingBuffer<uint8_t>(32768);
|
||||
_rb[_n_midi_in] = new PBD::RingBuffer<uint8_t>(32768);
|
||||
_input_queue[_n_midi_in] = CoreMIDIQueue();
|
||||
MIDIPortConnectSource(_input_ports[_n_midi_in], src, (void*) _rb[_n_midi_in]);
|
||||
CFRelease(port_name);
|
||||
|
|
|
@ -104,7 +104,7 @@ private:
|
|||
MIDIPortRef * _output_ports;
|
||||
CoreMIDIQueue * _input_queue;
|
||||
|
||||
RingBuffer<uint8_t> ** _rb;
|
||||
PBD::RingBuffer<uint8_t> ** _rb;
|
||||
|
||||
uint32_t _n_midi_in;
|
||||
uint32_t _n_midi_out;
|
||||
|
|
|
@ -1839,7 +1839,7 @@ DummyAudioPort::setup_generator (GeneratorType const g, float const samplerate,
|
|||
tc.frame = 0;
|
||||
ltc_encoder_set_timecode (_ltc, &tc);
|
||||
name += string_compose ("@%1h", (int)tc.hours);
|
||||
_ltcbuf = new RingBuffer<Sample> (std::max (DummyAudioBackend::max_buffer_size() * 2.f, samplerate));
|
||||
_ltcbuf = new PBD::RingBuffer<Sample> (std::max (DummyAudioBackend::max_buffer_size() * 2.f, samplerate));
|
||||
break;
|
||||
case Loopback:
|
||||
_wavetable = (Sample*) malloc (DummyAudioBackend::max_buffer_size() * sizeof(Sample));
|
||||
|
|
|
@ -200,7 +200,7 @@ class DummyAudioPort : public DummyPort {
|
|||
float _rn1;
|
||||
// LTC generator
|
||||
LTCEncoder* _ltc;
|
||||
RingBuffer<Sample>* _ltcbuf;
|
||||
PBD::RingBuffer<Sample>* _ltcbuf;
|
||||
float _ltc_spd;
|
||||
float _ltc_rand;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace ARDOUR {
|
|||
WinMMEMidiInputDevice::WinMMEMidiInputDevice (int index)
|
||||
: m_handle(0)
|
||||
, m_started(false)
|
||||
, m_midi_buffer(new RingBuffer<uint8_t>(MIDI_BUFFER_SIZE))
|
||||
, m_midi_buffer(new PBD::RingBuffer<uint8_t>(MIDI_BUFFER_SIZE))
|
||||
, m_sysex_buffer(new uint8_t[SYSEX_BUFFER_SIZE])
|
||||
{
|
||||
DEBUG_MIDI (string_compose ("Creating midi input device index: %1\n", index));
|
||||
|
@ -315,7 +315,7 @@ WinMMEMidiInputDevice::dequeue_midi_event (uint64_t timestamp_start,
|
|||
return false;
|
||||
}
|
||||
|
||||
RingBuffer<uint8_t>::rw_vector vector;
|
||||
PBD::RingBuffer<uint8_t>::rw_vector vector;
|
||||
m_midi_buffer->get_read_vector (&vector);
|
||||
if (vector.len[0] >= sizeof(MidiEventHeader)) {
|
||||
memcpy ((uint8_t*)&h, vector.buf[0], sizeof(MidiEventHeader));
|
||||
|
|
|
@ -95,7 +95,7 @@ private: // data
|
|||
std::string m_name;
|
||||
|
||||
// can't use unique_ptr yet
|
||||
boost::scoped_ptr<RingBuffer<uint8_t> > m_midi_buffer;
|
||||
boost::scoped_ptr<PBD::RingBuffer<uint8_t> > m_midi_buffer;
|
||||
boost::scoped_array<uint8_t> m_sysex_buffer;
|
||||
};
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ WinMMEMidiOutputDevice::WinMMEMidiOutputDevice (int index)
|
|||
, m_enabled(false)
|
||||
, m_thread_running(false)
|
||||
, m_thread_quit(false)
|
||||
, m_midi_buffer(new RingBuffer<uint8_t>(MIDI_BUFFER_SIZE))
|
||||
, m_midi_buffer(new PBD::RingBuffer<uint8_t>(MIDI_BUFFER_SIZE))
|
||||
{
|
||||
DEBUG_MIDI (string_compose ("Creating midi output device index: %1\n", index));
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ private: // Data
|
|||
bool m_thread_running;
|
||||
bool m_thread_quit;
|
||||
|
||||
boost::scoped_ptr<RingBuffer<uint8_t> > m_midi_buffer;
|
||||
boost::scoped_ptr<PBD::RingBuffer<uint8_t> > m_midi_buffer;
|
||||
};
|
||||
|
||||
} // namespace ARDOUR
|
||||
|
|
|
@ -46,7 +46,7 @@ class LIBPBD_API Pool
|
|||
guint total() const { return free_list.bufsize(); }
|
||||
|
||||
protected:
|
||||
RingBuffer<void*> free_list; ///< a list of pointers to free items within block
|
||||
PBD::RingBuffer<void*> free_list; ///< a list of pointers to free items within block
|
||||
std::string _name;
|
||||
|
||||
private:
|
||||
|
@ -116,7 +116,7 @@ class LIBPBD_API CrossThreadPool : public Pool
|
|||
void flush_pending_with_ev (void*);
|
||||
|
||||
private:
|
||||
RingBuffer<void*> pending;
|
||||
PBD::RingBuffer<void*> pending;
|
||||
PerThreadPool* _parent;
|
||||
};
|
||||
|
||||
|
@ -133,7 +133,7 @@ class LIBPBD_API PerThreadPool
|
|||
void create_per_thread_pool (std::string name, unsigned long item_size, unsigned long nitems);
|
||||
CrossThreadPool* per_thread_pool (bool must_exist = true);
|
||||
bool has_per_thread_pool ();
|
||||
void set_trash (RingBuffer<CrossThreadPool*>* t);
|
||||
void set_trash (PBD::RingBuffer<CrossThreadPool*>* t);
|
||||
void add_to_trash (CrossThreadPool *);
|
||||
|
||||
private:
|
||||
|
@ -142,7 +142,7 @@ class LIBPBD_API PerThreadPool
|
|||
|
||||
/** mutex to protect either changes to the _trash variable, or writes to the RingBuffer */
|
||||
Glib::Threads::Mutex _trash_mutex;
|
||||
RingBuffer<CrossThreadPool*>* _trash;
|
||||
PBD::RingBuffer<CrossThreadPool*>* _trash;
|
||||
};
|
||||
|
||||
#endif // __qm_pool_h__
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#include "pbd/libpbd_visibility.h"
|
||||
|
||||
namespace PBD {
|
||||
|
||||
template<class T>
|
||||
class /*LIBPBD_API*/ RingBuffer
|
||||
{
|
||||
|
@ -279,5 +281,6 @@ RingBuffer<T>::get_write_vector (typename RingBuffer<T>::rw_vector *vec)
|
|||
}
|
||||
}
|
||||
|
||||
} /* end namespace */
|
||||
|
||||
#endif /* __ringbuffer_h__ */
|
||||
|
|
Loading…
Reference in New Issue
Block a user