When trying out this VB6 code some strange things happen. It goes well for a few repetetions, but now and again (i.e. often) it stops for a long time (ie 4-5 seconds) waiting for the sample to complete decoding in the GetOpenState. The status says loading. There does not seem to be a fixed interval when it fails.
Public Function PlaySample(sFilename as string, lOffset as long, lLength as long) as long
Dim exinfo As FMOD_CREATESOUNDEXINFO
Dim lPointer As Long
Dim lState As Long
dim lResult as long
exinfo.cbsize = Len(exinfo) exinfo.fileoffset = lOffset exinfo.length = lLength lResult = FMOD_System_CreateSound(System, sFilename, FMOD_SOFTWARE + FMOD_CREATESAMPLE + FMOD_NONBLOCKING, exinfo, lPointer) Do While 1 = 1 lResult = FMOD_Sound_GetOpenState(lPointer, lState, 0, 0) If (lState = FMOD_OPENSTATE_READY) Then Exit Do End If Loop lResult = FMOD_System_PlaySound(System, FMOD_CHANNEL_FREE, lPointer, False, lChannel)
It works without NON_BLOCKING.
Using the brand new 29 release.
- ddebono asked 11 years ago
- You must login to post comments