9
* Copyright (C) 2011 Urs Fleisch
11
* This file is part of Kid3.
13
* Kid3 is free software; you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License as published by
15
* the Free Software Foundation; either version 2 of the License, or
16
* (at your option) any later version.
18
* Kid3 is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
23
* You should have received a copy of the GNU General Public License
24
* along with this program. If not, see <http://www.gnu.org/licenses/>.
35
#include <QStringList>
43
* Audio player toolbar.
45
class AudioPlayer : public QObject {
52
* @param parent parent object
54
explicit AudioPlayer(QObject* parent);
59
virtual ~AudioPlayer();
62
* Set files to be played.
64
* @param files paths to files
65
* @param fileNr index of file to play (default 0)
67
void setFiles(const QStringList& files, int fileNr = 0);
70
* Play a track from the files.
72
* @param fileNr index in list of files set with setFiles()
74
void playTrack(int fileNr);
77
* Access to media object.
78
* @return media object.
80
Phonon::MediaObject* mediaObject() { return m_mediaObject; }
83
* Access to audio output.
84
* @return audio output.
86
Phonon::AudioOutput* audioOutput() { return m_audioOutput; }
90
* Emitted when the current track is changed.
91
* @param filePath path of currently played audio file
92
* @param hasPrevious true if a previous track is available
93
* @param hasNext true if a next track is available
95
void trackChanged(const QString& filePath, bool hasPrevious, bool hasNext);
99
* Toggle between play and pause.
109
* Select previous track.
120
* Update display and button state when the current source is changed.
122
void currentSourceChanged();
125
* Queue next track when the current track is about to finish.
127
void aboutToFinish();
131
* Select a track from the files and optionally start playing it.
133
* @param fileNr index in list of files set with setFiles()
134
* @param play true to play track
136
void selectTrack(int fileNr, bool play);
138
Phonon::MediaObject* m_mediaObject;
139
Phonon::AudioOutput* m_audioOutput;
146
// Just to suppress moc "No relevant classes found" warning.
147
class AudioPlayer : public QObject {
151
#endif // HAVE_PHONON
153
#endif // AUDIOPLAYER_H