1 --- player.cpp 2008/09/16 19:41:09 274
2 +++ player.cpp 2009/04/21 20:44:39 275
5 - Copyright (c) 2006-2008 by amdfanatyk <amdfanatyk@o2.pl>
6 + Copyright (c) 2006-2009 by amdfanatyk <amdfanatyk@o2.pl>
8 *************************************************************************
11 ao_port = xine_open_audio_driver(xine, NULL, NULL);
20 void Player::setVolume(const int & vol)
25 + xine_set_param(stream, XINE_PARAM_AUDIO_VOLUME, volume);
28 int Player::getLength() const
33 +bool Player::getRestoring() const
38 void Player::setPos(const int & p)
45 +void Player::setRestoring(const bool value)
54 if (!xine_open(stream, (const char *)track.local8Bit()) || !xine_play(stream, 0, pos))
59 while ((xine_get_status(stream) == XINE_STATUS_PLAY) && (!term))
61 - xine_set_param(stream, XINE_PARAM_AUDIO_VOLUME, volume);
65 + volume = xine_get_param(stream, XINE_PARAM_AUDIO_VOLUME);
67 xine_get_pos_length(stream, NULL, &pos, &length);
77 --- frmmain.ui.h 2008/09/16 19:41:09 274
78 +++ frmmain.ui.h 2009/04/21 20:44:39 275
81 sldPos->setValue(frame);
83 + player.setRestoring(true);
85 QTimer::singleShot(0, this, SLOT(onAction()));
89 sldPos->setMaxValue(player.getLength()); // doesn't work without it ;[
90 sldPos->setValue(player.getPos());
92 + if (!player.getRestoring())
93 + sldVol->setValue(player.getVolume());
95 if (!player.running())
98 @@ -3231,17 +3236,18 @@
100 void frmMain::restoreVolume()
102 - const int & vol = player.getVolume();
103 + const int vol = (player.getVolume() + 5);
105 - if (vol < desiredVolume)
106 + if (vol >= desiredVolume)
108 - if ((vol + 5) > desiredVolume)
109 - sldVol->setValue(desiredVolume);
111 - player.setVolume(vol + 5);
112 + volumeTimer.stop();
114 + sldVol->setValue(desiredVolume);
116 + player.setRestoring(false);
119 - volumeTimer.stop();
120 + player.setVolume(vol);
123 void frmMain::makeUpPlaylist(int id)
124 --- player.h 2008/09/16 19:41:09 274
125 +++ player.h 2009/04/21 20:44:39 275
127 int getLength() const;
128 int getVolume() const;
130 + bool getRestoring() const;
131 QString getTrack() const;
132 QStringList getAudioCDContents(const QString & device) const;
133 const xine_t * getXineHandle() const;
138 + void setRestoring(bool);
151 - xine_stream_t * stream;
152 - xine_audio_port_t * ao_port;
154 + xine_stream_t * stream;
155 + xine_audio_port_t * ao_port;
156 + xine_event_queue_t * event_queue;
160 --- frmmain.ui.h 2010/12/30 19:27:09 291
161 +++ frmmain.ui.h 2011/01/01 00:39:30 292
164 alreadyRunning = false;
167 + QDir().mkdir(dir.path());
169 if (lockFile.exists())
177 - QDir().mkdir(dir.path());
180 lyricsErrStr = i18n("No lyrics found");
181 sldVol->setValue(50);