Question

I am trying to use the BASS library to do some audio editing, so if anyone is familiar with the library can hopefully help me.

The function I'm using is

Bass.BASS_StreamCreateFile(filename, offset, length, flags);

For a little background, I'm using Bass.net wrapper, am working with all mp3 files. The actual code I'm using this function with is:

int baseStream = Bass.BASS_StreamCreateFile(filename, startTimeBytes, durationBaseBytes, BASSFlag.BASS_STREAM_PRESCAN | BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT);

Whenever the offset (startTimeBytes) equals 0, the stream is created just fine, but whenever the offset is non-zero, the method returns 0, and the error code given is BASS_ERROR_FILEFORM. However, the files used work fine without the offset (offset = 0).

Maybe there is something wrong with the flags I'm using or something?

Was it helpful?

Solution

Your mp3 files contain frames without offset. So use 0 offset.
To set the playback position of a stream use BASS_ChannelSetPosition().

  1. Create a stream with offset = 0;
  2. Translate a time (seconds) position into bytes, based on a channel's format using BASS_ChannelSeconds2Bytes();
  3. Set position with BASS_ChannelSetPosition() and BASS_POS_BYTE mode.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top