Readd 'loaded' field to mod audio for CS compatibility

This commit is contained in:
Agent X 2024-06-19 17:50:19 -04:00
parent eeebfecca4
commit fa2ffcdcb9
5 changed files with 6 additions and 1 deletions

View file

@ -1071,6 +1071,7 @@
--- @field public baseVolume number --- @field public baseVolume number
--- @field public file ModFile --- @field public file ModFile
--- @field public isStream boolean --- @field public isStream boolean
--- @field public loaded boolean
--- @field public sampleCopiesTail ModAudioSampleCopies --- @field public sampleCopiesTail ModAudioSampleCopies
--- @class ModAudioSampleCopies --- @class ModAudioSampleCopies

View file

@ -1454,6 +1454,7 @@
| baseVolume | `number` | | | baseVolume | `number` | |
| file | [ModFile](structs.md#ModFile) | | | file | [ModFile](structs.md#ModFile) | |
| isStream | `boolean` | | | isStream | `boolean` | |
| loaded | `boolean` | |
| sampleCopiesTail | [ModAudioSampleCopies](structs.md#ModAudioSampleCopies) | | | sampleCopiesTail | [ModAudioSampleCopies](structs.md#ModAudioSampleCopies) | |
[:arrow_up_small:](#) [:arrow_up_small:](#)

View file

@ -1199,11 +1199,12 @@ static struct LuaObjectField sModFields[LUA_MOD_FIELD_COUNT] = {
// { "size", LVT_???, offsetof(struct Mod, size), true, LOT_??? }, <--- UNIMPLEMENTED // { "size", LVT_???, offsetof(struct Mod, size), true, LOT_??? }, <--- UNIMPLEMENTED
}; };
#define LUA_MOD_AUDIO_FIELD_COUNT 4 #define LUA_MOD_AUDIO_FIELD_COUNT 5
static struct LuaObjectField sModAudioFields[LUA_MOD_AUDIO_FIELD_COUNT] = { static struct LuaObjectField sModAudioFields[LUA_MOD_AUDIO_FIELD_COUNT] = {
{ "baseVolume", LVT_F32, offsetof(struct ModAudio, baseVolume), false, LOT_NONE }, { "baseVolume", LVT_F32, offsetof(struct ModAudio, baseVolume), false, LOT_NONE },
{ "file", LVT_COBJECT_P, offsetof(struct ModAudio, file), false, LOT_MODFILE }, { "file", LVT_COBJECT_P, offsetof(struct ModAudio, file), false, LOT_MODFILE },
{ "isStream", LVT_BOOL, offsetof(struct ModAudio, isStream), false, LOT_NONE }, { "isStream", LVT_BOOL, offsetof(struct ModAudio, isStream), false, LOT_NONE },
{ "loaded", LVT_BOOL, offsetof(struct ModAudio, loaded), false, LOT_NONE },
{ "sampleCopiesTail", LVT_COBJECT_P, offsetof(struct ModAudio, sampleCopiesTail), false, LOT_MODAUDIOSAMPLECOPIES }, { "sampleCopiesTail", LVT_COBJECT_P, offsetof(struct ModAudio, sampleCopiesTail), false, LOT_MODAUDIOSAMPLECOPIES },
// { "sound", LVT_???, offsetof(struct ModAudio, sound), false, LOT_??? }, <--- UNIMPLEMENTED // { "sound", LVT_???, offsetof(struct ModAudio, sound), false, LOT_??? }, <--- UNIMPLEMENTED
}; };

View file

@ -262,6 +262,7 @@ struct ModAudio* audio_load_internal(const char* filename, bool isStream) {
} }
audio->isStream = isStream; audio->isStream = isStream;
audio->loaded = true;
return audio; return audio;
} }

View file

@ -24,6 +24,7 @@ struct ModAudio {
struct ModAudioSampleCopies* sampleCopiesTail; struct ModAudioSampleCopies* sampleCopiesTail;
bool isStream; bool isStream;
f32 baseVolume; f32 baseVolume;
bool loaded;
}; };
struct ModAudio* audio_stream_load(const char* filename); struct ModAudio* audio_stream_load(const char* filename);