Added inline pyi to audiomp3
This commit is contained in:
parent
8330471068
commit
829da5c127
@ -34,16 +34,16 @@
|
||||
#include "shared-bindings/util.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
|
||||
//| .. currentmodule:: audiomp3
|
||||
//|class MP3:
|
||||
//| """.. currentmodule:: audiomp3
|
||||
//|
|
||||
//| :class:`MP3Decoder` -- Load a mp3 file for audio playback
|
||||
//| =========================================================
|
||||
//|
|
||||
//| An object that decodes MP3 files for playback on an audio device.
|
||||
//| An object that decodes MP3 files for playback on an audio device."""
|
||||
//|
|
||||
//| .. class:: MP3(file[, buffer])
|
||||
//|
|
||||
//| Load a .mp3 file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`.
|
||||
//| def __init__(self, file: typing.BinaryIO, buffer: bytearray):
|
||||
//| """Load a .mp3 file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`.
|
||||
//|
|
||||
//| :param typing.BinaryIO file: Already opened mp3 file
|
||||
//| :param bytearray buffer: Optional pre-allocated buffer, that will be split in half and used for double-buffering of the data. If not provided, two buffers are allocated internally. The specific buffer size required depends on the mp3 file.
|
||||
@ -68,8 +68,8 @@
|
||||
//| a.play(mp3)
|
||||
//| while a.playing:
|
||||
//| pass
|
||||
//| print("stopped")
|
||||
//|
|
||||
//| print("stopped")"""
|
||||
//| ...
|
||||
STATIC mp_obj_t audiomp3_mp3file_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
mp_arg_check_num(n_args, kw_args, 1, 2, false);
|
||||
|
||||
@ -92,10 +92,9 @@ STATIC mp_obj_t audiomp3_mp3file_make_new(const mp_obj_type_t *type, size_t n_ar
|
||||
return MP_OBJ_FROM_PTR(self);
|
||||
}
|
||||
|
||||
//| .. method:: deinit()
|
||||
//|
|
||||
//| Deinitialises the MP3 and releases all memory resources for reuse.
|
||||
//|
|
||||
//| def deinit(self, ) -> Any:
|
||||
//| """Deinitialises the MP3 and releases all memory resources for reuse."""
|
||||
//| ...
|
||||
STATIC mp_obj_t audiomp3_mp3file_deinit(mp_obj_t self_in) {
|
||||
audiomp3_mp3file_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
common_hal_audiomp3_mp3file_deinit(self);
|
||||
@ -109,17 +108,16 @@ STATIC void check_for_deinit(audiomp3_mp3file_obj_t *self) {
|
||||
}
|
||||
}
|
||||
|
||||
//| .. method:: __enter__()
|
||||
//|
|
||||
//| No-op used by Context Managers.
|
||||
//|
|
||||
//| def __enter__(self, ) -> Any:
|
||||
//| """No-op used by Context Managers."""
|
||||
//| ...
|
||||
// Provided by context manager helper.
|
||||
|
||||
//| .. method:: __exit__()
|
||||
//|
|
||||
//| Automatically deinitializes the hardware when exiting a context. See
|
||||
//| :ref:`lifetime-and-contextmanagers` for more info.
|
||||
//| def __exit__(self, ) -> Any:
|
||||
//|
|
||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||
//| ...
|
||||
STATIC mp_obj_t audiomp3_mp3file_obj___exit__(size_t n_args, const mp_obj_t *args) {
|
||||
(void)n_args;
|
||||
common_hal_audiomp3_mp3file_deinit(args[0]);
|
||||
@ -127,10 +125,9 @@ STATIC mp_obj_t audiomp3_mp3file_obj___exit__(size_t n_args, const mp_obj_t *arg
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomp3_mp3file___exit___obj, 4, 4, audiomp3_mp3file_obj___exit__);
|
||||
|
||||
//| .. attribute:: file
|
||||
//|
|
||||
//| File to play back.
|
||||
//|
|
||||
//| file: Any =
|
||||
//| """File to play back."""
|
||||
//| ...
|
||||
STATIC mp_obj_t audiomp3_mp3file_obj_get_file(mp_obj_t self_in) {
|
||||
audiomp3_mp3file_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
@ -158,12 +155,11 @@ const mp_obj_property_t audiomp3_mp3file_file_obj = {
|
||||
|
||||
|
||||
|
||||
//| .. attribute:: sample_rate
|
||||
//|
|
||||
//| 32 bit value that dictates how quickly samples are loaded into the DAC
|
||||
//| sample_rate: Any =
|
||||
//| """32 bit value that dictates how quickly samples are loaded into the DAC
|
||||
//| in Hertz (cycles per second). When the sample is looped, this can change
|
||||
//| the pitch output without changing the underlying sample.
|
||||
//|
|
||||
//| the pitch output without changing the underlying sample."""
|
||||
//| ...
|
||||
STATIC mp_obj_t audiomp3_mp3file_obj_get_sample_rate(mp_obj_t self_in) {
|
||||
audiomp3_mp3file_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
@ -186,10 +182,9 @@ const mp_obj_property_t audiomp3_mp3file_sample_rate_obj = {
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
//| .. attribute:: bits_per_sample
|
||||
//|
|
||||
//| Bits per sample. (read only)
|
||||
//|
|
||||
//| bits_per_sample: Any =
|
||||
//| """Bits per sample. (read only)"""
|
||||
//| ...
|
||||
STATIC mp_obj_t audiomp3_mp3file_obj_get_bits_per_sample(mp_obj_t self_in) {
|
||||
audiomp3_mp3file_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
@ -204,10 +199,9 @@ const mp_obj_property_t audiomp3_mp3file_bits_per_sample_obj = {
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
//| .. attribute:: channel_count
|
||||
//|
|
||||
//| Number of audio channels. (read only)
|
||||
//|
|
||||
//| channel_count: Any =
|
||||
//| """Number of audio channels. (read only)"""
|
||||
//| ...
|
||||
STATIC mp_obj_t audiomp3_mp3file_obj_get_channel_count(mp_obj_t self_in) {
|
||||
audiomp3_mp3file_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
@ -222,10 +216,9 @@ const mp_obj_property_t audiomp3_mp3file_channel_count_obj = {
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
//| .. attribute:: rms_level
|
||||
//|
|
||||
//| The RMS audio level of a recently played moment of audio. (read only)
|
||||
//|
|
||||
//| rms_level: Any =
|
||||
//| """The RMS audio level of a recently played moment of audio. (read only)"""
|
||||
//| ...
|
||||
STATIC mp_obj_t audiomp3_mp3file_obj_get_rms_level(mp_obj_t self_in) {
|
||||
audiomp3_mp3file_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
|
Loading…
x
Reference in New Issue
Block a user