Specify filetypes in audio folder, add audio_custom_shutdown()
This commit is contained in:
parent
a722afe122
commit
f2c032c6d8
|
@ -86,7 +86,7 @@ override_disallowed_functions = {
|
||||||
"src/pc/lua/utils/smlua_obj_utils.h": [ "spawn_object_remember_field" ],
|
"src/pc/lua/utils/smlua_obj_utils.h": [ "spawn_object_remember_field" ],
|
||||||
"src/game/camera.h": [ "update_camera", "init_camera", "stub_camera", "^reset_camera", "move_point_along_spline" ],
|
"src/game/camera.h": [ "update_camera", "init_camera", "stub_camera", "^reset_camera", "move_point_along_spline" ],
|
||||||
"src/game/behavior_actions.h": [ "bhv_dust_smoke_loop", "bhv_init_room" ],
|
"src/game/behavior_actions.h": [ "bhv_dust_smoke_loop", "bhv_init_room" ],
|
||||||
"src/pc/lua/utils/smlua_audio_utils.h": [ "smlua_audio_utils_override"],
|
"src/pc/lua/utils/smlua_audio_utils.h": [ "smlua_audio_utils_override", "audio_custom_shutdown"],
|
||||||
"src/pc/djui/djui_hud_utils.h": [ "djui_hud_render_texture", "djui_hud_render_texture_raw" ],
|
"src/pc/djui/djui_hud_utils.h": [ "djui_hud_render_texture", "djui_hud_render_texture_raw" ],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -387,3 +387,16 @@ void audio_sample_play(struct BassAudio* audio, Vec3f position, f32 volume) {
|
||||||
|
|
||||||
bassh_play_stream(stream, true);
|
bassh_play_stream(stream, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void audio_custom_shutdown(void) {
|
||||||
|
for(u16 i = 0; i < sBassAudioCount; i++) {
|
||||||
|
struct BassAudio* audio = &sBassAudio[i];
|
||||||
|
if (!audio->loaded) { continue; }
|
||||||
|
if (audio->isStream) {
|
||||||
|
audio_stream_destroy(audio);
|
||||||
|
} else {
|
||||||
|
audio_sample_destroy(audio);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sBassAudioCount = 0;
|
||||||
|
}
|
|
@ -38,4 +38,6 @@ struct BassAudio* audio_sample_load(const char* filename);
|
||||||
void audio_sample_destroy(struct BassAudio* audio);
|
void audio_sample_destroy(struct BassAudio* audio);
|
||||||
void audio_sample_play(struct BassAudio* audio, Vec3f position, f32 volume);
|
void audio_sample_play(struct BassAudio* audio, Vec3f position, f32 volume);
|
||||||
|
|
||||||
|
void audio_custom_shutdown(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -377,6 +377,11 @@ static bool mod_load_files(struct Mod* mod, char* modName, char* fullPath) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// only consider m64, mp3, aiff, and ogg files
|
||||||
|
if (!str_ends_with(path, ".m64") && !str_ends_with(path, ".mp3") && !str_ends_with(path, ".aiff") && !str_ends_with(path, ".ogg")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// allocate file
|
// allocate file
|
||||||
struct ModFile* file = mod_allocate_file(mod, relativePath);
|
struct ModFile* file = mod_allocate_file(mod, relativePath);
|
||||||
if (file == NULL) { return false; }
|
if (file == NULL) { return false; }
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "include/bass/bass.h"
|
#include "include/bass/bass.h"
|
||||||
#include "include/bass/bass_fx.h"
|
#include "include/bass/bass_fx.h"
|
||||||
#include "src/bass_audio/bass_audio_helpers.h"
|
#include "src/bass_audio/bass_audio_helpers.h"
|
||||||
|
#include "pc/lua/utils/smlua_audio_utils.h"
|
||||||
|
|
||||||
#ifdef DISCORDRPC
|
#ifdef DISCORDRPC
|
||||||
#include "pc/discord/discordrpc.h"
|
#include "pc/discord/discordrpc.h"
|
||||||
|
@ -241,6 +242,7 @@ void produce_one_frame(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio_shutdown(void) {
|
void audio_shutdown(void) {
|
||||||
|
audio_custom_shutdown();
|
||||||
if (audio_api) {
|
if (audio_api) {
|
||||||
if (audio_api->shutdown) audio_api->shutdown();
|
if (audio_api->shutdown) audio_api->shutdown();
|
||||||
audio_api = NULL;
|
audio_api = NULL;
|
||||||
|
@ -253,6 +255,7 @@ void game_deinit(void) {
|
||||||
#endif
|
#endif
|
||||||
configfile_save(configfile_name());
|
configfile_save(configfile_name());
|
||||||
controller_shutdown();
|
controller_shutdown();
|
||||||
|
audio_custom_shutdown();
|
||||||
audio_shutdown();
|
audio_shutdown();
|
||||||
gfx_shutdown();
|
gfx_shutdown();
|
||||||
network_shutdown(true);
|
network_shutdown(true);
|
||||||
|
|
BIN
test_echo.mp3
BIN
test_echo.mp3
Binary file not shown.
Loading…
Reference in New Issue