Touchscreen audio controller for presentation sound

The pause Function

The pause function is called when the pause button is touched on the touchscreen. Because I don't want to immediately start the next track, I disable the end event by calling self.channel.set_endevent with no arguments. Then, I can fadeout the current track (line 136) and set the class state to PAUSED (line 137).

The checkStopped Function

checkStopped first checks whether this instance is playing (line 140). If so, then it checks whether the channel it's been assigned is currently playing. If get_busy is False, then no playback is occuring (line 141). In that case, it's time to start the next track.

Line 142 clears the end event on self.channel, then increments trackIndex (line 143). Line 144 checks to see if trackIndex has run over the top, and if so, resets it to 0. Lines 145-151 are the same as the play function above to start playback.

Buy this article as PDF

Express-Checkout as PDF

Pages: 2

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content