|
OpenTTD Source 15.0-beta1
|
Handling of playing sounds. More...
#include "stdafx.h"#include "landscape.h"#include "sound_type.h"#include "soundloader_func.h"#include "mixer.h"#include "newgrf_sound.h"#include "random_access_file_type.h"#include "window_func.h"#include "window_gui.h"#include "vehicle_base.h"#include "base_media_func.h"#include "safeguards.h"Go to the source code of this file.
Macros | |
| #define | SET_TYPE "sounds" |
Functions | |
| static void | OpenBankFile (const std::string &filename) |
| static bool | SetBankSource (MixerChannel *mc, SoundEntry *sound, SoundID sound_id) |
| void | InitializeSound () |
| static void | StartSound (SoundID sound_id, float pan, uint volume) |
| void | SndCopyToPool () |
| void | ChangeSoundSet (int index) |
| Change the configured sound set and reset sounds. | |
| static void | SndPlayScreenCoordFx (SoundID sound, int left, int right, int top, int bottom) |
| Decide 'where' (between left and right speaker) to play the sound effect. | |
| void | SndPlayTileFx (SoundID sound, TileIndex tile) |
| void | SndPlayVehicleFx (SoundID sound, const Vehicle *v) |
| void | SndPlayFx (SoundID sound) |
Variables | |
| static std::array< SoundEntry, ORIGINAL_SAMPLE_COUNT > | _original_sounds |
| static const uint8_t | _vol_factor_by_zoom [] = {255, 255, 255, 190, 134, 87} |
| static const uint8_t | _sound_base_vol [] |
| static const uint8_t | _sound_idx [] |
| static const char *const | _sound_file_names [] = { "samples" } |
| Names corresponding to the sound set's files. | |
Handling of playing sounds.
Definition in file sound.cpp.
| void ChangeSoundSet | ( | int | index | ) |
Change the configured sound set and reset sounds.
| index | Index of sound set to switch to. |
Definition at line 169 of file sound.cpp.
References BaseMedia< SoundsSet >::GetIndexOfUsedSet(), BaseMedia< SoundsSet >::GetSet(), SoundEntry::grf_container_ver, BaseSounds::ini_set, InvalidateWindowData(), MxCloseAllChannels(), ORIGINAL_SAMPLE_COUNT, BaseMedia< SoundsSet >::SetSet(), WC_GAME_OPTIONS, and WN_GAME_OPTIONS_GAME_OPTIONS.
Referenced by GameOptionsWindow::OnDropdownSelect().
|
static |
The sound file for the original sounds, i.e. those not defined/overridden by a NewGRF. Needs to be kept alive during the game as _original_sounds[n].file refers to this.
Definition at line 29 of file sound.cpp.
References BASESET_DIR, ClrBit(), Debug, GB(), HasBit(), and ORIGINAL_SAMPLE_COUNT.
|
static |
|
static |
Decide 'where' (between left and right speaker) to play the sound effect.
Note: Callers must determine if sound effects are enabled. This plays a sound regardless of the setting.
| sound | Sound effect to play |
| left | Left edge of virtual coordinates where the sound is produced |
| right | Right edge of virtual coordinates where the sound is produced |
| top | Top edge of virtual coordinates where the sound is produced |
| bottom | Bottom edge of virtual coordinates where the sound is produced |
Definition at line 204 of file sound.cpp.
References Viewport::virtual_height, Viewport::virtual_left, Viewport::virtual_top, Viewport::virtual_width, and Viewport::zoom.
| void SndPlayVehicleFx | ( | SoundID | sound, |
| const Vehicle * | v | ||
| ) |
|
static |
|
static |
|
static |
|
static |
|
static |