Skip to content

Commit 24bca06

Browse files
committed
Added type hints to audiomixer
1 parent 3d1e005 commit 24bca06

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

shared-bindings/audiomixer/Mixer.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ STATIC mp_obj_t audiomixer_mixer_make_new(const mp_obj_type_t *type, size_t n_ar
121121
return MP_OBJ_FROM_PTR(self);
122122
}
123123

124-
//| def deinit(self, ) -> Any:
124+
//| def deinit(self, ) -> None:
125125
//| """Deinitialises the Mixer and releases any hardware resources for reuse."""
126126
//| ...
127127
//|
@@ -138,13 +138,13 @@ STATIC void check_for_deinit(audiomixer_mixer_obj_t *self) {
138138
}
139139
}
140140

141-
//| def __enter__(self, ) -> Any:
141+
//| def __enter__(self, ) -> Mixer:
142142
//| """No-op used by Context Managers."""
143143
//| ...
144144
//|
145145
// Provided by context manager helper.
146146

147-
//| def __exit__(self, ) -> Any:
147+
//| def __exit__(self, ) -> None:
148148
//| """Automatically deinitializes the hardware when exiting a context. See
149149
//| :ref:`lifetime-and-contextmanagers` for more info."""
150150
//| ...
@@ -156,7 +156,7 @@ STATIC mp_obj_t audiomixer_mixer_obj___exit__(size_t n_args, const mp_obj_t *arg
156156
}
157157
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomixer_mixer___exit___obj, 4, 4, audiomixer_mixer_obj___exit__);
158158

159-
//| playing: Any = ...
159+
//| playing: bool = ...
160160
//| """True when any voice is being output. (read-only)"""
161161
//|
162162
STATIC mp_obj_t audiomixer_mixer_obj_get_playing(mp_obj_t self_in) {
@@ -173,7 +173,7 @@ const mp_obj_property_t audiomixer_mixer_playing_obj = {
173173
(mp_obj_t)&mp_const_none_obj},
174174
};
175175

176-
//| sample_rate: Any = ...
176+
//| sample_rate: int = ...
177177
//| """32 bit value that dictates how quickly samples are played in Hertz (cycles per second)."""
178178
//|
179179
STATIC mp_obj_t audiomixer_mixer_obj_get_sample_rate(mp_obj_t self_in) {
@@ -190,7 +190,7 @@ const mp_obj_property_t audiomixer_mixer_sample_rate_obj = {
190190
(mp_obj_t)&mp_const_none_obj},
191191
};
192192

193-
//| voice: Any = ...
193+
//| voice: Tuple[audiomixer.MixerVoice, ...] = ...
194194
//| """A tuple of the mixer's `audiomixer.MixerVoice` object(s).
195195
//|
196196
//| .. code-block:: python
@@ -211,7 +211,7 @@ const mp_obj_property_t audiomixer_mixer_voice_obj = {
211211
(mp_obj_t)&mp_const_none_obj},
212212
};
213213

214-
//| def play(self, sample: Any, *, voice: Any = 0, loop: Any = False) -> Any:
214+
//| def play(self, sample: Union[audiomixer.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, voice: int = 0, loop: bool = False) -> None:
215215
//| """Plays the sample once when loop=False and continuously when loop=True.
216216
//| Does not block. Use `playing` to block.
217217
//|
@@ -244,7 +244,7 @@ STATIC mp_obj_t audiomixer_mixer_obj_play(size_t n_args, const mp_obj_t *pos_arg
244244
}
245245
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixer_play_obj, 1, audiomixer_mixer_obj_play);
246246

247-
//| def stop_voice(self, voice: Any = 0) -> Any:
247+
//| def stop_voice(self, voice: int = 0) -> None:
248248
//| """Stops playback of the sample on the given voice."""
249249
//| ...
250250
//|

shared-bindings/audiomixer/MixerVoice.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ STATIC mp_obj_t audiomixer_mixervoice_make_new(const mp_obj_type_t *type, size_t
5656
return MP_OBJ_FROM_PTR(self);
5757
}
5858

59-
//| def play(self, sample: Any, *, loop: Any = False) -> Any:
59+
//| def play(self, sample: Union[audiocore.WaveFile, audiomixer.Mixer, audiocore.RawSample], *, loop: bool = False) -> None:
6060
//| """Plays the sample once when ``loop=False``, and continuously when ``loop=True``.
6161
//| Does not block. Use `playing` to block.
6262
//|
@@ -81,7 +81,7 @@ STATIC mp_obj_t audiomixer_mixervoice_obj_play(size_t n_args, const mp_obj_t *po
8181
}
8282
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_play_obj, 1, audiomixer_mixervoice_obj_play);
8383

84-
//| def stop(self, ) -> Any:
84+
//| def stop(self, ) -> None:
8585
//| """Stops playback of the sample on this voice."""
8686
//| ...
8787
//|
@@ -100,7 +100,7 @@ STATIC mp_obj_t audiomixer_mixervoice_obj_stop(size_t n_args, const mp_obj_t *po
100100
}
101101
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_stop_obj, 1, audiomixer_mixervoice_obj_stop);
102102

103-
//| level: Any = ...
103+
//| level: None = ...
104104
//| """The volume level of a voice, as a floating point number between 0 and 1."""
105105
//|
106106
STATIC mp_obj_t audiomixer_mixervoice_obj_get_level(mp_obj_t self_in) {
@@ -136,7 +136,7 @@ const mp_obj_property_t audiomixer_mixervoice_level_obj = {
136136
(mp_obj_t)&mp_const_none_obj},
137137
};
138138

139-
//| playing: Any = ...
139+
//| playing: bool = ...
140140
//| """True when this voice is being output. (read-only)"""
141141
//|
142142

0 commit comments

Comments
 (0)