This forum has been archived. All content is frozen. Please use KDE Discuss instead.

wav file played using Phonon is cut

Tags: phonon phonon phonon
(comma "," separated)
cinas
Registered Member
Posts
21
Karma
0

wav file played using Phonon is cut

Wed Jul 08, 2009 7:38 am
Hi, I'm trying to play some small wav file in plasma applet (using phonon library). The problem is that the sound is almost always cut (it's played not so long as it should be).

Code: Select all
    m_pSound = Phonon::createPlayer(Phonon::AccessibilityCategory, Phonon::MediaSource(getPathToSample()));
    m_pSound->play();

Does anyone know why is that happening?
Thanks for help.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Which Phonon backend are you using and with which version of KDE? Whilst the Xine backend is recommended, some KDE releases had a bug in it, which caused sounds such as the login sound to be cut off.
cinas
Registered Member
Posts
21
Karma
0
It's xine backend and KDE 4.2.2
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
That version should have the bug fixed in theory. Does the cutting off always happen in the exact same place?
cinas
Registered Member
Posts
21
Karma
0
No, but maybe because each time before I play wav file I delete old MediaObject and create new one.
Code: Select all
void PlasmaYdpdict::playSound()
{
    m_pSound = Phonon::createPlayer(Phonon::AccessibilityCategory, Phonon::MediaSource(getPathToSample()));
    connect(m_pSound, SIGNAL(finished()), this, SLOT(playbackFinished()));
    m_pSound->play();
    enablePlayButton(false);
}

void PlasmaYdpdict::playbackFinished()
{
    delete m_pSound;
    m_pSound = NULL;
    enablePlayButton(true);
}

Interesting is that if I connect aboutToFinished slot with playbackFinished method (what is wrong) sample is played correctly, but of course plasma crashes after few times.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
It is not needed to delete the Phonon backend after use. You should just call play() when you need to replay the sound. You can also change the media file in use unless it is currently playing, using setCurrentSource().

By exact same place I mean does it always happen at <x seconds from finish of playback>.
cinas
Registered Member
Posts
21
Karma
0
There are very short wave files because this is dictionary, so it's hard to say precisely, but the same sample played few times is cut off more less after the same time.
I checked also playing those files in Amarok. Problem is the same, samples are cut off.

Last edited by cinas on Sat Jul 11, 2009 3:21 pm, edited 2 times in total.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
This is likely a bug in the Xine backend. Please check to see if you can reproduce with KDE 4.3, or with an alternate backend.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
cinas
Registered Member
Posts
21
Karma
0
Yes, the same situation happens on KDE 4.3 RC1, in my plasmoid and in amarok.

And another interesting thing (KDE 4.2.2, KDE 4.3 RC1), if wave file is played in amarok alone (nothing more in playlist) is cut off, if there is e.g. mp3 file in the playlist after the wave file, wave is played correctly (full length).

Another thing, finished() function is called "too early", I mean long before playing of wave file finishes.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
This is very likely related to the fadeout functions of Phonon, since it plays fine if a file is played after it.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
RealNC
Registered Member
Posts
20
Karma
0
This is getting frustrating. This bug is still not fixed. Sounds are still getting cut off with Xine backend, including when playing them in Amarok. KDE 4.4.1.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]