- Hack fix to Audio Controller

This commit is contained in:
noisymime 2008-04-28 23:05:13 +00:00
parent b033753e6e
commit 0489e0782b
4 changed files with 29 additions and 6 deletions

View File

@ -13,6 +13,8 @@ class MusicObjectRow(ImageRow):
gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, [])
}
fps = 75
frames = 45
def __init__(self, glossMgr, width, height, columns, music_player):
ImageRow.__init__(self, glossMgr, width, height, columns)

View File

@ -96,6 +96,7 @@ class Module:
elif (event.keyval == clutter.keysyms.Down):
self.list1.select_first_elegant()
self.list2.show()
self.current_context = self.CONTEXT_ALBUM_LIST
elif (event.keyval == clutter.keysyms.Return):
@ -112,6 +113,7 @@ class Module:
#If we're at the top of the list already, we change focus bar to the image_row
if self.list1.selected == 0:
self.list1.select_none_elegant()
self.list2.hide()
self.current_context = self.CONTEXT_ROW
else:
self.list1.input_queue.input(event)
@ -175,7 +177,7 @@ class Module:
def begin(self, glossMgr):
self.timeline_loading = clutter.Timeline(10,40)
self.timeline_loading = clutter.Timeline(80,160)
self.alpha = clutter.Alpha(self.timeline_loading, clutter.ramp_inc_func)
self.opacity_behaviour = clutter.BehaviourOpacity(opacity_start=0, opacity_end=255, alpha=self.alpha)
@ -202,14 +204,23 @@ class Module:
self.artistImageRow.objectLibrary = self.artists
self.artistImageRow.connect("load-complete", self.display, glossMgr)
self.timeline_loading.connect("completed", self.artistImageRow.load_image_range_cb, 0, len(self.artists)-1, False)
#self.timeline_loading.connect("completed", self.artistImageRow.load_image_range_cb, 0, len(self.artists)-1, False)
self.timeline_loading.connect("completed", self.flush_gobject_queue)
self.timeline_loading.start()
#thread.start_new_thread(self.artistImageRow.load_image_range, (0, len(self.artists)-1, True))
#gobject.idle_add(self.artistImageRow.load_image_range, 0, len(self.artists)-1, True)
def flush_gobject_queue(self, data=None):
"""
mc = gobject.main_context_default()
while mc.pending():
print "Iteration: " + str(mc.iteration(False))
print "finiahed loop"
"""
self.artistImageRow.load_image_range(0, len(self.artists)-1, False)
def display(self, data, glossMgr):
self.timeline_display = clutter.Timeline(10,40)

View File

@ -30,7 +30,7 @@ class Playlist:
self.audio_controller.play_audio(current_song_uri)
#Called when the playback of one song finishes and the next is required
def next_song(self):
def next_song(self, data = None):
self.position += 1
self.play()

View File

@ -8,11 +8,12 @@ class AudioController(MediaController):
def __init__(self, glossMgr):
MediaController.__init__(self, glossMgr)
"""
# Primary audio object
self.audio = clutter.cluttergst.Audio()
self.audio.connect("eos", self.stream_complete)
self.media_element = self.audio
"""
#self.osd = osd(glossMgr)
@ -25,6 +26,12 @@ class AudioController(MediaController):
#self.osd.enter()
def play_audio(self, uri):
print "Playing audio %s" % uri
# Primary audio object
self.audio = clutter.cluttergst.Audio()
self.audio.connect("eos", self.stream_complete)
self.media_element = self.audio
self.audio.set_uri(uri)
self.audio.set_playing(True)
@ -35,8 +42,11 @@ class AudioController(MediaController):
return self.audio
def stream_complete(self, audio):
self.isPlaying = False
self.audio.set_playing(False)
self.emit("completed")
self.stop_audio
#self.stop_audio
def stop_audio(self):
if self.audio.get_playing():