X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fbackends%2Fportaudio%2Fportaudio_backend.h;h=0433f120ee7b4623e1d4df1b01e83b2ac74545f3;hb=f1b336b01e28f499dcd73a1fd65236efe118eb7d;hp=15f32befc28dc25f91119cb0d77d3fb5d869fa11;hpb=a65b1ddedc28a4135057dd48782f4cfa5d1411ea;p=ardour.git diff --git a/libs/backends/portaudio/portaudio_backend.h b/libs/backends/portaudio/portaudio_backend.h index 15f32befc2..0433f120ee 100644 --- a/libs/backends/portaudio/portaudio_backend.h +++ b/libs/backends/portaudio/portaudio_backend.h @@ -30,12 +30,12 @@ #include #include "ardour/audio_backend.h" +#include "ardour/dsp_load_calculator.h" #include "ardour/types.h" #include "portaudio_io.h" #include "winmmemidi_io.h" #include "cycle_timer.h" -#include "dsp_load_calculator.h" namespace ARDOUR { @@ -320,13 +320,40 @@ class PortAudioBackend : public AudioBackend { void* main_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 (); + 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; @@ -337,9 +364,16 @@ class PortAudioBackend : public AudioBackend { bool _active; /* is running, process thread */ bool _freewheel; bool _freewheeling; + bool _freewheel_ack; + bool _reinit_thread_callback; bool _measure_latency; - DSPLoadCalculator m_dsp_calc; + ARDOUR::DSPLoadCalculator m_dsp_calc; + + bool m_freewheel_thread_active; + + pthread_mutex_t m_freewheel_mutex; + pthread_cond_t m_freewheel_signal; uint64_t m_cycle_count; uint64_t m_total_deviation_us; @@ -378,6 +412,12 @@ class PortAudioBackend : public AudioBackend { /* blocking thread */ pthread_t _main_blocking_thread; + /* main thread in callback mode(or fw thread when running) */ + pthread_t m_main_thread; + + /* freewheel thread in callback mode */ + pthread_t m_pthread_freewheel; + /* process threads */ static void* portaudio_process_thread (void *); std::vector _threads;