0
0

example:

in delphi i use the method :

to load:

procedure TForm1.[color=red:5vtwf4s3]Button1[/color:5vtwf4s3]Click(Sender: TObject);
begin
if opendialog1.execute then
edit1.text := opendialog1.filename;
end;
to play:

procedure TForm1.[color=red:5vtwf4s3]Button2[/color:5vtwf4s3]Click(Sender: TObject);
begin
SndPlaySound(PChar(edit1.Text), SND_ASYNC);
end;

how do this in fmod? how play any file i load in the same button?

(load : button1 ; Play Button2)

  • You must to post comments
0
0

something like:

[code:3mbbnh1f]
procedure TForm1.Button1Click(Sender: TObject);
begin
if opendialog1.execute then begin
edit1.text := opendialog1.filename;
SndPlaySound(PChar(edit1.Text), SND_ASYNC);
end;
[/code:3mbbnh1f]

or something like……

[code:3mbbnh1f]
procedure TForm1.Button1Click(Sender: TObject);
begin
if opendialog1.execute then
edit1.text := opendialog1.filename;
Button2.click;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
SndPlaySound(PChar(edit1.Text), SND_ASYNC);
end;
[/code:3mbbnh1f]

neither of them very elegant though :)

  • You must to post comments
0
0

how can i do this in Fmod?

  • You must to post comments
0
0

[code:1w8ujwqh]

var
Form1: TForm1;
system: FMOD_SYSTEM;
sound1: FMOD_SOUND;
channel: FMOD_CHANNEL = nil;
result: FMOD_RESULT;
version: cardinal;

implementation

{$R *.dfm}

procedure ErrCheck(result: FMOD_RESULT);
begin
if (result <> FMOD_OK) then begin
showmessage(’FMOD error! ‘ + FMOD_ErrorString(result));
end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
result := FMOD_System_Create(system);
ErrCheck(result);
result := FMOD_System_GetVersion(system, version);
ErrCheck(result);
if (version < FMOD_VERSION) then begin
showmessage(Format(’Error! You are using an old version of FMOD %.8x. This program requires %.8x’, [version, FMOD_VERSION]));
end;

result := FMOD_System_Init(system, 32, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);

result := FMOD_System_CreateSound(system, ‘../../examples/media/drumloop.wav’, FMOD_HARDWARE, nil, sound1);
ErrCheck(result);

result := FMOD_Sound_SetMode(sound1, FMOD_LOOP_OFF);
ErrCheck(result);
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if sound1 <> nil then begin
result := FMOD_Sound_Release(sound1);
ErrCheck(result);
end;
if system <> nil then begin
result := FMOD_System_Close(system);
ErrCheck(result);
result := FMOD_System_Release(system);
ErrCheck(result);
end;
end;

procedure TForm1.btnHardwareClick(Sender: TObject);
begin
result := FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound1, False, channel);
ErrCheck(result);
end;

[/code:1w8ujwqh]

hth

  • You must to post comments
0
0

thanks! but, why the Fmod stop the song after some times i press the button?

sorry my english!

  • You must to post comments
0
0

stop the sound before playing it again….

  • You must to post comments
0
0

was create_stream

  • You must to post comments
0
0

how can i open files in opendialog?

i try :

result := FMOD_System_createStream(system,[color=cyan:3l6k1ksw] opendialog1.filename[/color:3l6k1ksw], FMOD_hardware, nil, sound4);
ErrCheck(result);

dont work!!

  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.