1

我正在使用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

请帮我

4

2 回答 2

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);
于 2012-10-08T05:20:00.330 回答
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);

享受

于 2012-10-05T09:59:17.560 回答