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.
http://www.DelphiGamer.com := for all your Object Pascal game development needs;
- Anonymous asked 16 years ago
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 ?!
- Megelan answered 16 years ago
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…
Stream := TMemoryStream.Create;
FSample := FSOUND_Sample_Load(FSOUND_FREE, PChar(Stream.Memory), FSOUND_NORMAL or FSOUND_LOADMEMORY, Stream.Size);
if FSample <> nil then
Please login first to submit.