summaryrefslogtreecommitdiff
path: root/src/audio_core/time_stretch.h
diff options
context:
space:
mode:
authorGravatar James Rowe2018-01-11 19:21:20 -0700
committerGravatar James Rowe2018-01-12 19:11:03 -0700
commitebf9a784a9f7f4148a669dbb39e7cd50df779a14 (patch)
treed585685a1c0a34b903af1d086d62560bf56bb29f /src/audio_core/time_stretch.h
parentconfig: Default CPU core to Unicorn. (diff)
downloadyuzu-ebf9a784a9f7f4148a669dbb39e7cd50df779a14.tar.gz
yuzu-ebf9a784a9f7f4148a669dbb39e7cd50df779a14.tar.xz
yuzu-ebf9a784a9f7f4148a669dbb39e7cd50df779a14.zip
Massive removal of unused modules
Diffstat (limited to 'src/audio_core/time_stretch.h')
-rw-r--r--src/audio_core/time_stretch.h60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/audio_core/time_stretch.h b/src/audio_core/time_stretch.h
deleted file mode 100644
index c98b16705..000000000
--- a/src/audio_core/time_stretch.h
+++ /dev/null
@@ -1,60 +0,0 @@
1// Copyright 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <cstddef>
8#include <memory>
9#include <vector>
10#include "common/common_types.h"
11
12namespace AudioCore {
13
14class TimeStretcher final {
15public:
16 TimeStretcher();
17 ~TimeStretcher();
18
19 /**
20 * Set sample rate for the samples that Process returns.
21 * @param sample_rate The sample rate.
22 */
23 void SetOutputSampleRate(unsigned int sample_rate);
24
25 /**
26 * Add samples to be processed.
27 * @param sample_buffer Buffer of samples in interleaved stereo PCM16 format.
28 * @param num_samples Number of samples.
29 */
30 void AddSamples(const s16* sample_buffer, size_t num_samples);
31
32 /// Flush audio remaining in internal buffers.
33 void Flush();
34
35 /// Resets internal state and clears buffers.
36 void Reset();
37
38 /**
39 * Does audio stretching and produces the time-stretched samples.
40 * Timer calculations use sample_delay to determine how much of a margin we have.
41 * @param sample_delay How many samples are buffered downstream of this module and haven't been
42 * played yet.
43 * @return Samples to play in interleaved stereo PCM16 format.
44 */
45 std::vector<s16> Process(size_t sample_delay);
46
47private:
48 struct Impl;
49 std::unique_ptr<Impl> impl;
50
51 /// INTERNAL: ratio = wallclock time / emulated time
52 double CalculateCurrentRatio();
53 /// INTERNAL: If we have too many or too few samples downstream, nudge ratio in the appropriate
54 /// direction.
55 double CorrectForUnderAndOverflow(double ratio, size_t sample_delay) const;
56 /// INTERNAL: Gets the time-stretched samples from SoundTouch.
57 std::vector<s16> GetSamples();
58};
59
60} // namespace AudioCore