mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-04-22 01:52:43 +00:00
Eliminate baseVolume
Not needed
This commit is contained in:
parent
caac53d93e
commit
9c31fa8440
5 changed files with 5 additions and 12 deletions
|
|
@ -1197,7 +1197,6 @@
|
|||
--- @class ModAudio
|
||||
--- @field public filepath string
|
||||
--- @field public isStream boolean
|
||||
--- @field public baseVolume number
|
||||
--- @field public loaded boolean
|
||||
|
||||
--- @class ModFs
|
||||
|
|
|
|||
|
|
@ -1745,7 +1745,6 @@
|
|||
| ----- | ---- | ------ |
|
||||
| filepath | `string` | read-only |
|
||||
| isStream | `boolean` | read-only |
|
||||
| baseVolume | `number` | |
|
||||
| loaded | `boolean` | read-only |
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
|
|
|||
|
|
@ -1482,12 +1482,11 @@ static struct LuaObjectField sModFields[LUA_MOD_FIELD_COUNT] = {
|
|||
{ "size", LVT_U64, offsetof(struct Mod, size), true, LOT_NONE, 1, sizeof(size_t) },
|
||||
};
|
||||
|
||||
#define LUA_MOD_AUDIO_FIELD_COUNT 4
|
||||
#define LUA_MOD_AUDIO_FIELD_COUNT 3
|
||||
static struct LuaObjectField sModAudioFields[LUA_MOD_AUDIO_FIELD_COUNT] = {
|
||||
{ "baseVolume", LVT_F32, offsetof(struct ModAudio, baseVolume), false, LOT_NONE, 1, sizeof(f32) },
|
||||
{ "filepath", LVT_STRING_P, offsetof(struct ModAudio, filepath), true, LOT_NONE, 1, sizeof(const char*) },
|
||||
{ "isStream", LVT_BOOL, offsetof(struct ModAudio, isStream), true, LOT_NONE, 1, sizeof(bool) },
|
||||
{ "loaded", LVT_BOOL, offsetof(struct ModAudio, loaded), true, LOT_NONE, 1, sizeof(bool) },
|
||||
{ "filepath", LVT_STRING_P, offsetof(struct ModAudio, filepath), true, LOT_NONE, 1, sizeof(const char*) },
|
||||
{ "isStream", LVT_BOOL, offsetof(struct ModAudio, isStream), true, LOT_NONE, 1, sizeof(bool) },
|
||||
{ "loaded", LVT_BOOL, offsetof(struct ModAudio, loaded), true, LOT_NONE, 1, sizeof(bool) },
|
||||
};
|
||||
|
||||
#define LUA_MOD_FS_FIELD_COUNT 15
|
||||
|
|
|
|||
|
|
@ -397,7 +397,6 @@ void audio_stream_play(struct ModAudio* audio, bool restart, f32 volume) {
|
|||
if (!audio_sanity_check(audio, true, "play")) { return; }
|
||||
|
||||
ma_sound_set_volume(&audio->sound, volume);
|
||||
audio->baseVolume = volume;
|
||||
if (restart || !ma_sound_is_playing(&audio->sound)) { ma_sound_seek_to_pcm_frame(&audio->sound, 0); }
|
||||
ma_sound_start(&audio->sound);
|
||||
}
|
||||
|
|
@ -483,14 +482,13 @@ void audio_stream_set_frequency(struct ModAudio* audio, f32 freq) {
|
|||
f32 audio_stream_get_volume(struct ModAudio* audio) {
|
||||
if (!audio_sanity_check(audio, true, "get stream volume from")) { return 0; }
|
||||
|
||||
return audio->baseVolume;
|
||||
return ma_sound_get_volume(&audio->sound);
|
||||
}
|
||||
|
||||
void audio_stream_set_volume(struct ModAudio* audio, f32 volume) {
|
||||
if (!audio_sanity_check(audio, true, "set stream volume for")) { return; }
|
||||
|
||||
ma_sound_set_volume(&audio->sound, volume);
|
||||
audio->baseVolume = volume;
|
||||
}
|
||||
|
||||
// void audio_stream_set_speed(struct ModAudio* audio, f32 initial_freq, f32 speed, bool pitch) {
|
||||
|
|
@ -625,7 +623,6 @@ void audio_sample_play(struct ModAudio* audio, Vec3f position, f32 volume) {
|
|||
f32 intensity = sound_get_level_intensity(dist);
|
||||
ma_sound_set_volume(sound, volume * intensity);
|
||||
ma_sound_set_pan(sound, pan);
|
||||
audio->baseVolume = volume;
|
||||
|
||||
ma_sound_start(sound);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ struct ModAudio {
|
|||
u32 bufferSize;
|
||||
struct ModAudioSampleCopies* sampleCopiesTail;
|
||||
bool isStream;
|
||||
f32 baseVolume;
|
||||
bool loaded;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue