25 May '13 - 04:00 *
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: Set length of HSTREAM or HTEMPO  (Read 378 times)
SpiritBoy
Posts: 4


« on: 28 May '12 - 15:11 »
Reply with quoteQuote

I have an HTEMPO handle already loaded, and I want to change it's length to something else (e.g. play 500ms out of 1500ms).
My question is how do I accomplish this with streams? It's fairly straightforward with samples, but I haven't managed to find such thing with streams.
Logged
Ian @ un4seen
Administrator
Posts: 15276


« Reply #1 on: 28 May '12 - 16:08 »
Reply with quoteQuote

If you would like to end a stream early, you can do so via a "mixtime" BASS_SYNC_POS sync, something like this...

BASS_ChannelSetSync(stream, BASS_SYNC_POS|BASS_SYNC_MIXTIME, endpos, EndSyncProc, 0); // set a mixtime POS sync at the end position

...

void CALLBACK EndSyncProc(HSYNC handle, DWORD channel, DWORD data, void *user)
{
BASS_ChannelStop(channel); // end the stream
}
Logged
SpiritBoy
Posts: 4


« Reply #2 on: 29 May '12 - 18:27 »
Reply with quoteQuote

Thanks! That works, but I think I have a different problem related to that.
Basically I -think- (And do correct me if this is an irregular behavior) that if my length is longer than the specified string it 'pushes' the sound - e.g. if I my length is 2000ms and the sound I want to play is 1500ms long, the sound will start 500ms after I played him.
If I'm correct, how can I check a stream size or length?
I'm sorry if these questions seem stupid sometimes - First time working with bass and music files in general.

Scratch that, even smaller lengths proved to be problematic. I'll come back here if I manage to solve the problem.
« Last Edit: 29 May '12 - 22:08 by SpiritBoy » Logged
Ian @ un4seen
Administrator
Posts: 15276


« Reply #3 on: 30 May '12 - 13:15 »
Reply with quoteQuote

If the BASS_SYNC_POS sync is set beyond the stream's normal length, then it will never be triggered as the stream will never reach the sync's position, ie. playback will end at the normal length. You can get the stream's normal length from BASS_ChannelGetLength.

Be sure to set the sync (via BASS_ChannelSetSync) before you start playback (via BASS_ChannelPlay), as afterwards may be too late with very short files.
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines