2 * SomePlayer - An alternate music player for Maemo 5
3 * Copyright (C) 2010 Nikolay (somebody) Tischenko <niktischenko@gmail.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #include "../someplayer.h"
26 #include "../trackmetainformation.h"
27 #include "../playlist.h"
28 #include <phonon/MediaObject>
29 #include <phonon/AudioOutput>
30 #include <phonon/VolumeSlider>
31 #include <phonon/Effect>
32 #include <phonon/Path>
38 using SomePlayer::DataObjects::Track;
39 using SomePlayer::DataObjects::TrackMetadata;
40 using SomePlayer::DataObjects::Playlist;
41 using SomePlayer::Storage::Config;
43 namespace SomePlayer {
46 enum PlayerState { PLAYER_STOPPED, PLAYER_PLAYING, PLAYER_PAUSED, PLAYER_LOADING, PLAYER_DONE, PLAYER_ERROR };
50 void setPlaylist(QList<int>);
59 class Player : public QObject
63 explicit Player(QObject *parent = 0);
65 bool random() {return _random;}
66 bool repeat() {return _repeat;}
67 int volume() {return (int)(_output->volume()*100 + 0.5);}
68 Phonon::MediaObject* mediaObject() {return _player;}
69 bool equalizerEnabled() {return _equalizer_enabled;}
70 bool equalizerAvailable() {return _equalizer != NULL;}
73 void stateChanged (PlayerState);
74 void trackChanged (Track);
75 void tick (int, int); // played | all (seconds)
76 void trackDone(Track);
79 void setTrackId(int id);
86 void setPlaylist(Playlist);
91 void enableEqualizer();
92 void disableEqualizer();
93 void setEqualizerValue(int band, double value);
94 void equalizerValue(int band, double *);
96 void _stateChanged(Phonon::State, Phonon::State);
99 Randomizer _randomizer;
101 Track _track; // current track (workaround)
104 bool _equalizer_enabled;
105 QStack<int> _history;
107 QStack<int> _prev_history;
109 Phonon::MediaObject *_player;
110 Phonon::AudioOutput *_output;
112 Phonon::Effect *_equalizer;