From d356581651e4a11dc18787da95e2f96bfde3575d Mon Sep 17 00:00:00 2001 From: Taku Fukada Date: Sat, 25 Jul 2020 17:58:37 +0900 Subject: Fix several type hints --- shared-bindings/audiocore/RawSample.c | 6 +++--- shared-bindings/audiocore/WaveFile.c | 6 +++--- shared-bindings/audiocore/__init__.c | 7 +++++++ 3 files changed, 13 insertions(+), 6 deletions(-) (limited to 'shared-bindings/audiocore') diff --git a/shared-bindings/audiocore/RawSample.c b/shared-bindings/audiocore/RawSample.c index 20ebae001..fd8652c14 100644 --- a/shared-bindings/audiocore/RawSample.c +++ b/shared-bindings/audiocore/RawSample.c @@ -38,13 +38,13 @@ //| class RawSample: //| """A raw audio sample buffer in memory""" //| -//| def __init__(self, buffer: array.array, *, channel_count: int = 1, sample_rate: int = 8000) -> None: +//| def __init__(self, buffer: ReadableBuffer, *, channel_count: int = 1, sample_rate: int = 8000) -> None: //| """Create a RawSample based on the given buffer of signed values. If channel_count is more than //| 1 then each channel's samples should alternate. In other words, for a two channel buffer, the //| first sample will be for channel 1, the second sample will be for channel two, the third for //| channel 1 and so on. //| -//| :param array.array buffer: An `array.array` with samples +//| :param ReadableBuffer buffer: A buffer with samples //| :param int channel_count: The number of channels in the buffer //| :param int sample_rate: The desired playback sample rate //| @@ -136,7 +136,7 @@ STATIC mp_obj_t audioio_rawsample_obj___exit__(size_t n_args, const mp_obj_t *ar } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_rawsample___exit___obj, 4, 4, audioio_rawsample_obj___exit__); -//| sample_rate: Optional(int) = ... +//| sample_rate: Optional[int] //| """32 bit value that dictates how quickly samples are played in Hertz (cycles per second). //| When the sample is looped, this can change the pitch output without changing the underlying //| sample. This will not change the sample rate of any active playback. Call ``play`` again to diff --git a/shared-bindings/audiocore/WaveFile.c b/shared-bindings/audiocore/WaveFile.c index d986d6db5..89c731c68 100644 --- a/shared-bindings/audiocore/WaveFile.c +++ b/shared-bindings/audiocore/WaveFile.c @@ -125,7 +125,7 @@ STATIC mp_obj_t audioio_wavefile_obj___exit__(size_t n_args, const mp_obj_t *arg } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_wavefile___exit___obj, 4, 4, audioio_wavefile_obj___exit__); -//| sample_rate: int = ... +//| sample_rate: int //| """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.""" @@ -152,7 +152,7 @@ const mp_obj_property_t audioio_wavefile_sample_rate_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| bits_per_sample: int = ... +//| bits_per_sample: int //| """Bits per sample. (read only)""" //| STATIC mp_obj_t audioio_wavefile_obj_get_bits_per_sample(mp_obj_t self_in) { @@ -168,7 +168,7 @@ const mp_obj_property_t audioio_wavefile_bits_per_sample_obj = { (mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj}, }; -//| channel_count: int = ... +//| channel_count: int //| """Number of audio channels. (read only)""" //| STATIC mp_obj_t audioio_wavefile_obj_get_channel_count(mp_obj_t self_in) { diff --git a/shared-bindings/audiocore/__init__.c b/shared-bindings/audiocore/__init__.c index b400b9454..a27dcefa4 100644 --- a/shared-bindings/audiocore/__init__.c +++ b/shared-bindings/audiocore/__init__.c @@ -38,6 +38,13 @@ //| """Support for audio samples""" //| +//| _AudioSample = Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer, audiomp3.MP3Decoder] +//| """An audio sample for playback with `audioio.AudioOut`, `audiobusio.I2SOut` or `audiopwmio.PWMAudioOut`. +//| +//| Supported sources are :py:class:`audiocore.WaveFile`, :py:class:`audiocore.RawSample`, +//| :py:class:`audiomixer.Mixer` and :py:class:`audiomp3.MP3Decoder`.""" +//| + STATIC const mp_rom_map_elem_t audiocore_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_audiocore) }, { MP_ROM_QSTR(MP_QSTR_RawSample), MP_ROM_PTR(&audioio_rawsample_type) }, -- cgit v1.2.3