Player12
An open source football management simulator
Loading...
Searching...
No Matches
Audio Namespace Reference

Classes

class  AudioDevice
 
struct  BusLevels
 
class  CrowdBed
 
class  Darken
 
class  Drift
 
class  Mixer
 
class  Noise
 
class  OnePole
 
struct  SoundCommand
 
class  Svf
 
class  Voice
 

Enumerations

enum class  Sound : std::uint8_t {
  KICK , NET , WOODWORK , WHISTLE ,
  CROWD_OOH , CROWD_CHEER , CROWD_GROAN , CROWD_BOO ,
  CROWD_WHISTLES , CROWD_APPLAUSE , COUNT
}
 
enum class  WhistlePattern : std::uint8_t { SHORT , KICK_OFF , HALF_TIME , FULL_TIME }
 

Functions

float softLimit (float sample)
 
bool isCrowdSound (Sound sound)
 

Variables

constexpr int SAMPLE_RATE = 48000
 
constexpr float SAMPLE_RATE_F = 48000.0f
 
constexpr float SAMPLE_PERIOD = 1.0f / SAMPLE_RATE_F
 
constexpr std::size_t SOUND_COUNT
 

Detailed Description

Procedural sound synthesis for the match audio. Every sound is built from noise, oscillators and filters at run time: there are no sample files.

Nothing here allocates or locks, so it is safe on the audio thread. The noise generators are private xorshift states, independent of the game's seeded RNG, so audio can never influence a simulation.

Enumeration Type Documentation

◆ Sound

enum class Audio::Sound : std::uint8_t
strong

Every one-shot sound the match audio can play.

Enumerator
KICK 
NET 
WOODWORK 
WHISTLE 
CROWD_OOH 
CROWD_CHEER 
CROWD_GROAN 
CROWD_BOO 
CROWD_WHISTLES 
CROWD_APPLAUSE 
COUNT 

◆ WhistlePattern

enum class Audio::WhistlePattern : std::uint8_t
strong

Referee whistle patterns (Voice variant for Sound::WHISTLE).

Enumerator
SHORT 
KICK_OFF 
HALF_TIME 
FULL_TIME 

Function Documentation

◆ isCrowdSound()

bool Audio::isCrowdSound ( Sound  sound)

True for crowd sounds (crowd bus); the rest go to the effects bus.

◆ softLimit()

float Audio::softLimit ( float  sample)

Soft limiter: linear below 0.8, then a smooth knee that never reaches 1.

Variable Documentation

◆ SAMPLE_PERIOD

constexpr float Audio::SAMPLE_PERIOD = 1.0f / SAMPLE_RATE_F
inlineconstexpr

◆ SAMPLE_RATE

constexpr int Audio::SAMPLE_RATE = 48000
inlineconstexpr

◆ SAMPLE_RATE_F

constexpr float Audio::SAMPLE_RATE_F = 48000.0f
inlineconstexpr

◆ SOUND_COUNT

constexpr std::size_t Audio::SOUND_COUNT
inlineconstexpr
Initial value:
=
static_cast<std::size_t>(std::to_underlying(Sound::COUNT))