Author Topic: delphi: How to use the BASS_StreamCreateFileUser Method?  (Read 94 times)


  • Posts: 6
STREAMFILE_BUFFERPUSH: The first thing to note is that BASS_StreamPutFileData(Int32, IntPtr, Int32) needs a stream handle. You don't have that until the BASS_StreamCreateFileUser(BASSStreamSystem, BASSFlag, BASS_FILEPROCS, IntPtr) call returns, so some other way is needed for BASS to get the inital file data that it uses to detect the format/etc. That other way is the FILEREADPROC. After the stream has been created, the FILEREADPROC is never called again, and the remaining file data is fed to the stream via BASS_StreamPutFileData(Int32, IntPtr, Int32). E.g. a function receiving the data from the Internet would need to buffer the received data until the stream has been created, at which point it can start using BASS_StreamPutFileData(Int32, IntPtr, Int32) instead. The FILEREADPROC would read data from that buffer, and wait for the data to arrive if necessary. After the stream has been created, any buffered data that's remaining should be fed to the stream, before starting to feed newly arriving data. You'll need some synchronization (eg. a mutex) to enforce that order of things. Something like this (pseudo-code):