TransportManager
index
/home/david/Projects/Jokosher/trunk/Jokosher/TransportManager.py

#       THIS FILE IS PART OF THE JOKOSHER PROJECT AND LICENSED UNDER THE GPL. SEE
#       THE 'COPYING' FILE FOR DETAILS
#
#       TransportManager.py
#       
#       This class handles the current cursor position and the gstreamer
#       bits for rewinding, fast forwarding and seeking.
#       
#
#-------------------------------------------------------------------------------

 
Modules
       
gobject
gst
pygst

 
Classes
       
Monitored.Monitored
TransportManager

 
class TransportManager(Monitored.Monitored)
    This class handles the current cursor position and the gstreamer
bits for rewinding, fast forwarding and seeking.
 
  Methods defined here:
Forward(self, turnOn)
Called when fast forward button is
        a) pressed - turnOn = True
        b) released - turnOn = False
        
Parameters:
        turnOn -- state of the fast forward button.
GetPosition(self)
Obtain the current playhead position.
 
Returns:
        the current playhead cursor position.
GetPositionAsBarsAndBeats(self)
Obtain the current position in bars, beats and ticks.
 
Returns:
        tuple of the current position as (bar, beats, ticks).
GetPositionAsHoursMinutesSeconds(self)
Obtain the current position in hours, minutes and seconds.
 
Returns:
        tuple of the current position as (hours, minutes, seconds, milliseconds).
OnUpdate(self)
The timeout callback - called every 1/FPS to move the 
playhead display on.
 
Returns:
        True -- pipeline is playing, keep calling this method.
        False -- pipeline is paused or stopped, stop calling this method.
Pause(self)
Pause the playback.
Play(self, newAudioState)
Called when play button has been pressed (or whilst exporting
in which case, newAudioState will be set to AUDIO_EXPORTING).
 
Parameters:
        newAudioState -- new audio state to set the Project to.
QueryPosition(self)
Reads the current playhead cursor position by querying pipeline.
Reverse(self, turnOn)
Called when rewind button is
        a) pressed - turnOn = True
        b) released - turnOn = False
        
Parameters:
        turnOn -- state of the rewind button.
SeekTo(self, pos)
Performs a pipeline seek to alter position of the playhead cursor.
 
Parameters:
        pos -- position to place the playhead cursor.
SetMode(self, mode)
In most cases, for undo compatibility, use Project.SetTransportMode().
 
Parameters:
        mode -- new transport mode to be set.
SetPosition(self, pos)
Change the current position variable.
 
Considerations:
        Calls StateChanged to trigger response on all classes
        that are listening to this object.
 
Parameters:
        pos -- new playhead cursor position.
StartUpdateTimeout(self)
Starts the timeout that will control the playhead display.
Stop(self)
Stops the playback.
__init__(self, initialMode, project)
Creates a new instance of TransportManager.
 
Parameters:
        initialMode --the initial mode for the timeline display.
                                Possible values:
                                MODE_HOURS_MINS_SECS
                                MODE_BARS_BEATS
        project -- reference to the current Project.

Data and other attributes defined here:
FPS = 30.0
MODE_BARS_BEATS = 2
MODE_HOURS_MINS_SECS = 1
SEEK_RATE = 5.0
TICKS_PER_BEAT = 256

Methods inherited from Monitored.Monitored:
AddListener(self, obj)
Adds an object to report changes to.
 
Parameters:
        obj -- an object to inform when StateChanged is called.
ClearListeners(self)
Remove all listeners to allow them to be destroyed.
RemoveListener(self, obj)
Stop reporting changes to the specified object.
 
Parameters:
        obj -- the object which should no longer receive change updates.
StateChanged(self, change=None, *extra)
This method should be called when we want a change to be reported
to all objects previously added by AddListener. 
 
Parameters:
        change -- the change which has occured.
        extra -- any extra parameters that should be passed.