1
FMOD를 초기화하는 동안 이상한 문제가 발생하면 FMOD가 '무한 루프'로 들어가고 프로그램이 중지됩니다. 내가 뭘 잘못하고있어? FMOD를 초기화하는 중 오류가 발생했습니다.
FMOD::System *fmodsyst = 0;
FMOD::Sound *sound = 0;
FMOD::Channel *channel = 0;
FMOD_RESULT result = FMOD_OK;
unsigned int version = 0;
unsigned int soundlength = 0;
bool dspenabled = false;
void *extradriverdata = 0;
unsigned int recordpos = 0;
unsigned int recorddelta = 0;
unsigned int minrecorddelta = (unsigned int)-1;
unsigned int lastrecordpos = 0;
unsigned int samplesrecorded = 0;
unsigned int playpos = 0;
float smootheddelta = 0;
int recordrate = 0;
int recordchannels = 0;
unsigned int adjustedlatency = 0;
unsigned int driftthreshold = 0;
FMOD_CREATESOUNDEXINFO exinfo;
bool Basics::InitializeFMOD()
{
FMOD_RESULT result;
unsigned int version;
result = FMOD::System_Create(&fmodsyst);
FMOD_ERRCHECK(result);
result = fmodsyst->getVersion(&version);
FMOD_ERRCHECK(result);
if (version < FMOD_VERSION)
{
return false;
}
result = fmodsyst->init(100, FMOD_INIT_NORMAL, extradriverdata); //this is the line which crashes the .dll
FMOD_ERRCHECK(result);
result = fmodsyst->getRecordDriverInfo(0, NULL, NULL, 0, 0, &recordrate, 0, &recordchannels);
FMOD_ERRCHECK(result);
adjustedlatency = (recordrate * LATENCY_MS)/1000;
driftthreshold = adjustedlatency/2;
memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
exinfo.numchannels = recordchannels;
exinfo.format = FMOD_SOUND_FORMAT_PCM16;
exinfo.defaultfrequency = recordrate;
exinfo.length = exinfo.defaultfrequency * sizeof(short)* exinfo.numchannels * 5; /* 5 second buffer, doesnt really matter how big this is, but not too small of course. */
result = fmodsyst->createSound(0, FMOD_LOOP_NORMAL | FMOD_OPENUSER, &exinfo, &sound);
FMOD_ERRCHECK(result);
result = fmodsyst->recordStart(0, sound, true);
FMOD_ERRCHECK(result);
result = sound->getLength(&soundlength, FMOD_TIMEUNIT_PCM);
FMOD_ERRCHECK(result);
return true;
}
는 또한 기능 FMOD_ERRCHECK 아무 말도 나던 : 이는 기능입니다.
: 내 여분의 매개 변수를 필요로
우리는 서로 다른 버전을 가질 수있다? 코드를 줄이자. 간단한 초기화 코드가 포함 된 간단한 예제 만 포함하고 여전히 동일한 문제가 있는지 확인하십시오. –
이것은 문제의 원인이되는 행입니다. result = fmodsyst-> init (100, FMOD_INIT_NORMAL, extradriverdata); // 이것은 .dll을 충돌시키는 행입니다 - WriteToLog 함수를 사용하여 디버깅을 적용 했더니 그것이 멈추었습니다. – user3145274
'extradriverdata'에 대한 정의를 제공하지 않았지만 관련성이없는 코드를 많이 제공했습니다. 문제를 재현하려면 질문을 최소 _complete_ 코드로 편집하십시오. –