/*
- Copyright (C) 2012 Paul Davis
+ Copyright (C) 2012 Paul Davis
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
#include "pbd/ringbuffer.h"
#include "pbd/event_loop.h"
-#include "ardour/visibility.h"
+#include "ardour/libardour_visibility.h"
#include "ardour/types.h"
namespace ARDOUR {
class Slave;
class Region;
-class SessionEvent {
+class LIBARDOUR_API SessionEvent {
public:
enum Type {
SetTransportSpeed,
Audition,
InputConfigurationChange,
SetPlayAudioRange,
+ CancelPlayAudioRange,
RealTimeOperation,
AdjustPlaybackBuffering,
AdjustCaptureBuffering,
SetTimecodeTransmission,
+ Skip,
/* only one of each of these events can be queued at any one time */
union {
void* ptr;
bool yes_or_no;
- framepos_t target2_frame;
+ framepos_t target2_frame;
Slave* slave;
Route* route;
};
union {
bool second_yes_or_no;
+ double control_value;
};
union {
bool third_yes_or_no;
};
- /* 4 members to handle a multi-group event handled in RT context */
+ /* 5 members to handle a multi-group event handled in RT context */
typedef boost::function<void (SessionEvent*)> RTeventCallback;
- boost::shared_ptr<RouteList> routes; /* apply to */
- boost::function<void (void)> rt_slot; /* what to call in RT context */
- RTeventCallback rt_return; /* called after rt_slot, with this event as an argument */
+ boost::shared_ptr<ControlList> controls; /* apply to */
+ boost::shared_ptr<RouteList> routes; /* apply to */
+ boost::function<void (void)> rt_slot; /* what to call in RT context */
+ RTeventCallback rt_return; /* called after rt_slot, with this event as an argument */
PBD::EventLoop* event_loop;
std::list<AudioRange> audio_range;
boost::shared_ptr<Region> region;
- SessionEvent (Type t, Action a, framepos_t when, framepos_t where, double spd, bool yn = false, bool yn2 = false, bool yn3 = false)
- : type (t)
- , action (a)
- , action_frame (when)
- , target_frame (where)
- , speed (spd)
- , yes_or_no (yn)
- , second_yes_or_no (yn2)
- , third_yes_or_no (yn3)
- , event_loop (0) {}
+ SessionEvent (Type t, Action a, framepos_t when, framepos_t where, double spd, bool yn = false, bool yn2 = false, bool yn3 = false);
void set_ptr (void* p) {
ptr = p;
void* operator new (size_t);
void operator delete (void *ptr, size_t /*size*/);
- static const framepos_t Immediate = 0;
+ static const framepos_t Immediate = -1;
+ static bool has_per_thread_pool ();
static void create_per_thread_pool (const std::string& n, uint32_t nitems);
static void init_event_pool ();
+ CrossThreadPool* event_pool() const { return own_pool; }
+
private:
static PerThreadPool* pool;
CrossThreadPool* own_pool;
virtual void queue_event (SessionEvent *ev) = 0;
void clear_events (SessionEvent::Type type);
+ void clear_events (SessionEvent::Type type, boost::function<void (void)> after);
protected:
RingBuffer<SessionEvent*> pending_events;