Skip to content

Commit 12b2e62

Browse files
committed
[GEN] Add cmake setup for WWAudio and make it compile with VS2022 (#709)
1 parent d5ffc52 commit 12b2e62

File tree

7 files changed

+66
-3
lines changed

7 files changed

+66
-3
lines changed

Generals/Code/Libraries/Source/WWVegas/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ target_include_directories(g_wwcommon INTERFACE
1717
Wwutil
1818
)
1919

20+
add_subdirectory(WWAudio)
2021
add_subdirectory(WWMath)
2122
add_subdirectory(Wwutil)
2223
add_subdirectory(WW3D2)
@@ -28,6 +29,7 @@ add_library(g_wwvegas INTERFACE)
2829
target_include_directories(g_wwvegas INTERFACE
2930
.
3031
WW3D2
32+
WWAudio
3133
WWDownload
3234
Wwutil
3335
)

Generals/Code/Libraries/Source/WWVegas/WWAudio/AudioEvents.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ class AudioCallbackListClass : public SimpleDynVecClass< AUDIO_CALLBACK_STRUCT<T
151151
using SimpleDynVecClass< AUDIO_CALLBACK_STRUCT<T> >::Vector;
152152
using SimpleDynVecClass< AUDIO_CALLBACK_STRUCT<T> >::ActiveCount;
153153
using SimpleDynVecClass< AUDIO_CALLBACK_STRUCT<T> >::Delete;
154+
using SimpleDynVecClass< AUDIO_CALLBACK_STRUCT<T> >::Add;
154155

155156
public:
156157

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
set(WWAUDIO_SRC
2+
"AABTreeSoundCullClass.h"
3+
"AudibleSound.cpp"
4+
"AudibleSound.h"
5+
"AudioEvents.h"
6+
"AudioSaveLoad.cpp"
7+
"AudioSaveLoad.h"
8+
"FilteredSound.cpp"
9+
"FilteredSound.h"
10+
"Listener.cpp"
11+
"Listener.h"
12+
"listenerhandle.cpp"
13+
"listenerhandle.h"
14+
"LogicalListener.cpp"
15+
"LogicalListener.h"
16+
"LogicalSound.cpp"
17+
"LogicalSound.h"
18+
"PriorityVector.h"
19+
"sound2dhandle.cpp"
20+
"sound2dhandle.h"
21+
"Sound3D.cpp"
22+
"Sound3D.h"
23+
"sound3dhandle.cpp"
24+
"sound3dhandle.h"
25+
"SoundBuffer.cpp"
26+
"SoundBuffer.h"
27+
"SoundChunkIDs.h"
28+
"SoundCullObj.h"
29+
"soundhandle.cpp"
30+
"soundhandle.h"
31+
"SoundPseudo3D.cpp"
32+
"SoundPseudo3D.h"
33+
"SoundScene.cpp"
34+
"SoundScene.h"
35+
"SoundSceneObj.cpp"
36+
"SoundSceneObj.h"
37+
"soundstreamhandle.cpp"
38+
"soundstreamhandle.h"
39+
"Threads.cpp"
40+
"Threads.h"
41+
"Utils.cpp"
42+
"Utils.h"
43+
"WWAudio.cpp"
44+
"WWAudio.h"
45+
)
46+
47+
add_library(g_wwaudio STATIC)
48+
set_target_properties(g_wwaudio PROPERTIES OUTPUT_NAME wwaudio)
49+
50+
target_sources(g_wwaudio PRIVATE ${WWAUDIO_SRC})
51+
52+
target_link_libraries(g_wwaudio PRIVATE
53+
g_wwcommon
54+
)

Generals/Code/Libraries/Source/WWVegas/WWAudio/PriorityVector.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
template<class T>
4848
class PriorityVectorClass : public DynamicVectorClass<T>
4949
{
50+
using DynamicVectorClass<T>::Vector;
51+
using DynamicVectorClass<T>::ActiveCount;
52+
5053
public:
5154

5255
virtual bool Process_Head (T &object);

Generals/Code/Libraries/Source/WWVegas/WWAudio/SoundScene.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ SoundSceneClass::Collect_Audible_Sounds
278278
float length2 = (pos - listener_pos).Length2 ();
279279
if (length2 <= radius2) {
280280

281-
AudibleInfoClass *audible_info = W3DNEW AudibleInfoClass (sound_obj, length2);
281+
AudibleInfoClass *audible_info = new AudibleInfoClass (sound_obj, length2);
282282
list.Add (audible_info);
283283

284284
//
@@ -310,7 +310,7 @@ SoundSceneClass::Collect_Audible_Sounds
310310
float length2 = (pos - listener_pos).Length2 ();
311311
if (length2 <= radius2) {
312312

313-
AudibleInfoClass *audible_info = W3DNEW AudibleInfoClass (sound_obj, length2);
313+
AudibleInfoClass *audible_info = new AudibleInfoClass (sound_obj, length2);
314314
list.Add (audible_info);
315315

316316
//

Generals/Code/Libraries/Source/WWVegas/WWAudio/SoundScene.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ class SoundSceneClass
178178
//////////////////////////////////////////////////////////////////////
179179
// Collection methods
180180
//////////////////////////////////////////////////////////////////////
181+
public:
181182
class AudibleInfoClass : public MultiListObjectClass, public AutoPoolClass<AudibleInfoClass, 64>
182183
{
183184
public:
@@ -193,6 +194,7 @@ class SoundSceneClass
193194
float distance2;
194195
};
195196

197+
protected:
196198
typedef MultiListClass<AudibleInfoClass> COLLECTED_SOUNDS;
197199

198200
virtual void Collect_Audible_Sounds (Listener3DClass *listener, COLLECTED_SOUNDS &list);

Generals/Code/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,8 @@ WWAudioClass::Remove_From_Playlist (AudibleSoundClass *sound_obj)
12201220
if (sound_obj != NULL) {
12211221

12221222
// Loop through all the entries in the playlist
1223-
for (int index = 0; (index < m_Playlist.Count ()) && (retval == false); index ++) {
1223+
int index = 0;
1224+
for (; (index < m_Playlist.Count ()) && (retval == false); index ++) {
12241225

12251226
// Is this the entry we are looking for?
12261227
if (sound_obj == m_Playlist[index]) {

0 commit comments

Comments
 (0)