I’m not currently an fMod licensee, but we are considering using your obviously excellent system. I have two unrelated questions concerning two different projects:
For Virtual RC Racing, we have all sound effects in a sound container file. With FMod, is it possible to load a wav file for playback straight from memory? I.e., I will load the container file and then split it into the component wav files in memory, where they can hopefully remain. Can I send these to FModEx for playback as though they were loaded from disk via CreateSound?
Another application involves dynamic sound creating in real time. I.e., physics based acoustics. This involves manually calculating the wave form and putting it in a buffer in real time. Right now I’m doing this with Windows functions. Is it possible to send this buffer to FMOD for playback in real time? If so, are there any restrictions regarding what could be done with geometrical effects and so forth?
You’ve got a heck of a thing going here, guys. Fantastic stuff!
P.S.. One more question. There was a Basic/Delphi problem recently that required FMOD_System_CreateSound to have a FMOD_CREATESOUNDEXINFO structure passed to it with a .cbSize = 72 in order for sound to play. I’ve downloaded the new version and this problem appears to still occur. Could I be mistaken or doing something else wrong?
Problem solved… I had converted the FMOD_CREATESOUNDEXINFO structure from VB. The following members threw me for a loop:
dlsname As String
encryptionkey As String
In PB I can not use variable length strings, and not realizing these were pointers, simply defined fixed length strings of the wrong length as a substitute. So the problem was caused by the ExInfo.cbsize = SIZEOF(FMOD_CREATESOUNDEXINFO) line setting the wrong size for the structure (mine was 104 vs. 72). Setting these two members to LONG like the rest of the structure fixed it of course.
Thank you very much for your help. I am trying the first part now: Loading/playing a file from memory. I’m getting error FMOD_ERR_INVALID_HANDLE at FMOD_System_CreateSound, however. I’m doing this in PowerBasic for Windows 8.0 and am using the C loadfrommemory example you showed. Perhaps I am mistranslating/misunderstand the C function below.
result = FMOD_System_CreateSound(system, (const char *)buff, FMOD_HARDWARE | FMOD_OPENMEMORY, &exinfo, &sound1);
Perhaps the (const char *)buff is mistranslated? I am passing the entire file as stored in a memory string to the function in place of the file name. Is that right?
DECLARE FUNCTION FMOD_System_CreateSound LIB "fmodex.dll" ALIAS "FMOD_System_CreateSound" (BYVAL system AS LONG, BYVAL name_or_data AS STRING, BYVAL mode AS DWORD, BYREF exinfo AS FMOD_CREATESOUNDEXINFO, BYREF sound AS LONG) AS DWORD
FMOD_System_GetVersion system, version
result = FMOD_System_Init(system, 32, %FMOD_INIT_NORMAL, %NULL)
FileSpec$ = "c:\PBWin70\Samples\ToddDLL\fmod Ex\Enghi.wav"
FileHandle = FREEFILE ‘//Get a new file handle
OPEN FileSpec$ FOR BINARY AS FileHandle ‘//Open the file in binary mode
GET$ FileHandle,LOF(FileHandle),Memory$ ‘//Load the file into Memory$
ExInfo.cbsize = SIZEOF(FMOD_CREATESOUNDEXINFO) ‘//Set size per C loadmemory example
ExInfo.length = LEN(Memory$)’LOF(FileHandle) ‘//Set length per c loadmemory example
result = FMOD_System_CreateSound(system, Memory$, %FMOD_OPENMEMORY , ExInfo, sound1)
Thanks for any ideas!
Please login first to submit.