ebmDevMag.com home
ebm Developer's Magazine
links

developer's mag
main page

article
part 1
part 2
part 3
part 4
part 5
part 6
part 7
part 8
part 9


7 - Jingles

Stringing piezo tones together to create tunes can be problematic. For instance, if you were programming it yourself, you would need to play a tone, wait for it to end, and then play another (or pause if silence requested). It can be done (for instance the call piezo_sync() makes your program wait until the current audio is finished), but it is awkward, especially when there is a much easier way - the ebm jingle call:
  void piezo_play_jingle(unsigned int idx, int flags);

The flags for this call are the same as for piezo_play_1tone(); however, the index value is an index to a table of preset jingles. To get this list, you use piezo_njingles(), which returns the total available (and thereby the maximum index value to use):
  int piezo_njingles(size_t *nbytes);

The nbytes value is the memory required to store all the jingle names in a single array, including each string's null byte. This can be useful for efficiency, since you only need a single malloc() to set aside memory (instead of one per string), but if you plan to store names individually (or not at all), you can just ignore this value.

Previous Section
Next Section

Copyright © 2001-2006 ebmDevMag.com - Legal Notice