spike.speaker
Hub speaker mock API
Classes
|
Hub speaker mocking class |
- class spike.speaker.Speaker
Hub speaker mocking class
Class is accessed simultaneously by the user side thread and the ground truth update thread. It is therefore protected by a mutex
- __init__()
Contructor
- beep(note=60, seconds=0.2)
Plays a beep on the Hub.
- Parameters:
note (float) – The MIDI note number
seconds (float) – Beep duration in seconds
- Raises:
TypeError – note is not a number or seconds is not a number.
ValueError – note is not within the allowed range of 44-123
- start_beep(note=60)
Starts playing a beep.
The beep will play indefinitely until stop() or another beep method is called.
- Parameters:
note (float) – The MIDI note number
- Raises:
TypeError – note is not a number.
ValueError – note is not within the allowed range of 44-123
- stop()
Stops any sound that is playing.
- get_volume()
Retrieves the value of the speaker volume.
This only retrieves the volume of the Hub, not the programming app.
- Returns:
The speaker volume
- Return type:
int [0,100]
- set_volume(volume)
Sets the speaker volume. If the assigned volume is out of range, the nearest volume (i.e., 0 or 100) will be used instead. This only sets the volume of the Hub, not the programming app.
- Parameters:
volume (int [0,100]) – The new volume percentage.
- Raises:
TypeError – volume is not a number.
- __process_command(command)
Process command until over
- Parameters:
command (generator function) – command to process
- c_reset()
Reset function
Warning
This function is not part of the spike API. It is provided to update the component from scenario data and shall not be used by the end-user.
- c_beep(note=60, seconds=0.2)
Plays a beep on the Hub.
Warning
This function is not part of the spike API. It is provided to update the component from scenario data and shall not be used by the end-user.
- Parameters:
note (float) – The MIDI note number
seconds (float) – Beep duration in seconds
- c_start_beep(note=60)
Plays a beep on the Hub.
Warning
This function is not part of the spike API. It is provided to update the component from scenario data and shall not be used by the end-user.
- Parameters:
note (float) – The MIDI note number
- c_stop()
Stops the beep
Warning
This function is not part of the spike API. It is provided to update the component from scenario data and shall not be used by the end-user.
- c_set_volume(volume)
Sets the speaker volume.
Warning
This function is not part of the spike API. It is provided to update the component from scenario data and shall not be used by the end-user.
- Parameters:
volume (int [0,100]) – The new volume percentage.