How play part of a sound file?

Matthias Kretz kretz at kde.org
Fri Oct 5 12:39:02 BST 2007


Hi,

first you should go to api.kde.org instead of developer.kde.org. The 
documentation you were looking at was "Generated on Fri Oct 6 00:29:29 2006"

Regarding your question: the current API is not meant for any exact timings 
(which is also impossible with xine at least). But if close to 3000ms/8000ms 
is good enough for you you can do the following:

m_media = new MediaObject;
AudioOutput *out = new AudioOutput(Phonon::MusicCategory, m_media);
Phonon::createPath(m_media, out);
m_media->setCurrentSource(...);
m_media->pause();
m_media->seek(3000);
m_media->play();
m_media->setTickInterval(100);
connect(m_media, SIGNAL(tick(qint64)), SLOT(tick(qint64)));

.
.
.

void tick(qint64 position)
{
  if (position > 7900) {
    m_media->stop();
  }
}

On Friday 05 October 2007, Erik wrote:
> I need to play a part of a sound file, for example from 3000 ms to 8000
> ms. I looked at the documentation at
> [http://developer.kde.org/documentation/library/cvs-api/kdelibs-apidocs/pho
>non/html/classPhonon_1_1AudioPlayer.html] without finding what I was looking
> for. There is "void seek (qint64 ms)", so I suppose I could call
> "seek(3000); play()" but that does not tell it to stop at 8000 ms.


-- 
________________________________________________________
Matthias Kretz (Germany)                            <><
http://Vir.homelinux.org/
MatthiasKretz at gmx.net, kretz at kde.org,
Matthias.Kretz at urz.uni-heidelberg.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-multimedia/attachments/20071005/1d70f168/attachment.sig>
-------------- next part --------------
_______________________________________________
kde-multimedia mailing list
kde-multimedia at kde.org
https://mail.kde.org/mailman/listinfo/kde-multimedia


More information about the kde-multimedia mailing list