OpenTTD Source 20260206-master-g4d4e37dbf1
soundloader_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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
9
10#ifndef SOUNDLOADER_TYPE_H
11#define SOUNDLOADER_TYPE_H
12
13#include "provider_manager.h"
14#include "sound_type.h"
15
17class SoundLoader : public PriorityBaseProvider<SoundLoader> {
18public:
19 SoundLoader(std::string_view name, std::string_view description, int priority) : PriorityBaseProvider<SoundLoader>(name, description, priority)
20 {
21 ProviderManager<SoundLoader>::Register(*this);
22 }
23
24 ~SoundLoader() override
25 {
26 ProviderManager<SoundLoader>::Unregister(*this);
27 }
28
37 virtual bool Load(SoundEntry &sound, bool new_format, std::vector<std::byte> &data) const = 0;
38};
39
40#endif /* SOUNDLOADER_TYPE_H */
virtual bool Load(SoundEntry &sound, bool new_format, std::vector< std::byte > &data) const =0
Load a sound from the file and offset in the given sound entry.
Definition of the ProviderManager.
Types related to sounds.