mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
Master Volume
This commit is contained in:
parent
831354ade8
commit
b622b5dcdf
7 changed files with 38 additions and 3 deletions
|
|
@ -18,8 +18,7 @@ Target of sunshine mod - improve original game.
|
|||
* pixman
|
||||
* SDL3_image
|
||||
* SDL3_ttf
|
||||
* [SDL3_sound](https://github.com/icculus/SDL_sound)
|
||||
* OpenAL
|
||||
* SDL3_mixer
|
||||
* PhysFS
|
||||
* sigc++-2.0
|
||||
* vorbisfile
|
||||
|
|
|
|||
|
|
@ -46,6 +46,15 @@ static VALUE rb_audio_destroyGroup(VALUE self, VALUE groupId) {
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE rb_audio_getMasterVolume(VALUE self) {
|
||||
return DBL2NUM(shState->audio().getMasterVolume());
|
||||
}
|
||||
|
||||
static VALUE rb_audio_setMasterVolume(VALUE self, VALUE volume) {
|
||||
shState->audio().setMasterVolume(NUM2DBL(volume));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE rb_audio_getGroupVolume(VALUE self, VALUE groupId) {
|
||||
return DBL2NUM(shState->audio().getGroupVolume(FIX2INT(groupId)));
|
||||
}
|
||||
|
|
@ -108,6 +117,9 @@ void audioBindingInit(){
|
|||
rb_define_singleton_method(module, "create_group", RUBY_METHOD_FUNC(rb_audio_createGroup), 0);
|
||||
rb_define_singleton_method(module, "destroy_group", RUBY_METHOD_FUNC(rb_audio_destroyGroup), 1);
|
||||
|
||||
rb_define_singleton_method(module, "master_volume", RUBY_METHOD_FUNC(rb_audio_getMasterVolume), 0);
|
||||
rb_define_singleton_method(module, "master_volume=", RUBY_METHOD_FUNC(rb_audio_setMasterVolume), 1);
|
||||
|
||||
rb_define_singleton_method(module, "get_group_volume", RUBY_METHOD_FUNC(rb_audio_getGroupVolume), 1);
|
||||
rb_define_singleton_method(module, "set_group_volume", RUBY_METHOD_FUNC(rb_audio_setGroupVolume), 2);
|
||||
rb_define_singleton_method(module, "stop_group_sounds", RUBY_METHOD_FUNC(rb_audio_stopGroupSounds), -1);
|
||||
|
|
|
|||
|
|
@ -55,3 +55,5 @@ Fixed Office teleport bug
|
|||
Added Crash Screen
|
||||
Added In-Memory Log buffer
|
||||
Added setting "Use Old Self Contained Universe(Reprise) version"
|
||||
Rewrited audio system from SDL3_sound and OpenAL to SDL_mixer
|
||||
Added Master Volume setting
|
||||
|
|
@ -3,6 +3,7 @@ module Settings
|
|||
def reset!
|
||||
@data = {
|
||||
# Audio
|
||||
:master_volume => 100,
|
||||
:bgm_volume => 100,
|
||||
:sfx_volume => 100,
|
||||
:use_fight_crime_track => false,
|
||||
|
|
@ -154,6 +155,13 @@ class Window_Settings
|
|||
},
|
||||
],
|
||||
"Audio" => [
|
||||
{
|
||||
:type => :slider,
|
||||
:name => "Master Volume",
|
||||
:parameter => :master_volume,
|
||||
:min => 0,
|
||||
:max => 100
|
||||
},
|
||||
{
|
||||
:type => :slider,
|
||||
:name => "BGM Volume",
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@ module Settings
|
|||
def crashlog_privacy(value)
|
||||
Sunshine.crashprivacy=value
|
||||
end
|
||||
|
||||
def master_volume(value)
|
||||
Audio.master_volume = value / 100.0
|
||||
end
|
||||
def bgm_volume(value)
|
||||
Audio.bgm_volume = value
|
||||
end
|
||||
|
|
|
|||
|
|
@ -123,6 +123,14 @@ void Audio::destroyGroup(int group) {
|
|||
p->groups[group] = nullptr;
|
||||
}
|
||||
|
||||
float Audio::getMasterVolume() const {
|
||||
return MIX_GetMixerGain(mixer);
|
||||
}
|
||||
|
||||
void Audio::setMasterVolume(float volume) {
|
||||
MIX_SetMixerGain(mixer, volume);
|
||||
}
|
||||
|
||||
float Audio::getGroupVolume(int group) const {
|
||||
AudioGroup* mixGroup = getGroup(group);
|
||||
if (!mixGroup)
|
||||
|
|
@ -136,6 +144,7 @@ void Audio::setGroupVolume(int group, float volume) {
|
|||
if (a_group)
|
||||
a_group->setVolume(volume);
|
||||
}
|
||||
|
||||
void Audio::stopSoundsInGroup(int group, float fadeoutTime) {
|
||||
AudioGroup* a_group = getGroup(group);
|
||||
if (a_group)
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ public:
|
|||
AudioGroup* getGroup(int group) const;
|
||||
void destroyGroup(int group);
|
||||
|
||||
float getMasterVolume() const;
|
||||
void setMasterVolume(float volume);
|
||||
|
||||
float getGroupVolume(int group) const;
|
||||
void setGroupVolume(int group, float volume);
|
||||
void stopSoundsInGroup(int group, float fadeoutTime = 0.0f);
|
||||
|
|
|
|||
Loading…
Reference in a new issue