Skip to content

MiP_Sound

github-actions[bot] edited this page Aug 10, 2026 · 8 revisions

Class MiP_Sound

Manages MiP's sounds.

Public Elements

MIP_CMD_PLAY_SOUND

Signature: constexpr uint8_t MIP_CMD_PLAY_SOUND

Summary: MiP protocol command bytes used by the sound subsystem.

Details:

These values are placed in the first byte of requests sent to the MiP (and appear in the corresponding responses). See the official MiP BLE Protocol for the complete list.


MIP_CMD_SET_VOLUME

Signature: constexpr uint8_t MIP_CMD_SET_VOLUME


MIP_CMD_GET_VOLUME

Signature: constexpr uint8_t MIP_CMD_GET_VOLUME


MiP_Sound

Signature: MiP_Sound(MiP &mip)

Summary: Constructs the sound manager.

Parameters:

Parameter Description
mip A reference to the main MiP object to access core services.

beginList

Signature: void beginList()

Summary: Starts a new sound list sequence.

Details:

Must be called before adding entries with addEntryToSoundList().


addEntryToList

Signature: void addEntryToList(MiPSoundIndex sound, uint16_t delay=0, MiPVolume volume=MIP_VOLUME_DEFAULT)

Summary: Adds a sound (with optional delay and volume change) to the current sound list.

Parameters:

Parameter Description
sound Sound index.
delayTime Delay in milliseconds before next sound (0-7650 ms).
volume Volume for this sound (or MIP_VOLUME_DEFAULT to keep previous).

playList

Signature: void playList(uint8_t repeatCount=0)

Summary: Plays the current sound list.

Parameters:

Parameter Description
repeatCount Number of times to repeat the entire list (0 = once).

play

Signature: void play(MiPSoundIndex sound, MiPVolume volume=MIP_VOLUME_DEFAULT)

Summary: Plays a single sound at the specified volume.

Details:

Convenience method that builds and plays a one-entry sound list.

Parameters:

Parameter Description
sound Sound index to play.
volume Volume level (default = MIP_VOLUME_DEFAULT).

writeVolume

Signature: void writeVolume(uint8_t volume)

Summary: Sets the MiP speaker volume and verifies the change.

Details:

Retries automatically on failure.

Parameters:

Parameter Description
volume Volume level (0-7).

readVolume

Signature: uint8_t readVolume()

Summary: Reads the current speaker volume.

Details:

Performs a verified read with retries.

Returns: Current volume (0-7), or 0 on error.


end

Signature: void end()

Summary: Cleans up the sound subsystem upon end.

Details:

Restores MiP's default volume.


Clone this wiki locally