ma_uint32channels;/* The number of channels of the source, which will be the same as the output. Must be 1 or 2. The excite bus must always have one channel. */
ma_uint32channels;/* The number of channels of the source, which will be the same as the output. Must be 1 or 2. The excite bus must always have one channel. */
ma_uint32channels;/* The number of channels of the source, which will be the same as the output. Must be 1 or 2. The excite bus must always have one channel. */
The vocoder node has two inputs and one output. Inputs:
Input Bus 0: The source/carrier stream.
Input Bus 1: The excite/modulator stream.
The source (input bus 0) and output must have the same channel count, and is restricted to 1 or 2.
The excite (input bus 1) is restricted to 1 channel.
*/
typedefstruct
{
ma_node_confignodeConfig;
ma_uint32channels;/* The number of channels of the source, which will be the same as the output. Must be 1 or 2. The excite bus must always have one channel. */
Demonstrates how to apply an effect to a duplex stream using the node graph system.
This example applies a vocoder effect to the input stream before outputting it. A custom node
called `ma_vocoder_node` is used to achieve the effect which can be found in the extras folder in
the miniaudio repository. The vocoder node uses https://github.com/blastbay/voclib to achieve the
effect.
*/
#define MINIAUDIO_IMPLEMENTATION
#include "../../../../miniaudio.h"
#include "../../../miniaudio_engine.h"
#include "ma_vocoder_node.c"
#include <stdio.h>
#define DEVICE_FORMAT ma_format_f32 /* Must always be f32 for this example because the node graph system only works with this. */
#define DEVICE_CHANNELS 1 /* For this example, always set to 1. */
staticma_waveformg_sourceData;/* The underlying data source of the excite node. */
staticma_audio_buffer_refg_exciteData;/* The underlying data source of the source node. */
staticma_data_source_nodeg_sourceNode;/* A data source node containing the source data we'll be sending through to the vocoder. This will be routed into the first bus of the vocoder node. */
staticma_data_source_nodeg_exciteNode;/* A data source node containing the excite data we'll be sending through to the vocoder. This will be routed into the second bus of the vocoder node. */
staticma_vocoder_nodeg_vocoderNode;/* The vocoder node. */
* Call this function continuously to generate your output.
* carrier_buffer and modulator_buffer should contain the carrier and modulator signals respectively.
* The modulator must always have one channel.
* If the carrier has two channels, the samples in carrier_buffer must be interleaved.
* output_buffer will be filled with the result, and must be able to hold as many channels as the carrier.
* If the carrier has two channels, the output buffer will be filled with interleaved samples.
* output_buffer may be the same pointer as either carrier_buffer or modulator_buffer as long as it can hold the same number of channels as the carrier.
* The processing is performed in place.
* frames specifies the number of sample frames that should be processed.
* Returns nonzero (true) on success or 0 (false) on failure.
* The function will only fail if one or more of the parameters are invalid.
/* The main instance structure. This is the structure that you will create an instance of when using the vocoder. */
structvoclib_instance
{
voclib_bandanalysis_bands[VOCLIB_MAX_BANDS];/* The filterbank used for analysis (these are applied to the modulator). */
voclib_envelopeanalysis_envelopes[VOCLIB_MAX_BANDS];/* The envelopes used to smooth the analysis bands. */
voclib_bandsynthesis_bands[VOCLIB_MAX_BANDS*2];/* The filterbank used for synthesis (these are applied to the carrier). The second half of the array is only used for stereo carriers. */
floatreaction_time;/* In seconds. Higher values make the vocoder respond more slowly to changes in the modulator. */
floatformant_shift;/* In octaves. 1.0 is unchanged. */
ma_uint32channels;/* The number of channels of the source, which will be the same as the output. Must be 1 or 2. The excite bus must always have one channel. */
ma_uint32channels;/* The number of channels of the source, which will be the same as the output. Must be 1 or 2. The excite bus must always have one channel. */
ma_uint32channels;/* The number of channels of the source, which will be the same as the output. Must be 1 or 2. The excite bus must always have one channel. */
The vocoder node has two inputs and one output. Inputs:
Input Bus 0: The source/carrier stream.
Input Bus 1: The excite/modulator stream.
The source (input bus 0) and output must have the same channel count, and is restricted to 1 or 2.
The excite (input bus 1) is restricted to 1 channel.
*/
typedefstruct
{
ma_node_confignodeConfig;
ma_uint32channels;/* The number of channels of the source, which will be the same as the output. Must be 1 or 2. The excite bus must always have one channel. */
Demonstrates how to apply an effect to a duplex stream using the node graph system.
\ No newline at end of file
This example applies a vocoder effect to the input stream before outputting it. A custom node
called `ma_vocoder_node` is used to achieve the effect which can be found in the extras folder in
the miniaudio repository. The vocoder node uses https://github.com/blastbay/voclib to achieve the
effect.
*/
#define MINIAUDIO_IMPLEMENTATION
#include "../../../../miniaudio.h"
#include "../../../miniaudio_engine.h"
#include "ma_vocoder_node.c"
#include <stdio.h>
#define DEVICE_FORMAT ma_format_f32 /* Must always be f32 for this example because the node graph system only works with this. */
#define DEVICE_CHANNELS 1 /* For this example, always set to 1. */
staticma_waveformg_sourceData;/* The underlying data source of the excite node. */
staticma_audio_buffer_refg_exciteData;/* The underlying data source of the source node. */
staticma_data_source_nodeg_sourceNode;/* A data source node containing the source data we'll be sending through to the vocoder. This will be routed into the first bus of the vocoder node. */
staticma_data_source_nodeg_exciteNode;/* A data source node containing the excite data we'll be sending through to the vocoder. This will be routed into the second bus of the vocoder node. */
staticma_vocoder_nodeg_vocoderNode;/* The vocoder node. */