1
int main(int arg, char *args[])
{
FMOD::System *System;
FMOD::Sound *Sound;
FMOD::Channel *Channel = 0;
FMOD_CREATESOUNDEXINFO exinfo;
FMOD_RESULT result;
void *Buffer = 0;
int Key;
ZIPENTRY ze;
HZIP hz = OpenZip("C:\\Users\\Lukas\\Desktop\\Music.pak", "");
FindZipItem(hz, "Recording 1.mp3", true, NULL, &ze);
Buffer = malloc(ze.unc_size);
UnzipItem(hz, ze.index, Buffer, ze.unc_size);
CloseZip(hz);

ZeroMemory(&exinfo, sizeof(FMOD_CREATESOUNDEXINFO));
exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
exinfo.length = ze.unc_size;
result = FMOD::System_Create(&System);
result = System->init(32, FMOD_INIT_NORMAL, 0);
result = System->createSound((const char*)Buffer, FMOD_HARDWARE | FMOD_OPENMEMORY, &exinfo, &Sound);
result = System->playSound(FMOD_CHANNEL_FREE, Sound, false, &Channel);
while(TRUE)
{
    if(_kbhit())
    {
        Key = _getch();
        if(Key == 27)break;
    }
}
Sound->release();
System->close();
System->release();
return 0;
}

声音已正确加载到内存中。但我对 System->createSound() 函数有问题。它抛出 FMOD_INVALID_PARRAM 但一切都应该没问题。(与 FMOD 示例相比)感谢您的回答。

4

1 回答 1

2

一切都好,我只是忘了复制 DLL 文件^^

于 2013-09-19T12:14:57.973 回答