0
0

Hi,

FMUSIC_StopSong() just won’t work for me. (FMOD 3.74)
I am sure Im using the right FMUSIC Module Name as Parameter, it just won’t stop.
I am now using the FMUSIC_FreeSong() function, but that slows my application down a lot, because I need to load the files to play everytime again after I clicked my “Stop” Button.

Is this a known issue or am I the only one?

  • You must to post comments
0
0

This is probably something in your code, either post it here, or better try ro find out what it is.
Try for example creating a plain simple program which loads a song and can be stoppen by pressing a button. No more.
If you don’t have the problem there, it is something in your code.

  • You must to post comments
0
0

I already tried that. Futhermore I noticed that the Examples that are coming with the FMOD zip File also use FreeSong() for Stopping Playback.

  • You must to post comments
0
0

Well, here are excerpts of my code, which means all parts which include FMOD commands:

(Error Warnings are in german, sorry. But they wont matter)

I am intializing the following FMOD component:

[code:2hwlh73u]
var

FMODPlayer: PFMusicModule;

[/code:2hwlh73u]

On FormCreate I do

[code:2hwlh73u]
FMOD_Load(nil);
InitAudio;
[/code:2hwlh73u]

InitAudio looks like this:

[code:2hwlh73u]
procedure TFrmMain.InitAudio;
begin
if FMOD_VERSION > FSOUND_GetVersion then
begin
Showmessage(’Error: falsche Version’);
Exit;
end;

//Sets up the soundsystem output mode.
if not FSOUND_SetOutput(FSOUND_OUTPUT_WINMM) then
begin
Showmessage(’Error: Fehler bei FSOUND_SetOutput’);
Exit;
end;

if not FSOUND_SetDriver(0) then
begin
Showmessage(’Error: Fehler bei FSOUND_SetDriver’);
Exit;
end;

if not FSOUND_Init(24000, 4, 0) then
begin
Showmessage(’Error! Initializing ‘ + FMOD_ErrorString(FSOUND_GetError()));
Exit;
end;
end;
[/code:2hwlh73u]

then I load different songs depending on what entries are selected in a treenavview via:

[code:2hwlh73u]
case AIndexNav of

2: begin
// ShowMessage(’Audio zugewiesen’);

  FMODPlayer := FMusic_LoadSong('media\atomic.fsb');
  if FMODPlayer = nil then
    begin
     MessageDlg('failed to load music', mtError, [mbOk], 0 );
    exit;
    end;
  end;

[/code:2hwlh73u]

then the Song is played and stopped by the following procedures

[code:2hwlh73u]
procedure TFrmMain.SpdBtnAudioPlayClick(Sender: TObject);
begin

FMusic_PlaySong(FMODPlayer);

SpdBtnAudioPlay.Enabled := false;
SpdBtnAudioStop.Enabled := true;

Audioplaying := True;

end;

procedure TFrmMain.SpdBtnAudioStopClick(Sender: TObject);
begin
SpdBtnAudioPlay.Enabled := true;
SpdBtnAudioStop.Enabled := false;
AudioPlaying := False;
FMUSIC_StopSong(FMODPlayer);
SetAudioFile;

end;
[/code:2hwlh73u]

Only stopping won’t work.

I would be really thankful for any comments or help!

Jan

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.