I'm trying to get audio files to crossfade with phonon. I'm using PyQT4. I have tracks queuing properly, but I'm stuck with the fade effect. I think I need to be using the KVolumeFader effect. Here's my current code:
def music_play(self):
self.delayedInit()
self.m_media.setCurrentSource(Phonon.MediaSource(self.playlist[self.playlist_pos]))
self.m_media.play()
def music_stop(self):
self.m_media.stop()
def delayedInit(self):
if not self.m_media:
self.m_media = Phonon.MediaObject(self)
audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
Phonon.createPath(self.m_media, audioOutput)
def enqueueNextSource(self):
if len(self.playlist) >= self.playlist_pos+1:
self.playlist_pos += 1
self.m_media.enqueue(Phonon.MediaSource(self.playlist[self.playl开发者_运维技巧ist_pos]))
else:
self.m_media.stop()
Can anyone give me some advice on implementing the effect?
Seems I found the solution I was looking for. Although it's not supported by every phonon backend, setting the MediaObject's transitionTime with a negative number will crossfade.
精彩评论