Crossfading audio with PyQT4 and Phonon
Posted
by dwelch
on Stack Overflow
See other posts from Stack Overflow
or by dwelch
Published on 2010-05-20T23:09:47Z
Indexed on
2010/05/24
15:11 UTC
Read the original article
Hit count: 355
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.playlist_pos]))
else:
self.m_media.stop()
Can anyone give me some advice on implementing the effect?
© Stack Overflow or respective owner