3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005, 2006 Christian Schoenebeck * |
* Copyright (C) 2005 - 2009 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
26 |
|
|
27 |
namespace LinuxSampler { |
namespace LinuxSampler { |
28 |
|
|
29 |
|
class AudioOutputDeviceFactory; |
30 |
|
class MidiInputDeviceFactory; |
31 |
|
|
32 |
/** |
/** |
33 |
* Abstract base class for all kind of drivers in LinuxSampler. |
* Abstract base class for all kind of drivers in LinuxSampler. |
34 |
*/ |
*/ |
35 |
class Device { |
class Device { |
36 |
public: |
public: |
37 |
|
/** |
38 |
|
* Determines whether the device is an autonomous instance of some |
39 |
|
* driver or not autonomous (that is bound to some other entity). |
40 |
|
* An autonomous device can be created and deleted separately. |
41 |
|
* A non autonomous device only exists in the context of some |
42 |
|
* entity, e.g. in the context of a host plugin |
43 |
|
* (VST, AU, LV2, DSSI, ...) instance, and thus such a device |
44 |
|
* cannot be created or deleted on its own. |
45 |
|
* |
46 |
|
* By default, this method returns @c true unless overridden by the |
47 |
|
* descendent. |
48 |
|
*/ |
49 |
|
virtual bool isAutonomousDevice(); |
50 |
|
|
51 |
|
/** |
52 |
|
* Returns the numerical ID of this device instance. Every device |
53 |
|
* instance has a unique ID among all devices of its category, that |
54 |
|
* is e.g. every MIDI input device has a unique ID among all MIDI |
55 |
|
* input devices and every audio output device has a unique ID |
56 |
|
* among all audio output devices. The IDs are usually generated by |
57 |
|
* the respective factory class. |
58 |
|
*/ |
59 |
|
int deviceId() const; |
60 |
|
|
61 |
|
/** |
62 |
|
* Whether this is an autonomous device driver. |
63 |
|
* |
64 |
|
* @see isAutonomousDevice() |
65 |
|
*/ |
66 |
|
static bool isAutonomousDriver(); |
67 |
|
|
68 |
|
protected: |
69 |
|
void setDeviceId(int id); |
70 |
|
|
71 |
|
//TODO: maybe it would be cleaner to pass the device id through the drivers' constructors instead of having a setDeviceId() method being available only for the factory classes |
72 |
|
friend class AudioOutputDeviceFactory; |
73 |
|
friend class MidiInputDeviceFactory; |
74 |
|
private: |
75 |
|
int iDeviceId; //TODO: there is not default initialization (e.g. with -1) yet, since there is no constructor yet, it would require all driver implementations to be updated with a constructor call |
76 |
}; |
}; |
77 |
|
|
78 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |