Author Topic: BASS_ChannelGetPosition  (Read 147 times)

Ed1966

  • Posts: 230
BASS_ChannelGetPosition
« on: 12 Dec '22 - 11:36 »
Hello

Problem the 10th and 100th through the STREAM and STREAM through MIXER.
That is not correct.
I want to read out the stream in the MIXER.
Not the position of the stream in the mixer.

Sample:

Code: [Select]
function TfrmMainForm.UpdateTimeLoopStream: string;
var
  CurrentBytes: Cardinal;
  PlayingTime: Double;
  bHours, bMinutes, bSeconds, bFractions: Cardinal;
begin
  CurrentBytes := BASS_ChannelGetPosition(DefaultStream, BASS_POS_BYTE);
  PlayingTime := BASS_ChannelBytes2Seconds(DefaultStream, CurrentBytes);
  AT_BASSSec2TimeExt(BASSDoubleToCardinal17(PlayingTime), bHours, bMinutes, bSeconds, bFractions);
  Result := Format('%.2d:%.2d.%.2d', [bMinutes, bSeconds, bFractions]);
end;

// GOOD:
DefaultStream := BASS_StreamCreateFile(False, PChar('Andy Gibb - Desire.mp3'), 0, 0, BASS_SAMPLE_FLOAT or BASS_UNICODE);
BASS_ChannelPlay(DefaultStream, False);
// TIMER: UpdateTimeLoopStream

// STRANGE 10e fractions
DefaultStream := BASS_StreamCreateFile(False, PChar('Andy Gibb - Desire.mp3'), 0, 0, BASS_SAMPLE_FLOAT or BASS_STREAM_DECODE or BASS_UNICODE);
MixerStream := BASS_Mixer_StreamCreate(44100, 2, BASS_UNICODE or BASS_SAMPLE_FLOAT);
BASS_Mixer_StreamAddChannel(MixerStream, DefaultStream,  BASS_MIXER_CHAN_BUFFER or BASS_MIXER_CHAN_NORAMPIN);
BASS_ChannelPlay(MixerStream, True);
// Timer: UpdateTimeLoopStream


This is working but I don't want that?
Code: [Select]
CurrentBytes := BASS_Mixer_ChannelGetPosition(DefaultStream, BASS_POS_BYTE);
PlayingTime := BASS_ChannelBytes2Seconds(DefaultStream, CurrentBytes);

Maybe some help or is this not possible?

Regards,
Eduard.

Chris

  • Posts: 2115
Re: BASS_ChannelGetPosition
« Reply #1 on: 12 Dec '22 - 13:43 »
Maybe you are searching about this ?
BASS_Mixer_ChannelGetPosition

Ian @ un4seen

  • Administrator
  • Posts: 24940
Re: BASS_ChannelGetPosition
« Reply #2 on: 12 Dec '22 - 13:57 »
BASS_ChannelGetPosition will give you the decoding position and BASS_Mixer_ChannelGetPosition will give you the heard position (which is a bit behind due to buffering). If you want neither of those things then please explain a bit more about what you do want.

Ed1966

  • Posts: 230
Re: BASS_ChannelGetPosition
« Reply #3 on: 14 Dec '22 - 05:30 »
I know enough. I used this to display the time (00:00.00). So I didn't get the correct 10th and 100th seconds with BASS_ChannelGetPosition.
I'm using BASS_Mixer_ChannelGetPosition and BASS_ChannelGetPosition interchangeably so I need to do some rewriting.

Greetings,
Eduard.