Generating an audio sine wave #1087
|
Hiya, |
Replies: 1 comment 1 reply
|
You have several things wrong here. First, the device config is only used for configuring a The other thing is that I can see you are declaring your objects as local variables. When the function returns they'll go out of scope and will become invalid. You need to make sure they stay valid for their entire lifetime. Put it side-by-side with your |

You have several things wrong here.
First, the device config is only used for configuring a
ma_deviceobject. The way you're using it here is not working the way you're expecting. The format, channels and rate in the waveform config is being set to 0. Change this toma_format_f32, 1 and 48000 as a starting point and then modify from there to suit your requirements.The other thing is that I can see you are declaring your objects as local variables. When the function returns they'll go out of scope and will become invalid. You need to make sure they stay valid for their entire lifetime. Put it side-by-side with your
loadedAudioobject.