ASW Lib
A.D.S. Games SDL Wrapper Library. A library targeted at Allegro4 users who want to switch to SDL3 and use modern c++.
Loading...
Searching...
No Matches
anonymous_namespace{sound.cpp} Namespace Reference

Classes

struct  Duck
 
struct  LowPass
 
struct  Voice
 

Functions

float bus_gain (asw::sound::Bus bus)
 
bool is_active (const Voice &v)
 
void SDLCALL low_pass_callback (void *userdata, MIX_Track *, const SDL_AudioSpec *spec, float *pcm, int samples)
 
float attenuate (const asw::sound::Attenuation &att, float distance)
 
float doppler (const Voice &v)
 
void set_stereo_pan (Voice &v, float pan)
 
void set_point (Voice &v, float x, float z)
 
void apply (Voice &v)
 
void apply_music ()
 
int find_voice (int priority)
 
float vary (float value, float variation)
 
Voice * resolve (int voice, uint32_t generation)
 
asw::sound::SoundHandle start (const asw::Sample &sample, const asw::sound::PlayOptions &options, const asw::Vec2< float > *position)
 

Variables

constexpr size_t NUM_VOICES = 32
 
constexpr size_t NUM_BUSES = static_cast<size_t>(asw::sound::Bus::Count)
 
constexpr int MAX_FILTER_CHANNELS = 8
 
constexpr float OCCLUDED_CUTOFF_HZ = 500.0F
 
constexpr float OPEN_CUTOFF_HZ = 20000.0F
 
constexpr float OCCLUDED_GAIN = 0.5F
 
constexpr float MIN_DOPPLER = 0.5F
 
constexpr float MAX_DOPPLER = 2.0F
 
float master_volume = 1.0F
 
std::array< float, NUM_BUSES > bus_volume = { 1.0F, 1.0F, 1.0F, 1.0F, 1.0F }
 
std::array< Duck, NUM_BUSES > ducks {}
 
std::array< Voice, NUM_VOICES > voices
 
MIX_Track * music_track = nullptr
 
float music_base_volume = 1.0F
 
float music_sent_gain = -1.0F
 
MIX_Mixer * mixer = nullptr
 
uint32_t session = 0
 
asw::Vec2< float > listener_position
 
asw::Vec2< float > listener_velocity
 
asw::sound::SpatialMode spatial_mode = asw::sound::SpatialMode::Stereo
 
float doppler_factor = 1.0F
 
float speed_of_sound = 3000.0F
 
uint64_t last_update_ns = 0
 

Function Documentation

◆ apply()

void anonymous_namespace{sound.cpp}::apply ( Voice & v)

Definition at line 234 of file sound.cpp.

◆ apply_music()

void anonymous_namespace{sound.cpp}::apply_music ( )

Definition at line 282 of file sound.cpp.

◆ attenuate()

float anonymous_namespace{sound.cpp}::attenuate ( const asw::sound::Attenuation & att,
float distance )

Definition at line 145 of file sound.cpp.

◆ bus_gain()

float anonymous_namespace{sound.cpp}::bus_gain ( asw::sound::Bus bus)

Definition at line 96 of file sound.cpp.

◆ doppler()

float anonymous_namespace{sound.cpp}::doppler ( const Voice & v)

Definition at line 177 of file sound.cpp.

◆ find_voice()

int anonymous_namespace{sound.cpp}::find_voice ( int priority)

Definition at line 292 of file sound.cpp.

◆ is_active()

bool anonymous_namespace{sound.cpp}::is_active ( const Voice & v)

Definition at line 102 of file sound.cpp.

◆ low_pass_callback()

void SDLCALL anonymous_namespace{sound.cpp}::low_pass_callback ( void * userdata,
MIX_Track * ,
const SDL_AudioSpec * spec,
float * pcm,
int samples )

Definition at line 107 of file sound.cpp.

◆ resolve()

Voice * anonymous_namespace{sound.cpp}::resolve ( int voice,
uint32_t generation )

Definition at line 337 of file sound.cpp.

◆ set_point()

void anonymous_namespace{sound.cpp}::set_point ( Voice & v,
float x,
float z )

Definition at line 218 of file sound.cpp.

◆ set_stereo_pan()

void anonymous_namespace{sound.cpp}::set_stereo_pan ( Voice & v,
float pan )

Definition at line 200 of file sound.cpp.

◆ start()

asw::sound::SoundHandle anonymous_namespace{sound.cpp}::start ( const asw::Sample & sample,
const asw::sound::PlayOptions & options,
const asw::Vec2< float > * position )

Definition at line 552 of file sound.cpp.

◆ vary()

float anonymous_namespace{sound.cpp}::vary ( float value,
float variation )

Definition at line 316 of file sound.cpp.

Variable Documentation

◆ bus_volume

std::array<float, NUM_BUSES> anonymous_namespace{sound.cpp}::bus_volume = { 1.0F, 1.0F, 1.0F, 1.0F, 1.0F }

Definition at line 76 of file sound.cpp.

◆ doppler_factor

float anonymous_namespace{sound.cpp}::doppler_factor = 1.0F

Definition at line 91 of file sound.cpp.

◆ ducks

std::array<Duck, NUM_BUSES> anonymous_namespace{sound.cpp}::ducks {}

Definition at line 77 of file sound.cpp.

◆ last_update_ns

uint64_t anonymous_namespace{sound.cpp}::last_update_ns = 0

Definition at line 94 of file sound.cpp.

◆ listener_position

asw::Vec2<float> anonymous_namespace{sound.cpp}::listener_position

Definition at line 88 of file sound.cpp.

◆ listener_velocity

asw::Vec2<float> anonymous_namespace{sound.cpp}::listener_velocity

Definition at line 89 of file sound.cpp.

◆ master_volume

float anonymous_namespace{sound.cpp}::master_volume = 1.0F

Definition at line 75 of file sound.cpp.

◆ MAX_DOPPLER

float anonymous_namespace{sound.cpp}::MAX_DOPPLER = 2.0F
constexpr

Definition at line 25 of file sound.cpp.

◆ MAX_FILTER_CHANNELS

int anonymous_namespace{sound.cpp}::MAX_FILTER_CHANNELS = 8
constexpr

Definition at line 16 of file sound.cpp.

◆ MIN_DOPPLER

float anonymous_namespace{sound.cpp}::MIN_DOPPLER = 0.5F
constexpr

Definition at line 24 of file sound.cpp.

◆ mixer

MIX_Mixer* anonymous_namespace{sound.cpp}::mixer = nullptr

Definition at line 83 of file sound.cpp.

◆ music_base_volume

float anonymous_namespace{sound.cpp}::music_base_volume = 1.0F

Definition at line 81 of file sound.cpp.

◆ music_sent_gain

float anonymous_namespace{sound.cpp}::music_sent_gain = -1.0F

Definition at line 82 of file sound.cpp.

◆ music_track

MIX_Track* anonymous_namespace{sound.cpp}::music_track = nullptr

Definition at line 80 of file sound.cpp.

◆ NUM_BUSES

size_t anonymous_namespace{sound.cpp}::NUM_BUSES = static_cast<size_t>(asw::sound::Bus::Count)
constexpr

Definition at line 15 of file sound.cpp.

◆ NUM_VOICES

size_t anonymous_namespace{sound.cpp}::NUM_VOICES = 32
constexpr

Definition at line 14 of file sound.cpp.

◆ OCCLUDED_CUTOFF_HZ

float anonymous_namespace{sound.cpp}::OCCLUDED_CUTOFF_HZ = 500.0F
constexpr

Definition at line 19 of file sound.cpp.

◆ OCCLUDED_GAIN

float anonymous_namespace{sound.cpp}::OCCLUDED_GAIN = 0.5F
constexpr

Definition at line 21 of file sound.cpp.

◆ OPEN_CUTOFF_HZ

float anonymous_namespace{sound.cpp}::OPEN_CUTOFF_HZ = 20000.0F
constexpr

Definition at line 20 of file sound.cpp.

◆ session

uint32_t anonymous_namespace{sound.cpp}::session = 0

Definition at line 86 of file sound.cpp.

◆ spatial_mode

asw::sound::SpatialMode anonymous_namespace{sound.cpp}::spatial_mode = asw::sound::SpatialMode::Stereo

Definition at line 90 of file sound.cpp.

◆ speed_of_sound

float anonymous_namespace{sound.cpp}::speed_of_sound = 3000.0F

Definition at line 92 of file sound.cpp.

◆ voices

std::array<Voice, NUM_VOICES> anonymous_namespace{sound.cpp}::voices

Definition at line 79 of file sound.cpp.