0
0

Hello @all,

I have until now use bass.dll and want now use fmod ex. Some days ago I was able to play a mp3 with fmod, but today I can’t it. See somebody of you my mistake, because he say:

[quote:2aemfk7o]—————————

FMOD – Error

FMOD error! – Operation could not be performed because specified sound is not ready.

OK

[/quote:2aemfk7o]

[code:2aemfk7o] TPlayer = class(TObject)
private
FSystem : Pointer;
FChannel1 : Pointer;
FChannel2 : Pointer;
FSound : Pointer;
...

//——————————————————————————
//–TPlayer–

//public
constructor TPlayer.Create;
begin
FMOD_System_Create(FSystem);
FMOD_System_Init(FSystem, 2, FMOD_INIT_NORMAL, nil);
FMOD_System_SetStreamBufferSize(FSystem, 65536, FMOD_TIMEUNIT_RAWBYTES);
FChannel1:=nil;
FSmallPlayer:=TSmallPlayer.Create;
end;

destructor TPlayer.Destroy;
begin
FSmallPlayer.Free;
if FSound<> nil then FMOD_System_Release(FSound);
if FSystem <> nil then
begin
FMOD_System_Close(FSystem);
FMOD_System_Release(FSystem);
end
end;

procedure TPlayer.TogglePlayState;
var
Playing: LongBool;
begin
FMOD_Channel_GetPaused(FChannel1, Playing);
if Playing then //Pause
else Play;
end;

procedure TPlayer.Play;
var
Node: PVirtualNode;
Data: PVSTMusicInfo;
Return: FMOD_RESULT;
begin
Node:=MainForm.PlayListVST.GetFirstSelected;
if Node=nil then Node:=MainForm.PlayListVST.GetFirst;
Data:=MainForm.PlayListVST.GetNodeData(Node);
Return:=FMOD_System_CreateSound(FSystem,
PAnsiChar(AnsiString(Data.MusicInfo.Strs[StrsFileFolder]+Data.MusicInfo.Strs[StrsFileName])),
FMOD_HARDWARE or FMOD_2D or FMOD_CREATESTREAM or FMOD_NONBLOCKING,
nil,
FSound);
Return:=FMOD_System_PlaySound(FSystem, FMOD_CHANNEL_FREE, FSound, false, FChannel1);
if Return<>FMOD_OK then
begin
Application.MessageBox(PAnsiChar(’FMOD error! – ‘ + FMOD_ErrorString(Return)), ‘FMOD – Error’, 16);
end;[/code:2aemfk7o]

For me it is also mysterious, that this errormessage is not written in the unit fmoderrors.

SunBlack

  • You must to post comments
0
0

Looks like your path to the file is wrong somewhere. Do a showmessage on the treeview or whatever you are using to check the file’s path

that’s what that error message applies to anyway….

kimB

  • You must to post comments
0
0

No, the file exists. I have test with the delphi debugger and my WMP 9 can play this url ;).

[code:3ipasyig]...
StrsFileName = 11;
StrsFileFolder = 12;
...

type
TMusicInfo = record
Strs: array[0..Strs ] of WideString;
...
end;[/code:3ipasyig]

  • You must to post comments
0
0

whats the url?

  • You must to post comments
0
0

It’s a local file like in the netstream demo, where you can use local files and internetstreams.

  • You must to post comments
0
0

Hmm, I think maybe there are some new issues with net streaming

In the c++ Netstream example:

FMOD_Channel_SetMute() is throwing a parameter error, commenting it out fixes it although obv now doesn’t mute if the buffer is starving.

Playsound is not accepting urls although it will accept a local path i.e.

http://myserveraddess/mytest.mp3 throws a ‘could not seek’ error

C:\mylocalserver\mytest.mp3 – plays fine …. it’s the same mp3 file.

So I didn’t get the same error as you although there definitely is a new issue there.

Delphi and VB throw the same error.

kimB

  • You must to post comments
0
0

You’re opening the sound with the NONBLOCKING flag which means the open function will return immediately instead of waiting for the sound to finish loading. That means that when the playsound call executes the sound will not be guaranteed to have finished loading. The error message is telling you this.

Either take off the NONBLOCKING flag or put in code to wait until it is ready to play. (If you don’t want to spend the time to write some proper code to check the ready state, just try a Sleep(500) or something like that)

  • You must to post comments
0
0

thx, now it playing again :). But why it work with this parameter in the C#-Demo?

  • You must to post comments
0
0

[quote="SunBlack":1o360xnn]thx, now it playing again :). But why it work with this parameter in the C#-Demo?[/quote:1o360xnn]Either dumb luck (perhaps the call takes long enough to allow it to succeed) or a slight difference between the C# demo and your code, most likely.

  • You must to post comments
Showing 8 results
Your Answer

Please first to submit.