#include <boost/shared_ptr.hpp>
#include "ardour/audio_backend.h"
+#include "ardour/dsp_load_calculator.h"
#include "ardour/types.h"
#include "portaudio_io.h"
void* get_buffer (PortHandle, pframes_t);
- void* main_blocking_process_thread ();
+ void* blocking_process_thread ();
+
+ void* freewheel_process_thread ();
private: // Methods
bool start_blocking_process_thread ();
bool stop_blocking_process_thread ();
+ bool blocking_process_freewheel ();
+ bool blocking_process_main (const float* interleaved_input_data,
+ float* interleaved_output_data);
+
+ void process_port_connection_changes ();
+ void process_incoming_midi ();
+ void process_outgoing_midi ();
+
+ bool engine_halted ();
+ bool running ();
+
+ static int portaudio_callback(const void* input,
+ void* output,
+ unsigned long frameCount,
+ const PaStreamCallbackTimeInfo* timeInfo,
+ PaStreamCallbackFlags statusFlags,
+ void* userData);
+
+ bool process_callback(const float* input,
+ float* output,
+ uint32_t frame_count,
+ const PaStreamCallbackTimeInfo* timeInfo,
+ PaStreamCallbackFlags statusFlags);
+
+ bool start_freewheel_process_thread ();
+ bool stop_freewheel_process_thread ();
+
+ static bool set_mmcss_pro_audio (HANDLE* task_handle);
+ static bool reset_mmcss (HANDLE task_handle);
private:
std::string _instance_name;
bool _active; /* is running, process thread */
bool _freewheel;
bool _freewheeling;
+ bool _freewheel_ack;
+ bool _reinit_thread_callback;
bool _measure_latency;
- uint64_t m_cycle_count;
- uint64_t m_total_deviation_us;
- uint64_t m_max_deviation_us;
+ ARDOUR::DSPLoadCalculator _dsp_calc;
+
+ bool _freewheel_thread_active;
+
+ pthread_mutex_t _freewheel_mutex;
+ pthread_cond_t _freewheel_signal;
- CycleTimer m_cycle_timer;
- uint64_t m_last_cycle_start;
+ uint64_t _cycle_count;
+ uint64_t _total_deviation_us;
+ uint64_t _max_deviation_us;
+
+ CycleTimer _cycle_timer;
+ uint64_t _last_cycle_start;
static std::vector<std::string> _midi_options;
static std::vector<AudioBackend::DeviceStatus> _input_audio_device_status;
/* blocking thread */
pthread_t _main_blocking_thread;
+ /* main thread in callback mode(or fw thread when running) */
+ pthread_t _main_thread;
+
+ /* freewheel thread in callback mode */
+ pthread_t _pthread_freewheel;
+
/* process threads */
static void* portaudio_process_thread (void *);
std::vector<pthread_t> _threads;