1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 // PageBgFades.cpp : implementation file
23 #include "std_sound_plugin.h"
24 #include "georges_plugin_sound.h"
25 #include "nel/misc/types_nl.h"
26 #include "sound_dialog.h"
27 #include "sound_plugin.h"
28 #include "nel/sound/u_audio_mixer.h"
30 #include "PageBgFades.h"
71 uint FILTER_FADE_IN
[] =
107 uint FILTER_FADE_OUT
[] =
143 map
<uint
, uint
> FILTER_FADE_IN_IDX
;
144 map
<uint
, uint
> FILTER_FADE_OUT_IDX
;
146 /////////////////////////////////////////////////////////////////////////////
147 // CPageBgFades property page
150 IMPLEMENT_DYNCREATE(CPageBgFades
, CPageBase
)
153 CPageBgFades::CPageBgFades(NLGEORGES::CSoundDialog
*soundDialog
)
154 : CPageBase(soundDialog
, CPageBgFades::IDD
)
156 AFX_MANAGE_STATE(AfxGetStaticModuleState());
157 //{{AFX_DATA_INIT(CPageBgFades)
158 // NOTE: the ClassWizard will add member initialization here
161 for (uint i
=0; i
<32; ++i
)
163 FILTER_FADE_IN_IDX
.insert(make_pair(FILTER_FADE_IN
[i
], i
));
164 FILTER_FADE_OUT_IDX
.insert(make_pair(FILTER_FADE_OUT
[i
], i
));
168 CPageBgFades::~CPageBgFades()
172 void CPageBgFades::DoDataExchange(CDataExchange
* pDX
)
174 CPropertyPage::DoDataExchange(pDX
);
175 //{{AFX_DATA_MAP(CPageBgFades)
176 // NOTE: the ClassWizard will add DDX and DDV calls here
181 BEGIN_MESSAGE_MAP(CPageBgFades
, CPropertyPage
)
182 //{{AFX_MSG_MAP(CPageBgFades)
186 /////////////////////////////////////////////////////////////////////////////
187 // CPageBgFades message handlers
189 BOOL
CPageBgFades::OnInitDialog()
191 CPropertyPage::OnInitDialog();
193 // initialize the filter names and fade value
194 for (uint i
=0; i
<32; ++i
)
197 GetDlgItem(FILTER_NAMES
[i
])->SetWindowText(nlUtf8ToTStr(SoundDialog
->EnvNames
[i
].Name
));
198 sprintf(tmp
, "%u", (unsigned int)SoundDialog
->FilterFades
.FadeIns
[i
]);
199 GetDlgItem(FILTER_FADE_IN
[i
])->SetWindowText(nlUtf8ToTStr(tmp
));
200 sprintf(tmp
, "%u", (unsigned int)SoundDialog
->FilterFades
.FadeOuts
[i
]);
201 GetDlgItem(FILTER_FADE_OUT
[i
])->SetWindowText(nlUtf8ToTStr(tmp
));
204 SoundDialog
->getSoundPlugin()->getMixer()->setBackgroundFilterFades(SoundDialog
->FilterFades
);
206 return TRUE
; // return TRUE unless you set the focus to a control
207 // EXCEPTION: OCX Property Pages should return FALSE
210 BOOL
CPageBgFades::OnCommand(WPARAM wParam
, LPARAM lParam
)
212 if (lParam
!= 0 && HIWORD(wParam
) == EN_CHANGE
)
214 int id
= ::GetDlgCtrlID(HWND(lParam
));
217 if (FILTER_FADE_IN_IDX
.find(id
) != FILTER_FADE_IN_IDX
.end())
219 // this is a fade in value modified !
220 GetDlgItem(id
)->GetWindowText(tmp
, 1024);
221 SoundDialog
->FilterFades
.FadeIns
[FILTER_FADE_IN_IDX
[id
]] = atoi(nlTStrToUtf8(tmp
));
222 SoundDialog
->getSoundPlugin()->getMixer()->setBackgroundFilterFades(SoundDialog
->FilterFades
);
224 else if (FILTER_FADE_OUT_IDX
.find(id
) != FILTER_FADE_OUT_IDX
.end())
226 // this is a fade in value modified !
227 GetDlgItem(id
)->GetWindowText(tmp
, 1024);
228 SoundDialog
->FilterFades
.FadeOuts
[FILTER_FADE_OUT_IDX
[id
]] = atoi(nlTStrToUtf8(tmp
));
229 SoundDialog
->getSoundPlugin()->getMixer()->setBackgroundFilterFades(SoundDialog
->FilterFades
);
233 return CPropertyPage::OnCommand(wParam
, lParam
);