tsp_algorithmic

Advanced sound player example showing algorithmic sequencing of sound playback.

Synopsis

tsp_algorithmic

Description

Assume you have two short sounds in memory and one long sound file with the following markers:

BEGIN
beginning segment (attack)
Loop
loop segment (sustain)
First Ending
1st ending segment (gap)
Second Ending
2nd ending segment (release, end)
END
Given this, algorithmically play the following sequence of sounds:

Segment
What you should hear
long sound beginning segment
attack
long sound loop segment
sustain
long sound 1st ending segment
gap
long sound loop segment
sustain
long sound 2nd ending segment
release, end
short sound 1
<blast>
long sound loop segment
sustain
long sound 1st ending segment
gap
long sound loop segment
sustain
long sound 2nd ending segment
release, end
short sound 2
<honk>
The technique used to implement this sequence involves the use of static branches, where one segment always leads into another, (e.g. after playing the 1st ending always go back to the loop segment), and decision functions where a conditional branching is required (e.g. from the end of the loop segment either go to the 1st or 2nd ending).

This also demonstrates using sounds spooled from disc and played directly from memory.

Associated Files

tsp_algorithmic.c

$samples, words.aiff

Location

examples/Audio/Advanced_Sound_Player

See Also

spCreatePlayer, ./12PGS073.html#XREF12413">tsp_switcher, ./12PGS071.html#XREF30384">tsp_rooms