void latency_callback (bool for_playback);
void halted_callback (const char* reason);
+ /* checks if current thread is properly set up for audio processing */
+ static bool thread_initialised_for_audio_processing ();
+
/* sets up the process callback thread */
static void thread_init_callback (void *);
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 ();
return _backend->set_systemic_output_latency (ol);
}
+bool
+AudioEngine::thread_initialised_for_audio_processing ()
+{
+ return SessionEvent::has_per_thread_pool () && AsyncMIDIPort::is_process_thread();
+}
+
/* END OF BACKEND PROXY API */
void
pool = new PerThreadPool;
}
+bool
+SessionEvent::has_per_thread_pool ()
+{
+ return pool->has_per_thread_pool ();
+}
+
void
SessionEvent::create_per_thread_pool (const std::string& name, uint32_t nitems)
{
AudioEngine::thread_init_callback (this);
}
+ if ( !engine.thread_initialised_for_audio_processing () ) {
+ std::cerr << "\tWavesAudioBackend::_audio_device_callback (): It's an attempt to call process callback from the thread which didn't initialize it " << std::endl;
+
+ if (process_id != pthread_self() ) {
+ std::cerr << "Process thread ID has changed. Expected thread: " << process_id << " current thread: " << pthread_self() << std::dec << " !" << std::endl;
+ process_id = pthread_self();
+ }
+
+ AudioEngine::thread_init_callback (this);
+ }
+
engine.process_callback (nframes);
_write_audio_data_to_device (output_buffer, nframes);
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 add_to_trash (CrossThreadPool *);
_key.set (new CrossThreadPool (n, isize, nitems, this));
}
+/** @return True if CrossThreadPool for the current thread exists,
+ * False otherwise
+ */
+bool
+PerThreadPool::has_per_thread_pool ()
+{
+ CrossThreadPool* p = _key.get();
+ if (p) {
+ return true;
+ }
+ return false;
+}
+
+
/** @return CrossThreadPool for the current thread, which must previously have been created by
* calling create_per_thread_pool in the current thread.
*/