diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2013-02-19 18:09:00 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2013-02-19 18:09:00 +0000 |
| commit | 75c4eaf61e17e1a132498929f783964de134c7be (patch) | |
| tree | 6d56eb4607c6dc153ef69153cc1537d1a4ae1382 /src/plugins/Output/alsa/outputalsa.cpp | |
| parent | f4a87da830f5c2bd5b57fcc1e1e2de1b1b8eb120 (diff) | |
| download | qmmp-75c4eaf61e17e1a132498929f783964de134c7be.tar.gz qmmp-75c4eaf61e17e1a132498929f783964de134c7be.tar.bz2 qmmp-75c4eaf61e17e1a132498929f783964de134c7be.zip | |
changed volume api
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3266 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Output/alsa/outputalsa.cpp')
| -rw-r--r-- | src/plugins/Output/alsa/outputalsa.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/plugins/Output/alsa/outputalsa.cpp b/src/plugins/Output/alsa/outputalsa.cpp index c9ed0eecd..f037d40b8 100644 --- a/src/plugins/Output/alsa/outputalsa.cpp +++ b/src/plugins/Output/alsa/outputalsa.cpp @@ -375,31 +375,28 @@ VolumeALSA::~VolumeALSA() snd_mixer_close(mixer); } -void VolumeALSA::setVolume(int channel, int value) +void VolumeALSA::setVolume(const VolumeSettings &vol) { if (!pcm_element) return; - _snd_mixer_selem_channel_id channel_id = SND_MIXER_SCHN_FRONT_LEFT; - if(channel == Volume::RIGHT_CHANNEL) - channel_id = SND_MIXER_SCHN_FRONT_RIGHT; - - snd_mixer_selem_set_playback_volume(pcm_element, channel_id, value); + snd_mixer_selem_set_playback_volume(pcm_element, SND_MIXER_SCHN_FRONT_LEFT, vol.left); + snd_mixer_selem_set_playback_volume(pcm_element, SND_MIXER_SCHN_FRONT_RIGHT, vol.right); } -int VolumeALSA::volume(int channel) +VolumeSettings VolumeALSA::volume() const { + VolumeSettings vol; if (!pcm_element) - return 0; - - _snd_mixer_selem_channel_id channel_id = SND_MIXER_SCHN_FRONT_LEFT; - if(channel == Volume::RIGHT_CHANNEL) - channel_id = SND_MIXER_SCHN_FRONT_RIGHT; + return vol; long value = 0; snd_mixer_handle_events(mixer); - snd_mixer_selem_get_playback_volume(pcm_element, channel_id, &value); - return value; + snd_mixer_selem_get_playback_volume(pcm_element, SND_MIXER_SCHN_FRONT_LEFT, &value); + vol.left = value; + snd_mixer_selem_get_playback_volume(pcm_element, SND_MIXER_SCHN_FRONT_RIGHT, &value); + vol.right = value; + return vol; } int VolumeALSA::setupMixer(QString card, QString device) |
