kcat / alure

Alure is a utility library for OpenAL, providing a C++ API and managing common tasks that include file loading, caching, and streaming
zlib License
70 stars 20 forks source link

Clarification on responsibilities of classes in source? #17

Closed Cazadorro closed 4 years ago

Cazadorro commented 6 years ago

For example, of the following, what are their responsibilities what to they do, what is the intent behind making the class?

kcat commented 6 years ago

For example, of the following, what are their responsibilities what to they do, what is the intent behind making the class?

The majority of classes are basically equivalent to OpenAL objects of the same name (notable exceptions being SourceGroups and Decoders).

Buffer? Buffer loaded sound data given a decoder and is played from Source?

A buffer of preloaded PCM samples, which currently come from a Decoder.

Source? - assume source of sound? responsible for playing a stream with 3D sound properties which are configurable?

A sound source, which plays samples. It may be a 3D source in which case it will apply panning and distance attenuation to simulate a sound at the given position. The samples either come from a Buffer where they've been preloaded, or from a Decoder where it reads them over time and discards the samples already played.

SourceGroup? - I assume is a group of sources, which can configure multiple sources as a group?

A collection of Source references, which are modified as a group. For example, setting a SourceGroup's gain to 0.5 will reduce the gain of all sources in the group by half (on top of whatever adjustments each individual source has).

Context? - the entire sound environment (actual listener, source group, and special environmental effects)?

Contains and maintains the entire audio environment, it's settings and both the active (e.g. sources, auxiliary effect slots) and inactive (e.g. buffers, effects) components.

Effect? Pre-made effects which modify the properties of sound in a given context. ?

A collection of settings/parameters detailing an effect.

Device? Interface to physical media to play/record?

An object representing the output of the audio mix (Alure currently doesn't do recording). Normally this is a system audio output stream, which it mixes with any other process's audio and gives to a hardware audio device. On some systems, it may be an actual hardware port.

DeviceManager? Holds multiple devices?

Global state which can query non-device-specific information, and maintains open devices.

AuxiliaryEffectSlot? Some how works with effect? not sure how?

An effect processor. It takes the output mix of zero or more sources, applies DSP for the desired effect (as configured by a given Effect object), then adds to the output mix.

Cazadorro commented 4 years ago

issues solved in comments.