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

#       THIS FILE IS PART OF THE JOKOSHER PROJECT AND LICENSED UNDER THE GPL. SEE
#       THE 'COPYING' FILE FOR DETAILS
#
#       Event.py
#       
#       This module is the non-gui class the represents events. Events
#       represent a piece of audio such as a file or something that was recorded.
#       This module handles loading and saving events from xml, the gstreamer
#       bits event properties as well as any event specific functionality like;
#       audio fades, splits, joins, trims, waveform levels, etc.
#
#-------------------------------------------------------------------------------

 
Modules
       
Globals
IncrementalSave
LevelsList
PlatformUtils
UndoSystem
Utils
gettext
gobject
gst
os
pygst
sys
urllib
xml.dom.minidom

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

 
class Event(gobject._gobject.GObject)
    This class handles maintaing the information for a single audio 
event, normally, a fragment of a recorded file.
 
Signals:
        "waveform" -- The waveform date for this event has changed.
        "position" -- The starting position of this event has changed.
        "length" -- The length of this event has changed.
        "corrupt" -- The audio file for this event is not playable. Two strings with detailed information are sent.
        "loading" -- Loading has started or completed.
 
 
Method resolution order:
Event
gobject._gobject.GObject
__builtin__.object

Methods defined here:
AddAudioFadePoints = 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.
CopyAndGenerateWaveform(self, uri)
Copies the audio file to the new file location and reads the levels
at the same time.
CopySelection(self, eventID=-1)
Only for use with a 2-point selection.
Essentially performs a 'fake split' and returns a new event
which would be the result of splitting an event at the 2 points.
 
This is used when the user shift-drags an event to create a selection,
then chooses 'copy' from the context menu. The new event can be placed
wherever the user wishes by right-clicking and choosing 'paste'.
CreateFilesource(self)
Creates a new GStreamer file source with an unique id.
It then calls SetProperties() to populate the new object's
properties.
Delete(self, _undoAction_=None)
Deletes this Event and sends it to the graveyard.
DeleteSelectedFadePoints(self)
Removes all the fade points for this Event.
DestroyFilesource(self)
Removes the Gstreamer file source from the instrument's composition.
GenerateWaveform(self)
Renders the level information for the GUI.
GetAbsFile(self)
GetAbsLevelsFile(self)
GetFadeLevelAtPoint(self, time)
Obtain the level of audio at any point in time.
 
Parameters:
        time -- point in time to extract the audio level from.
 
Returns:
        the level of the audio in percentage format [0,1]
GetFadeLevels(self)
Obtain the fade levels list.
The only difference between this list and the levels list is
that the levels in this list are scaled according to the fade
curves applied to the current Event.
 
Returns:
        a list of fade levels, the same length as the levels list.
GetFilename(self)
JoinEvent = 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.
MayPlace(self, xpos)
Checks if this event could be placed at xpos without 
overlapping another Event on the same Instrument.
 
Parameters:
        xpos -- the potential start position to check.
 
Returns:
        True if it's OK to place the Event at xpos, False if not.
Move = 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.
MoveButDoNotOverlap(self, xpos)
This method will attempt to move this Event to the given position.
If the position requires overlapping, this Event will be put flush
against the closest side of the Event which is in the way.
 
Parameters:
        xpos -- the potential position to move the Event to.
RemoveAudioFadePoints = 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.
Resurrect(self, _undoAction_=None)
Brings this event back from the graveyard.
 
Considerations:
        This method is made obsolete by instrument.ResurrectEvent(),
        but is still kept here for 0.2 undo history compatibility.
SetProperties(self)
Sets basic Event properties like location, start, duration, etc.
SetSelected(self, sel)
Enables or disables the selection state for this Event.
 
Parameters:
        sel -- the new selection state:
                        True = the Event has been selected.
                        False = the Event has been deselected.
SplitEvent = 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.
StopGenerateWaveform(self, finishedLoading=True)
Stops the internal pipeline that loads the waveform from this event's file.
 
Parameters:
        finishedLoading -- True if the event has finished loading the waveform,
                        False if the loading is being cancelled.
StoreToXML(self, doc, parent, graveyard=False)
Converts this Event into an XML representation suitable for saving to a file.
 
Parameters:
        doc -- the XML document object the Event will be saved to.
        parent -- the parent node that the serialized Event should
                                be added to.
        graveyard -- True if this Event is on the graveyard stack,
                                and should be serialized as a dead Event.
Trim(self, start_split, end_split)
Splits the Event and then deletes the first and last sections,
leaving only the middle section.
 
Parameters:
        start_split -- the time for the start of the trim.
        end_split -- the time for the end of the trim.
__cmp__(self, object)
Compares two Events for equality.
 
Returns:
        True -- the Events are equal.
        False -- the Events are different.
__init__(self, instrument, file=None, id=None, filelabel=None)
Creates a new instance of Event.
 
Parameters:
        instrument -- Instrument associated with this Event.
        file -- the file this Event should play.
        id -- unique ID for this Event. If it's taken, a new one will be generated.
        filelabel -- label to print in error messages.
                                It can be different     from the file parameter.
__repr__(self)
Creates a representation string of the Event.
 
Returns:
        a string representing the name, id, start and duration
        for this Event.
bus_eos(self, bus, message)
Handler for the GStreamer End Of Stream message. Currently
used when the file is loading and is being rendered. This
function is called at the end of the file loading process and
finalises the rendering.
 
Parameters:
        bus -- GStreamer bus sending the message.
        message -- GStreamer message.
        
Returns:
        False -- stops the signal propagation. *CHECK*
bus_error(self, bus, message)
Handler for when things go completely wrong with GStreamer.
 
Parameters:
        bus -- GStreamer bus sending the message.
        message -- GStreamer message.
bus_message(self, bus, message)
Handler for the GStreamer bus messages relevant to this Event.
At the moment, this is used to report on how the loading progress
is going.
 
Parameters:
        bus -- GStreamer bus sending the message.
        message -- GStreamer message.
        
Returns:
        True -- the Event is loading.
        False -- the Event isn't loading.
bus_message_statechange(self, bus, message)
Handler for the GStreamer statechange message.
 
Parameters:
        bus -- GStreamer bus sending the message.
        message -- GStreamer message.
bus_message_tags(self, bus, message)
Handler for catching audio file tags that Gstreamer throws.
 
Parameters:
        bus -- GStreamer bus sending the message.
        message -- GStreamer message.
install_plugin_cb(self, result)
recording_bus_level(self, bus, message)
Handler for the GStreamer bus messages relevant to this Event.
At the moment this is used to report on how the recording
progress is going. *CHECK*
 
Parameters:
        bus -- GStreamer bus sending the message.
        message -- GStreamer message.
        
Returns:
        True -- the Event is recording.
        False -- the Event isn't recording.

Data and other attributes defined here:
LEVELS_FILE_EXTENSION = '.leveldata'
LEVEL_INTERVAL = 0.10000000000000001
__gtype__ = <GType Event+Event (35613632)>

Methods inherited from gobject._gobject.GObject:
__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 Event+Event\n\n\n\tThis class handles maintai...array)\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>