Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API for sound #108

Open
jimmcnulty41 opened this issue Jul 2, 2017 · 0 comments
Open

Add API for sound #108

jimmcnulty41 opened this issue Jul 2, 2017 · 0 comments

Comments

@jimmcnulty41
Copy link
Collaborator

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

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant