mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-30 02:16:06 +00:00
ad2e1cc554
Since the launch of the steam controller I think it's only best to push towards updating to SDL3 allowing for a wider range of controller support I went ahead and started on getting it working. Everything here should be functional, I've personally tested it all on Arch Linux. Still untested on windows, so looking for feedback on that Any feedback and help would be appreciated! Main changes: - Bump everything to SDL3 - Handle SDL3 audio and input - Add steam controller support, including HD Rumble - Improved battery reporting via the status icon by using real % rather than state alone Co-authored-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3952 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: Lizzie <lizzie@eden-emu.dev>
110 lines
3.1 KiB
C++
110 lines
3.1 KiB
C++
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "audio_core/sink/sink.h"
|
|
|
|
namespace Core {
|
|
class System;
|
|
}
|
|
|
|
namespace AudioCore::Sink {
|
|
class SinkStream;
|
|
|
|
/**
|
|
* SDL backend sink, holds multiple output streams and is responsible for sinking samples to
|
|
* hardware. Used by Audio Render, Audio In and Audio Out.
|
|
*/
|
|
class SDLSink final : public Sink {
|
|
public:
|
|
explicit SDLSink(std::string_view device_id);
|
|
~SDLSink() override;
|
|
|
|
/**
|
|
* Create a new sink stream.
|
|
*
|
|
* @param system - Core system.
|
|
* @param system_channels - Number of channels the audio system expects.
|
|
* May differ from the device's channel count.
|
|
* @param name - Name of this stream.
|
|
* @param type - Type of this stream, render/in/out.
|
|
*
|
|
* @return A pointer to the created SinkStream
|
|
*/
|
|
SinkStream* AcquireSinkStream(Core::System& system, u32 system_channels,
|
|
const std::string& name, StreamType type) override;
|
|
|
|
/**
|
|
* Close a given stream.
|
|
*
|
|
* @param stream - The stream to close.
|
|
*/
|
|
void CloseStream(SinkStream* stream) override;
|
|
|
|
/**
|
|
* Close all streams.
|
|
*/
|
|
void CloseStreams() override;
|
|
|
|
/**
|
|
* Get the device volume. Set from calls to the IAudioDevice service.
|
|
*
|
|
* @return Volume of the device.
|
|
*/
|
|
f32 GetDeviceVolume() const override;
|
|
|
|
/**
|
|
* Set the device volume. Set from calls to the IAudioDevice service.
|
|
*
|
|
* @param volume - New volume of the device.
|
|
*/
|
|
void SetDeviceVolume(f32 volume) override;
|
|
|
|
/**
|
|
* Set the system volume. Comes from the audio system using this stream.
|
|
*
|
|
* @param volume - New volume of the system.
|
|
*/
|
|
void SetSystemVolume(f32 volume) override;
|
|
|
|
private:
|
|
/// Name of the output device used by streams
|
|
std::string output_device;
|
|
/// Name of the input device used by streams
|
|
std::string input_device;
|
|
/// Vector of streams managed by this sink
|
|
std::vector<SinkStreamPtr> sink_streams;
|
|
};
|
|
|
|
/**
|
|
* Get a list of connected devices from SDL.
|
|
*
|
|
* @param capture - Return input (capture) devices if true, otherwise output devices.
|
|
*/
|
|
std::vector<std::string> ListSDLSinkDevices(bool capture);
|
|
|
|
// REVERSION - function GetSDLLatency() reintroduced from EA-3833 - DIABLO 3 FIX
|
|
/**
|
|
* Get the reported latency for this sink.
|
|
*
|
|
* @return Minimum latency for this sink.
|
|
*/
|
|
u32 GetSDLLatency();
|
|
|
|
/** REVERTED back to 3833 - Below function IsSDLSuitable() removed, reverting to GetSDLLatency() above. - DIABLO 3 FIX
|
|
* Check if this backend is suitable for use.
|
|
* Checks if enabled, its latency, whether it opens successfully, etc.
|
|
*
|
|
* @return True is this backend is suitable, false otherwise.
|
|
*/
|
|
//bool IsSDLSuitable(); // REVERTED for GetSDLLatency() from EA-3833
|
|
|
|
} // namespace AudioCore::Sink
|