Skip to content

Commit 7e09775

Browse files
committed
feat: integrate stb_vorbis for OGG audio support and update sound assets
1 parent e092ae5 commit 7e09775

29 files changed

Lines changed: 99 additions & 29 deletions

CMakeLists.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,32 @@ target_include_directories(utils SYSTEM
251251
INTERFACE vendor/utils
252252
)
253253

254+
# ---- stb_vorbis ----
255+
set(STB_VORBIS_COMMIT "31c1ad37456438565541f4919958214b6e762fb4")
256+
set(STB_VORBIS_DIR "${CMAKE_BINARY_DIR}/_deps/stb_vorbis")
257+
set(STB_VORBIS_FILE "${STB_VORBIS_DIR}/stb_vorbis.c")
258+
if(NOT EXISTS "${STB_VORBIS_FILE}")
259+
file(MAKE_DIRECTORY "${STB_VORBIS_DIR}")
260+
message(STATUS "Downloading stb_vorbis @ ${STB_VORBIS_COMMIT}")
261+
file(DOWNLOAD
262+
"https://raw.githubusercontent.com/nothings/stb/${STB_VORBIS_COMMIT}/stb_vorbis.c"
263+
"${STB_VORBIS_FILE}"
264+
STATUS STB_VORBIS_DL_STATUS
265+
TLS_VERIFY ON
266+
)
267+
list(GET STB_VORBIS_DL_STATUS 0 STB_VORBIS_DL_CODE)
268+
if(NOT STB_VORBIS_DL_CODE EQUAL 0)
269+
file(REMOVE "${STB_VORBIS_FILE}")
270+
message(FATAL_ERROR "Failed to download stb_vorbis: ${STB_VORBIS_DL_STATUS}")
271+
endif()
272+
endif()
273+
add_library(stb_vorbis STATIC "${STB_VORBIS_FILE}")
274+
target_include_directories(stb_vorbis SYSTEM PUBLIC "${STB_VORBIS_DIR}")
275+
target_compile_options(stb_vorbis PRIVATE
276+
$<$<C_COMPILER_ID:GNU,Clang,AppleClang>:-w>
277+
$<$<C_COMPILER_ID:MSVC>:/w>
278+
)
279+
254280
# ---- ImGui ----
255281
add_library(imgui STATIC
256282
vendor/imgui/imgui.cpp
@@ -365,6 +391,7 @@ target_link_libraries(${PROJECT_NAME}
365391
glm
366392
imgui
367393
utils
394+
stb_vorbis
368395
BulletDynamics
369396
BulletCollision
370397
BulletSoftBody

assets/sounds/ambient.ogg

1.11 MB
Binary file not shown.

assets/sounds/ambient.wav

-13.6 MB
Binary file not shown.

assets/sounds/deagle.ogg

25.3 KB
Binary file not shown.

assets/sounds/deagle.wav

-253 KB
Binary file not shown.

assets/sounds/drone_gun_shot.ogg

5.82 KB
Binary file not shown.

assets/sounds/drone_gun_shot.wav

-24.6 KB
Binary file not shown.

assets/sounds/gun_reload.ogg

16.8 KB
Binary file not shown.

assets/sounds/gun_reload.wav

-142 KB
Binary file not shown.

assets/sounds/gun_shot.ogg

6.71 KB
Binary file not shown.

0 commit comments

Comments
 (0)