OpenTTD Source  20241108-master-g80f628063a
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 
19  VSE_START = 1,
20  VSE_TUNNEL = 2,
28 };
29 
30 
31 SoundEntry *AllocateSound(uint num);
32 void InitializeSoundPool();
33 bool LoadNewGRFSound(SoundEntry *sound);
34 SoundID GetNewGRFSoundID(const struct GRFFile *file, SoundID sound_id);
35 SoundEntry *GetSound(SoundID sound_id);
36 uint GetNumSounds();
37 bool PlayVehicleSound(const Vehicle *v, VehicleSoundEvent event, bool force = false);
38 void PlayTileSound(const struct GRFFile *file, SoundID sound_id, TileIndex tile);
39 
40 #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.
bool LoadNewGRFSound(SoundEntry *sound)
Extract meta data from a NewGRF sound.
VehicleSoundEvent
Events at which a sound might be played.
Definition: newgrf_sound.h:18
@ VSE_VISUAL_EFFECT
Vehicle visual effect (steam, diesel smoke or electric spark) is shown.
Definition: newgrf_sound.h:24
@ VSE_TOUCHDOWN
Whenever a plane touches down.
Definition: newgrf_sound.h:23
@ VSE_RUNNING
Vehicle running normally.
Definition: newgrf_sound.h:22
@ VSE_START
Vehicle starting, i.e. leaving, the station.
Definition: newgrf_sound.h:19
@ VSE_STOPPED_16
Every 16 ticks while the vehicle is stopped (speed == 0).
Definition: newgrf_sound.h:26
@ VSE_LOAD_UNLOAD
Whenever cargo payment is made for a vehicle.
Definition: newgrf_sound.h:27
@ VSE_TUNNEL
Train entering a tunnel.
Definition: newgrf_sound.h:20
@ VSE_RUNNING_16
Every 16 ticks while the vehicle is running (speed > 0).
Definition: newgrf_sound.h:25
@ VSE_BREAKDOWN
Vehicle breaking down.
Definition: newgrf_sound.h:21
SoundEntry * AllocateSound(uint num)
Allocate sound slots.
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.
Definition: vehicle_base.h:244
Types related to tiles.
Types related to vehicles.