I’m trying to play a MP3 file from a stream. I don’t want to use the FSound_Stream_OpenFile because i don’t want to use file but stream.
I saw the callback function that i should use to do this but i don’t understand what i must put in the buffer?
I’d like to open my MP3 file in a normal stream and then playing the stream with the call back function. This stream can’t be a PFSoundStream but a TMemoryStream (I’m using Delphi 6 ent.)
Thanks for your responses
- Anonymous asked 15 years ago
I guess you mean that you want to stream a file from a server, right?
well in this case just use the path to the file in the server (eg. “\192.168.0.1\file.mp3”). But don’t forget that FMOD does not support yet shoutcast, icecast and relevant stuff.
I hope this will help you
c u laser
I am creating a series of programs which will help me organize my mp3z (you can get an idea in [url:2qljtd5a]http://3base.da.ru[/url:2qljtd5a]). Some times allthough I download some files (eg from ex-AudioGalaxy), although the files are not completed FMOD plays them, and continues to play until the stream is over (ie all currentlydownlaoded bytes are played). If I get some bytes before the stream ends, they will be added and played.
Maybe you should try to save the stream in you disk and then play it through FMOD as a file.
I don’t know if this helps, but the truth is that I do not know EXACTLY what you want to do, and what for.
c u laser
OK, i see what you’re doing in your prog, but what are you doing when new info come, do you had them to the file? Are these new info played as well?
If true, then it’s my solution: making a temporary MP3 file on the disk and then adding infos step by step. 😆
Can you confirm me it’s a good solutions ?
If you use FSOUND_Stream_OpenFile, FMOD does NOT load the file in memory, neither prevents it from writing data to the end of it. So if you download a file for example, or you are generally adding bytes to a stream, FMOD will play them. In other words FMOD plays everything you supply to it. If you can achieve to have the file fully downloaded while FMOD plays it from the beginning you will hear the whole song. What you cannot do, is to rename it while it is playing ;-P
What I am saying you is certain. 😉
c u laser
You still use FSOUND_Stream_OpenFile, but you tell it that the file is in memory by using the FSOUND_LOADMEMORY flag. For example
function PlayFromMemory(Stream: TMemoryStream): PFSoundStream;
Result := FSOUND_Stream_OpenFile(Stream.Memory, FSOUND_2D or FSOUND_LOADMEMORY, Stream.Size);
This way you can populate the stream in whatever way you want and play it.
Thanks for your response.
But, if my stream is not completly full, will it work ?
IE, my stream will be filled progressively, I know the size but when i pass the stream to the FSOUND_Stream_OpenFile function, my stream isn’t full.
Will i be able to fill my stream while the music is playing ?
Please login first to submit.