Instrument
index
/home/laszlo/Dev/joko-gtk-builder/Jokosher/Instrument.py

#       THIS FILE IS PART OF THE JOKOSHER PROJECT AND LICENSED UNDER THE GPL. SEE
#       THE 'COPYING' FILE FOR DETAILS
#
#       Instrument.py
#       
#       This module is the non-gui class the represents instruments. instruments
#       represent a track of audio that can contain many different sources in sequence.
#       This module handles loading and saving instruments from xml, the gstreamer
#       bits for playing and recording events, audio effects plugins, as well as any 
#       instrument specific functionality like; solo, mute, volume, etc.
#
#-------------------------------------------------------------------------------

 
Modules
       
Event
Globals
IncrementalSave
PlatformUtils
UndoSystem
Utils
gettext
gobject
gst
os
pygst
shutil
time
urlparse

 
Classes
       
gobject._gobject.GObject(__builtin__.object)
Instrument

 
class Instrument(gobject._gobject.GObject)
    This module is the non-gui class the represents Instruments. Instruments
represent a track of audio that can contain many different sources in sequence.
It also handles loading and saving Instruments from xml, the gstreamer
bits for playing and recording events, audio effects plugins, as well as any 
Instrument specific functionality like; solo, mute, volume, etc.
 
 
Method resolution order:
Instrument
gobject._gobject.GObject
__builtin__.object

Methods defined here:
AddAndLinkPlaybackbin(self)
Creates a playback bin for this Instrument and adds it to the main
playback pipeline. *CHECK*
AddEffect(self, effectName)
Adds an effect to the pipeline for this Instrument.
 
Considerations:
        The effect is always placed in the pipeline after any other
        effects that were previously added.
        
Parameters:
        effectName -- GStreamer element name of the effect to add.
        
Returns:
        the added effect element.
AddEventsFromList(self, start, fileList, copyFile=False, undoAction=None)
Adds multiple files to an instrument one after another starting
at the given start position.
 
Parameters:
        start -- the offset time in seconds for the first event.
        fileList -- URIs to the Event files.
        copyfile --     True = copy the files to Project's audio directory.
                                False = don't copy the files to the Project's audio directory.
ChangeEffectOrder(self, effect, newPosition)
Move a given GStreamer element inside the effects bin. This method
does not swap the element into its new position, it simply shifts all the
elements between the effect's current position and the new position
down by one. Since a Gstreamer pipeline is essentially a linked list, this
"shift" implementation is the fastest way to make one element move to
a new position without changing the order of any of the others.
For example if this instrument has five effects which are ordered
A, B, C, D, E, and I call this method with effect D and a new position
of 1 the new order will be:  A, D, B, C, E.
 
Parameters:
        effect -- GStreamer effect to be moved.
        newPosition -- value of the new position inside the effects bin
                        the effect will have (with 0 as the first position).
ChangeType = UndoWrapper(funcSelf, *args, **kwargs)
This function will wrap and take the place of the function
that is being decorated. All arguments to the original function
will be saved, and sent to the decorated function call.
The funcSelf value must be the first parameter, because
the first parameter will always be self, and it carries a
reference to the decorated function's class.
 
Considerations:
        All decorated undo functions *must* be in a class or this will fail.
        
Parameters:
        funcSelf -- reference to the decorated function's class.
        *args -- parameters meant for the decorated function.
        **kwargs -- dictionary of keyword:value parameters
                        containing the optional _undoAction_ parameter.
        _undoAction_ -- has to be passed as a key:value pair inside kwargs.
                        The AtomicUndoAction object to append the 
                        command to or None to create a default 
                        AtomicUndoAction with only the one command.
 
Returns:
        the wrapped function resulting value.
CommitVolume(self)
Signal that the volume is no longer volatile. This means we can incrementally save,
which we didn't do before because the volume was rapidly changing as the user
moved the mouse.
DeleteEvent = UndoWrapper(funcSelf, *args, **kwargs)
This function will wrap and take the place of the function
that is being decorated. All arguments to the original function
will be saved, and sent to the decorated function call.
The funcSelf value must be the first parameter, because
the first parameter will always be self, and it carries a
reference to the decorated function's class.
 
Considerations:
        All decorated undo functions *must* be in a class or this will fail.
        
Parameters:
        funcSelf -- reference to the decorated function's class.
        *args -- parameters meant for the decorated function.
        **kwargs -- dictionary of keyword:value parameters
                        containing the optional _undoAction_ parameter.
        _undoAction_ -- has to be passed as a key:value pair inside kwargs.
                        The AtomicUndoAction object to append the 
                        command to or None to create a default 
                        AtomicUndoAction with only the one command.
 
Returns:
        the wrapped function resulting value.
FinalizeRecording(self, event)
Called when the recording of an Event has finished.
 
Parameters:
        event -- Event object that has finished being recorded.
FinishRecordingEvent = UndoWrapper(funcSelf, *args, **kwargs)
This function will wrap and take the place of the function
that is being decorated. All arguments to the original function
will be saved, and sent to the decorated function call.
The funcSelf value must be the first parameter, because
the first parameter will always be self, and it carries a
reference to the decorated function's class.
 
Considerations:
        All decorated undo functions *must* be in a class or this will fail.
        
Parameters:
        funcSelf -- reference to the decorated function's class.
        *args -- parameters meant for the decorated function.
        **kwargs -- dictionary of keyword:value parameters
                        containing the optional _undoAction_ parameter.
        _undoAction_ -- has to be passed as a key:value pair inside kwargs.
                        The AtomicUndoAction object to append the 
                        command to or None to create a default 
                        AtomicUndoAction with only the one command.
 
Returns:
        the wrapped function resulting value.
GetRecordingEvent(self)
Obtain an Event suitable for recording.
Returns:
        an Event suitable for recording.
MultipleEventsSelected(self)
Confirms whether or not multiple events are selected.
 
Returns:
        True = multiple Instruments have been selected.
        False = none or just one Instrument has been seleced.
OnMute(self)
Updates the GStreamer volume element to reflect the mute status.
PrepareController(self)
Fills the gst.Controller for this Instrument with its list of fade times.
RemoveAndUnlinkPlaybackbin(self)
Removes this Instrumen's playback bin from the main playback pipeline. *CHECK*
RemoveEffect(self, effect)
Remove the given GStreamer element from the effects bin.
 
Parameters:
        effect -- GStreamer effect to be removed from this Instrument.
RemoveEventsUnderEvent(self, mainEvent, undoAction=None)
Deletes and/or trims any events which are between the two given values.
This is useful for ensuring that a particular section of this instrument in
totally clear of any audio.
 
Parameters:
        start -- the start of the interval in seconds
        stop -- the stop of the interval in seconds
ResurrectEvent = UndoWrapper(funcSelf, *args, **kwargs)
This function will wrap and take the place of the function
that is being decorated. All arguments to the original function
will be saved, and sent to the decorated function call.
The funcSelf value must be the first parameter, because
the first parameter will always be self, and it carries a
reference to the decorated function's class.
 
Considerations:
        All decorated undo functions *must* be in a class or this will fail.
        
Parameters:
        funcSelf -- reference to the decorated function's class.
        *args -- parameters meant for the decorated function.
        **kwargs -- dictionary of keyword:value parameters
                        containing the optional _undoAction_ parameter.
        _undoAction_ -- has to be passed as a key:value pair inside kwargs.
                        The AtomicUndoAction object to append the 
                        command to or None to create a default 
                        AtomicUndoAction with only the one command.
 
Returns:
        the wrapped function resulting value.
SetInput(self, device, inTrack)
SetLevel(self, level)
Sets the level of this Instrument.
 
Considerations:
        This sets the current REPORTED level, NOT THE VOLUME!
 
Parameters:
        level -- new level value in a [0,1] range.
SetName = UndoWrapper(funcSelf, *args, **kwargs)
This function will wrap and take the place of the function
that is being decorated. All arguments to the original function
will be saved, and sent to the decorated function call.
The funcSelf value must be the first parameter, because
the first parameter will always be self, and it carries a
reference to the decorated function's class.
 
Considerations:
        All decorated undo functions *must* be in a class or this will fail.
        
Parameters:
        funcSelf -- reference to the decorated function's class.
        *args -- parameters meant for the decorated function.
        **kwargs -- dictionary of keyword:value parameters
                        containing the optional _undoAction_ parameter.
        _undoAction_ -- has to be passed as a key:value pair inside kwargs.
                        The AtomicUndoAction object to append the 
                        command to or None to create a default 
                        AtomicUndoAction with only the one command.
 
Returns:
        the wrapped function resulting value.
SetSelected(self, sel)
Sets the Instrument to be highlighted and receive keyboard actions.
 
Parameters:
        sel --  True = the Instrument is currently selected.
                        False = the Instrument is not currently selected.
SetVisible = UndoWrapper(funcSelf, *args, **kwargs)
This function will wrap and take the place of the function
that is being decorated. All arguments to the original function
will be saved, and sent to the decorated function call.
The funcSelf value must be the first parameter, because
the first parameter will always be self, and it carries a
reference to the decorated function's class.
 
Considerations:
        All decorated undo functions *must* be in a class or this will fail.
        
Parameters:
        funcSelf -- reference to the decorated function's class.
        *args -- parameters meant for the decorated function.
        **kwargs -- dictionary of keyword:value parameters
                        containing the optional _undoAction_ parameter.
        _undoAction_ -- has to be passed as a key:value pair inside kwargs.
                        The AtomicUndoAction object to append the 
                        command to or None to create a default 
                        AtomicUndoAction with only the one command.
 
Returns:
        the wrapped function resulting value.
SetVolume(self, volume)
Sets the volume of this Instrument.
 
Parameters:
        volume -- new volume value in a [0,1] range.
StoreToXML(self, doc, parent, graveyard=False)
Converts this Instrument into an XML representation suitable for saving to a file.
 
Parameters:
        doc -- the XML document object the Instrument will be saved to.
        parent -- the parent node that the serialized Instrument should
                                be added to.
        graveyard -- True if this Instrument is on the graveyard stack,
                                and should be serialized as a dead Instrument.
ToggleArmed = UndoWrapper(funcSelf, *args, **kwargs)
This function will wrap and take the place of the function
that is being decorated. All arguments to the original function
will be saved, and sent to the decorated function call.
The funcSelf value must be the first parameter, because
the first parameter will always be self, and it carries a
reference to the decorated function's class.
 
Considerations:
        All decorated undo functions *must* be in a class or this will fail.
        
Parameters:
        funcSelf -- reference to the decorated function's class.
        *args -- parameters meant for the decorated function.
        **kwargs -- dictionary of keyword:value parameters
                        containing the optional _undoAction_ parameter.
        _undoAction_ -- has to be passed as a key:value pair inside kwargs.
                        The AtomicUndoAction object to append the 
                        command to or None to create a default 
                        AtomicUndoAction with only the one command.
 
Returns:
        the wrapped function resulting value.
ToggleMuted = UndoWrapper(funcSelf, *args, **kwargs)
This function will wrap and take the place of the function
that is being decorated. All arguments to the original function
will be saved, and sent to the decorated function call.
The funcSelf value must be the first parameter, because
the first parameter will always be self, and it carries a
reference to the decorated function's class.
 
Considerations:
        All decorated undo functions *must* be in a class or this will fail.
        
Parameters:
        funcSelf -- reference to the decorated function's class.
        *args -- parameters meant for the decorated function.
        **kwargs -- dictionary of keyword:value parameters
                        containing the optional _undoAction_ parameter.
        _undoAction_ -- has to be passed as a key:value pair inside kwargs.
                        The AtomicUndoAction object to append the 
                        command to or None to create a default 
                        AtomicUndoAction with only the one command.
 
Returns:
        the wrapped function resulting value.
ToggleSolo = UndoWrapper(funcSelf, *args, **kwargs)
This function will wrap and take the place of the function
that is being decorated. All arguments to the original function
will be saved, and sent to the decorated function call.
The funcSelf value must be the first parameter, because
the first parameter will always be self, and it carries a
reference to the decorated function's class.
 
Considerations:
        All decorated undo functions *must* be in a class or this will fail.
        
Parameters:
        funcSelf -- reference to the decorated function's class.
        *args -- parameters meant for the decorated function.
        **kwargs -- dictionary of keyword:value parameters
                        containing the optional _undoAction_ parameter.
        _undoAction_ -- has to be passed as a key:value pair inside kwargs.
                        The AtomicUndoAction object to append the 
                        command to or None to create a default 
                        AtomicUndoAction with only the one command.
 
Returns:
        the wrapped function resulting value.
UpdateVolume(self)
Updates the volume property of the gstreamer volume element
based on this instrument's volume and the project's master volume.
__init__(self, project, name, type, pixbuf, id=None)
Creates a new instance of Instrument.
 
Parameters:
        project -- the currently active Project.
        name -- name of the Instrument.
        type -- type of the Instrument.
        pixbuf -- image of the Instrument resource object.
        id -- unique ID value for the Instrument.
__repr__(self)
Creates a representation string of the Instrument.
 
Returns:
        a string representing the id and name for this Instrument.
addEventFromEvent = UndoWrapper(funcSelf, *args, **kwargs)
This function will wrap and take the place of the function
that is being decorated. All arguments to the original function
will be saved, and sent to the decorated function call.
The funcSelf value must be the first parameter, because
the first parameter will always be self, and it carries a
reference to the decorated function's class.
 
Considerations:
        All decorated undo functions *must* be in a class or this will fail.
        
Parameters:
        funcSelf -- reference to the decorated function's class.
        *args -- parameters meant for the decorated function.
        **kwargs -- dictionary of keyword:value parameters
                        containing the optional _undoAction_ parameter.
        _undoAction_ -- has to be passed as a key:value pair inside kwargs.
                        The AtomicUndoAction object to append the 
                        command to or None to create a default 
                        AtomicUndoAction with only the one command.
 
Returns:
        the wrapped function resulting value.
addEventFromFile = UndoWrapper(funcSelf, *args, **kwargs)
This function will wrap and take the place of the function
that is being decorated. All arguments to the original function
will be saved, and sent to the decorated function call.
The funcSelf value must be the first parameter, because
the first parameter will always be self, and it carries a
reference to the decorated function's class.
 
Considerations:
        All decorated undo functions *must* be in a class or this will fail.
        
Parameters:
        funcSelf -- reference to the decorated function's class.
        *args -- parameters meant for the decorated function.
        **kwargs -- dictionary of keyword:value parameters
                        containing the optional _undoAction_ parameter.
        _undoAction_ -- has to be passed as a key:value pair inside kwargs.
                        The AtomicUndoAction object to append the 
                        command to or None to create a default 
                        AtomicUndoAction with only the one command.
 
Returns:
        the wrapped function resulting value.
addEventFromURL = UndoWrapper(funcSelf, *args, **kwargs)
This function will wrap and take the place of the function
that is being decorated. All arguments to the original function
will be saved, and sent to the decorated function call.
The funcSelf value must be the first parameter, because
the first parameter will always be self, and it carries a
reference to the decorated function's class.
 
Considerations:
        All decorated undo functions *must* be in a class or this will fail.
        
Parameters:
        funcSelf -- reference to the decorated function's class.
        *args -- parameters meant for the decorated function.
        **kwargs -- dictionary of keyword:value parameters
                        containing the optional _undoAction_ parameter.
        _undoAction_ -- has to be passed as a key:value pair inside kwargs.
                        The AtomicUndoAction object to append the 
                        command to or None to create a default 
                        AtomicUndoAction with only the one command.
 
Returns:
        the wrapped function resulting value.
checkActuallyIsMuted(self)
Determines if this Intrument should be muted, by taking into account
if any other Intruments are muted.

Data and other attributes defined here:
LADSPA_ELEMENT_CAPS = 'audio/x-raw-float, width=(int)32, rate=(int)[ 1,...47 ], channels=(int)1, endianness=(int)BYTE_ORDER'
__gtype__ = <GType Instrument+Instrument (35940032)>

Methods inherited from gobject._gobject.GObject:
__cmp__(...)
x.__cmp__(y) <==> cmp(x,y)
__copy__(...)
__deepcopy__(...)
__delattr__(...)
x.__delattr__('name') <==> del x.name
__gobject_init__(...)
__hash__(...)
x.__hash__() <==> hash(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
chain(...)
connect(...)
connect_after(...)
connect_object(...)
connect_object_after(...)
disconnect(...)
disconnect_by_func(...)
emit(...)
emit_stop_by_name(...)
freeze_notify(...)
get_data(...)
get_properties(...)
get_property(...)
handler_block(...)
handler_block_by_func(...)
handler_disconnect(...)
handler_is_connected(...)
handler_unblock(...)
handler_unblock_by_func(...)
notify(...)
set_data(...)
set_properties(...)
set_property(...)
stop_emission(...)
thaw_notify(...)
weak_ref(...)

Data descriptors inherited from gobject._gobject.GObject:
__dict__
__grefcount__

Data and other attributes inherited from gobject._gobject.GObject:
__gdoc__ = 'Object Instrument+Instrument\n\n\n\tThis module is t...one ()\n\nSignals from GObject:\n notify (GParam)\n\n'
__new__ = <built-in method __new__ of GObjectMeta object>
T.__new__(S, ...) -> a new object with type S, a subtype of T
props = <gobject.GProps object>