pvrecorder/src/miniaudio/research/_extras/nodes/ma_channel_combiner_node/ma_channel_combiner_node.c
Go to the documentation of this file.
1 
3 
5 {
7 
9  config.nodeConfig = ma_node_config_init(); /* Input and output channels will be set in ma_channel_combiner_node_init(). */
10  config.channels = channels;
11 
12  return config;
13 }
14 
15 
16 static void ma_channel_combiner_node_process_pcm_frames(ma_node* pNode, const float** ppFramesIn, ma_uint32* pFrameCountIn, float** ppFramesOut, ma_uint32* pFrameCountOut)
17 {
18  ma_channel_combiner_node* pCombinerNode = (ma_channel_combiner_node*)pNode;
19 
20  (void)pFrameCountIn;
21 
22  ma_interleave_pcm_frames(ma_format_f32, ma_node_get_output_channels(pCombinerNode, 0), *pFrameCountOut, (const void**)ppFramesIn, (void*)ppFramesOut[0]);
23 }
24 
26 {
28  NULL,
29  MA_NODE_BUS_COUNT_UNKNOWN, /* Input bus count is determined by the channel count and is unknown until the node instance is initialized. */
30  1, /* 1 output bus. */
31  0 /* Default flags. */
32 };
33 
35 {
36  ma_result result;
37  ma_node_config baseConfig;
38  ma_uint32 inputChannels[MA_MAX_NODE_BUS_COUNT];
39  ma_uint32 outputChannels[1];
40  ma_uint32 iChannel;
41 
42  if (pCombinerNode == NULL) {
43  return MA_INVALID_ARGS;
44  }
45 
46  MA_ZERO_OBJECT(pCombinerNode);
47 
48  if (pConfig == NULL) {
49  return MA_INVALID_ARGS;
50  }
51 
52  /* All input channels are mono. */
53  for (iChannel = 0; iChannel < pConfig->channels; iChannel += 1) {
54  inputChannels[iChannel] = 1;
55  }
56 
57  outputChannels[0] = pConfig->channels;
58 
59  baseConfig = pConfig->nodeConfig;
61  baseConfig.inputBusCount = pConfig->channels; /* The vtable has an unknown channel count, so must specify it here. */
62  baseConfig.pInputChannels = inputChannels;
63  baseConfig.pOutputChannels = outputChannels;
64 
65  result = ma_node_init(pNodeGraph, &baseConfig, pAllocationCallbacks, &pCombinerNode->baseNode);
66  if (result != MA_SUCCESS) {
67  return result;
68  }
69 
70  return MA_SUCCESS;
71 }
72 
74 {
75  /* The base node is always uninitialized first. */
76  ma_node_uninit(pCombinerNode, pAllocationCallbacks);
77 }
ma_channel_combiner_node
Definition: porcupine/demo/c/pvrecorder/src/miniaudio/research/_extras/nodes/ma_channel_combiner_node/ma_channel_combiner_node.h:18
MA_INVALID_ARGS
#define MA_INVALID_ARGS
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/miniaudio.h:1661
NULL
#define NULL
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:92
ma_node_config::inputBusCount
ma_uint32 inputBusCount
Definition: porcupine/demo/c/pvrecorder/src/miniaudio/research/miniaudio_engine.h:939
ma_channel_combiner_node_uninit
MA_API void ma_channel_combiner_node_uninit(ma_channel_combiner_node *pCombinerNode, const ma_allocation_callbacks *pAllocationCallbacks)
Definition: pvrecorder/src/miniaudio/research/_extras/nodes/ma_channel_combiner_node/ma_channel_combiner_node.c:73
ma_format_f32
@ ma_format_f32
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/miniaudio.h:1790
ma_channel_combiner_node_config
Definition: porcupine/demo/c/pvrecorder/src/miniaudio/research/_extras/nodes/ma_channel_combiner_node/ma_channel_combiner_node.h:9
MA_API
#define MA_API
Definition: porcupine/demo/c/pvrecorder/src/miniaudio/extras/miniaudio_split/miniaudio.h:174
ma_node
void ma_node
Definition: porcupine/demo/c/pvrecorder/src/miniaudio/research/miniaudio_engine.h:874
ma_node_vtable
Definition: porcupine/demo/c/pvrecorder/src/miniaudio/research/miniaudio_engine.h:892
ma_allocation_callbacks
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/miniaudio.h:1823
g_ma_channel_combiner_node_vtable
static ma_node_vtable g_ma_channel_combiner_node_vtable
Definition: pvrecorder/src/miniaudio/research/_extras/nodes/ma_channel_combiner_node/ma_channel_combiner_node.c:25
ma_result
int ma_result
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/miniaudio.h:1658
ma_node_init
MA_API ma_result ma_node_init(ma_node_graph *pNodeGraph, const ma_node_config *pConfig, const ma_allocation_callbacks *pAllocationCallbacks, ma_node *pNode)
ma_node_config_init
MA_API ma_node_config ma_node_config_init(void)
ma_node_config::vtable
const ma_node_vtable * vtable
Definition: porcupine/demo/c/pvrecorder/src/miniaudio/research/miniaudio_engine.h:937
ma_node_config::pOutputChannels
const ma_uint32 * pOutputChannels
Definition: porcupine/demo/c/pvrecorder/src/miniaudio/research/miniaudio_engine.h:942
MA_NODE_BUS_COUNT_UNKNOWN
#define MA_NODE_BUS_COUNT_UNKNOWN
Definition: porcupine/demo/c/pvrecorder/src/miniaudio/research/miniaudio_engine.h:871
ma_node_uninit
MA_API void ma_node_uninit(ma_node *pNode, const ma_allocation_callbacks *pAllocationCallbacks)
ma_channel_combiner_node::baseNode
ma_node_base baseNode
Definition: porcupine/demo/c/pvrecorder/src/miniaudio/research/_extras/nodes/ma_channel_combiner_node/ma_channel_combiner_node.h:20
ma_node_get_output_channels
MA_API ma_uint32 ma_node_get_output_channels(const ma_node *pNode, ma_uint32 outputBusIndex)
ma_channel_combiner_node_config::channels
ma_uint32 channels
Definition: porcupine/demo/c/pvrecorder/src/miniaudio/research/_extras/nodes/ma_channel_combiner_node/ma_channel_combiner_node.h:12
ma_uint32
uint32_t ma_uint32
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/miniaudio.h:1503
ma_channel_combiner_node_config::nodeConfig
ma_node_config nodeConfig
Definition: porcupine/demo/c/pvrecorder/src/miniaudio/research/_extras/nodes/ma_channel_combiner_node/ma_channel_combiner_node.h:11
ma_node_config
Definition: porcupine/demo/c/pvrecorder/src/miniaudio/research/miniaudio_engine.h:935
ma_node_graph
Definition: porcupine/demo/c/pvrecorder/src/miniaudio/research/miniaudio_engine.h:1053
ma_channel_combiner_node_init
MA_API ma_result ma_channel_combiner_node_init(ma_node_graph *pNodeGraph, const ma_channel_combiner_node_config *pConfig, const ma_allocation_callbacks *pAllocationCallbacks, ma_channel_combiner_node *pCombinerNode)
Definition: pvrecorder/src/miniaudio/research/_extras/nodes/ma_channel_combiner_node/ma_channel_combiner_node.c:34
ma_channel_combiner_node.h
ma_node_config::pInputChannels
const ma_uint32 * pInputChannels
Definition: porcupine/demo/c/pvrecorder/src/miniaudio/research/miniaudio_engine.h:941
config
static sai_transceiver_t config
Definition: imxrt1050/imxrt1050-evkb/source/pv_audio_rec.c:75
MA_SUCCESS
#define MA_SUCCESS
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/miniaudio.h:1659
MA_ZERO_OBJECT
#define MA_ZERO_OBJECT(p)
Definition: porcupine/demo/c/pvrecorder/src/miniaudio/extras/miniaudio_split/miniaudio.c:774
ma_channel_combiner_node_process_pcm_frames
static void ma_channel_combiner_node_process_pcm_frames(ma_node *pNode, const float **ppFramesIn, ma_uint32 *pFrameCountIn, float **ppFramesOut, ma_uint32 *pFrameCountOut)
Definition: pvrecorder/src/miniaudio/research/_extras/nodes/ma_channel_combiner_node/ma_channel_combiner_node.c:16
ma_channel_combiner_node_config_init
MA_API ma_channel_combiner_node_config ma_channel_combiner_node_config_init(ma_uint32 channels)
Definition: pvrecorder/src/miniaudio/research/_extras/nodes/ma_channel_combiner_node/ma_channel_combiner_node.c:4
ma_interleave_pcm_frames
void ma_interleave_pcm_frames(ma_format format, ma_uint32 channels, ma_uint64 frameCount, const void **ppDeinterleavedPCMFrames, void *pInterleavedPCMFrames)
Definition: porcupine/demo/c/pvrecorder/src/miniaudio/extras/miniaudio_split/miniaudio.c:30362
MA_MAX_NODE_BUS_COUNT
#define MA_MAX_NODE_BUS_COUNT
Definition: porcupine/demo/c/pvrecorder/src/miniaudio/research/miniaudio_engine.h:862


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:13:56