Skip to content

Add API for sound #108

Description

@jimmcnulty41

We should have means for playing sound.

Unlike some popular major engines, our sound system need not support sound locality (a.k.a. Sound attenuation). This should considerably reduce the complexity of designing the sound system.

The system will be designed similarly to the existing animation system.

An Entity should have a SoundAttribute. The sound attribute should have a collection of sounds with unique keys.

Unlike drawables, there will not be different types of sounds.

The basic API for a sound will be:

class Sound  {

    bool loopSound; // property to loop the sound clip when it ends (default should be false)
    float volume; // property to set the default volume of the clip. volume ranges from [0,1] where 1 is full volume

    (() => float) pitchModulationFunction; // property to modify the pitch each time playSound is called (default should return 1); pitch > 1 means a higher pitch, < 1 means a lower pitch
    (() => float) volumeModulationFunction; // property to modify the volume each time playSound is called (default should return 1); volume ranges from [0,1] where 1 is full volume
    (() => float) durationModulationFunction; // property to modify the duration each time playSound is called; duration will be multiplied by the default duration
    
    void playSound(); // plays a sound
    void stopSound(); // Stops the sound early

}

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions