OpenTTD Source 20241224-master-gf74b0cf984
sound_type.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 SOUND_TYPE_H
11#define SOUND_TYPE_H
12
13enum class SoundSource : uint8_t {
14 BasesetOldFormat,
15 BasesetNewFormat,
16 NewGRF,
17};
18
19struct SoundEntry {
20 std::shared_ptr<std::vector<uint8_t>> data;
21 class RandomAccessFile *file;
22 size_t file_offset;
23 size_t file_size;
24 uint16_t rate;
25 uint8_t bits_per_sample;
26 uint8_t channels;
27 uint8_t volume;
28 uint8_t priority;
29 SoundSource source;
31};
32
45enum SoundFx {
46 SND_BEGIN = 0,
120 SND_END
121};
122
124static const uint ORIGINAL_SAMPLE_COUNT = 73;
125
126typedef uint16_t SoundID;
127
128static const SoundID INVALID_SOUND = 0xFFFF;
129
130static const uint8_t SOUND_EFFECT_MAX_VOLUME = 128;
131
132#endif /* SOUND_TYPE_H */
A file from which bytes, words and double words are read in (potentially) a random order.
static const uint ORIGINAL_SAMPLE_COUNT
The number of sounds in the original sample.cat.
Definition sound_type.h:124
SoundFx
Sound effects from baseset.
Definition sound_type.h:45
@ SND_1B_DEPARTURE_MODERN_BUS
25 == 0x19 Station departure: modern bus (non-toyland)
Definition sound_type.h:72
@ SND_26_FARM_3
36 == 0x24 Industry producing: farm (3): horse
Definition sound_type.h:83
@ SND_22_UNUSED
32 == 0x20 unused (3)
Definition sound_type.h:79
@ SND_3A_BREAKDOWN_TRAIN_SHIP_TOYLAND
58 == 0x3A Breakdown: train or ship (toyland)
Definition sound_type.h:105
@ SND_08_TAKEOFF_PROPELLER
6 == 0x06 Takeoff: propeller plane (non-toyland)
Definition sound_type.h:53
@ SND_27_CONSTRUCTION_BRIDGE
37 == 0x25 Construction: bridge
Definition sound_type.h:84
@ SND_19_DEPARTURE_OLD_RV_1
23 == 0x17 Station departure: truck and old bus (1) (non-toyland)
Definition sound_type.h:70
@ SND_30_TOFFEE_QUARRY
48 == 0x30 Industry animation: toffee quarry: drill
Definition sound_type.h:95
@ SND_23_UNUSED
33 == 0x21 unused (4)
Definition sound_type.h:80
@ SND_03_FACTORY
1 == 0x01 Industry producing: factory: whistle
Definition sound_type.h:48
@ SND_2E_BUBBLE_GENERATOR
46 == 0x2E Industry animation: bubble generator (1): generate bubble
Definition sound_type.h:93
@ SND_05_TRAIN_THROUGH_TUNNEL
3 == 0x03 Train enters tunnel: steam engine
Definition sound_type.h:50
@ SND_3F_DEPARTURE_TRUCK_TOYLAND_1
63 == 0x3F Station departure: truck (1) (toyland)
Definition sound_type.h:110
@ SND_02_CONSTRUCTION_WATER
0 == 0x00 Construction: water infrastructure
Definition sound_type.h:47
@ SND_2D_SUGAR_MINE_1
45 == 0x2D Industry animation: sugar mine (1): shaking sieve
Definition sound_type.h:92
@ SND_40_DEPARTURE_TRUCK_TOYLAND_2
64 == 0x40 Station departure: truck (2) (toyland)
Definition sound_type.h:111
@ SND_18_TAKEOFF_HELICOPTER
22 == 0x16 Takeoff: helicopter
Definition sound_type.h:69
@ SND_2B_TOY_FACTORY_2
43 == 0x2B Industry animation: toy factory (2): stamp product
Definition sound_type.h:90
@ SND_04_DEPARTURE_STEAM
2 == 0x02 Station departure: steam engine
Definition sound_type.h:49
@ SND_39_ARCTIC_SNOW_2
57 == 0x39 Tree ambient: arctic snow (2): heavy wind
Definition sound_type.h:104
@ SND_44_RAINFOREST_3
68 == 0x44 Tree ambient: rainforest ambient (3): monkeys
Definition sound_type.h:115
@ SND_41_DEPARTURE_MAGLEV
65 == 0x41 Station departure: maglev engine
Definition sound_type.h:112
@ SND_1D_APPLAUSE
27 == 0x1B News: first vehicle at station
Definition sound_type.h:74
@ SND_1C_DEPARTURE_OLD_BUS
26 == 0x1A Station departure: old bus (non-toyland)
Definition sound_type.h:73
@ SND_01_BAD_YEAR
40 == 0x28 New year: performance declined
Definition sound_type.h:87
@ SND_34_ARCTIC_SNOW_1
52 == 0x34 Tree ambient: arctic snow (1): wind
Definition sound_type.h:99
@ SND_15_BEEP
19 == 0x13 GUI button click
Definition sound_type.h:66
@ SND_10_BREAKDOWN_TRAIN_SHIP
14 == 0x0E Breakdown: train or ship (non-toyland)
Definition sound_type.h:61
@ SND_24_FARM_1
34 == 0x22 Industry producing: farm (1): sheep
Definition sound_type.h:81
@ SND_16_NEWS_TICKER
20 == 0x14 News ticker
Definition sound_type.h:67
@ SND_17_SKID_PLANE
21 == 0x15 Plane landing / touching ground
Definition sound_type.h:68
@ SND_38_LUMBER_MILL_1
56 == 0x38 Industry animation: lumber mill (1): chainsaw
Definition sound_type.h:103
@ SND_14_CASHTILL
18 == 0x12 Income from cargo delivery
Definition sound_type.h:65
@ SND_3E_DEPARTURE_BUS_TOYLAND_2
62 == 0x3E Station departure: bus (2) (toyland)
Definition sound_type.h:109
@ SND_07_DEPARTURE_FERRY
5 == 0x05 Station departure: passenger ships
Definition sound_type.h:52
@ SND_31_BUBBLE_GENERATOR_SUCCESS
49 == 0x31 Industry animation: bubble generator (2b): bubble slurped
Definition sound_type.h:96
@ SND_29_SUGAR_MINE_2
41 == 0x29 Industry animation: sugar mine (2): shaking sieve
Definition sound_type.h:88
@ SND_45_TAKEOFF_PROPELLER_TOYLAND_1
69 == 0x45 Takeoff: propeller plane (1) (toyland)
Definition sound_type.h:116
@ SND_1E_NEW_ENGINE
28 == 0x1C News: new engine available
Definition sound_type.h:75
@ SND_21_ROAD_WORKS
31 == 0x1F Road reconstruction animation
Definition sound_type.h:78
@ SND_2C_TOY_FACTORY_1
44 == 0x2C Industry animation: toy factory (1): conveyor belt
Definition sound_type.h:91
@ SND_3B_TAKEOFF_JET_FAST
59 == 0x3B Takeoff: supersonic plane (fast)
Definition sound_type.h:106
@ SND_37_LUMBER_MILL_2
55 == 0x37 Industry animation: lumber mill (2): falling tree
Definition sound_type.h:102
@ SND_28_SAWMILL
38 == 0x26 Industry producing: sawmill
Definition sound_type.h:85
@ SND_43_RAINFOREST_2
67 == 0x43 Tree ambient: rainforest ambient (2): lion
Definition sound_type.h:114
@ SND_25_FARM_2
35 == 0x23 Industry producing: farm (2): cow
Definition sound_type.h:82
@ SND_2F_BUBBLE_GENERATOR_FAIL
47 == 0x2F Industry animation: bubble generator (2a): bubble pop
Definition sound_type.h:94
@ SND_13_TRAIN_COLLISION
15 == 0x11 Train+train crash
Definition sound_type.h:64
@ SND_0E_LEVEL_CROSSING
12 == 0x0C Train passes through level crossing
Definition sound_type.h:59
@ SND_11_UNUSED
15 == 0x0F unused (2)
Definition sound_type.h:62
@ SND_06_DEPARTURE_CARGO_SHIP
4 == 0x04 Station departure: cargo ships
Definition sound_type.h:51
@ SND_42_RAINFOREST_1
66 == 0x42 Tree ambient: rainforest ambient (1): bird (1)
Definition sound_type.h:113
@ SND_1F_CONSTRUCTION_OTHER
29 == 0x1D Construction: other (non-water, non-rail, non-bridge)
Definition sound_type.h:76
@ SND_0C_POWER_STATION
10 == 0x0A Industry animation: power station: spark
Definition sound_type.h:57
@ SND_3C_DEPARTURE_BUS_TOYLAND_1
60 == 0x3C Station departure: bus (1) (toyland)
Definition sound_type.h:107
@ SND_12_EXPLOSION
16 == 0x10 Destruction, crashes, disasters, ...
Definition sound_type.h:63
@ SND_33_PLASTIC_MINE
51 == 0x33 Industry producing: plastic fountain
Definition sound_type.h:98
@ SND_32_UNUSED
50 == 0x32 unused (5)
Definition sound_type.h:97
@ SND_0B_MINE
9 == 0x09 Industry animation: coal/copper/gold mine: headgear
Definition sound_type.h:56
@ SND_48_RAINFOREST_4
72 == 0x48 Tree ambient: rainforest ambient (4): bird (2)
Definition sound_type.h:119
@ SND_36_LUMBER_MILL_3
54 == 0x36 Industry animation: lumber mill (3): crashing tree
Definition sound_type.h:101
@ SND_20_CONSTRUCTION_RAIL
30 == 0x1E Construction: rail infrastructure
Definition sound_type.h:77
@ SND_2A_TOY_FACTORY_3
42 == 0x2A Industry animation: toy factory (3): eject product
Definition sound_type.h:89
@ SND_00_GOOD_YEAR
39 == 0x27 New year: performance improved
Definition sound_type.h:86
@ SND_0F_BREAKDOWN_ROADVEHICLE
13 == 0x0D Breakdown: road vehicle (non-toyland)
Definition sound_type.h:60
@ SND_1A_DEPARTURE_OLD_RV_2
24 == 0x18 Station departure: truck and old bus (2) (random variation of SND_19_DEPARTURE_OLD_RV_1) (...
Definition sound_type.h:71
@ SND_0D_UNUSED
11 == 0x0B unused (1)
Definition sound_type.h:58
@ SND_46_TAKEOFF_PROPELLER_TOYLAND_2
70 == 0x46 Takeoff: propeller plane (2) (toyland)
Definition sound_type.h:117
@ SND_09_TAKEOFF_JET
7 == 0x07 Takeoff: regular jet plane
Definition sound_type.h:54
@ SND_35_BREAKDOWN_ROADVEHICLE_TOYLAND
53 == 0x35 Breakdown: road vehicle (toyland)
Definition sound_type.h:100
@ SND_0A_DEPARTURE_TRAIN
8 == 0x08 Station departure: diesel and electric engine
Definition sound_type.h:55
@ SND_47_DEPARTURE_MONORAIL
71 == 0x47 Station departure: monorail engine
Definition sound_type.h:118
@ SND_3D_TAKEOFF_JET_BIG
61 == 0x3D Takeoff: huge jet plane (high capacity)
Definition sound_type.h:108
uint8_t grf_container_ver
NewGRF container version if the sound is from a NewGRF.
Definition sound_type.h:30