OpenTTD Source 20241224-master-gf74b0cf984
newgrf_sound.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10#ifndef NEWGRF_SOUND_H
11#define NEWGRF_SOUND_H
12
13#include "sound_type.h"
14#include "tile_type.h"
15#include "vehicle_type.h"
16
29
30
31SoundEntry *AllocateSound(uint num);
32void InitializeSoundPool();
33bool LoadNewGRFSound(SoundEntry &sound, SoundID sound_id);
34SoundID GetNewGRFSoundID(const struct GRFFile *file, SoundID sound_id);
35SoundEntry *GetSound(SoundID sound_id);
36uint GetNumSounds();
38bool PlayVehicleSound(const Vehicle *v, VehicleSoundEvent event, bool force = false);
39void PlayTileSound(const struct GRFFile *file, SoundID sound_id, TileIndex tile);
40
41#endif /* NEWGRF_SOUND_H */
void PlayTileSound(const GRFFile *file, SoundID sound_id, TileIndex tile)
Play a NewGRF sound effect at the location of a specific tile.
SoundID GetNewGRFSoundID(const GRFFile *file, SoundID sound_id)
Resolve NewGRF sound ID.
SoundEntry * AllocateSound(uint num)
Allocate sound slots.
bool LoadNewGRFSound(SoundEntry &sound, SoundID sound_id)
Extract meta data from a NewGRF sound.
size_t GetSoundPoolAllocatedMemory()
Get size of memory allocated to sound effects.
VehicleSoundEvent
Events at which a sound might be played.
@ VSE_VISUAL_EFFECT
Vehicle visual effect (steam, diesel smoke or electric spark) is shown.
@ VSE_TOUCHDOWN
Whenever a plane touches down.
@ VSE_RUNNING
Vehicle running normally.
@ VSE_START
Vehicle starting, i.e. leaving, the station.
@ VSE_STOPPED_16
Every 16 ticks while the vehicle is stopped (speed == 0).
@ VSE_LOAD_UNLOAD
Whenever cargo payment is made for a vehicle.
@ VSE_TUNNEL
Train entering a tunnel.
@ VSE_RUNNING_16
Every 16 ticks while the vehicle is running (speed > 0).
@ VSE_BREAKDOWN
Vehicle breaking down.
bool PlayVehicleSound(const Vehicle *v, VehicleSoundEvent event, bool force=false)
Checks whether a NewGRF wants to play a different vehicle sound effect.
Types related to sounds.
Dynamic data of a loaded NewGRF.
Definition newgrf.h:108
Vehicle data structure.
Types related to tiles.
Types related to vehicles.