Merge pull request #3831 from FearlessTobi/add-volume-slider
citra_qt: Add a volume slider
This commit is contained in:
commit
2f8c9c8126
9 changed files with 110 additions and 20 deletions
|
@ -7,6 +7,7 @@
|
|||
#include "audio_core/sink.h"
|
||||
#include "audio_core/sink_details.h"
|
||||
#include "common/assert.h"
|
||||
#include "core/settings.h"
|
||||
|
||||
namespace AudioCore {
|
||||
|
||||
|
@ -39,10 +40,17 @@ void DspInterface::EnableStretching(bool enable) {
|
|||
perform_time_stretching = enable;
|
||||
}
|
||||
|
||||
void DspInterface::OutputFrame(const StereoFrame16& frame) {
|
||||
void DspInterface::OutputFrame(StereoFrame16& frame) {
|
||||
if (!sink)
|
||||
return;
|
||||
|
||||
// Implementation of the hardware volume slider with a dynamic range of 60 dB
|
||||
float volume_scale_factor = std::exp(6.90775 * Settings::values.volume) * 0.001;
|
||||
for (size_t i = 0; i < frame.size(); i++) {
|
||||
frame[i][0] = static_cast<s16>(frame[i][0] * volume_scale_factor);
|
||||
frame[i][1] = static_cast<s16>(frame[i][1] * volume_scale_factor);
|
||||
}
|
||||
|
||||
if (perform_time_stretching) {
|
||||
time_stretcher.AddSamples(&frame[0][0], frame.size());
|
||||
std::vector<s16> stretched_samples = time_stretcher.Process(sink->SamplesInQueue());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue