mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-04-29 06:49:24 -04:00
review changes
This commit is contained in:
parent
7d735536a3
commit
2b23c6bb1d
6 changed files with 22 additions and 26 deletions
|
@ -129,6 +129,7 @@ AudioAPIPtr IAudioAPI::CreateDeviceFromConfig(AudioType type, sint32 rate, sint3
|
|||
|
||||
audioAPIDev = CreateDevice(audio_api, device_description, rate, channels, samples_per_block, bits_per_sample);
|
||||
audioAPIDev->SetVolume(TV ? config.tv_volume : config.pad_volume);
|
||||
|
||||
return audioAPIDev;
|
||||
}
|
||||
|
||||
|
@ -220,7 +221,7 @@ AudioChannels IAudioAPI::AudioTypeToChannels(AudioType type)
|
|||
case Gamepad:
|
||||
return config.pad_channels;
|
||||
case Portal:
|
||||
return config.portal_channels;
|
||||
return kMono;
|
||||
default:
|
||||
return kMono;
|
||||
}
|
||||
|
@ -241,3 +242,19 @@ std::wstring IAudioAPI::GetDeviceFromType(AudioType type)
|
|||
return L"";
|
||||
}
|
||||
}
|
||||
|
||||
sint32 IAudioAPI::GetVolumeFromType(AudioType type)
|
||||
{
|
||||
auto& config = GetConfig();
|
||||
switch (type)
|
||||
{
|
||||
case TV:
|
||||
return config.tv_volume;
|
||||
case Gamepad:
|
||||
return config.pad_volume;
|
||||
case Portal:
|
||||
return config.portal_volume;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,6 +95,7 @@ private:
|
|||
void InitWFX(sint32 samplerate, sint32 channels, sint32 bits_per_sample);
|
||||
static AudioChannels AudioTypeToChannels(AudioType type);
|
||||
static std::wstring GetDeviceFromType(AudioType type);
|
||||
static sint32 GetVolumeFromType(AudioType type);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -275,7 +275,6 @@ void CemuConfig::Load(XMLConfigParser& parser)
|
|||
tv_channels = audio.get("TVChannels", kStereo);
|
||||
pad_channels = audio.get("PadChannels", kStereo);
|
||||
input_channels = audio.get("InputChannels", kMono);
|
||||
portal_channels = audio.get("PortalChannels", kMono);
|
||||
tv_volume = audio.get("TVVolume", 20);
|
||||
pad_volume = audio.get("PadVolume", 0);
|
||||
input_volume = audio.get("InputVolume", 20);
|
||||
|
@ -520,7 +519,6 @@ void CemuConfig::Save(XMLConfigParser& parser)
|
|||
audio.set("TVChannels", tv_channels);
|
||||
audio.set("PadChannels", pad_channels);
|
||||
audio.set("InputChannels", input_channels);
|
||||
audio.set("PortalChannels", portal_channels);
|
||||
audio.set("TVVolume", tv_volume);
|
||||
audio.set("PadVolume", pad_volume);
|
||||
audio.set("InputVolume", input_volume);
|
||||
|
|
|
@ -479,7 +479,7 @@ struct CemuConfig
|
|||
// audio
|
||||
sint32 audio_api = 0;
|
||||
sint32 audio_delay = 2;
|
||||
AudioChannels tv_channels = kStereo, pad_channels = kStereo, input_channels = kMono, portal_channels = kMono;
|
||||
AudioChannels tv_channels = kStereo, pad_channels = kStereo, input_channels = kMono;
|
||||
sint32 tv_volume = 50, pad_volume = 0, input_volume = 50, portal_volume = 50;
|
||||
std::wstring tv_device{ L"default" }, pad_device, input_device, portal_device;
|
||||
|
||||
|
|
|
@ -559,17 +559,6 @@ wxPanel* GeneralSettings2::AddAudioPage(wxNotebook* notebook)
|
|||
|
||||
m_portal_device->Bind(wxEVT_CHOICE, &GeneralSettings2::OnAudioDeviceSelected, this);
|
||||
|
||||
const wxString audio_channel_drc_choices[] = { _("Mono") }; // mono for now only
|
||||
|
||||
portal_audio_row->Add(new wxStaticText(box, wxID_ANY, _("Channels")), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||
m_portal_channels = new wxChoice(box, wxID_ANY, wxDefaultPosition, wxDefaultSize, std::size(audio_channel_drc_choices), audio_channel_drc_choices);
|
||||
|
||||
m_portal_channels->SetSelection(0); // set default to mono
|
||||
|
||||
m_portal_channels->Bind(wxEVT_CHOICE, &GeneralSettings2::OnAudioChannelsSelected, this);
|
||||
portal_audio_row->Add(m_portal_channels, 0, wxEXPAND | wxALL, 5);
|
||||
portal_audio_row->AddSpacer(0);
|
||||
|
||||
portal_audio_row->Add(new wxStaticText(box, wxID_ANY, _("Volume")), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||
m_portal_volume = new wxSlider(box, wxID_ANY, 100, 0, 100);
|
||||
portal_audio_row->Add(m_portal_volume, 0, wxEXPAND | wxALL, 5);
|
||||
|
@ -1030,7 +1019,6 @@ void GeneralSettings2::StoreConfig()
|
|||
config.pad_channels = kStereo; // (AudioChannels)m_pad_channels->GetSelection();
|
||||
//config.input_channels = (AudioChannels)m_input_channels->GetSelection();
|
||||
config.input_channels = kMono; // (AudioChannels)m_input_channels->GetSelection();
|
||||
config.portal_channels = kMono; // (AudioChannels)m_portal_channels->GetSelection();
|
||||
|
||||
config.tv_volume = m_tv_volume->GetValue();
|
||||
config.pad_volume = m_pad_volume->GetValue();
|
||||
|
@ -1720,7 +1708,6 @@ void GeneralSettings2::ApplyConfig()
|
|||
m_pad_channels->SetSelection(0);
|
||||
//m_input_channels->SetSelection(config.pad_channels);
|
||||
m_input_channels->SetSelection(0);
|
||||
m_portal_channels->SetSelection(0);
|
||||
|
||||
SendSliderEvent(m_tv_volume, config.tv_volume);
|
||||
|
||||
|
@ -1975,7 +1962,7 @@ void GeneralSettings2::UpdateAudioDevice()
|
|||
}
|
||||
catch (std::runtime_error& ex)
|
||||
{
|
||||
cemuLog_log(LogType::Force, "can't initialize pad audio: {}", ex.what());
|
||||
cemuLog_log(LogType::Force, "can't initialize portal audio: {}", ex.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2010,13 +1997,6 @@ void GeneralSettings2::OnAudioChannelsSelected(wxCommandEvent& event)
|
|||
|
||||
config.pad_channels = (AudioChannels)obj->GetSelection();
|
||||
}
|
||||
else if (obj == m_portal_channels)
|
||||
{
|
||||
if (config.portal_channels == (AudioChannels)obj->GetSelection())
|
||||
return;
|
||||
|
||||
config.portal_channels = (AudioChannels)obj->GetSelection();
|
||||
}
|
||||
else
|
||||
cemu_assert_debug(false);
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ private:
|
|||
wxChoice* m_audio_api;
|
||||
wxSlider *m_audio_latency;
|
||||
wxSlider *m_tv_volume, *m_pad_volume, *m_input_volume, *m_portal_volume;
|
||||
wxChoice *m_tv_channels, *m_pad_channels, *m_input_channels, *m_portal_channels;
|
||||
wxChoice *m_tv_channels, *m_pad_channels, *m_input_channels;
|
||||
wxChoice *m_tv_device, *m_pad_device, *m_input_device, *m_portal_device;
|
||||
|
||||
// Account
|
||||
|
|
Loading…
Add table
Reference in a new issue