I’m trying out FMODEx with Delphi with some success. I’ve converted the Playsound and Playstream demos to Delphi no problem.
Next I thought I’d do the recording demo but got stuck here…
I haven’t yet worked out why PChar strings returned in functions like FMOD_SYSTEM_GetDriverName aren’t returning a PChar string the way I understand them.
eg in FMOD.pas there’s:
function FMOD_System_GetDriverName(system: FMOD_SYSTEM; id: Integer; var name: PChar; namelen: Integer): FMOD_RESULT; stdcall;
FYI notice I added var to name:, I’m pretty sure that should be the case for this and all the other functions returning data in fmod.pas
So I did:
result := FMOD_System_Create(system);
result := FMOD_System_GetVersion(system, version);
result := FMOD_System_GetNumDrivers(system, numdrivers);
if numdrivers > 0 then begin
for i := 0 to numdrivers -1 do begin
result := FMOD_System_GetDriverName(system, i, name, 256);
//name isn’t a value i can read so far
The equivalent FMOD3 function returns a PChar correctly.
Anyone know what the problem is?
BTW wouldn’t it be better to call the new Delphi lib fmodex.pas instead of fmod.pas inline with the rest of the languages?
- kimb asked 13 years ago
function FMOD_System_GetDriverName(system: FMOD_SYSTEM; id: Integer; var dname: Char; namelen: Integer): FMOD_RESULT; stdcall;
dname: array[0..MAX_LENGTH] of char;
//MAX_LENGTH is const 256
result := FMOD_System_GetDriverName(system, i, dname, 256);
There might be a few more of these to fix, I’ll work through the demos…
Yeah the var bit wasn’t needed in the end. The VB demo uses an array of bytes which is different to either C or Delphi. I used the same principle but with chars, pchar does not work like it did in FMOD3.
I’ve changed maybe 10-20 things so far in the Delphi API, mostly types, it’s not right yet I’m sure, and I’ve not even finished the recording demo…
BTW I’ve renamed all the api files to FmodEx.. .* so that it doesn’t bump into my FMOD3 projects.
Correct.. there is a lot of guess work going on here, I refer to fmod3 stuff a lot but it does not work the same way anymore in FmodEx. The typecasts are not easy, but I have learned at lot in the meantime. Problem I now have is that the CREATESOUNDEXINFO record might be wrong. When in run FMOD_RecordStart FMOD_ERROR tells me it that the maxchannels were too high and that I should use SetMaxChannels.. however there is no function for this and the C and VB demos don’t return this error either. So I know it’s my Delphi fault but why?
So Delphi is ‘Unprofessional’ now.. oh well. I looked at c# a while ago, it was total w@nk, maybe I’ll go back to C after years of ObjectPascal.
Please login first to submit.