0
0

Hi people,

at the moment im trying to convert the pitch detection example from C-Sharp to Delphi. Now im arrived successfully at the point where i have to create the sound object to record to, and thats where i have some troubles i could not find an answer to yet. My code is the following:

[code:5yujah2n]
fmodResult := FMOD_System_CreateSound(fmodSystem,nil,FMOD_SOFTWARE,exinfo,fmodSound);
[/code:5yujah2n]

Now FMOD tells me i passed an invalid argument because the name_or_data variable (the second variable) is empty. It works when i insert a file name, but as i want to record and not to play a sound thats not the solution. Another problem is the "exinfo" i need. This variable is a type of FMOD_CREATESOUNDEXINFO which is also used in the example. But the delphi CreateSound function wants a type of PFMOD_CREATESOUNDEXINFO. I did not find any information about this type in the documentation or API reference and also not here in the forum, so i started this thread. I hope someone got a solution for me …

  • You must to post comments
0
0

Harold,

Are you gonna put some effort into doing the rest of the Delphi demos or do you just want the code?

I could do with some help. It’s not difficult stuff, I just do not have the time at the moment. Gimme your email.

Kim

  • You must to post comments
0
0

Hello Kim,

I’ve send you a private message..

gr. Harold

  • You must to post comments
0
0

there aren’t any pm messages pending, maybe you hit the wrong button.

kimB

  • You must to post comments
0
0

alright, so u mean i should use "FMOD_OPENUSER" instead of "nil" as second parameter in the CreateSound function? all other examples (C#, VB ..) uses just 0, nil or an empty string for this parameter so i thought thats correct. it seems that the delphi implementation works kinda different from the other languages?

i know thats FMOD_CREATESOUNDEXINFO is in the fmodtypes.pas which i also included in my project. the problem ist that the delphi CreateSound function wants the type PFMOD_CREATESOUNDEXINFO. so theres a "P" in front of this type and i couldnt find out anything about this one. so is this just a spelling bug in the source or is there in fact a PFMOD_CREATESOUNDEXINFO type, and if so wheres the difference to FMOD_CREATESOUNDEXINFO??

would be nice if someone could post a short example for me …

  • You must to post comments
0
0

Hello Kim,

I;ve just send you a new PM

  • You must to post comments
0
0

hehe, it seems where talkin about different things =) ok heres the whole unit i already wrote:

[code:abr63r6q]unit main;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, fmod, fmoderrors, fmodpresets, fmodtypes, StdCtrls;

type
TForm1 = class(TForm)
comboBoxOutput: TComboBox;
comboBoxPlayback: TComboBox;
comboBoxRecord: TComboBox;
procedure comboBoxRecordChange(Sender: TObject);
procedure comboBoxPlaybackChange(Sender: TObject);
procedure comboBoxOutputChange(Sender: TObject);

procedure FormCreate(Sender: TObject);
procedure fmodError(resp: FMOD_RESULT);

private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
fmodSound: FMOD_SOUND;
fmodSystem: pointer;
fmodChannel: FMOD_CHANNEL;
fmodResult: FMOD_RESULT;
exinfo: FMOD_CREATESOUNDEXINFO;
resampler: FMOD_DSP_RESAMPLER;
format: FMOD_SOUND_FORMAT;
samplerate: integer;

implementation

{$R *.dfm}

procedure TForm1.comboBoxOutputChange(Sender: TObject);
begin
case comboBoxOutput.ItemIndex of
0: fmodResult := FMOD_System_SetOutput(fmodSystem,FMOD_OUTPUTTYPE_DSOUND);
1: fmodResult := FMOD_System_SetOutput(fmodSystem,FMOD_OUTPUTTYPE_WINMM);
2: fmodResult := FMOD_System_SetOutput(fmodSystem,FMOD_OUTPUTTYPE_ASIO);
end;
fmodError(fmodResult);
comboBoxPlayback.Enabled := true;
end;

procedure TForm1.comboBoxPlaybackChange(Sender: TObject);
begin
fmodResult := FMOD_System_SetDriver(fmodSystem,comboBoxPlayback.ItemIndex);
fmodError(fmodResult);
comboBoxRecord.Enabled := true;
end;

procedure TForm1.comboBoxRecordChange(Sender: TObject);
vat temp: integer;
begin
fmodResult := FMOD_System_SetRecordDriver(fmodSystem,comboBoxRecord.ItemIndex);
fmodError(fmodResult);
fmodResult := FMOD_System_SetSoftwareFormat(fmodSystem,48000,FMOD_SOUND_FORMAT_PCM16,1,0,resampler);
fmodError(fmodResult);
fmodResult := FMOD_System_Init(fmodSystem, 32, FMOD_INIT_NORMAL, nil);
fmodError(fmodResult);
fmodResult := FMOD_System_GetSoftwareFormat(fmodSystem,samplerate,format,temp,temp,temp,resampler);
fmodError(fmodResult);
exinfo.cbsize := SizeOf(exinfo);
exinfo.numchannels := 1;
exinfo.format := FMOD_SOUND_FORMAT_PCM16;
exinfo.defaultfrequency := 48000;
exinfo.length := exinfo.defaultfrequency * 2 * exinfo.numchannels * 5;
fmodResult := FMOD_System_CreateSound(fmodSystem,nil,(FMOD_2D or FMOD_SOFTWARE or FMOD_LOOP_NORMAL or FMOD_OPENUSER),exinfo,fmodSound);
fmodError(fmodResult);
end;

procedure TForm1.fmodError(resp: FMOD_RESULT);
begin
if resp <> FMOD_OK then
showmessage(’FMOD Fehler: ‘ + FMOD_ErrorString(resp));
end;

procedure TForm1.FormCreate(Sender: TObject);
var numdrivers,i: integer;
driverName: array[0..255] of char;
begin
fmodResult := FMOD_System_Create(fmodSystem);
fmodError(fmodResult);

fmodResult := FMOD_System_GetNumDrivers(fmodSystem,numdrivers);
fmodError(fmodResult);
for i := 0 to numdrivers-1 do
begin
fmodResult := FMOD_System_GetDriverName(fmodSystem,i,driverName,256);
fmodError(fmodResult);
comboBoxPlayback.Items.Add(driverName);
end;

fmodResult := FMOD_System_GetRecordNumDrivers(fmodSystem,numdrivers);
fmodError(fmodResult);
for i := 0 to numdrivers-1 do
begin
fmodResult := FMOD_System_GetRecordDriverName(fmodSystem,i,driverName,256);
fmodError(fmodResult);
comboBoxRecord.Items.Add(driverName);
end;

end;

end.[/code:abr63r6q]

Now the problem remains the same, caus i cant pass an 0,nil or empty string to the file parameter in the createSound function. if i do so the program crashs everytime it reached this line. When i insert a filename there it works, but as i said before thats not the solution as i want to record and not to playback.

so for the other prob i can just use PFMOD_CREATESOUNDEXINFO instead of FMOD_CREATESOUNDEXINFO?

Sorry, for my dumb questions but im a totally FMOD noob =)

  • You must to post comments
0
0

nope still nothing there, maybe there’s something wrong with this board?

KimB

  • You must to post comments
0
0

noone here who can help me? =(

  • You must to post comments
0
0

Can you send me your email to me as a PM?

  • You must to post comments
0
0

I’ve got that Delphi demo working and nearly all of the other ones, it was done last october though so might need tweaking to work with the latest FMODEx. let me know if you need a link to it.

kimB

  • You must to post comments
0
0

And one with callbacks, and syncs… please, please, please

  • You must to post comments
0
0

I will download the latest version and make sure it all still works.

I thought I posted a link to it before somewhere.

Chz

kimB

  • You must to post comments
0
0

OK a few things have changed, but mostly working.

It ‘s not complete however and I would prefer if someone else put some effort into finishing/updating it, I am a bit busy at the moment.

There are 17 of the 25 odd c/vb demos converted, all using Delphi 7.

I changed the way that the libs are referenced so that they didn’t interfere with my FMOD3 projects, so they are called FMODEx, FMODExTypes ….etc. There are also many changes to the released delphi lib, mostly incorrect delphi types. One issue here is that everytime something gets changed/added in FMODEx you have to go through the FMOD released files and make changes/additions to my version manually.

TODO:

Update existing demos – readtags not working, 3D not working correctly (both used to work…i think)
Convert other C/vb demos
Create BDS2006 version
Convert FMOD3 Testbed demo to work on FMODEx.

Also the status bar stuff at the bottom of many of the demos needs better formatting (lazy me).

I need to find somewhere to put this stuff on the net….

I understand that Delphi isn’t a priority language for FMOD, maybe I could start a Sourceforge project for the Delphi version….

Is that ok Brett?

Kim

  • You must to post comments
0
0

Hello Kim,

Since Brad is not responding, could you send me the examples by mail?

gr. Harold (Trying very hard to change his app into using FMOD…)

  • You must to post comments
Showing 14 results
Your Answer

Please first to submit.