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 // PagePosition.cpp : implementation file
20 #include "std_sound_plugin.h"
21 #include "georges_plugin_sound.h"
22 #include "listener_view.h"
23 #include "sound_dialog.h"
24 #include "nel/georges/u_form_elm.h"
25 #include "sound_document_plugin.h"
26 #include "nel/sound/u_audio_mixer.h"
27 #include "nel/sound/sound.h"
28 #include "nel/sound/simple_sound.h"
30 #include "PagePosition.h"
34 /////////////////////////////////////////////////////////////////////////////
35 // CPagePosition property page
38 IMPLEMENT_DYNCREATE(CPagePosition
, CPageBase
)
41 CPagePosition::CPagePosition(NLGEORGES::CSoundDialog
*soundDialog
) : CPageBase(soundDialog
, CPagePosition::IDD
)
43 AFX_MANAGE_STATE(AfxGetStaticModuleState());
44 //{{AFX_DATA_INIT(CPagePosition)
45 // NOTE: the ClassWizard will add member initialization here
49 CPagePosition::~CPagePosition()
53 void CPagePosition::DoDataExchange(CDataExchange
* pDX
)
55 CPropertyPage::DoDataExchange(pDX
);
56 //{{AFX_DATA_MAP(CPagePosition)
57 DDX_Control(pDX
, IDC_PSEUDO_PICTURE
, _Picture
);
62 BEGIN_MESSAGE_MAP(CPagePosition
, CPropertyPage
)
63 //{{AFX_MSG_MAP(CPagePosition)
67 /////////////////////////////////////////////////////////////////////////////
68 // CPagePosition message handlers
70 BOOL
CPagePosition::OnInitDialog()
72 CPropertyPage::OnInitDialog();
74 // TODO: Add extra initialization here
75 // insert the listener position view inside the pseudo picture control.
76 WINDOWPLACEMENT place
;
77 _Picture
.GetWindowPlacement(&place
);
81 _ListenerView
= new NLGEORGES::CListenerView();
83 _ListenerView
->init(SoundDialog
->getSoundPlugin(), CRect(place
.rcNormalPosition
), this);
86 return TRUE
; // return TRUE unless you set the focus to a control
87 // EXCEPTION: OCX Property Pages should return FALSE
91 void CPagePosition::onDocChanged()
93 /* // the document have been modified, update the dialog
94 NLGEORGES::IEditDocument *pdoc = SoundDialog->getSoundPlugin()->getActiveDocument();
100 string type, dfnName;
102 pdoc->getForm()->getRootNode().getDfnName(dfnName);
103 if (dfnName == "sound.dfn")
105 */ NLSOUND::CSound
*sound
= SoundDialog
->getSoundPlugin()->getSound();
109 // the sound is available !
110 float minDist
= 1.0f
;
111 _ListenerView
->setAngles(uint32(180 * sound
->getConeInnerAngle() / NLMISC::Pi
), uint32(180 * sound
->getConeOuterAngle() / NLMISC::Pi
));
112 if (sound
->getSoundType() == NLSOUND::CSound::SOUND_SIMPLE
)
114 _ListenerView
->setAlpha(static_cast<NLSOUND::CSimpleSound
*>(sound
)->getAlpha());
115 _ListenerView
->setShowAlpha(true);
116 minDist
= static_cast<NLSOUND::CSimpleSound
*>(sound
)->getMinDistance();
119 _ListenerView
->setShowAlpha(false);
121 _ListenerView
->setMinMaxDistances(minDist
, sound
->getMaxDistance());
122 _ListenerView
->setActive(true);
132 _ListenerView
->setActive(false);