0
0

Hi,

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:

[code:35u0wns0]
function FMOD_System_GetDriverName(system: FMOD_SYSTEM; id: Integer; var name: PChar; namelen: Integer): FMOD_RESULT; stdcall;
[/code:35u0wns0]

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:
[code:35u0wns0]
var
name: PChar;
begin
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
comboPlayback.Items.Add(string(name));
end;
end;
ERRCHECK(result);
[/code:35u0wns0]

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?

Ta

Kim

  • You must to post comments
0
0

fixed….

in fmodex.pas
[code:2js9013f]
function FMOD_System_GetDriverName(system: FMOD_SYSTEM; id: Integer; var dname: Char; namelen: Integer): FMOD_RESULT; stdcall;
[/code:2js9013f]

in unit1.pas
[code:2js9013f]
var
dname: array[0..MAX_LENGTH] of char;
//MAX_LENGTH is const 256
begin
.....
result := FMOD_System_GetDriverName(system, i, dname[0], 256);
ERRCHECK(result);
comboPlayback.Items.Add(string(dname));
[/code:2js9013f]

There might be a few more of these to fix, I’ll work through the demos…

kim

  • You must to post comments
0
0

Brett,

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.

Cheers

Kim

  • You must to post comments
0
0

woo..

I’m only trying to help, in my limited fashion i suppose, i’m no expert.

The Delphi api does not work as it is, I am spending my own time to make it work ‘cos I want to use it. Is that alright?

Cheers

Kim

  • You must to post comments
0
0

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.

chz

Kim

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.