diff options
| author | 2019-06-16 19:06:33 +1000 | |
|---|---|---|
| committer | 2019-06-16 19:06:33 +1000 | |
| commit | 335127af6921ce298a6dd63682895768c6b06e86 (patch) | |
| tree | 0a505fec2c232dec0945fc02159eecc9c3af087e /src/audio_core/stream.cpp | |
| parent | Merge pull request #2538 from ReinUsesLisp/ssy-pbk (diff) | |
| download | yuzu-335127af6921ce298a6dd63682895768c6b06e86.tar.gz yuzu-335127af6921ce298a6dd63682895768c6b06e86.tar.xz yuzu-335127af6921ce298a6dd63682895768c6b06e86.zip | |
Impl'd IsUserAccountSwitchLocked, SetAudioOutVolume, GetAudioOutVolume & Partial impl of GetAccumulatedSuspendedTickChangedEvent
IPC-100 was changed to InitializeApplicationInfoOld instead of InitializeApplicationInfo. IPC-150 makes an indentical call to IPC-100 however does extra processing. They should not have the same name as it's quite confusing to debug.
Diffstat (limited to 'src/audio_core/stream.cpp')
| -rw-r--r-- | src/audio_core/stream.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/audio_core/stream.cpp b/src/audio_core/stream.cpp index 11481a776..982c7af2f 100644 --- a/src/audio_core/stream.cpp +++ b/src/audio_core/stream.cpp | |||
| @@ -51,6 +51,10 @@ void Stream::Stop() { | |||
| 51 | UNIMPLEMENTED(); | 51 | UNIMPLEMENTED(); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | void Stream::SetVolume(float volume) { | ||
| 55 | game_volume = volume; | ||
| 56 | } | ||
| 57 | |||
| 54 | Stream::State Stream::GetState() const { | 58 | Stream::State Stream::GetState() const { |
| 55 | return state; | 59 | return state; |
| 56 | } | 60 | } |
| @@ -62,8 +66,8 @@ s64 Stream::GetBufferReleaseCycles(const Buffer& buffer) const { | |||
| 62 | return Core::Timing::usToCycles(us); | 66 | return Core::Timing::usToCycles(us); |
| 63 | } | 67 | } |
| 64 | 68 | ||
| 65 | static void VolumeAdjustSamples(std::vector<s16>& samples) { | 69 | static void VolumeAdjustSamples(std::vector<s16>& samples, float game_volume) { |
| 66 | const float volume{std::clamp(Settings::values.volume, 0.0f, 1.0f)}; | 70 | const float volume{std::clamp(Settings::values.volume - (1.0f - game_volume), 0.0f, 1.0f)}; |
| 67 | 71 | ||
| 68 | if (volume == 1.0f) { | 72 | if (volume == 1.0f) { |
| 69 | return; | 73 | return; |
| @@ -97,7 +101,7 @@ void Stream::PlayNextBuffer() { | |||
| 97 | active_buffer = queued_buffers.front(); | 101 | active_buffer = queued_buffers.front(); |
| 98 | queued_buffers.pop(); | 102 | queued_buffers.pop(); |
| 99 | 103 | ||
| 100 | VolumeAdjustSamples(active_buffer->GetSamples()); | 104 | VolumeAdjustSamples(active_buffer->GetSamples(), game_volume); |
| 101 | 105 | ||
| 102 | sink_stream.EnqueueSamples(GetNumChannels(), active_buffer->GetSamples()); | 106 | sink_stream.EnqueueSamples(GetNumChannels(), active_buffer->GetSamples()); |
| 103 | 107 | ||