Module xStreamPos
This class can track playback progression in a song.
How to use
Create an instance, and supply it with a steady flow of song-position changes (idle loop).
Functions
__init () | [Constructor] does not accept any arguments |
start (playmode) | Start streaming - preferable to calling renoise transport.start() |
reset () | [Class] Initialize position - called as a last resort, when current position is deemed unreliable due to 'crazy navigation' |
_set_pos (pos) | [Class] Update the stream-position as a result of a changed playback position. |
update () | [Class] This function is designed to be called in an idle loop |
get_scheduled_pos (schedule) | return a buffer position which correspond to the desired schedule |
attach_to_song () | [Class] Call when a new document becomes available |
determine_writeahead () | [Class] Decide the writeahead amount, depending on the song tempo |
Fields
self.playpos | (xPlayPos) precise playback position |
self.pos | (SongPos) the current stream position |
self.xinc | number, represents the total number of lines since streaming started |
self.block_enabled | bool, track changes to loopblockenabled TODO refactor into xBlockloop |
self.just_started_playback | number, 0 for 'false' this is a short-lived timestamp indicating that we should ignore changes to the playback position, right after playback has started (the fuzziness is due to API living in separate thread) |
self.callback_fn | function, define a function to call when it's time for output |
self.refresh_fn | function, called when we need fresh content (i.e. |
Functions
- __init ()
- [Constructor] does not accept any arguments
- start (playmode)
-
Start streaming - preferable to calling renoise transport.start()
Parameters:
- playmode , renoise.Transport.PLAYMODE
- reset ()
- [Class] Initialize position - called as a last resort, when current position is deemed unreliable due to 'crazy navigation'
- _set_pos (pos)
-
[Class] Update the stream-position as a result of a changed playback position.
Most of the time the stream progresses smoothly forward - however, we also look for
'user events', changes which can cause the position to jump anywhere...
Parameters:
- pos (renoise.SongPos), the current playback position
- update ()
- [Class] This function is designed to be called in an idle loop
- get_scheduled_pos (schedule)
-
return a buffer position which correspond to the desired schedule
Parameters:
- schedule , xStreamPos.SCHEDULE
Returns:
-
SongPos,int (lines travelled)
[[ - attach_to_song ()
- [Class] Call when a new document becomes available
- determine_writeahead ()
- [Class] Decide the writeahead amount, depending on the song tempo
Fields
- self.playpos
- (xPlayPos) precise playback position
- self.pos
- (SongPos) the current stream position
- self.xinc
- number, represents the total number of lines since streaming started
- self.block_enabled
- bool, track changes to loopblockenabled TODO refactor into xBlockloop
- self.just_started_playback
- number, 0 for 'false' this is a short-lived timestamp indicating that we should ignore changes to the playback position, right after playback has started (the fuzziness is due to API living in separate thread)
- self.callback_fn
- function, define a function to call when it's time for output
- self.refresh_fn
- function, called when we need fresh content (i.e. when the position has been changed by the user, and previously produced content no longer would be valid...)