ScummVM API documentation
musicplugin.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef AUDIO_MUSICPLUGIN_H
23 #define AUDIO_MUSICPLUGIN_H
24 
25 #include "base/plugins.h"
26 #include "audio/mididrv.h"
27 #include "common/list.h"
28 
29 namespace Common {
30 class Error;
31 }
32 
33 class MusicPluginObject;
34 
48 class MusicDevice {
49 public:
50  MusicDevice(MusicPluginObject const *musicPlugin, Common::String name, MusicType mt);
51 
52  const Common::String &getName() const { return _name; }
53  const Common::String &getMusicDriverName() const { return _musicDriverName; }
54  const Common::String &getMusicDriverId() const { return _musicDriverId; }
55  MusicType getMusicType() const { return _type; }
56 
61  Common::String getCompleteName();
62 
67  Common::String getCompleteId();
68 
69  MidiDriver::DeviceHandle getHandle();
70 
71 private:
72  Common::String _name;
73  Common::String _musicDriverName;
74  Common::String _musicDriverId;
75  MusicType _type;
76 };
77 
80 
86 public:
87  virtual ~MusicPluginObject() {}
88 
93  virtual const char *getId() const = 0;
94 
98  virtual MusicDevices getDevices() const = 0;
99 
111  virtual bool checkDevice(MidiDriver::DeviceHandle hdl, int checkFlags, bool quiet) const { return (checkFlags & MDCK_AUTO) == 0; }
112 
125  virtual Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const = 0;
126 };
127 
131 class MusicManager : public Common::Singleton<MusicManager> {
132 private:
133  friend class Common::Singleton<SingletonBaseType>;
134 
135 public:
136  const PluginList &getPlugins() const;
137 };
138 
140 #define MusicMan MusicManager::instance()
141 
142 #endif
Definition: str.h:59
Definition: error.h:84
uint32 DeviceHandle
Definition: mididrv.h:318
Definition: array.h:52
Common::List< MusicDevice > MusicDevices
Definition: musicplugin.h:79
MusicType
Definition: mididrv.h:44
Definition: list.h:44
Definition: mididrv.h:309
Definition: musicplugin.h:85
Definition: musicplugin.h:48
Definition: algorithm.h:29
Definition: plugins.h:131
Definition: musicplugin.h:131
virtual bool checkDevice(MidiDriver::DeviceHandle hdl, int checkFlags, bool quiet) const
Definition: musicplugin.h:111
Definition: singleton.h:42