# Palomino - Sound Module

©2004,2008 Jim E. Brooks http://www.palomino3d.org

# Contents

- Main Contents

- Overview
- SoundAbstract
- PLIB Implementation

## Overview

[2007/12]

Sound class plays sound files, can loop the same sound, and can adjust volume. App code will initiate asynchronous playing of a sound file (sample) by calling Sound::Play().

## SoundAbstract

[2007/12]

SoundAbstract is an abstract class that is meant to be implemented by a derivative such as SoundPlib. Actually, SoundAbstract serves double-duty as a NOP class on systems that lack an underlying sound library.

## PLIB Implementation

[2007/12]

The developers of PLIB decided to require the application to perodically pulse PLIB to play sounds, deferring the choice of the frequency of the tick to the app developer. PLIB will play a segment of a sample once every tick. Therefore, the Sound class has a timer-tick functor.

PLIB alters a sample's volume by modifying its waveform (slow operation). The Sound class avoids PLIB distorting the waveform by restoring the original waveform (so changing volume becomes even slower).

PLIB will cause program exit if a sample is deleted while still playing. stopSample() and update() don't quite work according to the PLIB docs. The reliable way is to enqueue zombie samples then deleted them when their "play count" reaches zero.

Last modified: Thu Jan 31 20:30:15 EST 2008