Changeset 89ae974


Ignore:
Timestamp:
03/07/14 09:46:55 (7 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
187a4cf
Parents:
92e8b9b
Message:

Make the tray portion of pc-mixer also "L/R channel" aware. It reports whichever value is higher on the tray slider, but keeps the difference between the two channels the same when modified.

Location:
src-qt4/pc-mixer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-mixer/MixerTray.cpp

    r0c784d0 r89ae974  
    3939  this->setIcon(QIcon(":icons/audio-volume-high.png")); 
    4040  CVOL = 101; //quick default to maximize it 
    41    
     41  CDIFF = 0; 
    4242  //Make sure no single-instance events for 30 seconds 
    4343  QTimer::singleShot(30000, this, SLOT(doneStarting()) ); 
     
    6262  int L = val.section(":",0,0).toInt(); 
    6363  int R = val.section(":",1,1).toInt(); 
     64  //Record the different between L/R channels (if any) 
     65  CDIFF = L - R; // - for L lower, + for R lower 
    6466  //Just use the largest value for the moment 
    6567  if(L > R){ R = L; } 
    6668  else if(L < R){ L = R; } 
    6769  //Now just run the changeVol function to update everything (better than duplication) 
    68   changeVol(R); 
     70  changeVol(R, false); 
    6971} 
    7072 
    71 void MixerTray::changeVol(int percent){ 
     73void MixerTray::changeVol(int percent, bool modify){ 
    7274  //Determine the percentage to actually use and adjust internal value 
    7375  if(percent < 0 && isMuted){ percent = CVOL; }   //Return to CVOL value 
     
    7678  else{ CVOL = percent; } 
    7779  //Now update the backend mixer to the proper value 
    78   Mixer::setValues(settings->value("tray-device","vol").toString(), percent); 
     80  if(modify){ 
     81    if(CDIFF==0){ 
     82      Mixer::setValues(settings->value("tray-device","vol").toString(), percent); 
     83    }else if(CDIFF < 0){ 
     84      //L channel lower 
     85      Mixer::setValues(settings->value("tray-device","vol").toString(), percent + CDIFF, percent); 
     86    }else{ 
     87      //R channel lower 
     88      Mixer::setValues(settings->value("tray-device","vol").toString(), percent, percent - CDIFF); 
     89    } 
     90           
     91  } 
    7992  //Now update the display appropriately 
    8093  if(percent == 0){ 
  • src-qt4/pc-mixer/MixerTray.h

    rcaf88c8 r89ae974  
    3434        MixerGUI *GUI; 
    3535        int CVOL; //current volume 
     36        int CDIFF; //difference between L/R channels 
    3637        bool starting, isMuted; 
    3738 
    38         void changeVol(int); //Set volume to value (0-100), -1 = mute but save volume 
     39        void changeVol(int percent, bool modify = true); //Set volume to value (0-100), -1 = mute but save volume 
    3940 
    4041private slots: 
Note: See TracChangeset for help on using the changeset viewer.