Bug 118265 - Volume is always maximised when playing first song
Summary: Volume is always maximised when playing first song
Status: RESOLVED FIXED
Alias: None
Product: juk
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Scott Wheeler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-13 21:30 UTC by Dik Takken
Modified: 2005-12-14 12:43 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dik Takken 2005-12-13 21:30:21 UTC
Version:            (using KDE KDE 3.5.0)
Installed from:    Gentoo Packages
OS:                Linux

How to reproduce:

* Start Juk
* Reduce the volume
* Play a song

When the song is started, Juk will change the volume to maximum and play. Very dangerous for your speakers... :)
Comment 1 Scott Wheeler 2005-12-14 11:32:11 UTC
This seems to only be true with the aKode backend.
Comment 2 Scott Wheeler 2005-12-14 12:43:21 UTC
SVN commit 488424 by wheeler:

Initialize the aKode volume after instantiating the playback engine.

BUG:118265


 M  +7 -6      akodeplayer.cpp  
 M  +1 -0      akodeplayer.h  


--- branches/KDE/3.5/kdemultimedia/juk/akodeplayer.cpp #488423:488424
@@ -32,7 +32,8 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 aKodePlayer::aKodePlayer() : Player(),
-                             m_player(0)
+                             m_player(0),
+                             m_volume(1.0)
 {}
 
 aKodePlayer::~aKodePlayer()
@@ -61,6 +62,7 @@
     else {
         m_player = new aKode::Player();
         m_player->open("auto");
+        m_player->setVolume(m_volume);
     }
 
     if (m_player->load(filename.local8Bit().data()))
@@ -84,16 +86,15 @@
 
 void aKodePlayer::setVolume(float volume)
 {
+    m_volume = volume;
+
     if (m_player)
-        m_player->setVolume(volume);
+        m_player->setVolume(m_volume);
 }
 
 float aKodePlayer::volume() const
 {
-    if (m_player)
-        return m_player->volume();
-    // 1.0 is full volume
-    return 1.0;
+    return m_volume;
 }
 
 /////////////////////////////////////////////////////////////////////////////////
--- branches/KDE/3.5/kdemultimedia/juk/akodeplayer.h #488423:488424
@@ -59,6 +59,7 @@
 
 private:
     aKode::Player *m_player;
+    float m_volume;
 };
 
 #endif