Update: Translations from eints
[openttd-github.git] / src / music / extmidi.h
blobf08c5130088ecae7afa8a8f94fca45601fb00ca2
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 */
8 /** @file extmidi.h Base support for playing music via an external application. */
10 #ifndef MUSIC_EXTERNAL_H
11 #define MUSIC_EXTERNAL_H
13 #include "music_driver.hpp"
15 class MusicDriver_ExtMidi : public MusicDriver {
16 private:
17 std::vector<std::string> command_tokens;
18 std::string song;
19 pid_t pid;
21 void DoPlay();
22 void DoStop();
24 public:
25 std::optional<std::string_view> Start(const StringList &param) override;
27 void Stop() override;
29 void PlaySong(const MusicSongInfo &song) override;
31 void StopSong() override;
33 bool IsSongPlaying() override;
35 void SetVolume(uint8_t vol) override;
36 std::string_view GetName() const override { return "extmidi"; }
39 class FMusicDriver_ExtMidi : public DriverFactoryBase {
40 public:
41 FMusicDriver_ExtMidi() : DriverFactoryBase(Driver::DT_MUSIC, 3, "extmidi", "External MIDI Driver") {}
42 Driver *CreateInstance() const override { return new MusicDriver_ExtMidi(); }
45 #endif /* MUSIC_EXTERNAL_H */