OpenTTD Source: src/newgrf_sound.h Source File

OpenTTD Source 15.3

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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
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
18 enum VehicleSoundEvent : uint8_t {
19 VSE_START = 1,
20 VSE_TUNNEL = 2,
21 VSE_BREAKDOWN = 3,
22 VSE_RUNNING = 4,
23 VSE_TOUCHDOWN = 5,
24 VSE_VISUAL_EFFECT = 6,
25 VSE_RUNNING_16 = 7,
26 VSE_STOPPED_16 = 8,
27 VSE_LOAD_UNLOAD = 9,
28};
29
30
31 SoundEntry *AllocateSound(uint num);
32void InitializeSoundPool();
33bool LoadNewGRFSound(SoundEntry &sound, SoundID sound_id);
34SoundID GetNewGRFSoundID(const struct GRFFile *file, SoundID sound_id);
35 SoundEntry *GetSound(SoundID sound_id);
36uint GetNumSounds();
37size_t GetSoundPoolAllocatedMemory();
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 */
PlayTileSound
void PlayTileSound(const GRFFile *file, SoundID sound_id, TileIndex tile)
Play a NewGRF sound effect at the location of a specific tile.
Definition newgrf_sound.cpp:176
GetNewGRFSoundID
SoundID GetNewGRFSoundID(const GRFFile *file, SoundID sound_id)
Resolve NewGRF sound ID.
Definition newgrf_sound.cpp:125
AllocateSound
SoundEntry * AllocateSound(uint num)
Allocate sound slots.
Definition newgrf_sound.cpp:33
LoadNewGRFSound
bool LoadNewGRFSound(SoundEntry &sound, SoundID sound_id)
Extract meta data from a NewGRF sound.
Definition newgrf_sound.cpp:83
GetSoundPoolAllocatedMemory
size_t GetSoundPoolAllocatedMemory()
Get size of memory allocated to sound effects.
Definition newgrf_sound.cpp:66
VehicleSoundEvent
VehicleSoundEvent
Events at which a sound might be played.
Definition newgrf_sound.h:18
VSE_VISUAL_EFFECT
@ VSE_VISUAL_EFFECT
Vehicle visual effect (steam, diesel smoke or electric spark) is shown.
Definition newgrf_sound.h:24
VSE_TOUCHDOWN
@ VSE_TOUCHDOWN
Whenever a plane touches down.
Definition newgrf_sound.h:23
VSE_RUNNING
@ VSE_RUNNING
Vehicle running normally.
Definition newgrf_sound.h:22
VSE_START
@ VSE_START
Vehicle starting, i.e. leaving, the station.
Definition newgrf_sound.h:19
VSE_STOPPED_16
@ VSE_STOPPED_16
Every 16 ticks while the vehicle is stopped (speed == 0).
Definition newgrf_sound.h:26
VSE_LOAD_UNLOAD
@ VSE_LOAD_UNLOAD
Whenever cargo payment is made for a vehicle.
Definition newgrf_sound.h:27
VSE_TUNNEL
@ VSE_TUNNEL
Train entering a tunnel.
Definition newgrf_sound.h:20
VSE_RUNNING_16
@ VSE_RUNNING_16
Every 16 ticks while the vehicle is running (speed > 0).
Definition newgrf_sound.h:25
VSE_BREAKDOWN
@ VSE_BREAKDOWN
Vehicle breaking down.
Definition newgrf_sound.h:21
PlayVehicleSound
bool PlayVehicleSound(const Vehicle *v, VehicleSoundEvent event, bool force=false)
Checks whether a NewGRF wants to play a different vehicle sound effect.
Definition newgrf_sound.cpp:143
sound_type.h
Types related to sounds.
GRFFile
Dynamic data of a loaded NewGRF.
Definition newgrf.h:114
SoundEntry
Definition sound_type.h:19
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
Vehicle
Vehicle data structure.
Definition vehicle_base.h:205
tile_type.h
Types related to tiles.
vehicle_type.h
Types related to vehicles.