mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-11-27 14:33:00 +00:00
Implement audout GetAudioOutPlayedSampleCount
Used in Ninja Gaiden games.
This commit is contained in:
parent
83ac715e76
commit
ba3af04da1
|
@ -107,9 +107,12 @@ void Stream::PlayNextBuffer(std::chrono::nanoseconds ns_late) {
|
||||||
active_buffer = queued_buffers.front();
|
active_buffer = queued_buffers.front();
|
||||||
queued_buffers.pop();
|
queued_buffers.pop();
|
||||||
|
|
||||||
VolumeAdjustSamples(active_buffer->GetSamples(), game_volume);
|
auto& samples = active_buffer->GetSamples();
|
||||||
|
|
||||||
sink_stream.EnqueueSamples(GetNumChannels(), active_buffer->GetSamples());
|
VolumeAdjustSamples(samples, game_volume);
|
||||||
|
|
||||||
|
sink_stream.EnqueueSamples(GetNumChannels(), samples);
|
||||||
|
played_samples += samples.size();
|
||||||
|
|
||||||
const auto buffer_release_ns = GetBufferReleaseNS(*active_buffer);
|
const auto buffer_release_ns = GetBufferReleaseNS(*active_buffer);
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,11 @@ public:
|
||||||
return sample_rate;
|
return sample_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Gets the number of samples played so far
|
||||||
|
[[nodiscard]] u64 GetPlayedSampleCount() const {
|
||||||
|
return played_samples;
|
||||||
|
}
|
||||||
|
|
||||||
/// Gets the number of channels
|
/// Gets the number of channels
|
||||||
[[nodiscard]] u32 GetNumChannels() const;
|
[[nodiscard]] u32 GetNumChannels() const;
|
||||||
|
|
||||||
|
@ -106,6 +111,7 @@ private:
|
||||||
[[nodiscard]] std::chrono::nanoseconds GetBufferReleaseNS(const Buffer& buffer) const;
|
[[nodiscard]] std::chrono::nanoseconds GetBufferReleaseNS(const Buffer& buffer) const;
|
||||||
|
|
||||||
u32 sample_rate; ///< Sample rate of the stream
|
u32 sample_rate; ///< Sample rate of the stream
|
||||||
|
u64 played_samples{}; ///< The current played sample count
|
||||||
Format format; ///< Format of the stream
|
Format format; ///< Format of the stream
|
||||||
float game_volume = 1.0f; ///< The volume the game currently has set
|
float game_volume = 1.0f; ///< The volume the game currently has set
|
||||||
ReleaseCallback release_callback; ///< Buffer release callback for the stream
|
ReleaseCallback release_callback; ///< Buffer release callback for the stream
|
||||||
|
|
|
@ -58,7 +58,7 @@ public:
|
||||||
{7, &IAudioOut::AppendAudioOutBufferImpl, "AppendAudioOutBufferAuto"},
|
{7, &IAudioOut::AppendAudioOutBufferImpl, "AppendAudioOutBufferAuto"},
|
||||||
{8, &IAudioOut::GetReleasedAudioOutBufferImpl, "GetReleasedAudioOutBufferAuto"},
|
{8, &IAudioOut::GetReleasedAudioOutBufferImpl, "GetReleasedAudioOutBufferAuto"},
|
||||||
{9, &IAudioOut::GetAudioOutBufferCount, "GetAudioOutBufferCount"},
|
{9, &IAudioOut::GetAudioOutBufferCount, "GetAudioOutBufferCount"},
|
||||||
{10, nullptr, "GetAudioOutPlayedSampleCount"},
|
{10, &IAudioOut::GetAudioOutPlayedSampleCount, "GetAudioOutPlayedSampleCount"},
|
||||||
{11, &IAudioOut::FlushAudioOutBuffers, "FlushAudioOutBuffers"},
|
{11, &IAudioOut::FlushAudioOutBuffers, "FlushAudioOutBuffers"},
|
||||||
{12, &IAudioOut::SetAudioOutVolume, "SetAudioOutVolume"},
|
{12, &IAudioOut::SetAudioOutVolume, "SetAudioOutVolume"},
|
||||||
{13, &IAudioOut::GetAudioOutVolume, "GetAudioOutVolume"},
|
{13, &IAudioOut::GetAudioOutVolume, "GetAudioOutVolume"},
|
||||||
|
@ -186,6 +186,14 @@ private:
|
||||||
rb.Push(static_cast<u32>(stream->GetQueueSize()));
|
rb.Push(static_cast<u32>(stream->GetQueueSize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GetAudioOutPlayedSampleCount(Kernel::HLERequestContext& ctx) {
|
||||||
|
LOG_DEBUG(Service_Audio, "called");
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
rb.Push(stream->GetPlayedSampleCount());
|
||||||
|
}
|
||||||
|
|
||||||
void FlushAudioOutBuffers(Kernel::HLERequestContext& ctx) {
|
void FlushAudioOutBuffers(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_Audio, "called");
|
LOG_DEBUG(Service_Audio, "called");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue