1

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?

David
  • 15,894
  • 22
  • 55
  • 66
Tevis
  • 729
  • 1
  • 12
  • 27
  • Sounds to me like it's letting you specify an offset in a composite file to extract your media file from. Handy for container files that store multiple files in a sequential format. Probably not intended for what you're trying to do with it. Or to paraphrase Fezzik: `I don't think it does what you think it does.` – Corey May 21 '13 at 03:02

1 Answers1

1

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.
Andrey Volk
  • 3,513
  • 2
  • 17
  • 29