add audio::InputDevice

This commit is contained in:
MihailRis 2025-10-14 12:43:51 +03:00
parent 2b72f87c64
commit 27416ab0cd
4 changed files with 96 additions and 0 deletions

View file

@ -108,6 +108,20 @@ namespace audio {
}
};
class InputDevice {
public:
virtual ~InputDevice() {};
virtual void startCapture() = 0;
virtual void stopCapture() = 0;
/// @brief Get number of audio channels
/// @return 1 if mono, 2 if stereo
virtual uint getChannels() const = 0;
virtual size_t read(char* buffer, size_t bufferSize) = 0;
};
/// @brief audio::PCMStream is a data source for audio::Stream
class PCMStream {
public:
@ -345,6 +359,9 @@ namespace audio {
virtual std::unique_ptr<Stream> openStream(
std::shared_ptr<PCMStream> stream, bool keepSource
) = 0;
virtual std::unique_ptr<InputDevice> openInputDevice(
uint sampleRate, uint channels, uint bitsPerSample
) = 0;
virtual void setListener(
glm::vec3 position,
glm::vec3 velocity,