libretro.drivers.microphone.driver¶
Protocol definitions for microphone capture drivers.
See also
libretro.api.microphoneThe matching
ctypestypes and callback definitions.
Classes
Protocol for an open microphone capture stream returned by a |
|
Protocol for drivers that expose the libretro microphone capture interface. |
- class Microphone[source]¶
Bases:
ProtocolProtocol for an open microphone capture stream returned by a
MicrophoneDriver.- abstractmethod close()[source]¶
Close this microphone and release any underlying resources.
Subsequent calls to
read()should returnNone.- Return type:
- abstract property params¶
The capture parameters (sample rate, channel layout) negotiated for this microphone.
Noneif the microphone is closed or no parameters have been negotiated.See also
retro_microphone_paramsThe C struct describing the negotiated capture format.
- abstract property state¶
Whether this microphone is currently capturing.
- poll()[source]¶
Advance any per-frame internal state (e.g. refilling the capture buffer).
Default implementation is a no-op; drivers that need per-frame work override this.
- Return type:
- __init__(*args, **kwargs)¶
- classmethod __new__(*args, **kwargs)¶
- class MicrophoneDriver[source]¶
Bases:
ProtocolProtocol for drivers that expose the libretro microphone capture interface.
See also
libretro.api.microphoneThe matching
ctypestypes and callback definitions.
- abstract property version¶
The version of the microphone interface this driver implements.
- abstractmethod open_mic(params)[source]¶
Open a new microphone capture stream.
- Parameters:
params (
retro_microphone_params|None) – Requested capture parameters, orNoneto let the driver pick its defaults.- Return type:
- Returns:
A handle to the opened microphone, or
Noneif no microphone could be opened.
- abstractmethod close_mic(mic)[source]¶
Close a microphone previously returned by
open_mic().- Parameters:
mic (
retro_microphone) – The microphone handle to close.- Return type:
- abstractmethod get_mic_params(mic)[source]¶
Return the negotiated capture parameters for
mic.- Parameters:
mic (
retro_microphone) – The microphone handle to query.- Return type:
- Returns:
The negotiated parameters, or
Noneif the microphone has none.
- abstractmethod get_mic_state(mic)[source]¶
Return whether
micis currently capturing.- Parameters:
mic (
retro_microphone) – The microphone handle to query.- Return type:
- Returns:
Trueif the microphone is capturing.
- abstractmethod set_mic_state(mic, state)[source]¶
Start or pause capture on
mic.- Parameters:
mic (
retro_microphone) – The microphone handle to update.
- Return type:
- abstractmethod read_mic(mic, frames)[source]¶
Read up to
framesaudio frames frommic.- Parameters:
mic (
retro_microphone) – The microphone handle to read from.frames (
int) – Maximum number of mono signed 16-bit frames to read.
- Return type:
- Returns:
An
array.arrayof signed 16-bit samples holding the frames actually read, orNoneif the microphone is closed or no samples are available.
- abstract property microphones¶
All microphones currently open through this driver.
- __init__(*args, **kwargs)¶
- classmethod __new__(*args, **kwargs)¶