CUGL 3.0
Cornell University Game Library
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Classes | Enumerations | Functions
cugl::audio Namespace Reference

Classes

class  AlgorithmicReverb
 
class  AudioDecoder
 
class  AudioDevices
 
class  AudioEngine
 
class  AudioFader
 
class  AudioInput
 
class  AudioMixer
 
class  AudioNode
 
class  AudioNodeQueue
 
class  AudioOutput
 
class  AudioPanner
 
class  AudioPlayer
 
class  AudioQueue
 
class  AudioRedistributor
 
class  AudioResampler
 
class  AudioSample
 
class  AudioScheduler
 
class  AudioSpinner
 
class  AudioSynchronizer
 
class  AudioWaveform
 
class  Sound
 
class  SoundLoader
 

Enumerations

enum class  AudioType : int {
  UNKNOWN = -1 , WAV_FILE = 0 , MP3_FILE = 1 , OGG_FILE = 2 ,
  FLAC_FILE = 3 , IN_MEMORY = 4
}
 

Functions

AudioType guessType (const std::string file)
 
std::string typeName (AudioType type)
 

Detailed Description

The classes supporting sound playback and recording.

While sound is an important part of most games, it is less important in early prototypes. Therefore, we have factored this subsystem out to reduce the application footprint. Note that even without these classes, it is still possible to play audio using the SDL API.

Enumeration Type Documentation

◆ AudioType

enum class cugl::audio::AudioType : int
strong

This enum represents the currently supported audio sources.

Currenltly, we only support file types that are easy to stream into a Linear PCM format. We recommend that you use OGG for music (which is streamed) and WAV for sound effects (which is buffered).

All audio sources in CUGL interleave the audio channels. MP3 and WAV ADPCM only support mono or stereo. But all other formats can support more channels. SDL supports up to 8 channels (7.1 stereo) in general. Note that the channel layout for OGG data is nonstandard (e.g. channels > 3 are not stereo compatible), so CUGL standardizes the channel layout to agree with FLAC and other data encodings.

Enumerator
UNKNOWN 

An unknown audio file source

WAV_FILE 

A (Windows-style) WAV file

CUGL supports PCM, IEEE Float, and ADPCM encoding (both MS and IMA). However, it does not support MP3 data stored in a WAV file. It also does not support A-law or mu-law.

MP3_FILE 

A simple MP3 file

For licensing reasons, MP3 support is provided by minimp3. The does provide support for VBR MP3 files, but the files must be mono or stereo. CUGL does not support MP3 surround.

OGG_FILE 

An ogg vorbis file

CUGL only supports Vorbis encodings. It does not support FLAC data encoded in an ogg file container. It also does not support the newer Opus codec.

FLAC_FILE 

A FLAC file

CUGL only supports native FLAC encodings. It does not support FLAC data encoded in an ogg file container. In addition, the FLAC data must have a complete stream info header containing the size and channel data.

IN_MEMORY 

An in-memory sound source

These sound sources are linear PCM signals that are generatee programatically, and do not correspond to an audio file.

Function Documentation

◆ guessType()

AudioType cugl::audio::guessType ( const std::string  file)

Returns the type suggested by the given file name

The type will be determined from the file extension (e.g. .wav, .mp3, .ogg, etc).

Parameters
fileThe file name
Returns
the type suggested by the given file name

◆ typeName()

std::string cugl::audio::typeName ( AudioType  type)

Returns a string description of the given type

Parameters
typeThe audio source type
Returns
a string description of the given type