Loading...
Searching...
No Matches
music_store.h File Reference

Active music store: what the phone is playing, as a Pebble app music plugin reports it. More...

#include <pebble.h>

Go to the source code of this file.

Data Structures

struct  MusicConfig
 The rules a face hands the store. More...
struct  MusicSeed
 Optional prefill, or pinned state when live = false. More...

Functions

void music_store_init (MusicConfig cfg, const MusicSeed *seed)
 Start the store with its rules. Pass seed = NULL for normal use.
void music_store_subscribe (void(*cb)(void))
 Hand it the function to call when the track changes (the screen redraw).
const char * music_store_title (void)
 The song's title, or an empty string for none.
const char * music_store_artist (void)
 Who it is by, or an empty string for none.
bool music_store_playing (void)
 True while the track plays, and false while it is paused or nothing is playing.
bool music_store_has_track (void)
 Whether there is a track to show, paused or playing.
const GBitmap * music_store_artwork (void)
 The track's album art, as a 4-bit palettized bitmap.
void music_store_deinit (void)
 Frees the album art the store holds. Call it from the face's deinit.
bool music_store_no_plugin (void)
 Whether the phone said no plugin on it serves now playing.

Detailed Description

Active music store: what the phone is playing, as a Pebble app music plugin reports it.

It holds the title and the artist, up to 32 characters each, and whether the track plays. Nothing is saved to flash, since a song from an hour ago is worse than none. It clears when the phone drops, and the store asks the phone again when the link comes back and once at launch.

The text is ASCII, since the phone folds each line to it before sending. A line in a script with no ASCII form arrives empty.

A face that started the phone's music feature as music.withArtwork({ w, h }) also gets the album art, as a GBitmap from music_store_artwork(). The store holds one bitmap at a time, up to 100 by 100 pixels at 4 bits each, and frees it when the art changes, clears, or the phone drops, and in music_store_deinit().

The phone also says when no plugin on it serves now playing, such as with plugins off in the Pebble app or on an iPhone. The store then reads as nothing playing, and music_store_no_plugin() says why, so a face can show its own words in place of its empty state.

It is built only for a face that declares MUSIC_TITLE, MUSIC_ARTIST, MUSIC_PLAYING, and MUSIC_REQUEST, which the build allows only with PLUGIN_MUSIC in the appinfo's defines. On any other face it does nothing and reads as nothing playing.