PebbleOS
Loading...
Searching...
No Matches
Enumerations | Functions
speaker_service.h File Reference
#include <pbl/services/speaker/limits.h>
#include <pbl/services/speaker/note_sequence.h>
#include <pbl/services/speaker/speaker_finish_reason.h>
#include <pbl/services/speaker/speaker_pcm_format.h>
#include <pbl/services/speaker/track.h>
#include <kernel/pebble_tasks.h>
#include <stdbool.h>
#include <stdint.h>

Enumerations

enum  SpeakerPriority { SpeakerPriorityApp = 0 , SpeakerPriorityNotification , SpeakerPriorityCritical }
 Playback priority; a higher priority preempts a lower one. More...
 
enum  SpeakerState { SpeakerStateIdle = 0 , SpeakerStatePlaying , SpeakerStateDraining }
 Playback state. More...
 
enum  SpeakerSourceType {
  SpeakerSourceNone = 0 , SpeakerSourceNoteSeq , SpeakerSourceStream , SpeakerSourceTracks ,
  SpeakerSourceTone
}
 Kind of source being played. More...
 

Functions

void speaker_service_init (void)
 Initialize the speaker service.
 
bool speaker_service_play_note_seq (const SpeakerNote *notes, uint32_t num_notes, SpeakerPriority pri, uint8_t vol)
 Play a note sequence.
 
bool speaker_service_play_tone (uint16_t freq_hz, uint16_t duration_ms, uint8_t waveform, uint8_t velocity, SpeakerPriority pri, uint8_t vol)
 Play a single tone at an exact frequency.
 
bool speaker_service_play_volume_preview (uint8_t vol)
 Play a short tone at an absolute output volume.
 
bool speaker_service_play_tracks (const SpeakerTrack *tracks, uint32_t num_tracks, SpeakerPriority pri, uint8_t vol)
 Play monophonic tracks in parallel, mixed together.
 
void speaker_service_register_finish (PebbleTask task)
 Post a PEBBLE_SPEAKER_EVENT with the finish reason whenever playback ends.
 
bool speaker_service_stream_open (SpeakerPriority pri, uint8_t vol, SpeakerPcmFormat fmt)
 Open a PCM stream for writing.
 
bool speaker_service_stream_open_owned (SpeakerPriority pri, uint8_t vol, SpeakerPcmFormat fmt, PebbleTask owner)
 Open a PCM stream owned by a task.
 
bool speaker_service_stream_open_realtime_owned (SpeakerPriority pri, uint8_t vol, SpeakerPcmFormat fmt, PebbleTask owner)
 Open an owned PCM stream for internal live audio.
 
uint32_t speaker_service_stream_write_owned (PebbleTask owner, const void *data, uint32_t num_bytes)
 Write PCM data to the stream owned by a task.
 
void speaker_service_stream_close_owned (PebbleTask owner)
 Close the stream owned by a task, draining its buffered data.
 
uint32_t speaker_service_stream_write (const void *data, uint32_t num_bytes)
 Write PCM data to the active stream.
 
void speaker_service_stream_close (void)
 Close the active stream.
 
void speaker_service_stop (void)
 Stop any active playback immediately.
 
void speaker_service_set_volume (uint8_t vol)
 Set the playback volume.
 
void speaker_service_set_volume_owned (PebbleTask owner, uint8_t vol)
 Set the playback volume, only if the playback belongs to a task.
 
SpeakerState speaker_service_get_state (void)
 Get the playback state.
 
void speaker_service_stop_for_task (PebbleTask task)
 Stop any playback owned by a task and drop its finish events.
 
void speaker_service_set_owner_task (PebbleTask task)
 Set the task that owns the current playback.
 
bool speaker_service_is_muted (void)
 Check whether the speaker is muted.
 
void speaker_service_handle_audio_prefs_changed (void)
 Notify that the audio preferences (mute or system volume cap) changed.