From 1c76e93d291ace5df5ccf55ad6549bf28e8dc4fa Mon Sep 17 00:00:00 2001 From: Nanako <469449812@qq.com> Date: Thu, 13 Jun 2024 20:52:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Emixer=E6=8E=A7=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/audio/mixer/mixer_track.cpp | 1 + core/audio/mixer/mixer_track.h | 10 +++++++++- core/window/window_manager.cpp | 1 - 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/core/audio/mixer/mixer_track.cpp b/core/audio/mixer/mixer_track.cpp index 3a7b359..33a90ed 100644 --- a/core/audio/mixer/mixer_track.cpp +++ b/core/audio/mixer/mixer_track.cpp @@ -18,6 +18,7 @@ void mixer_track::init() { buffer.resize(channel_count, g_audio_device_manager.get_buffer_size()); for (int i = 0; i < buffer.get_num_channels(); ++i) { ui_buffers->emplace_back(g_audio_device_manager.get_buffer_size() * 2); + ui_buffer_peaks.emplace_back(); } channel_interface_ = new mixer_channel_interface(this); diff --git a/core/audio/mixer/mixer_track.h b/core/audio/mixer/mixer_track.h index 4db7692..17f4a31 100644 --- a/core/audio/mixer/mixer_track.h +++ b/core/audio/mixer/mixer_track.h @@ -18,6 +18,11 @@ struct mixer_track_link { float send_level; }; +struct mixer_track_peak { + sample_t peak; + float left_time; +}; + class CORE_API mixer_track { public: explicit mixer_track(mixer_track_type in_type) : type_(in_type) { @@ -47,12 +52,15 @@ public: [[nodiscard]] float get_volume() const { return volume; } audio_buffer buffer; - std::shared_ptr ui_buffers; std::vector effects{}; std::vector children{}; multicast_delegate on_processed; multicast_delegate on_add_effect; multicast_delegate on_remove_effect; + + // UI + std::shared_ptr ui_buffers; + std::vector ui_buffer_peaks; private: const mixer_track_type type_; std::atomic volume = 1.0f; diff --git a/core/window/window_manager.cpp b/core/window/window_manager.cpp index 4815858..d47f8ba 100644 --- a/core/window/window_manager.cpp +++ b/core/window/window_manager.cpp @@ -76,7 +76,6 @@ void window_manager::destroy_plugin_window(plugin_host* host) { } void window_manager::update() { - // glfwPollEvents(); for (auto& info : host_infos_) { if (!info.second.window) { continue;