CHGame 0.3.0
Libraries for the CHGame handheld
Loading...
Searching...
No Matches
audio::Melody Struct Reference

A melody: one line of notes, easy to write by hand. More...

#include <chgame/Audio.h>

Public Attributes

const uint8_t * notes
 (MIDI note, length) pairs.
 
uint8_t count
 Number of pairs.
 
uint8_t unitMs
 Milliseconds per length unit.
 
uint8_t gapMs
 Silence at the end of each note, in milliseconds.
 

Detailed Description

A melody: one line of notes, easy to write by hand.

(MIDI note, length) pairs: note 0 is a rest, a length counts units of unitMs, and each note is let go gapMs early so repeated notes stay apart. Middle C is 60; the piezo sings best from C6 (84) to C8 (108).

static const uint8_t TUNE[] = { 84,2, 88,2, 91,4, 0,2 };
static const audio::Melody TITLE = { TUNE, sizeof TUNE / 2, 105, 14 };
void melody(const Melody &m, bool loop=true)
Play a melody under the effects (it replaces any score).
A melody: one line of notes, easy to write by hand.
Definition Audio.h:155

Member Data Documentation

◆ notes

const uint8_t* audio::Melody::notes

(MIDI note, length) pairs.

◆ count

uint8_t audio::Melody::count

Number of pairs.

◆ unitMs

uint8_t audio::Melody::unitMs

Milliseconds per length unit.

◆ gapMs

uint8_t audio::Melody::gapMs

Silence at the end of each note, in milliseconds.


The documentation for this struct was generated from the following file: