@@ -47,46 +47,17 @@ BOOL CSoundRender_CoreA::EAXTestSupport (BOOL bDeferred)
4747void CSoundRender_CoreA::_restart ()
4848{
4949 inherited::_restart ();
50- /*
51- CSoundRender_Target* T = 0;
52- for (u32 tit=0; tit<s_targets.size(); tit++)
53- {
54- T = s_targets[tit];
55- T->_destroy ();
56- }
57-
58- // Reset the current context to NULL.
59- alcMakeContextCurrent (NULL);
60- // Release the context and the device.
61- alcDestroyContext (pContext);
62- pContext = NULL;
63- alcCloseDevice (pDevice);
64- pDevice = NULL;
65-
66- _initialize (2);
67-
68- for (u32 tit=0; tit<s_targets.size(); tit++)
69- {
70- T = s_targets[tit];
71- T->_initialize ();
72- }
73- */
7450}
7551
76- void CSoundRender_CoreA::_initialize (int stage )
52+ void CSoundRender_CoreA::_initialize ()
7753{
78- if (stage==0 )
79- {
80- pDeviceList = xr_new<ALDeviceList>();
54+ pDeviceList = xr_new<ALDeviceList>();
8155
82- if (0 ==pDeviceList->GetNumDevices ())
83- {
84- CHECK_OR_EXIT (0 ," OpenAL: Can't create sound device." );
85- xr_delete (pDeviceList);
86- }
87- return ;
56+ if (0 ==pDeviceList->GetNumDevices ())
57+ {
58+ CHECK_OR_EXIT (0 ," OpenAL: Can't create sound device." );
59+ xr_delete (pDeviceList);
8860 }
89-
9061 pDeviceList->SelectBestDevice ();
9162 R_ASSERT (snd_device_id>=0 && snd_device_id<pDeviceList->GetNumDevices ());
9263 const ALDeviceDesc& deviceDesc = pDeviceList->GetDeviceDesc (snd_device_id);
@@ -140,25 +111,22 @@ void CSoundRender_CoreA::_initialize(int stage)
140111 bEAX = EAXTestSupport (FALSE );
141112 }
142113
143- inherited::_initialize (stage );
114+ inherited::_initialize ();
144115
145- if (stage==1 )// first initialize
116+ // Pre-create targets
117+ CSoundRender_Target* T = 0 ;
118+ for (u32 tit=0 ; tit<u32 (psSoundTargets); tit++)
146119 {
147- // Pre-create targets
148- CSoundRender_Target* T = 0 ;
149- for (u32 tit=0 ; tit<u32 (psSoundTargets); tit++)
120+ T = xr_new<CSoundRender_TargetA>();
121+ if (T->_initialize ())
122+ {
123+ s_targets.push_back (T);
124+ }else
150125 {
151- T = xr_new<CSoundRender_TargetA>();
152- if (T->_initialize ())
153- {
154- s_targets.push_back (T);
155- }else
156- {
157- Log (" ! SOUND: OpenAL: Max targets - " ,tit);
158- T->_destroy ();
159- xr_delete (T);
160- break ;
161- }
126+ Log (" ! SOUND: OpenAL: Max targets - " ,tit);
127+ T->_destroy ();
128+ xr_delete (T);
129+ break ;
162130 }
163131 }
164132}
0 commit comments