0
0

Hi All,
I am having a few problems loading sounds from memory using Delphi/Kylix’s TMemoryStream.

I have tried…
FSOUND_Sample_Load( FSOUND_FREE, PChar( MyMemoryStream.Memory ), FSOUND_NORMAL or FSOUND_LOADMEMORY, MyMemoryStream.Size );

But the sound does not play. If use FSOUND_Sample_Load and load from a file it works fine. Can anyone see whare I have gone wrong? Or alternatively does anyone have a small demo using TMemoryStream that I could look over.

thanks,

Dominique Louis
http://www.DelphiGamer.com := for all your Object Pascal game development needs;

  • You must to post comments
0
0

It works fine using a TMemoryStream as the source. Make sure the contents of the memory stream is correct. Try this code for a test…
<pre>
Stream := TMemoryStream.Create;
try
Stream.LoadFromFile(dlgOpenWav.FileName);
FSample := FSOUND_Sample_Load(FSOUND_FREE, PChar(Stream.Memory), FSOUND_NORMAL or FSOUND_LOADMEMORY, Stream.Size);
finally
Stream.Free;
end;
if FSample <> nil then
FSOUND_PlaySound(FSOUND_FREE, FSample);
</pre>

  • You must to post comments
0
0

Hi there,

I have nearly the same problem.
I used FMUSIC_LoadSongMemory
for a long time successfull. Then
I tried to load a mp3 file with
FSOUND_Stream_OpenFile also from
memory but it does not work correct.
There is a screeezzze sound when it
starts to play and then its like if
the music is forwarded and the song
strarts nearly at the end of the music track. But then he plays with normal speed.
Don’t know what’s wrong with that function cause when I load the song without the parameter (to load it from memory) it works fine. It’s only when I load it from memory ?!

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.