Commit 93e1755e authored by David Reid's avatar David Reid

Add support for more than 2 outputs to splitter nodes.

parent cf154428
......@@ -2093,7 +2093,7 @@ pointer to the processing function and the number of input and output buses. Exa
static ma_node_vtable my_custom_node_vtable =
{
my_custom_node_process_pcm_frames, // The function that will be called process your custom node. This is where you'd implement your effect processing.
my_custom_node_process_pcm_frames, // The function that will be called to process your custom node. This is where you'd implement your effect processing.
NULL, // Optional. A callback for calculating the number of input frames that are required to process a specified number of output frames.
2, // 2 input buses.
1, // 1 output bus.
......@@ -10507,6 +10507,7 @@ typedef struct
{
ma_node_config nodeConfig;
ma_uint32 channels;
ma_uint32 outputBusCount;
} ma_splitter_node_config;
MA_API ma_splitter_node_config ma_splitter_node_config_init(ma_uint32 channels);
......@@ -70379,6 +70380,7 @@ MA_API ma_splitter_node_config ma_splitter_node_config_init(ma_uint32 channels)
MA_ZERO_OBJECT(&config);
config.nodeConfig = ma_node_config_init();
config.channels = channels;
config.outputBusCount = 2;
return config;
}
......@@ -70411,7 +70413,7 @@ static ma_node_vtable g_ma_splitter_node_vtable =
ma_splitter_node_process_pcm_frames,
NULL, /* onGetRequiredInputFrameCount */
1, /* 1 input bus. */
2, /* 2 output buses. */
MA_NODE_BUS_COUNT_UNKNOWN, /* The output bus count is specified on a per-node basis. */
0
};
......@@ -70420,7 +70422,8 @@ MA_API ma_result ma_splitter_node_init(ma_node_graph* pNodeGraph, const ma_split
ma_result result;
ma_node_config baseConfig;
ma_uint32 pInputChannels[1];
ma_uint32 pOutputChannels[2];
ma_uint32 pOutputChannels[MA_MAX_NODE_BUS_COUNT];
ma_uint32 iOutputBus;
if (pSplitterNode == NULL) {
return MA_INVALID_ARGS;
......@@ -70432,15 +70435,21 @@ MA_API ma_result ma_splitter_node_init(ma_node_graph* pNodeGraph, const ma_split
return MA_INVALID_ARGS;
}
if (pConfig->outputBusCount > MA_MAX_NODE_BUS_COUNT) {
return MA_INVALID_ARGS; /* Too many output buses. */
}
/* Splitters require the same number of channels between inputs and outputs. */
pInputChannels[0] = pConfig->channels;
pOutputChannels[0] = pConfig->channels;
pOutputChannels[1] = pConfig->channels;
for (iOutputBus = 0; iOutputBus < pConfig->outputBusCount; iOutputBus += 1) {
pOutputChannels[iOutputBus] = pConfig->channels;
}
baseConfig = pConfig->nodeConfig;
baseConfig.vtable = &g_ma_splitter_node_vtable;
baseConfig.pInputChannels = pInputChannels;
baseConfig.pOutputChannels = pOutputChannels;
baseConfig.outputBusCount = pConfig->outputBusCount;
result = ma_node_init(pNodeGraph, &baseConfig, pAllocationCallbacks, &pSplitterNode->base);
if (result != MA_SUCCESS) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment