Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/samtupy/nvgt
Browse files Browse the repository at this point in the history
  • Loading branch information
TheQuinbox committed Jun 3, 2024
2 parents 558f964 + 77cf575 commit f5b1f4b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ user/**
lindev
macosdev
windev
deps

# website builds
web/public_html
Expand Down
4 changes: 2 additions & 2 deletions release/include/sound_pool.nvgt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class sound_pool_item {
return;
}
if (total_distance <= max_distance and handle.active == false) {
handle.load(filename, @packfile);
handle.load(filename, @packfile != null? @packfile : @sound_default_pack);
if (handle.active == true) {
if (start_offset > 0)
handle.seek(start_offset);
Expand Down Expand Up @@ -346,7 +346,7 @@ class sound_pool {
return slot;
}
}
items[slot].handle.load(items[slot].filename, @items[slot].packfile);
items[slot].handle.load(items[slot].filename, @items[slot].packfile != null? @items[slot].packfile : @sound_default_pack);
if (items[slot].handle.active == false) {
items[slot].reset();
return -1;
Expand Down
6 changes: 4 additions & 2 deletions src/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ static IPLHRTFSettings phonon_hrtfSettings{};
static IPLHRTF phonon_hrtf = NULL;
static IPLHRTF phonon_hrtf_reflections = NULL;
static thread_mutex_t preload_mutex;
static pack* g_sound_default_pack = nullptr;

hstream_entry* last_channel = NULL;
hstream_entry* register_hstream(unsigned int channel) {
Expand Down Expand Up @@ -2122,6 +2123,7 @@ sound_environment* ScriptSound_Environment_Factory() {
return new sound_environment();
}
void RegisterScriptSound(asIScriptEngine* engine) {
engine->RegisterGlobalProperty("pack@ sound_default_pack", &g_sound_default_pack);
engine->RegisterFuncdef(_O("void sound_close_callback(string)"));
engine->RegisterFuncdef(_O("uint sound_length_callback(string)"));
engine->RegisterFuncdef(_O("int sound_read_callback(string &out, uint, string)"));
Expand All @@ -2135,11 +2137,11 @@ void RegisterScriptSound(asIScriptEngine* engine) {
engine->RegisterObjectBehaviour("sound", asBEHAVE_ADDREF, "void f()", asMETHOD(sound, AddRef), asCALL_THISCALL);
engine->RegisterObjectBehaviour("sound", asBEHAVE_RELEASE, "void f()", asMETHOD(sound, Release), asCALL_THISCALL);
engine->RegisterObjectMethod("sound", "bool close()", asMETHOD(sound, close), asCALL_THISCALL);
engine->RegisterObjectMethod("sound", "bool load(const string &in, pack@ = null, bool = true)", asMETHOD(sound, load), asCALL_THISCALL);
engine->RegisterObjectMethod("sound", "bool load(const string &in, pack@ = sound_default_pack, bool = true)", asMETHOD(sound, load), asCALL_THISCALL);
engine->RegisterObjectMethod("sound", "bool load(sound_close_callback@, sound_length_callback@, sound_read_callback@, sound_seek_callback@, const string &in, const string&in = \"\")", asMETHOD(sound, load_script), asCALL_THISCALL);
engine->RegisterObjectMethod("sound", "bool load(string&, uint, const string&in = \"\", bool = false)", asMETHOD(sound, load_memstream), asCALL_THISCALL);
engine->RegisterObjectMethod("sound", "bool load_url(const string &in)", asMETHOD(sound, load_url), asCALL_THISCALL);
engine->RegisterObjectMethod("sound", "bool stream(const string &in, pack@ = null)", asMETHOD(sound, stream), asCALL_THISCALL);
engine->RegisterObjectMethod("sound", "bool stream(const string &in, pack@ = sound_default_pack)", asMETHOD(sound, stream), asCALL_THISCALL);
engine->RegisterObjectMethod("sound", "bool push_memory(const string &in, bool = false, int = 0, int = 0)", asMETHOD(sound, push_string), asCALL_THISCALL);
engine->RegisterObjectMethod("sound", "bool set_position(float, float, float, float, float, float, float, float, float)", asMETHOD(sound, set_position), asCALL_THISCALL);
engine->RegisterObjectMethod("sound", "bool set_mixer(mixer@ = null)", asMETHOD(sound, set_mixer), asCALL_THISCALL);
Expand Down

0 comments on commit f5b1f4b

Please sign in to comment.