Fmod:读取音频文件,添加效果,然后将结果保存到文件中
我正在使用 FMOD 播放文件中的一些声音,并添加一些效果。我想预览添加到其中的效果,并将满意的结果保存到磁盘。 我尝试过使用 SetOutput 和 Init,然后使用 createSound、playSound 但我听不到声音,而且磁盘中保存的文件似乎有错误!
如果我不使用setOutput和init系统,第四个参数为0,我就可以听到声音。
附加我的代码:
result = FMOD_System_SetOutput(gSystem,FMOD_OUTPUTTYPE_WAVWRITER);
result = FMOD_System_Init(gSystem, 32,FMOD_INIT_NORMAL,"/sdcard/wav.wav");
result = FMOD_System_CreateSound(gSystem, filename, FMOD_SOFTWARE | FMOD_LOOP_NORMAL, 0, &gSound);
result = FMOD_System_PlaySound(gSystem, FMOD_CHANNEL_FREE, gSound, 0, &gChannel);
希望你能帮助我!
谢谢
I am using FMOD to play some sounds from files and I add some effects. I want to preview the effects added to it, and save the satisfied result to disk.
I have tried using SetOutput and Init and then createSound, playSound
but I cannot hear the sound and the file saved in the disk seems wrong!
If I don't use setOutput and init system with the 4th parameter 0, I can hear the sound.
appending my code :
result = FMOD_System_SetOutput(gSystem,FMOD_OUTPUTTYPE_WAVWRITER);
result = FMOD_System_Init(gSystem, 32,FMOD_INIT_NORMAL,"/sdcard/wav.wav");
result = FMOD_System_CreateSound(gSystem, filename, FMOD_SOFTWARE | FMOD_LOOP_NORMAL, 0, &gSound);
result = FMOD_System_PlaySound(gSystem, FMOD_CHANNEL_FREE, gSound, 0, &gChannel);
Hope you can help me!
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果将 setOutput 与 WavWriter 一起使用,音频将转到文件而不是扬声器。如果这不是您想要的,也许您应该尝试使用自定义 DSP 捕获音频。
基本思想是遵循 dsp_custom 示例,让用户创建 DSP,然后在 DSP 读取回调中将数据写入磁盘。您还必须将进入 DSP 的数据复制到输出缓冲区(直接 memcpy),以允许音频传递到扬声器。您可以将 DSP 放置在 DSP 网络中您想要捕获音频的任何位置。如果您只对最终混音感兴趣,只需使用 System::addDSP。
If you use setOutput with WavWriter the audio will go to a file instead of the speakers. If this isn't what you are looking for perhaps you should try capturing the audio with a custom DSP.
The basic idea is you follow the dsp_custom example, make a user created DSP, then in the DSP read callback write the data out to disk. You must also copy the data coming into the DSP into the output buffer (direct memcpy) to allow the audio to pass through to the speakers. You can place the DSP anywhere in the DSP network you want to capture audio. If you are only interested in the final mix, just use System::addDSP.