我正在使用FMOD
为音频文件添加效果。
这是我的代码
char cDest[200] = {0};
NSString *fileName=[NSString stringWithFormat:@"%@/recordName.wav", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]];
NSLog(@"%@",fileName);
[fileName getCString:cDest maxLength:200 encoding:NSASCIIStringEncoding];
result = system->setOutput(FMOD_OUTPUTTYPE_WAVWRITER); ERRCHECK(result);
result = system->init(32, FMOD_INIT_NORMAL | FMOD_INIT_ENABLE_PROFILE, NULL);
ERRCHECK(result);
添加FMOD error! (23) File not found.
FMOD_OUTPUTTYPE_WAVWRITER
请帮帮我
答案 0 :(得分:2)
我想将高通文件管理器(或任何其他过滤器)添加到音频文件,然后将其保存到文档目录。 下面是我的代码。它没有给我结果。你能告诉我哪里错了吗?
FMOD_RESULT result = FMOD_OK;
char buffer[200] = {0};
unsigned int version = 0;
result = FMOD::System_Create(&system);
ERRCHECK(result);
result = system->getVersion(&version);
ERRCHECK(result);
if (version < FMOD_VERSION)
{
fprintf(stderr, "You are using an old version of FMOD %08x. This program requires %08x\n", version, FMOD_VERSION);
exit(-1);
}
[[NSString stringWithFormat:@"%@/song1.wav", [[NSBundle mainBundle] resourcePath]] getCString:buffer maxLength:200 encoding:NSASCIIStringEncoding];
char cDest[200] = {0};
NSString *fileName=[NSString stringWithFormat:@"%@/recordName.wav", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]];
[fileName getCString:cDest maxLength:200 encoding:NSASCIIStringEncoding];
result = system->setOutput(FMOD_OUTPUTTYPE_WAVWRITER);
ERRCHECK(result);
result = system->init(32, FMOD_INIT_NORMAL | FMOD_INIT_ENABLE_PROFILE, cDest);
ERRCHECK(result);
result = system->createSound(buffer, FMOD_SOFTWARE, NULL, &sound);
ERRCHECK(result);
result = system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);
ERRCHECK(result);
result = system->createDSPByType(FMOD_DSP_TYPE_HIGHPASS, &dsphighpass);
ERRCHECK(result);
result = system->addDSP(dsphighpass, NULL);
ERRCHECK(result);
答案 1 :(得分:1)
朋友我自己解决了这个问题
这是代码。希望它会帮助一些人
[strSavedFile getCString:cDest maxLength:200 encoding:NSASCIIStringEncoding];
result = system->setOutput(FMOD_OUTPUTTYPE_WAVWRITER_NRT); ERRCHECK(result);
result = system->init(32, FMOD_INIT_NORMAL, cDest);
只需更改
result = system->init(32, FMOD_INIT_NORMAL | FMOD_INIT_ENABLE_PROFILE, NULL);
带
result = system->init(32, FMOD_INIT_NORMAL, cDest);
享受