I am using BASS to record audio.
The user can then play-back from a user selected position in the recording. The user clicks on a visual representation of the recorded waveform to select an approximate in-point.
So, from the recorded data, I create a Playback stream as follows (for 32 bit):
<PlaybackStream := BASS_StreamCreate(SampleFreq, ChannelCount, BASS_SAMPLE_FLOAT, @PlaybackCallback, Pointer(MemoryStream));>
Play-back is commenced from the stream as follows:
<BASS_ChannelSetPosition(PlaybackStream, Position, BASS_POS_BYTE);>
<BASS_ChannelStart(PlaybackStream);>
The problem is that the calculated In-Point is not always on an exact sample... sometimes just playing shash.
So in order to fix this, I do some maths to do a block align and make sure that the start point (Position) matches the CHANNEL COUNT and BIT DEPTH as follows:
<Position = Position + (Position mod (WaveHeader.NumChans * WaveHeader.BitsPerSamp)>
But on commencing play-back I still seem to get an occasional Left / Right channel reversal which I just don't understand!
Any ideas how can I ensure that I always hit a first byte of a Ch.1 sample when playing back from memory?
Any help much appreciated!