0
0

Can someone help me?
I need to know what do they mean when it says :
Pointer to the song to set channel/volume optimization settings.
How do you program a pointer to a song????

Is it in TYPE
……
or in
Var
….

Do you do something like this :

aaaa = ^song;
song: string;

Please Help me!!!!!!!!!!!!!

  • You must to post comments
0
0

Your doing the same thing with the repeat statement, assigning playing to true until the songs is finished then making it false.

I use a timer, and I look for the Position to equal the count of either frames or time depending on the type of song being played, stream or music module.

Either way, you’ll need some kind of routine to check and see if the end has been reached.

  • You must to post comments
0
0

Take a look at the Delphi FMOD testbed application. It can play songs in a playlist sequence.

  • You must to post comments
0
0

Do you know how to use FSound_SetEndCallback;

I managed to do my plylist with the timer, but i would like to know if it is possible to do it with FSound_SetEndCallback;

In fact, i’m not sure that i really understand what is this function or how you use it;

If Someone could help me….

  • You must to post comments
0
0

ok, but it i am doing it in a console mode wich is not the same, do i need to use Callbacks functions

  • You must to post comments
0
0

I have never used this callback, although I have used callbacks. The only thing I can recommend is that you play around with any sample code you can get.

If you want to see my code for a callback to get waveform data to create an oscilloscope, you can download it here :

http://members.shaw.ca/nitebeast/files/FullResScope.zip

This is a CPU intensive example since it graphs 512 values every 25ms but you will be able to see what I have done. I do believe I commented everything that was relevant.

So there it is, you should be able to get an idea of how to use callbacks. One note though, my callback gets called with every update of the buffer, SetEndCallback will only be called once, at the end of a song.

Hope this helps.
๐Ÿ˜†

  • You must to post comments
0
0

ok, but it i am doing it in a console mode wich is not the same, do i need to use Callbacks functions

  • You must to post comments
0
0

The types are already declared in fmod.pas. Declare a variable of the required type, use it to store the value returned by the various Open functions, and pass it in to the various functions that require a pointer to the song. Take a look at the samples for an example of how it is done.

  • You must to post comments
0
0

Use a StringList. I use one for my player, and you could easily read from a text file that has the paths to the songs or samples or whatever you want to play. I would recommend using a Quoted String though. If you try to load a file with an apostrophe in it you could get into trouble.

Take an MP3 located and named as such :

C:MP3Some Silly Lil’ Song.mp3

As a Quoted Str (QuotedStr(String) is the function) would be :

‘C:MP3Some Silly Lil”’ Song.mp3′

And when you load it, use AnsiDeQuotedStr(String,Char); or:

AnsiDeQuotedStr(‘C:MP3Some Silly Lil”’ Song.mp3′,#39);

39 is the ASCII for the Apostrophe. Using this eliminates most file not found and related errors.

Hmm… Kinda went on a tangent there… Use a StringList though, very easy just remember to Create and Free it where needed.

Also, you shouldn’t need to use Callbacks to find the end of a song, use FSOUND_IsPlaying or FMusic_IsPlaying. They return boolean TRUE if a song is playing.

Hope this helps.

:smile:

  • You must to post comments
0
0

Thank you.

I’ve got another question, maybe a little stupid, but

What does it mean when you stream a song; what is the aim of doing this?? is a stream a song , a .mp3 or another thing like this!

  • You must to post comments
0
0

Thank you but here is what i used for my playlist, it is working when i run it alone , but while running a game at the same time, it occurs an error because of this call:

repeat
PlayList[i+2].play := true;
until FSound-IsPlaying(i)= false);

procedure SoundMusicPlay(i: integer); // always put i to 0

begin
SoundPlaySound(PlayList[i+1].titre,i);
repeat
PlayList[i+2].jouer := true;
until (FSound_IsPlaying(i)= false);

if (Fsound_IsPlaying(i) = false) and (PlayList[i+2].jouer = true) then
begin
SoundMusicPlay(i+1);
end;
end;

function SoundMusicQueue(filename: PChar): boolean;

var
i:integer;
begin
i := 1;
while (Playlist[i].titre <> ”) or (PlayList[i].jouer = true) do
i := i + 1;
if (PlayList[i].titre = ”) then
begin
PlayList[i].titre := filename;
end;
result := true;
end;

function SoundLoadSound(filename: PCHAR): boolean;

begin
stream := FSOUND_Stream_OpenFile(filename,FSOUND_NORMAL, 0);
if stream = nil then
begin
writeln(false);
writeln(FMOD_ErrorString(FSOUND_GetError()));
FSOUND_Close();
exit;
end
else
writeln(true);
//writeln(FSOUND_Stream_GetTime(stream));
writeln(FSOUND_Stream_GetLengthMs(stream));
end;

And the problem is that when i’m running the game with SoundMusicPlay(0), It stops because of the repeat-until so i have to find another way to program this and to make my playlist.

Please give me some new advices

  • You must to post comments
0
0

Think of a computer stream like an actual water stream, or river. Information flows from one point to another, but not all at once.

A computer stream flows from one location to another. When ever you download a file your are using a type of stream. If you listen to any kind of online music that is a stream.

As far as FMOD goes (And I hope I’m not wrong on this) when you open a file (MP3 say) you are setting the start and end points, but not reading all the data yet. Once you start to play the song, a stream of data relating to that songs passes through FMOD and then into the soundcard.

I none stream would be like a document, where you load the entire file into memory.

Hope this helps.
:smile:

  • You must to post comments
0
0

here are the others procedures and functions:

const
MAX = 15;

type
TSon = record
titre: PChar;
jouer: boolean;
end;

PSmallInt = ^SmallInt;

var
PlayList: array [1..Max] of Tson;
samp1: PFSoundSample;
stream: PFSoundStream;
Channel: integer;
listdriv: TFSoundOutputTypes;

function SoundPlaySound(filename: PChar;chann: integer): boolean;

begin
FSOUND_SetPaused(chann , False);
channel := FSOUND_Stream_Play(chann,FSOUND_Stream_OpenFile(filename,FSOUND_NORMAL, 0));
writeln(FSOUND_Stream_GetLengthMs(FSOUND_Stream_OpenFile(filename,FSOUND_NORMAL,0)));
if channel < 0 then
begin
writeln(FMOD_ErrorString(FSOUND_GetError()));
readln;
FSOUND_Close();
exit;
end;
end;

  • You must to post comments
0
0

To answer the oher part of your question :

You would stream a song or any file when you only need a samll amount of the data immediatley. There is no sense in loading a HUGE file into memory when at any one time you are only using a small amount of the entire thing. So we stream it.

Keep in mind that the term “Stream” changes in context each time it is used to describe something. In FMOD it is a true stream, in Delphi me have FileStreams, MemoryStreams, BlobStreams, etc. Each of which is a stream but in a different context.

  • You must to post comments
0
0

when i run it , ido something like this

Sound_Init; // i already have the procedure.

SoundMusicQueue(‘name.mp3’);
SoundMusicQueue(‘name1.mp3’);

SoundMusicPlay(0);
this works alone but not in a game because of the repeat-until in SoundMusicPlay

  • You must to post comments
0
0

Tahnk you so much.

I have a lot of questions like this, like what is a buffer, how do you use it, what is a callback and how you use it.

Could someone give me a real procedure or function in Delphi that loads a song, sterams it and plays it????

That would be so nice. Thank you in advance

  • You must to post comments
0
0

Could someone please answer me?

  • You must to post comments
0
0

Here you go:

Buffer – A buffer is a segment of active memory used to hold information (data), in the case of FMOD, the buffer is sort of variable that can be accessed by your program. The buffer for FMOD holds the actual data that makes up a song or sound. I believe it is an array of floating point numbers from -32767 to +32768, making it 16 Bit (65535 numbers). From this buffer, you can create a callback to analyse or “sample” the buffer. The buffer is a stream and is ever changing.

Callback – A callback is a routine you add into your program to “sample” or grab the buffer. From here you can do some manipulation on the buffer and then send it ons its way back toward the soundcard. You HAVE to return the buffer to the chain for everything to work. I recently (month or two ago) did up my first callback with FMOD in the form of an oscilloscope of the waveforem data. Check the other messages to find it. Its for Delphi. In it’s truest sense, I liken a callback to a small program that the FMOD dll runs along with its own functions. However you write the program for FMOD to run. Very cool stuff!

As for your last question, when you downloaded the FMOD zip you also received some sample source code, the TestBed is an excellent example of using FMOD. I based my first work on the TestBed and it taught me alot. Also, absorb every particle of information you can find through the API documentation, I have it open whenever I’m coding with FMOD.

So there you go.
:smile:

  • You must to post comments
0
0

For myself, I try to stay away from Repeat statements. I try my best to avoid a possible unterminating loop.

I would recommend using a timer and for the event set somethis like this :

If FSound_IsPlaying(i)= True then
PlayList[i+2].play := true
else
Begin
PlayList[i+2].play := False;
// Do code here needed to account for the end of a sound
SoundMusicPlay(i+1);
PlayList[i+2].play := true;
end;

there. By using the timer, you are letting other functions work as well since it should be on its own thread.

I’m guessing this is what is going on, that the game won’t work because it is not given then chance to do its own code. Let me stress that fact “I’m Guessing!” since I can’t see exactly what you are doing.

I can’t see trying to set a boolean to true in a repeat statement causing an error, but I suppose it is possible.

Hope this helps.

๐Ÿ˜†

  • You must to post comments
0
0

thank you

  • You must to post comments
0
0

I am worry that for the timer i’ll be forced to do a repetition to seek for the enf of a song. in fact, i will use something like

FSound_Stream_GetLengthMs
and I will only call SoundPlaySound(i+1) when timer > FSound_Stream_GetlengthMs

  • You must to post comments
Showing 1 - 20 of 21 results
Your Answer

Please first to submit.