Ejemplo n.º 1
0
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);
}
Ejemplo n.º 2
0
void CPlayerSeekBar::SetPos(__int64 pos)
{
	CWnd* w = GetCapture();
	if(w && w->m_hWnd == m_hWnd) return;

	SetPosInternal(pos);
}
Ejemplo n.º 3
0
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);
}
Ejemplo n.º 4
0
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);
		}
	}
}
Ejemplo n.º 5
0
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);
	}
}
Ejemplo n.º 6
0
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);
		}
	}
}
Ejemplo n.º 7
0
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()));
}
Ejemplo n.º 8
0
void CVolumeCtrl::IncreaseVolume()
{
    // align volume up to step. recommend using steps 1, 2, 5 and 10
    SetPosInternal(GetPos() + GetPageSize() - GetPos() % GetPageSize());

}