Skip to content

Commit 2b23c6b

Browse files
committed
review changes
1 parent 7d73553 commit 2b23c6b

File tree

6 files changed

+22
-26
lines changed

6 files changed

+22
-26
lines changed

src/audio/IAudioAPI.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ AudioAPIPtr IAudioAPI::CreateDeviceFromConfig(AudioType type, sint32 rate, sint3
129129

130130
audioAPIDev = CreateDevice(audio_api, device_description, rate, channels, samples_per_block, bits_per_sample);
131131
audioAPIDev->SetVolume(TV ? config.tv_volume : config.pad_volume);
132+
132133
return audioAPIDev;
133134
}
134135

@@ -220,7 +221,7 @@ AudioChannels IAudioAPI::AudioTypeToChannels(AudioType type)
220221
case Gamepad:
221222
return config.pad_channels;
222223
case Portal:
223-
return config.portal_channels;
224+
return kMono;
224225
default:
225226
return kMono;
226227
}
@@ -241,3 +242,19 @@ std::wstring IAudioAPI::GetDeviceFromType(AudioType type)
241242
return L"";
242243
}
243244
}
245+
246+
sint32 IAudioAPI::GetVolumeFromType(AudioType type)
247+
{
248+
auto& config = GetConfig();
249+
switch (type)
250+
{
251+
case TV:
252+
return config.tv_volume;
253+
case Gamepad:
254+
return config.pad_volume;
255+
case Portal:
256+
return config.portal_volume;
257+
default:
258+
return 0;
259+
}
260+
}

src/audio/IAudioAPI.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ class IAudioAPI
9595
void InitWFX(sint32 samplerate, sint32 channels, sint32 bits_per_sample);
9696
static AudioChannels AudioTypeToChannels(AudioType type);
9797
static std::wstring GetDeviceFromType(AudioType type);
98+
static sint32 GetVolumeFromType(AudioType type);
9899

99100
};
100101

src/config/CemuConfig.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ void CemuConfig::Load(XMLConfigParser& parser)
275275
tv_channels = audio.get("TVChannels", kStereo);
276276
pad_channels = audio.get("PadChannels", kStereo);
277277
input_channels = audio.get("InputChannels", kMono);
278-
portal_channels = audio.get("PortalChannels", kMono);
279278
tv_volume = audio.get("TVVolume", 20);
280279
pad_volume = audio.get("PadVolume", 0);
281280
input_volume = audio.get("InputVolume", 20);
@@ -520,7 +519,6 @@ void CemuConfig::Save(XMLConfigParser& parser)
520519
audio.set("TVChannels", tv_channels);
521520
audio.set("PadChannels", pad_channels);
522521
audio.set("InputChannels", input_channels);
523-
audio.set("PortalChannels", portal_channels);
524522
audio.set("TVVolume", tv_volume);
525523
audio.set("PadVolume", pad_volume);
526524
audio.set("InputVolume", input_volume);

src/config/CemuConfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ struct CemuConfig
479479
// audio
480480
sint32 audio_api = 0;
481481
sint32 audio_delay = 2;
482-
AudioChannels tv_channels = kStereo, pad_channels = kStereo, input_channels = kMono, portal_channels = kMono;
482+
AudioChannels tv_channels = kStereo, pad_channels = kStereo, input_channels = kMono;
483483
sint32 tv_volume = 50, pad_volume = 0, input_volume = 50, portal_volume = 50;
484484
std::wstring tv_device{ L"default" }, pad_device, input_device, portal_device;
485485

src/gui/GeneralSettings2.cpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -559,17 +559,6 @@ wxPanel* GeneralSettings2::AddAudioPage(wxNotebook* notebook)
559559

560560
m_portal_device->Bind(wxEVT_CHOICE, &GeneralSettings2::OnAudioDeviceSelected, this);
561561

562-
const wxString audio_channel_drc_choices[] = { _("Mono") }; // mono for now only
563-
564-
portal_audio_row->Add(new wxStaticText(box, wxID_ANY, _("Channels")), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
565-
m_portal_channels = new wxChoice(box, wxID_ANY, wxDefaultPosition, wxDefaultSize, std::size(audio_channel_drc_choices), audio_channel_drc_choices);
566-
567-
m_portal_channels->SetSelection(0); // set default to mono
568-
569-
m_portal_channels->Bind(wxEVT_CHOICE, &GeneralSettings2::OnAudioChannelsSelected, this);
570-
portal_audio_row->Add(m_portal_channels, 0, wxEXPAND | wxALL, 5);
571-
portal_audio_row->AddSpacer(0);
572-
573562
portal_audio_row->Add(new wxStaticText(box, wxID_ANY, _("Volume")), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
574563
m_portal_volume = new wxSlider(box, wxID_ANY, 100, 0, 100);
575564
portal_audio_row->Add(m_portal_volume, 0, wxEXPAND | wxALL, 5);
@@ -1030,7 +1019,6 @@ void GeneralSettings2::StoreConfig()
10301019
config.pad_channels = kStereo; // (AudioChannels)m_pad_channels->GetSelection();
10311020
//config.input_channels = (AudioChannels)m_input_channels->GetSelection();
10321021
config.input_channels = kMono; // (AudioChannels)m_input_channels->GetSelection();
1033-
config.portal_channels = kMono; // (AudioChannels)m_portal_channels->GetSelection();
10341022

10351023
config.tv_volume = m_tv_volume->GetValue();
10361024
config.pad_volume = m_pad_volume->GetValue();
@@ -1720,7 +1708,6 @@ void GeneralSettings2::ApplyConfig()
17201708
m_pad_channels->SetSelection(0);
17211709
//m_input_channels->SetSelection(config.pad_channels);
17221710
m_input_channels->SetSelection(0);
1723-
m_portal_channels->SetSelection(0);
17241711

17251712
SendSliderEvent(m_tv_volume, config.tv_volume);
17261713

@@ -1975,7 +1962,7 @@ void GeneralSettings2::UpdateAudioDevice()
19751962
}
19761963
catch (std::runtime_error& ex)
19771964
{
1978-
cemuLog_log(LogType::Force, "can't initialize pad audio: {}", ex.what());
1965+
cemuLog_log(LogType::Force, "can't initialize portal audio: {}", ex.what());
19791966
}
19801967
}
19811968
}
@@ -2010,13 +1997,6 @@ void GeneralSettings2::OnAudioChannelsSelected(wxCommandEvent& event)
20101997

20111998
config.pad_channels = (AudioChannels)obj->GetSelection();
20121999
}
2013-
else if (obj == m_portal_channels)
2014-
{
2015-
if (config.portal_channels == (AudioChannels)obj->GetSelection())
2016-
return;
2017-
2018-
config.portal_channels = (AudioChannels)obj->GetSelection();
2019-
}
20202000
else
20212001
cemu_assert_debug(false);
20222002

src/gui/GeneralSettings2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class GeneralSettings2 : public wxDialog
6464
wxChoice* m_audio_api;
6565
wxSlider *m_audio_latency;
6666
wxSlider *m_tv_volume, *m_pad_volume, *m_input_volume, *m_portal_volume;
67-
wxChoice *m_tv_channels, *m_pad_channels, *m_input_channels, *m_portal_channels;
67+
wxChoice *m_tv_channels, *m_pad_channels, *m_input_channels;
6868
wxChoice *m_tv_device, *m_pad_device, *m_input_device, *m_portal_device;
6969

7070
// Account

0 commit comments

Comments
 (0)