Skip to content

Commit 32f6161

Browse files
Docs for SoundEvent.CLAP
As added here: bbcmicrobit/micropython@a37074f
1 parent 8eb7165 commit 32f6161

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

lang/en/typeshed/stdlib/microbit/__init__.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,9 @@ class SoundEvent:
837837
QUIET: SoundEvent
838838
"""Represents the transition of sound events, from ``loud`` to ``quiet`` like speaking or background music."""
839839

840+
CLAP: SoundEvent
841+
"""Represents a loud event similar to a clap."""
842+
840843
class Sound:
841844
"""The built-in sounds can be called using ``audio.play(Sound.NAME)``."""
842845

lang/en/typeshed/stdlib/microbit/microphone.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def current_event() -> Optional[SoundEvent]:
1010
1111
Example: ``microphone.current_event()``
1212
13-
:return: The event, ``SoundEvent('loud')`` or ``SoundEvent('quiet')``.
13+
:return: The event, ``SoundEvent('loud')``, ``SoundEvent('quiet')`` or ``SoundEvent('clap')``.
1414
"""
1515
...
1616

@@ -21,7 +21,7 @@ def was_event(event: SoundEvent) -> bool:
2121
2222
This call clears the sound history before returning.
2323
24-
:param event: The event to check for, such as ``SoundEvent.LOUD`` or ``SoundEvent.QUIET``
24+
:param event: The event to check for, such as ``SoundEvent.LOUD``, ``SoundEvent.QUIET`` or ``SoundEvent.CLAP``.
2525
:return: ``True`` if sound was heard at least once since the last call, otherwise ``False``.
2626
"""
2727
...
@@ -33,7 +33,7 @@ def is_event(event: SoundEvent) -> bool:
3333
3434
This call does not clear the sound event history.
3535
36-
:param event: The event to check for, such as ``SoundEvent.LOUD`` or ``SoundEvent.QUIET``
36+
:param event: The event to check for, such as ``SoundEvent.LOUD``, ``SoundEvent.QUIET`` or ``SoundEvent.CLAP``.
3737
:return: ``True`` if sound was the most recent heard, ``False`` otherwise.
3838
"""
3939
...
@@ -50,7 +50,7 @@ def get_events() -> Tuple[SoundEvent, ...]:
5050
...
5151

5252
def set_threshold(event: SoundEvent, value: int) -> None:
53-
"""Set the threshold for a sound event.
53+
"""Set the threshold for the ``LOUD`` or ``QUIET`` sound events.
5454
5555
Example: ``microphone.set_threshold(SoundEvent.LOUD, 250)``
5656
@@ -65,7 +65,7 @@ def set_threshold(event: SoundEvent, value: int) -> None:
6565
threshold, then the ``SoundEvent.LOUD`` threshold will increase by one unit
6666
above the ``SoundEvent.QUIET`` threshold.
6767
68-
:param event: A sound event, such as ``SoundEvent.LOUD`` or ``SoundEvent.QUIET``.
68+
:param event: A ``SoundEvent.LOUD`` or ``SoundEvent.QUIET`` event.
6969
:param value: The threshold level in the range 0-255. Values outside this range will be clamped.
7070
"""
7171
...

0 commit comments

Comments
 (0)