启用RtAudio
This commit is contained in:
parent
dce226a28e
commit
3d14705a07
@ -31,7 +31,7 @@ void audio_device_manager::start() {
|
||||
if (input_params_.deviceId != 0) {
|
||||
input_params = &input_params_;
|
||||
}
|
||||
// audio_.openStream(&output_params_, input_params, RTAUDIO_FLOAT32, get_sample_rate(), &options_.numberOfBuffers, &rt_audio_callback, this, &options_);
|
||||
audio_.openStream(&output_params_, input_params, RTAUDIO_FLOAT32, get_sample_rate(), &options_.numberOfBuffers, &rt_audio_callback, this, &options_);
|
||||
}
|
||||
|
||||
uint32_t audio_device_manager::get_sample_rate() const {
|
||||
@ -86,23 +86,23 @@ void audio_device_manager::render_thread() {
|
||||
const uint32_t frames = get_buffer_size();
|
||||
const uint32_t rate = get_sample_rate();
|
||||
|
||||
// while (audio_.isStreamRunning()) {
|
||||
// const uint32_t milliseconds = 1.f / (rate / (frames / 4)) * 1000;
|
||||
//
|
||||
// g_audio_thread_hub.process_messages();
|
||||
// if (render_buffer_.Num() >= render_buffer_size_) {
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds));
|
||||
// continue;
|
||||
// }
|
||||
// g_midi_sequencer.process(rate, frames);
|
||||
// g_mixer.reset();
|
||||
// g_plugin_host_manager.process(frames);
|
||||
// g_mixer.process(frames);
|
||||
//
|
||||
// const auto& master_headers = master->buffer.get_headers_vector();
|
||||
// for (const auto element: master_headers) {
|
||||
// render_buffer_.Push(element, frames);
|
||||
// }
|
||||
// }
|
||||
while (audio_.isStreamRunning()) {
|
||||
const uint32_t milliseconds = 1.f / (rate / (frames / 4)) * 1000;
|
||||
|
||||
g_audio_thread_hub.process_messages();
|
||||
if (render_buffer_.Num() >= render_buffer_size_) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds));
|
||||
continue;
|
||||
}
|
||||
g_midi_sequencer.process(rate, frames);
|
||||
g_mixer.reset();
|
||||
g_plugin_host_manager.process(frames);
|
||||
g_mixer.process(frames);
|
||||
|
||||
const auto& master_headers = master->buffer.get_headers_vector();
|
||||
for (const auto element: master_headers) {
|
||||
render_buffer_.Push(element, frames);
|
||||
}
|
||||
}
|
||||
spdlog::info("port_audio render thread stopped");
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ private:
|
||||
RtAudio::StreamParameters output_params_ = {};
|
||||
RtAudio::StreamOptions options_ = {};
|
||||
uint32_t sample_rate_ = 44100;
|
||||
// RtAudio audio_;
|
||||
RtAudio audio_;
|
||||
};
|
||||
|
||||
DEFINE_SINGLETON_INSTANCE(audio_device_manager)
|
||||
|
Loading…
x
Reference in New Issue
Block a user