Sound

// Generates audio in a scene.
class RVAPI Sound
{
public:
    // Check if sound is currently playing.
    bool IsPlaying() const;

    // Play sound.
    void Play();

    // Pause sound.
    void Pause();

    // Stop sound.
    void Stop();

    // Set [gain] to normalized value.
    void SetGain(float gain);

    // Set [pitch] to normalized value. 1 = no change. higher = higher pitch. lower = lower pitch. 
    void SetPitch(float pitch);

    // Set velocity vector.
    void SetVelocity(const S3f &vel);

    // Set range in meters. Loudest when less than [min]. Not audible when greater than [max].
    void SetRange(float min, float max);

    // Set cone angle. Loudest when less than [inner]. At outer gain when greater than [outer]. 
    // [gain] is outer volume.
    void SetCone(float inner, float outer, float gain);

    // Enable/Disable looping.
    void SetLoop(bool enable);

    // Set position.
    void SetPos(const M4f &pos);

    // Set sound source.
    void SetSource(wcstr assetName);

    // Stream sound from file. [path] is file location relative to assets root.
    void SetStream(wcstr path);

    // Internal.
    void *operator () () const { return (void *)wobj; }

    // Constructor.
    Sound();

    // Destructor.
    ~Sound();

private:
    byte wobj[1024];
};