2020-04-19 23:04:05 +02:00
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
2020-03-27 20:36:02 +01:00
|
|
|
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
2023-03-15 18:49:17 +01:00
|
|
|
// Copyright © 2022 yuzu Emulator Project (https://github.com/yuzu-emu/)
|
2020-03-27 20:36:02 +01:00
|
|
|
|
2020-01-02 21:19:34 +01:00
|
|
|
#pragma once
|
|
|
|
|
2023-03-15 18:49:17 +01:00
|
|
|
#include <audio_core/out/audio_out_system.h>
|
|
|
|
#include <audio_core/out/audio_out.h>
|
|
|
|
#include <audio_core/core/hle/kernel/k_event.h>
|
2020-01-02 21:19:34 +01:00
|
|
|
#include <services/serviceman.h>
|
|
|
|
|
2020-02-17 20:11:59 +01:00
|
|
|
namespace skyline::service::audio {
|
2020-01-02 21:19:34 +01:00
|
|
|
/**
|
2020-09-28 12:05:17 +02:00
|
|
|
* @brief IAudioOut is a service opened when OpenAudioOut is called by IAudioOutManager
|
|
|
|
* @url https://switchbrew.org/wiki/Audio_services#IAudioOut
|
2020-01-02 21:19:34 +01:00
|
|
|
*/
|
|
|
|
class IAudioOut : public BaseService {
|
|
|
|
private:
|
2023-03-15 18:49:17 +01:00
|
|
|
std::shared_ptr<type::KEvent> releaseEvent;
|
|
|
|
KernelShim::KEvent releaseEventWrapper;
|
2020-01-02 21:19:34 +01:00
|
|
|
|
2020-08-21 15:28:47 +02:00
|
|
|
u32 sampleRate;
|
|
|
|
u8 channelCount;
|
2020-01-24 23:03:12 +01:00
|
|
|
|
2020-01-02 21:19:34 +01:00
|
|
|
public:
|
2023-03-15 18:49:17 +01:00
|
|
|
std::shared_ptr<AudioCore::AudioOut::Out> impl;
|
|
|
|
|
|
|
|
IAudioOut(const DeviceState &state, ServiceManager &manager, size_t sessionId,
|
|
|
|
std::string_view deviceName, AudioCore::AudioOut::AudioOutParameter parameters,
|
|
|
|
KHandle handle, u32 appletResourceUserId);
|
2020-01-02 21:19:34 +01:00
|
|
|
|
|
|
|
~IAudioOut();
|
|
|
|
|
|
|
|
/**
|
2020-09-28 12:05:17 +02:00
|
|
|
* @url https://switchbrew.org/wiki/Audio_services#GetAudioOutState
|
2020-01-02 21:19:34 +01:00
|
|
|
*/
|
2020-09-03 20:43:52 +02:00
|
|
|
Result GetAudioOutState(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
2020-01-02 21:19:34 +01:00
|
|
|
|
|
|
|
/**
|
2020-09-28 12:05:17 +02:00
|
|
|
* @url https://switchbrew.org/wiki/Audio_services#StartAudioOut
|
2020-01-02 21:19:34 +01:00
|
|
|
*/
|
2020-09-03 20:43:52 +02:00
|
|
|
Result StartAudioOut(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
2020-01-02 21:19:34 +01:00
|
|
|
|
|
|
|
/**
|
2020-09-28 12:05:17 +02:00
|
|
|
* @url https://switchbrew.org/wiki/Audio_services#StartAudioOut
|
2020-01-02 21:19:34 +01:00
|
|
|
*/
|
2020-09-03 20:43:52 +02:00
|
|
|
Result StopAudioOut(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
2020-01-02 21:19:34 +01:00
|
|
|
|
|
|
|
/**
|
2020-09-28 12:05:17 +02:00
|
|
|
* @url https://switchbrew.org/wiki/Audio_services#AppendAudioOutBuffer
|
2020-01-02 21:19:34 +01:00
|
|
|
*/
|
2020-09-03 20:43:52 +02:00
|
|
|
Result AppendAudioOutBuffer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
2020-01-02 21:19:34 +01:00
|
|
|
|
|
|
|
/**
|
2020-09-28 12:05:17 +02:00
|
|
|
* @url https://switchbrew.org/wiki/Audio_services#AppendAudioOutBuffer
|
2020-01-02 21:19:34 +01:00
|
|
|
*/
|
2020-09-03 20:43:52 +02:00
|
|
|
Result RegisterBufferEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
2020-01-02 21:19:34 +01:00
|
|
|
|
|
|
|
/**
|
2020-09-28 12:05:17 +02:00
|
|
|
* @url https://switchbrew.org/wiki/Audio_services#GetReleasedAudioOutBuffer
|
2020-01-02 21:19:34 +01:00
|
|
|
*/
|
2020-09-03 20:43:52 +02:00
|
|
|
Result GetReleasedAudioOutBuffer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
2020-01-02 21:19:34 +01:00
|
|
|
|
|
|
|
/**
|
2020-09-28 12:05:17 +02:00
|
|
|
* @url https://switchbrew.org/wiki/Audio_services#ContainsAudioOutBuffer
|
2020-01-02 21:19:34 +01:00
|
|
|
*/
|
2020-09-03 20:43:52 +02:00
|
|
|
Result ContainsAudioOutBuffer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
2020-09-21 12:04:26 +02:00
|
|
|
|
2023-03-15 18:49:17 +01:00
|
|
|
/**
|
|
|
|
* @url https://switchbrew.org/wiki/Audio_services#GetAudioOutBufferCount
|
|
|
|
*/
|
|
|
|
Result GetAudioOutBufferCount(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @url https://switchbrew.org/wiki/Audio_services#GetAudioOutPlayedSampleCount
|
|
|
|
*/
|
|
|
|
Result GetAudioOutPlayedSampleCount(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @url https://switchbrew.org/wiki/Audio_services#FlushAudioOutBuffers
|
|
|
|
*/
|
|
|
|
Result FlushAudioOutBuffers(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @url https://switchbrew.org/wiki/Audio_services#SetAudioOutVolume
|
|
|
|
*/
|
|
|
|
Result SetAudioOutVolume(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @url https://switchbrew.org/wiki/Audio_services#GetAudioOutVolume
|
|
|
|
*/
|
|
|
|
Result GetAudioOutVolume(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
|
|
|
|
|
|
SERVICE_DECL(
|
2020-09-21 12:04:26 +02:00
|
|
|
SFUNC(0x0, IAudioOut, GetAudioOutState),
|
|
|
|
SFUNC(0x1, IAudioOut, StartAudioOut),
|
|
|
|
SFUNC(0x2, IAudioOut, StopAudioOut),
|
|
|
|
SFUNC(0x3, IAudioOut, AppendAudioOutBuffer),
|
|
|
|
SFUNC(0x4, IAudioOut, RegisterBufferEvent),
|
|
|
|
SFUNC(0x5, IAudioOut, GetReleasedAudioOutBuffer),
|
|
|
|
SFUNC(0x6, IAudioOut, ContainsAudioOutBuffer),
|
|
|
|
SFUNC(0x7, IAudioOut, AppendAudioOutBuffer),
|
2023-03-15 18:49:17 +01:00
|
|
|
SFUNC(0x8, IAudioOut, GetReleasedAudioOutBuffer),
|
|
|
|
SFUNC(0x9, IAudioOut, GetAudioOutBufferCount),
|
|
|
|
SFUNC(0xA, IAudioOut, GetAudioOutPlayedSampleCount),
|
|
|
|
SFUNC(0xB, IAudioOut, FlushAudioOutBuffers),
|
|
|
|
SFUNC(0xC, IAudioOut, SetAudioOutVolume),
|
|
|
|
SFUNC(0xD, IAudioOut, GetAudioOutVolume),
|
|
|
|
)
|
2020-01-02 21:19:34 +01:00
|
|
|
};
|
|
|
|
}
|