libretro.drivers.audio.wave¶
An audio driver that writes received samples to a WAV file.
See also
waveThe Python standard library module used to write WAV files in this driver.
libretro.api.audioDefines the audio callback types and sample formats this driver handles.
Classes
An |
- class WaveWriterAudioDriver[source]¶
Bases:
AudioDriverAn
AudioDriverthat writes all audio output to a WAV file.The output file is always stereo, 16-bit PCM at 44,100 Hz.
- __init__(file)[source]¶
Open the given file for writing WAV audio.
- Parameters:
file (
str|bytes|PathLike[str] |PathLike[bytes] |IO[bytes]) – The output destination. Can be a file path (str,bytes, orPathLike) or a writable binary I/O object.- Raises:
ValueError – If
fileis anIOobject that is not writable.TypeError – If
fileis not one of the supported types.
- sample(left, right)[source]¶
Receives a single stereo audio sample from the core.
- Parameters:
See also
retro_audio_sample_tThe C function pointer type whose signature this method implements.
- sample_batch(frames)[source]¶
Receives a batch of interleaved stereo audio frames from the core.
- Parameters:
frames (
memoryview) – A read-onlymemoryviewof interleaved signed 16-bit stereo frames.- Return type:
- Returns:
The number of frames consumed.
See also
retro_audio_sample_batch_tThe C function pointer type whose signature this method implements.
- property callbacks¶
Audio callbacks are not supported by this driver.
- Returns:
None, always.- Raises:
UnsupportedEnvCall – If setting this property.
- classmethod __new__(*args, **kwargs)¶
- callback()¶
Invoke the registered asynchronous audio callback, if any.
Calls
retro_audio_callback.callbackif a callback is registered.- Return type:
- report_buffer_status(active, occupancy, underrun_likely)¶
Invoke the registered buffer-status callback, if any.
- set_state(enabled)¶
Enable or disables the registered asynchronous audio callback.
Calls
retro_audio_callback.set_stateif a callback is registered.
- property buffer_status¶
Buffer-status callbacks are not supported by this driver.
- Returns:
None, always.- Raises:
UnsupportedEnvCall – If setting this property.
- property minimum_latency¶
Setting a minimum latency is not supported by this driver.
- Returns:
None, always.- Raises:
UnsupportedEnvCall – If setting this property.
- property system_av_info¶
The AV info most recently set by the core.
Used by the driver to configure audio parameters such as sample rate.