diff options
-rw-r--r-- | volume.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -12,6 +12,7 @@ int printusage(int,const char *const *argv,const char *message=NULL){ cout<<"Usage: "<<argv[0]<<" [volume]"<<endl; cout<<"If [volume] is given, changes volume to that value. (Integer in [0,100].)"<<endl; cout<<"Otherwise, it shows a graphical slider, adjustable with the arrow keys or h/j/k/l."<<endl; + cout<<"In graphical mode, 'm' toggles whether sound is muted."<<endl; cout<<"If the output is not a tty, the graphical slider is disabled."<<endl; return 1; } @@ -56,7 +57,7 @@ bool getmuted(void){ void displayslider(bool m,int vol){ cout<<"\x1B[2K\r0 |" - <<string(vol/5,'#')<<string((100-vol)/5,'-') + <<string(vol/5,'#')<<string((104-vol)/5,'-') <<"| 100 ("<<vol<<"%)"; if(m)cout<<" \x1B[1mMUTED (m)\x1B[0m"; cout.flush(); @@ -83,12 +84,12 @@ int interact(bool &m,int &vol){ return 0; } if(c!=27){ - cout<<7<<flush; + cout<<'\x07'<<flush; return 0; } c=cin.get(); if(c!='['){ - cout<<7<<flush; + cout<<'\x07'<<flush; return 0; } c=cin.get(); @@ -96,7 +97,7 @@ int interact(bool &m,int &vol){ if(c=='D')return incvol(vol,-5); if(c=='A')return incvol(vol,100); if(c=='B')return incvol(vol,-100); - cout<<7<<flush; + cout<<'\x07'<<flush; return 0; } |