0
0

A big problem using FMOD.
I have a PDA with Windows Mobile 5.0 and want to write some kind of simple mp3 player (load-play-pause-unpause-stop).
Now wrote some simple app using testbed.dpr (cleared :) the code until it had only this functions). In Delphi 5 under Windows XP all works fine (fmod.dll).

Now using FreePascal (ppcrossarm) I set up the FMOD_DLL=fmodce.dll and recompiled the project in -Mdelphi mode.
All message output is directed to file.
So, if opening WAV or MP3 the program starts normally, waits 10 seconds and stops. No errors are in log file, no sound in the speaker, even no clap at start. At the same time GSplayer and Windows player work fine.
When opening WMA file the ony error I saw is "Unknown file format".

What should I do?

[code:ert6av2a]program fmdemo;

uses
Windows,
messages,
SysUtils,
FMOD, fmodtypes, fmoderrors;

var
FSongsModule : PFMusicModule;
FSongsStream : PFSoundStream;
FSongsPlaying : Boolean;
FSongsChannel : integer;
f:text;

procedure xloadsong(fn:string);
var
Module: PFMusicModule;
Stream: PFSoundStream;
begin
Stream := nil;
Module := FMUSIC_LoadSong(PChar(fn));
if Module = nil then
begin
Stream := FSOUND_Stream_Open(PChar(fn), FSOUND_NORMAL or FSOUND_LOOP_NORMAL, 0, 0);
end;

 if (Module = nil) and (Stream = nil) then
 begin
    writeln(f,'*LOAD ERROR:',FMOD_ErrorString(FSOUND_GetError));
 end;

  if Module <> nil then
  begin
    FMUSIC_SetMasterVolume(Module, 255);
    if (FMUSIC_GetType(Module) = FMUSIC_TYPE_MOD) or (FMUSIC_GetType(Module) = FMUSIC_TYPE_S3M) then
      FMUSIC_SetPanSeperation(Module, 0.15);  // 15% crossover
  end;

  FSongsModule := Module;
  FSongsStream := Stream;
  FSongsPlaying := False;

end;

procedure play;
begin
FSOUND_SetPan(FSongsChannel, FSOUND_STEREOPAN);
FSOUND_SetVolume(FSongsChannel, 255);
FMUSIC_SetMasterVolume(FSongsModule, 255);
if FSongsModule <> nil then
begin
FSongsPlaying := FMUSIC_PlaySong(FSongsModule);
writeln(f,’Play song error: ‘,FMOD_ErrorString(FSOUND_GetError));
end
else if FSongsStream <> nil then
begin
FSongsChannel := FSOUND_Stream_Play(FSOUND_FREE, FSongsStream);
FSongsPlaying := FSongsChannel >= 0;
if not FSongsPlaying then
begin
writeln(f,’
Play stream error: ‘,FMOD_ErrorString(FSOUND_GetError));
end
else
begin
FSOUND_SetPan(FSongsChannel, FSOUND_STEREOPAN);
FSOUND_SetVolume(FSongsChannel, 255);
end;
end;
end;

procedure stop;
begin
if FSongsModule <> nil then FMUSIC_StopSong(FSongsModule) else
if FSongsStream <> nil then FSOUND_Stream_Stop(FSongsStream);
FSongsChannel := -1;
FSongsPlaying := False;
end;

procedure initall;
begin
FMOD_Load(nil);
if FMOD_VERSION > FSOUND_GetVersion then
begin
writeln(f,’*Version mismatch’);
Halt;
end;
{ Initialize FSOUND }
//FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND);
//FSOUND_SetDriver(0);
//FSOUND_SetMixer(FSOUND_MIXER_QUALITY_AUTODETECT);

 try
    if not FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND) then writeln(f,'*FSOUND_SetOutput failed');
    if not FSOUND_SetDriver(0) then writeln(f,'*FSOUND_SetDriver failed');
    if not FSOUND_SetMixer(FSOUND_MIXER_QUALITY_AUTODETECT) then writeln(f,'*FSOUND_SetMixer failed');
 except
writeln(f,'*init exception');
 end;

 if not FSOUND_Init(22050, 128, 0) then
 begin
writeln(f,'*init error ',FMOD_ErrorString(FSOUND_GetError));
      Halt;
 end;

end;

procedure unloadall;
begin
FMUSIC_StopAllSongs();
if FSongsModule <> nil then
begin
FMUSIC_FreeSong(FSongsModule);
end
else if FSongsStream <> nil then
begin
FSOUND_Stream_Stop(FSongsStream);
FSOUND_Stream_Close(FSongsStream);
end;
FMOD_Unload;
end;

begin
assign(f,’\My Documents\appwav\tex2.txt’);
rewrite(f);
writeln(f,’Hello world’);
initall;
writeln(f,’Initialized’);
// xloadsong(’\My Documents\appwav\cod.mp3’);
xloadsong(’\tst1.wav’);
writeln(f,’song loaded’);
play;
writeln(f,’Play started’);
sleep(5000);
stop;
writeln(f,’stopped’);
unloadall;
writeln(f,’Unloaded’);
close(f);
end.[/code:ert6av2a]

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.