void CVolumeCtrl::OnLButtonDown(UINT nFlags, CPoint point) { CRect r; GetChannelRect(&r); if (r.left >= r.right) { return; } int start, stop; GetRange(start, stop); r.left += 3; r.right -= 4; if (point.x < r.left) { SetPosInternal(start); } else if (point.x >= r.right) { SetPosInternal(stop); } else { int w = r.right - r.left; if (start < stop) { SetPosInternal(start + ((stop - start) * (point.x - r.left) + (w / 2)) / w); } } CSliderCtrl::OnLButtonDown(nFlags, point); }
void CPlayerSeekBar::SetPos(__int64 pos) { CWnd* w = GetCapture(); if(w && w->m_hWnd == m_hWnd) return; SetPosInternal(pos); }
bool CVolumeCtrl::Create(CWnd* pParentWnd) { if(!CSliderCtrl::Create(WS_CHILD|WS_VISIBLE|TBS_NOTICKS|TBS_HORZ, CRect(0,0,0,0), pParentWnd, IDC_SLIDER1)) return(false); SetRange(0, 120); SetPosInternal(AfxGetCurrentSettings().nVolume); SetPageSize(8); SetLineSize(0); return(true); }
void CVolumeCtrl::IncreaseVolume() { AppSettings& s = AfxGetCurrentSettings(); if(GetPos() > 99 && !s.fAudioNormalize){ SetPosInternal(GetPos() + 1); /* DWORD plVolume; int WaveOutVol = 100; // if(MMSYSERR_NOERROR == waveOutGetVolume(0, (DWORD*)plVolume) ){ // WaveOutVol = (HIWORD(plVolume) + LOWORD(plVolume)) * 100 / 2 / 0xFFFF; // } if( WaveOutVol > 90){ int iBVol = (int)(50.0f*log10(s.AudioBoost)); iBVol = min(iBVol + 8, 100); s.AudioBoost = pow(10.0f, (float)iBVol/50); if( s.AudioBoost > 100) s.AudioBoost = 100; }else{ //increaseWaveOut //plVolume = (min( (HIWORD(plVolume) + 0x0FFF), 0xFFFF) << 16) | min( (LOWORD(plVolume) + 0x0FFF), 0xFFFF) ; //waveOutSetVolume(0, plVolume); }*/ }else{ if (GetPos() > 95 ){ SetPosInternal(100); }else if (GetPos() > 25 ){ SetPosInternal(GetPos() + GetPageSize()); }else if (GetPos() > 15 ){ SetPosInternal(GetPos() + 3); }else{ SetPosInternal(GetPos() + 1); } } }
void CPlayerSeekBar::MoveThumb(CPoint point) { CRect r = GetChannelRect(); if(r.left >= r.right) return; if(point.x < r.left) SetPos(m_start); else if(point.x >= r.right) SetPos(m_stop); else { __int64 w = r.right - r.left; if(m_start < m_stop) SetPosInternal(m_start + ((m_stop - m_start) * (point.x - r.left) + (w/2)) / w); } }
void CVolumeCtrl::DecreaseVolume() { AppSettings& s = AfxGetCurrentSettings(); if(0 && s.AudioBoost > 1){ int iBVol = (int)(50.0f*log10(s.AudioBoost)); iBVol = max(iBVol - 8, 0); s.AudioBoost = pow(10.0f, (float)iBVol/50); if( s.AudioBoost < 1) s.AudioBoost = 1; }else{ if (GetPos() > 99 ){ SetPosInternal(GetPos() - 1); } else if (GetPos() > 25 ){ SetPosInternal(GetPos() - GetPageSize()); }else if (GetPos() > 15 ){ SetPosInternal(GetPos() - 3); }else{ SetPosInternal(GetPos() - 1); } } }
void CVolumeCtrl::DecreaseVolume() { // align volume down to step. recommend using steps 1, 2, 5 and 10 int m = GetPos() % GetPageSize(); SetPosInternal(GetPos() - (m ? m : GetPageSize())); }
void CVolumeCtrl::IncreaseVolume() { // align volume up to step. recommend using steps 1, 2, 5 and 10 SetPosInternal(GetPos() + GetPageSize() - GetPos() % GetPageSize()); }