azahar/src/audio_core/sink.h
Eric Warmenhoven d9b77cc21e
Implement libretro core (#1215)
* libretro core

* Bringing citra libretro implementation over
* libretro: hook up vulkan renderer
* libretro: github actions
* libretro: gyro
* libretro: core options v2
* libretro: on ios turn off shader jit if unavailable
* moltenvk 1.3.0 introduces 8-bit indexes but allocates 16-bit for metal; this ends up allocating stream buffer * 2 = 132MiB. Instead, just use 16-bit indexes. (This will be necessary for standalone when bumping moltenvk version.)

* libretro core: address review feedback

* libretro: microphone support

* cmake: Add ENABLE_ROOM_STANDALONE to list of incompatible libretro flags

* libretro: proper initial geometry

* libretro: fix software renderer

* libretro: address review feedback

* .github/libretro.yml: Pin macOS runners at macOS 26

* ci: Remove explicit selection of Xcode 16.0

* .github/libretro.yml: remove unnecessary windows builder apt commands

* .github/libretro.yml: bump min macos version to 11.0

* ci: Re-enable CI jobs for all libretro cores

This is under the condition that we don't introduce build cache for these builds

---------

Co-authored-by: OpenSauce04 <opensauce04@gmail.com>
Co-authored-by: PabloMK7 <hackyglitch2@gmail.com>
2026-02-19 22:30:25 +00:00

52 lines
1.6 KiB
C++

// Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <functional>
#include "audio_types.h"
namespace AudioCore {
constexpr char auto_device_name[] = "Auto";
/**
* This class is an interface for an audio sink. An audio sink accepts samples in stereo signed
* PCM16 format to be output. Sinks *do not* handle resampling and expect the correct sample rate.
* They are dumb outputs.
*/
class Sink {
public:
virtual ~Sink() = default;
/// The native rate of this sink. The sink expects to be fed samples that respect this.
/// (Units: samples/sec)
virtual unsigned int GetNativeSampleRate() const = 0;
/**
* Set callback for samples
* @param samples Samples in interleaved stereo PCM16 format.
* @param sample_count Number of samples.
*/
virtual void SetCallback(std::function<void(s16*, std::size_t)> cb) = 0;
/**
* Override and set this to true if the sink wants audio data submitted
* immediately rather than requesting audio on demand
* @return true if audio data should be pushed to the sink
*/
virtual bool ImmediateSubmission() {
return false;
}
/**
* Push audio samples directly to the sink, bypassing the FIFO.
* Only called when ImmediateSubmission() returns true.
* @param data Pointer to stereo PCM16 samples (each sample is L+R pair)
* @param num_samples Number of stereo samples
*/
virtual void PushSamples(const void* data, std::size_t num_samples) {}
};
} // namespace AudioCore