23 May '13 - 03:33
Pages: [1]
 Author Topic: Getting new length after tempo change  (Read 592 times)
dkardell
Posts: 8

 « on: 22 Mar '11 - 21:49 » Quote

After applying a tempo change to a stream, how can I determine the new playback time of the stream?  GetLength seems to still return the actual size of the stream, not the modified one.

I'm sure I'm just missing a flag or a call.

 Logged
AName
Posts: 20

 « Reply #1 on: 22 Mar '11 - 23:31 » Quote

I didn't even know you can apply a tempo change to a stream (I thought it was only for a channel, or is that what you meant?), but it seems like simple math to me:

Your stream's original playback is X - then you speed it up Y%. Wouldn't it then be (1-Y) * X, or if you slowed it down by Y% then wouldn't it would be (1+Y) * X?

For example, if the stream's original playback time is 500 and you make it 20% faster, then the playback time would be (100%-20%) * 500 = 80% * 500 = 400.

I apologize in advance if I'm wrong.
 Logged
Chris
Posts: 1507

 « Reply #2 on: 23 Mar '11 - 09:43 » Quote

Hi
here an short example (The return Value is in ms)

function PlayLength(Channel:HStream) int64;
begin
result := 0;
if Channel = 0 then
exit;
Result := round(1000 * BASS_ChannelBytes2Seconds(channel,BASS_ChannelGetLength(Channel)) / (BASS_FX_TempoGetRateRatio(Channel)));
end;
Chris
 Logged
Pages: [1]