1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 // sound_dlg.cpp : implementation file
21 #include "base_dialog.h"
22 #include "client_config.h"
23 #include "sound_dlg.h"
26 // ***************************************************************************
27 #define SOUND_BUFFER_STEP 8
28 #define SOUND_BUFFER_NUM_STEP (32/SOUND_BUFFER_STEP)
30 // ***************************************************************************
32 // ***************************************************************************
34 CSoundDlg::CSoundDlg(CWnd
* pParent
/*=NULL*/)
35 : CBaseDialog(CSoundDlg::IDD
, pParent
)
37 //{{AFX_DATA_INIT(CSoundDlg)
41 ForceSoundSoft
= FALSE
;
46 // ***************************************************************************
48 void CSoundDlg::DoDataExchange(CDataExchange
* pDX
)
50 CDialog::DoDataExchange(pDX
);
51 //{{AFX_DATA_MAP(CSoundDlg)
52 DDX_Control(pDX
, IDC_SOUND_TEXT_SB
, TextSB
);
53 DDX_Control(pDX
, IDC_SOUND_TEXT_EAX
, TextEAX
);
54 DDX_Control(pDX
, IDC_SOUND_TEXT_FMOD
, TextFMod
);
55 DDX_Control(pDX
, IDC_SOUND_TEXT_FORCESOFT
, TextForceSoundSoft
);
56 DDX_Control(pDX
, IDC_EAX
, EAXCtrl
);
57 DDX_Control(pDX
, IDC_FMOD
, FModCtrl
);
58 DDX_Control(pDX
, IDC_FORCESOUNDSOFT
, ForceSoundSoftCtrl
);
59 DDX_Check(pDX
, IDC_SOUND_ON
, SoundOn
);
60 DDX_Check(pDX
, IDC_EAX
, EAX
);
61 DDX_Check(pDX
, IDC_FMOD
, FMod
);
62 DDX_Check(pDX
, IDC_FORCESOUNDSOFT
, ForceSoundSoft
);
63 DDX_Control(pDX
, IDC_SOUND_QUALITY
, SoundQuality
);
64 DDX_Control(pDX
, IDC_SOUND_QUALITY_VALUE
, SoundQualityValue
);
65 DDX_Slider(pDX
, IDC_SOUND_QUALITY
, SoundQualityInt
);
69 // ***************************************************************************
71 BEGIN_MESSAGE_MAP(CSoundDlg
, CDialog
)
72 //{{AFX_MSG_MAP(CSoundDlg)
74 ON_BN_CLICKED(IDC_SOUND_ON
, OnSoundOn
)
75 ON_BN_CLICKED(IDC_EAX
, OnEax
)
76 ON_BN_CLICKED(IDC_FMOD
, OnFMod
)
77 ON_BN_CLICKED(IDC_FORCESOUNDSOFT
, OnForceSoundSoft
)
81 // ***************************************************************************
82 // CSoundDlg message handlers
83 // ***************************************************************************
85 void CSoundDlg::OnSoundOn()
93 // ***************************************************************************
95 void CSoundDlg::updateState ()
97 FModCtrl
.EnableWindow (SoundOn
);
98 ForceSoundSoftCtrl
.EnableWindow (SoundOn
);
99 EAXCtrl
.EnableWindow (SoundOn
);
100 SoundQuality
.EnableWindow (SoundOn
);
101 TextSB
.EnableWindow (SoundOn
);
102 TextEAX
.EnableWindow (SoundOn
);
103 TextFMod
.EnableWindow (SoundOn
);
104 TextForceSoundSoft
.EnableWindow (SoundOn
);
105 SoundQualityValue
.EnableWindow (SoundOn
);
107 // Yoyo: temporary avoid FMod ctrl, since always FMod....
108 TextFMod
.ShowWindow(SW_HIDE
);
109 FModCtrl
.ShowWindow(SW_HIDE
);
111 ucstring str
= NLMISC::toString (getAsNumSoundBuffer()) + " " + NLMISC::CI18N::get ("uiConfigTracks");
112 setWindowText(SoundQualityValue
, (WCHAR
*)str
.c_str());
115 // ***************************************************************************
117 BOOL
CSoundDlg::OnInitDialog()
119 CDialog::OnInitDialog();
121 SoundQuality
.SetRange(1, SOUND_BUFFER_NUM_STEP
);
125 return TRUE
; // return TRUE unless you set the focus to a control
126 // EXCEPTION: OCX Property Pages should return FALSE
129 // ***************************************************************************
131 void CSoundDlg::OnEax()
136 // ***************************************************************************
138 void CSoundDlg::OnFMod()
143 // ***************************************************************************
145 void CSoundDlg::OnForceSoundSoft()
150 // ***************************************************************************
151 void CSoundDlg::setAsNumSoundBuffer(uint sb
)
153 SoundQualityInt
= sb
/SOUND_BUFFER_STEP
;
154 NLMISC::clamp(SoundQualityInt
, 1, SOUND_BUFFER_NUM_STEP
);
157 // ***************************************************************************
158 uint
CSoundDlg::getAsNumSoundBuffer() const
160 return SoundQualityInt
* SOUND_BUFFER_STEP
;
163 // ***************************************************************************
165 void CSoundDlg::OnHScroll(UINT nSBCode
, UINT nPos
, CScrollBar
* pScrollBar
)
172 CDialog::OnHScroll(nSBCode
, nPos
, pScrollBar
);