临时禁用RtAudio, 因为它在获取设备时死循环
This commit is contained in:
parent
e136589a19
commit
d765452895
@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
class renderer;
|
||||
@ -8,9 +9,7 @@ class application;
|
||||
|
||||
class CORE_API application {
|
||||
public:
|
||||
application() {
|
||||
}
|
||||
|
||||
application() = default;
|
||||
virtual ~application() = default;
|
||||
|
||||
application(const application&) = delete;
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -11,14 +11,14 @@ public:
|
||||
|
||||
void start();
|
||||
|
||||
CORE_API [[nodiscard]] const char* get_name() override { return "audio_device_manager"; }
|
||||
CORE_API const char* get_name() override { return "audio_device_manager"; }
|
||||
|
||||
CORE_API [[nodiscard]] uint32_t get_sample_rate() const;
|
||||
CORE_API uint32_t get_sample_rate() const;
|
||||
CORE_API void set_sample_rate(uint32_t sample_rate);
|
||||
CORE_API [[nodiscard]] uint32_t get_buffer_size() const;
|
||||
CORE_API uint32_t get_buffer_size() const;
|
||||
CORE_API void set_buffer_size(int buffer_size);
|
||||
CORE_API [[nodiscard]] uint32_t get_input_channel_count() const;
|
||||
CORE_API [[nodiscard]] uint32_t get_output_channel_count() const;
|
||||
CORE_API uint32_t get_input_channel_count() const;
|
||||
CORE_API uint32_t get_output_channel_count() const;
|
||||
|
||||
int stream_callback(float** output, float** input, unsigned long frame_count, double stream_time, RtAudioStreamStatus status);
|
||||
protected:
|
||||
@ -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