mixer_track新增add_effect和remove_effect代理, 并更新spdlog和taskflow版本
This commit is contained in:
parent
b8b1b0465e
commit
2307a196df
@ -14,8 +14,7 @@ void build_effect_channel_interface(mixer_track* track, const channel_interface*
|
||||
auto& input_channel_nodes = in_interface->input_channel_nodes;
|
||||
auto& output_channel_nodes = in_interface->output_channel_nodes;
|
||||
// 如果这个效果器需要从其他轨道输入,那么目标轨道的深度就是这个轨道的深度+1
|
||||
for (int i = 1; i < input_channel_nodes.size(); ++i)
|
||||
{
|
||||
for (int i = 1; i < input_channel_nodes.size(); ++i) {
|
||||
channel_node* node = input_channel_nodes[i];
|
||||
if (node->type != channel_node_type::mixer)
|
||||
continue;
|
||||
@ -26,8 +25,7 @@ void build_effect_channel_interface(mixer_track* track, const channel_interface*
|
||||
}
|
||||
|
||||
// 如果这个效果器需要输出到其他轨道,那么这个轨道的深度就是目标轨道的深度+1
|
||||
for (int i = 1; i < output_channel_nodes.size(); ++i)
|
||||
{
|
||||
for (int i = 1; i < output_channel_nodes.size(); ++i) {
|
||||
auto* node = output_channel_nodes[i];
|
||||
if (node->type != channel_node_type::mixer)
|
||||
continue;
|
||||
@ -41,12 +39,10 @@ void build_effect_channel_interface(mixer_track* track, const channel_interface*
|
||||
int32_t build_process_node_internal(mixer_track* track, std::map<mixer_track*, int32_t>& processed_tracks, int32_t layer) {
|
||||
int32_t& track_current_layer = processed_tracks[track];
|
||||
track_current_layer = std::max(track_current_layer, layer);
|
||||
for (const mixer_track_link& child_link: track->children)
|
||||
{
|
||||
for (const mixer_track_link& child_link: track->children) {
|
||||
mixer_track* ChildTrack = child_link.track;
|
||||
build_process_node_internal(ChildTrack, processed_tracks, layer + 1);
|
||||
for (const plugin_host* effect: ChildTrack->effects)
|
||||
{
|
||||
for (const plugin_host* effect: ChildTrack->effects) {
|
||||
build_effect_channel_interface(ChildTrack, effect->channel, processed_tracks);
|
||||
}
|
||||
}
|
||||
@ -54,8 +50,7 @@ int32_t build_process_node_internal(mixer_track* track, std::map<mixer_track*, i
|
||||
}
|
||||
|
||||
void build_instrument_process_node(const plugin_host* host, std::map<mixer_track*, int32_t>& processed_tracks) {
|
||||
for (mixer_track* Track : host->owner_tracks)
|
||||
{
|
||||
for (mixer_track* Track : host->owner_tracks) {
|
||||
build_effect_channel_interface(Track, host->channel, processed_tracks);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "channel_interface.h"
|
||||
#include "audio/device/audio_device_manager.h"
|
||||
#include "audio/plugin_host/plugin_host.h"
|
||||
#include "thread_message/thread_message_hubs.h"
|
||||
|
||||
mixer_track::~mixer_track() {
|
||||
|
||||
@ -19,11 +20,19 @@ void mixer_track::init() {
|
||||
}
|
||||
|
||||
void mixer_track::add_effect(plugin_host* in_effect) {
|
||||
in_effect->owner_tracks.push_back(this);
|
||||
g_audio_thread_hub.push_message([in_effect, this] {
|
||||
in_effect->owner_tracks.push_back(this);
|
||||
g_main_thread_hub.push_message([in_effect, this] {
|
||||
on_add_effect.broadcast(in_effect);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void mixer_track::remove_effect(plugin_host* in_effect) {
|
||||
|
||||
on_remove_effect.broadcast(in_effect);
|
||||
g_audio_thread_hub.push_message([in_effect, this] {
|
||||
in_effect->owner_tracks.erase(std::remove(in_effect->owner_tracks.begin(), in_effect->owner_tracks.end(), this), in_effect->owner_tracks.end());
|
||||
});
|
||||
}
|
||||
|
||||
void mixer_track::add_child(mixer_track* in_child, float in_send_level) {
|
||||
|
@ -46,6 +46,8 @@ public:
|
||||
std::vector<plugin_host*> effects{};
|
||||
std::vector<mixer_track_link> children{};
|
||||
multicast_delegate<mixer_track*> on_processed;
|
||||
multicast_delegate<plugin_host*> on_add_effect;
|
||||
multicast_delegate<plugin_host*> on_remove_effect;
|
||||
private:
|
||||
void add_effect_internal(plugin_host* in_effect);
|
||||
const mixer_track_type type_;
|
||||
|
2
third_party/spdlog
vendored
2
third_party/spdlog
vendored
@ -1 +1 @@
|
||||
Subproject commit a627f5c43a81b2f155f8b06b18c3ea345f1c826b
|
||||
Subproject commit f0b96d2ad105bbcde2130851e7bb0c033d66ec2f
|
2
third_party/taskflow
vendored
2
third_party/taskflow
vendored
@ -1 +1 @@
|
||||
Subproject commit 10dfa7920d1a786099a92614c4183f6339975728
|
||||
Subproject commit 1b6cf17bb37741103a67cb3698066b6b80def2e0
|
Loading…
x
Reference in New Issue
Block a user