Volume setting

This commit is contained in:
Mark Suckerberg
2025-12-30 13:15:50 -06:00
parent b5568d5493
commit c30a9e3520
6 changed files with 22 additions and 1 deletions

View File

@@ -12,6 +12,12 @@ namespace game::resource
return mixer;
}
void Audio::set_gain(float gain)
{
auto mixer = mixer_get();
MIX_SetMasterGain(mixer, gain);
}
void Audio::retain()
{
if (refCount) ++(*refCount);

View File

@@ -10,7 +10,7 @@ namespace game::resource
MIX_Audio* internal{nullptr};
MIX_Track* track{nullptr};
int* refCount{nullptr};
MIX_Mixer* mixer_get();
static MIX_Mixer* mixer_get();
void unload();
void retain();
void release();
@@ -27,5 +27,6 @@ namespace game::resource
void play(bool isLoop = false);
void stop();
bool is_playing() const;
static void set_gain(float vol);
};
}