Einzelnen Beitrag anzeigen

Benjin

Registriert seit: 1. Nov 2004
Ort: München
64 Beiträge
 
Delphi 7 Enterprise
 
#1

Problem mit FMODs FMUSIC_StopSong()

  Alt 25. Mär 2005, 15:32
Hallo, bei mir wll FMUSIC_StopSong() einfach nicht funktionieren. Es gibt keine Fehlermeldung oder sonstiges, es passiert beim klicken auf den entsprechenden Button einfach nichts.
Ich benutze fsb Dateien, die jeweils eine mp3 Datei enthalten und auch ohne Probleme abgespielt werden.

Ich habe das Problem bereits im FMOD Forum gepostet, deswegen hier einfach ein repost des Problems und des Sourcecodes:

Zitat:
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:

Delphi-Quellcode:

var

FMODPlayer: PFMusicModule;



On FormCreate I do

Delphi-Quellcode:

  FMOD_Load(nil);
  InitAudio;
InitAudio looks like this:

Delphi-Quellcode:

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;
then I load different songs depending on what entries are selected in a treenavview via:

Delphi-Quellcode:

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;

then the Song is played and stopped by the following procedures


Delphi-Quellcode:

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;
Only stopping won't work.


I would be really thankful for any comments or help!

Weiß da jemand Rat?
..... - Kurt - .....
  Mit Zitat antworten Zitat