Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
c4a07387
Commit
c4a07387
authored
Jan 16, 2021
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get the bus order correct on the vocoder example.
parent
ec077e79
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
21 deletions
+21
-21
research/_examples/duplex_effect.c
research/_examples/duplex_effect.c
+21
-21
No files found.
research/_examples/duplex_effect.c
View file @
c4a07387
...
@@ -14,7 +14,7 @@ effect.
...
@@ -14,7 +14,7 @@ effect.
#include <stdio.h>
#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_FORMAT ma_format_f32;
/* Must always be f32 for this example because the node graph system only works with this. */
#define DEVICE_CHANNELS
2
/* The vocoder only supports 1 or 2 channels
. */
#define DEVICE_CHANNELS
1
/* For this example, always set to 1
. */
static
ma_audio_buffer_ref
g_sourceData
;
/* The underlying data source of the source node. */
static
ma_audio_buffer_ref
g_sourceData
;
/* The underlying data source of the source node. */
static
ma_waveform
g_exciteData
;
/* The underlying data source of the excite node. */
static
ma_waveform
g_exciteData
;
/* The underlying data source of the excite node. */
...
@@ -91,42 +91,42 @@ int main(int argc, char** argv)
...
@@ -91,42 +91,42 @@ int main(int argc, char** argv)
ma_node_set_output_bus_volume
(
&
g_vocoderNode
,
0
,
2
);
ma_node_set_output_bus_volume
(
&
g_vocoderNode
,
0
,
2
);
/* Source/carrier. Attached to input bus 0 of the vocoder node. */
/* Excite/modulator. Attached to input bus 0 of the vocoder node. */
result
=
ma_audio_buffer_ref_init
(
device
.
capture
.
format
,
device
.
capture
.
channels
,
NULL
,
0
,
&
g_sourceData
);
waveformConfig
=
ma_waveform_config_init
(
device
.
capture
.
format
,
device
.
capture
.
channels
,
device
.
sampleRate
,
ma_waveform_type_sawtooth
,
1
.
0
,
50
);
result
=
ma_waveform_init
(
&
waveformConfig
,
&
g_exciteData
);
if
(
result
!=
MA_SUCCESS
)
{
if
(
result
!=
MA_SUCCESS
)
{
printf
(
"Failed to initialize
audio buffer for sourc
e."
);
printf
(
"Failed to initialize
waveform for excite nod
e."
);
goto
done
2
;
goto
done
3
;
}
}
sourceNodeConfig
=
ma_data_source_node_config_init
(
&
g_sourc
eData
,
MA_FALSE
);
exciteNodeConfig
=
ma_data_source_node_config_init
(
&
g_excit
eData
,
MA_FALSE
);
result
=
ma_data_source_node_init
(
&
g_nodeGraph
,
&
sourceNodeConfig
,
NULL
,
&
g_sourc
eNode
);
result
=
ma_data_source_node_init
(
&
g_nodeGraph
,
&
exciteNodeConfig
,
NULL
,
&
g_excit
eNode
);
if
(
result
!=
MA_SUCCESS
)
{
if
(
result
!=
MA_SUCCESS
)
{
printf
(
"Failed to initialize
sourc
e node."
);
printf
(
"Failed to initialize
excit
e node."
);
goto
done
2
;
goto
done
3
;
}
}
ma_node_attach_output_bus
(
&
g_
sourc
eNode
,
0
,
&
g_vocoderNode
,
0
);
ma_node_attach_output_bus
(
&
g_
excit
eNode
,
0
,
&
g_vocoderNode
,
0
);
/* Excite/modulator. Attached to input bus 1 of the vocoder node. */
/* Source/carrier. Attached to input bus 1 of the vocoder node. */
waveformConfig
=
ma_waveform_config_init
(
device
.
capture
.
format
,
1
,
device
.
sampleRate
,
ma_waveform_type_sawtooth
,
1
.
0
,
500
);
/* Must be one channel. */
result
=
ma_audio_buffer_ref_init
(
device
.
capture
.
format
,
device
.
capture
.
channels
,
NULL
,
0
,
&
g_sourceData
);
result
=
ma_waveform_init
(
&
waveformConfig
,
&
g_exciteData
);
if
(
result
!=
MA_SUCCESS
)
{
if
(
result
!=
MA_SUCCESS
)
{
printf
(
"Failed to initialize
waveform for excite nod
e."
);
printf
(
"Failed to initialize
audio buffer for sourc
e."
);
goto
done
3
;
goto
done
2
;
}
}
exciteNodeConfig
=
ma_data_source_node_config_init
(
&
g_excit
eData
,
MA_FALSE
);
sourceNodeConfig
=
ma_data_source_node_config_init
(
&
g_sourc
eData
,
MA_FALSE
);
result
=
ma_data_source_node_init
(
&
g_nodeGraph
,
&
exciteNodeConfig
,
NULL
,
&
g_excit
eNode
);
result
=
ma_data_source_node_init
(
&
g_nodeGraph
,
&
sourceNodeConfig
,
NULL
,
&
g_sourc
eNode
);
if
(
result
!=
MA_SUCCESS
)
{
if
(
result
!=
MA_SUCCESS
)
{
printf
(
"Failed to initialize
excit
e node."
);
printf
(
"Failed to initialize
sourc
e node."
);
goto
done
3
;
goto
done
2
;
}
}
ma_node_attach_output_bus
(
&
g_
excit
eNode
,
0
,
&
g_vocoderNode
,
1
);
ma_node_attach_output_bus
(
&
g_
sourc
eNode
,
0
,
&
g_vocoderNode
,
1
);
ma_device_start
(
&
device
);
ma_device_start
(
&
device
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment