23 May '13 - 03:33 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: Getting new length after tempo change  (Read 592 times)
dkardell
Posts: 8


« on: 22 Mar '11 - 21:49 »
Reply with quoteQuote

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 »
Reply with quoteQuote

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 »
Reply with quoteQuote

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]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines