Revert "Merged commit"

This reverts commit cad6b30284.
This commit is contained in:
RedTrainer97 2017-03-28 16:12:59 +02:00
parent cad6b30284
commit 7137d9dcdf
7 changed files with 2 additions and 51 deletions

View File

@ -10,7 +10,6 @@
#include "audio_core/hle/source.h" #include "audio_core/hle/source.h"
#include "audio_core/sink.h" #include "audio_core/sink.h"
#include "audio_core/time_stretch.h" #include "audio_core/time_stretch.h"
#include "core/settings.h"
namespace DSP { namespace DSP {
namespace HLE { namespace HLE {
@ -90,15 +89,6 @@ static bool perform_time_stretching = true;
static std::unique_ptr<AudioCore::Sink> sink; static std::unique_ptr<AudioCore::Sink> sink;
static AudioCore::TimeStretcher time_stretcher; static AudioCore::TimeStretcher time_stretcher;
static StereoFrame16 ChangeVolume(const StereoFrame16& frame) {
StereoFrame16 new_frame = StereoFrame16();
for (int i = 0; i < frame.size(); i++) {
new_frame[i][0] = frame[i][0] * Settings::values.volume;
new_frame[i][1] = frame[i][1] * Settings::values.volume;
}
return new_frame;
}
static void FlushResidualStretcherAudio() { static void FlushResidualStretcherAudio() {
time_stretcher.Flush(); time_stretcher.Flush();
while (true) { while (true) {
@ -110,9 +100,8 @@ static void FlushResidualStretcherAudio() {
} }
static void OutputCurrentFrame(const StereoFrame16& frame) { static void OutputCurrentFrame(const StereoFrame16& frame) {
StereoFrame16 new_frame = ChangeVolume(frame);
if (perform_time_stretching) { if (perform_time_stretching) {
time_stretcher.AddSamples(&new_frame[0][0], frame.size()); time_stretcher.AddSamples(&frame[0][0], frame.size());
std::vector<s16> stretched_samples = time_stretcher.Process(sink->SamplesInQueue()); std::vector<s16> stretched_samples = time_stretcher.Process(sink->SamplesInQueue());
sink->EnqueueSamples(stretched_samples.data(), stretched_samples.size() / 2); sink->EnqueueSamples(stretched_samples.data(), stretched_samples.size() / 2);
} else { } else {
@ -123,7 +112,7 @@ static void OutputCurrentFrame(const StereoFrame16& frame) {
return; return;
} }
sink->EnqueueSamples(&new_frame[0][0], frame.size()); sink->EnqueueSamples(&frame[0][0], frame.size());
} }
} }

View File

@ -100,7 +100,6 @@ void Config::ReadValues() {
Settings::values.enable_audio_stretching = Settings::values.enable_audio_stretching =
sdl2_config->GetBoolean("Audio", "enable_audio_stretching", true); sdl2_config->GetBoolean("Audio", "enable_audio_stretching", true);
Settings::values.audio_device_id = sdl2_config->Get("Audio", "output_device", "auto"); Settings::values.audio_device_id = sdl2_config->Get("Audio", "output_device", "auto");
Settings::values.volume = sdl2_config->GetReal("Audio", "volume", 1);
// Data Storage // Data Storage
Settings::values.use_virtual_sd = Settings::values.use_virtual_sd =

View File

@ -108,10 +108,6 @@ enable_audio_stretching =
# auto (default): Auto-select # auto (default): Auto-select
output_device = output_device =
# Output volume.
# 1.0 (default): 100%, 0.0; mute
volume =
[Data Storage] [Data Storage]
# Whether to create a virtual SD card. # Whether to create a virtual SD card.
# 1 (default): Yes, 0: No # 1 (default): Yes, 0: No

View File

@ -87,7 +87,6 @@ void Config::ReadValues() {
qt_config->value("enable_audio_stretching", true).toBool(); qt_config->value("enable_audio_stretching", true).toBool();
Settings::values.audio_device_id = Settings::values.audio_device_id =
qt_config->value("output_device", "auto").toString().toStdString(); qt_config->value("output_device", "auto").toString().toStdString();
Settings::values.volume = qt_config->value("volume", 1).toFloat();
qt_config->endGroup(); qt_config->endGroup();
using namespace Service::CAM; using namespace Service::CAM;
@ -214,7 +213,6 @@ void Config::SaveValues() {
qt_config->setValue("output_engine", QString::fromStdString(Settings::values.sink_id)); qt_config->setValue("output_engine", QString::fromStdString(Settings::values.sink_id));
qt_config->setValue("enable_audio_stretching", Settings::values.enable_audio_stretching); qt_config->setValue("enable_audio_stretching", Settings::values.enable_audio_stretching);
qt_config->setValue("output_device", QString::fromStdString(Settings::values.audio_device_id)); qt_config->setValue("output_device", QString::fromStdString(Settings::values.audio_device_id));
qt_config->setValue("volume", Settings::values.volume);
qt_config->endGroup(); qt_config->endGroup();
using namespace Service::CAM; using namespace Service::CAM;

View File

@ -51,7 +51,6 @@ void ConfigureAudio::setConfiguration() {
} }
} }
ui->audio_device_combo_box->setCurrentIndex(new_device_index); ui->audio_device_combo_box->setCurrentIndex(new_device_index);
ui->volume_slider->setValue(Settings::values.volume * ui->volume_slider->maximum());
} }
void ConfigureAudio::applyConfiguration() { void ConfigureAudio::applyConfiguration() {
@ -62,8 +61,6 @@ void ConfigureAudio::applyConfiguration() {
Settings::values.audio_device_id = Settings::values.audio_device_id =
ui->audio_device_combo_box->itemText(ui->audio_device_combo_box->currentIndex()) ui->audio_device_combo_box->itemText(ui->audio_device_combo_box->currentIndex())
.toStdString(); .toStdString();
Settings::values.volume = (float)ui->volume_slider->value() / ui->volume_slider->maximum();
Settings::Apply(); Settings::Apply();
} }

View File

@ -46,33 +46,6 @@
</item> </item>
<item> <item>
<widget class="QComboBox" name="audio_device_combo_box"> <widget class="QComboBox" name="audio_device_combo_box">
<widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Volume:</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="volume_slider">
<property name="maximum">
<number>1023</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>

View File

@ -110,7 +110,6 @@ struct Values {
std::string sink_id; std::string sink_id;
bool enable_audio_stretching; bool enable_audio_stretching;
std::string audio_device_id; std::string audio_device_id;
float volume;
// Camera // Camera
std::array<std::string, Service::CAM::NumCameras> camera_name; std::array<std::string, Service::CAM::NumCameras> camera_name;