summaryrefslogtreecommitdiffstats
path: root/src/audio_core
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-02-25 16:51:33 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-06-27 17:35:10 +0200
commit6bf137a0e81fa3fae030687f10ac2c1e12d824ff (patch)
tree4f7a88533bf028c6779f156ceaa7793075714a2f /src/audio_core
parentGeneral: Setup yuzu threads' microprofile, naming and registry. (diff)
downloadyuzu-6bf137a0e81fa3fae030687f10ac2c1e12d824ff.tar
yuzu-6bf137a0e81fa3fae030687f10ac2c1e12d824ff.tar.gz
yuzu-6bf137a0e81fa3fae030687f10ac2c1e12d824ff.tar.bz2
yuzu-6bf137a0e81fa3fae030687f10ac2c1e12d824ff.tar.lz
yuzu-6bf137a0e81fa3fae030687f10ac2c1e12d824ff.tar.xz
yuzu-6bf137a0e81fa3fae030687f10ac2c1e12d824ff.tar.zst
yuzu-6bf137a0e81fa3fae030687f10ac2c1e12d824ff.zip
Diffstat (limited to '')
-rw-r--r--src/audio_core/stream.cpp10
-rw-r--r--src/audio_core/stream.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/audio_core/stream.cpp b/src/audio_core/stream.cpp
index ca7cfb030..6d5539b6b 100644
--- a/src/audio_core/stream.cpp
+++ b/src/audio_core/stream.cpp
@@ -59,11 +59,11 @@ Stream::State Stream::GetState() const {
return state;
}
-s64 Stream::GetBufferReleaseCycles(const Buffer& buffer) const {
+s64 Stream::GetBufferReleaseNS(const Buffer& buffer) const {
const std::size_t num_samples{buffer.GetSamples().size() / GetNumChannels()};
- const auto us =
- std::chrono::microseconds((static_cast<u64>(num_samples) * 1000000) / sample_rate);
- return Core::Timing::usToCycles(us);
+ const auto ns =
+ std::chrono::nanoseconds((static_cast<u64>(num_samples) * 1000000000ULL) / sample_rate);
+ return ns.count();
}
static void VolumeAdjustSamples(std::vector<s16>& samples, float game_volume) {
@@ -105,7 +105,7 @@ void Stream::PlayNextBuffer() {
sink_stream.EnqueueSamples(GetNumChannels(), active_buffer->GetSamples());
- core_timing.ScheduleEvent(GetBufferReleaseCycles(*active_buffer), release_event, {});
+ core_timing.ScheduleEvent(GetBufferReleaseNS(*active_buffer), release_event, {});
}
void Stream::ReleaseActiveBuffer() {
diff --git a/src/audio_core/stream.h b/src/audio_core/stream.h
index 1708a4d98..0663ce435 100644
--- a/src/audio_core/stream.h
+++ b/src/audio_core/stream.h
@@ -96,7 +96,7 @@ private:
void ReleaseActiveBuffer();
/// Gets the number of core cycles when the specified buffer will be released
- s64 GetBufferReleaseCycles(const Buffer& buffer) const;
+ s64 GetBufferReleaseNS(const Buffer& buffer) const;
u32 sample_rate; ///< Sample rate of the stream
Format format; ///< Format of the stream