1 |
schoenebeck |
411 |
/*************************************************************************** |
2 |
|
|
* * |
3 |
|
|
* Copyright (C) 2005 Christian Schoenebeck * |
4 |
|
|
* * |
5 |
|
|
* This program is free software; you can redistribute it and/or modify * |
6 |
|
|
* it under the terms of the GNU General Public License as published by * |
7 |
|
|
* the Free Software Foundation; either version 2 of the License, or * |
8 |
|
|
* (at your option) any later version. * |
9 |
|
|
* * |
10 |
|
|
* This program is distributed in the hope that it will be useful, * |
11 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
12 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
13 |
|
|
* GNU General Public License for more details. * |
14 |
|
|
* * |
15 |
|
|
* You should have received a copy of the GNU General Public License * |
16 |
|
|
* along with this program; if not, write to the Free Software * |
17 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * |
18 |
|
|
* MA 02111-1307 USA * |
19 |
|
|
***************************************************************************/ |
20 |
|
|
|
21 |
|
|
#ifndef __LS_ENGINECHANNEL_H__ |
22 |
|
|
#define __LS_ENGINECHANNEL_H__ |
23 |
|
|
|
24 |
|
|
#include "../../drivers/audio/AudioOutputDevice.h" |
25 |
|
|
#include "Engine.h" |
26 |
|
|
|
27 |
|
|
namespace LinuxSampler { |
28 |
|
|
|
29 |
|
|
// just symbol prototyping |
30 |
|
|
class AudioOutputDevice; |
31 |
|
|
|
32 |
|
|
/** @brief Channel Interface for LinuxSampler Sampler Engines |
33 |
|
|
* |
34 |
|
|
* Every sampler engine can be used on several sampler channels and |
35 |
|
|
* usually the same Engine instance is used on multiple sampler |
36 |
|
|
* channels. For this every sampler engine must also implement a class |
37 |
|
|
* which handles all channel dependant parameters and channel |
38 |
|
|
* dependant execution code. |
39 |
|
|
* |
40 |
|
|
* This abstract base interface class defines all mandatory methods |
41 |
|
|
* which have to be implemented by all engine channel implementations. |
42 |
|
|
*/ |
43 |
|
|
class EngineChannel { |
44 |
|
|
public: |
45 |
schoenebeck |
660 |
|
46 |
schoenebeck |
411 |
///////////////////////////////////////////////////////////////// |
47 |
|
|
// abstract methods |
48 |
|
|
// (these have to be implemented by the descendant) |
49 |
schoenebeck |
660 |
|
50 |
schoenebeck |
411 |
virtual void PrepareLoadInstrument(const char* FileName, uint Instrument) = 0; |
51 |
|
|
virtual void LoadInstrument() = 0; |
52 |
|
|
virtual void SendNoteOn(uint8_t Key, uint8_t Velocity) = 0; |
53 |
|
|
virtual void SendNoteOff(uint8_t Key, uint8_t Velocity) = 0; |
54 |
|
|
virtual void SendPitchbend(int Pitch) = 0; |
55 |
schoenebeck |
660 |
virtual void SendControlChange(uint8_t Controller, uint8_t Value) = 0; |
56 |
|
|
virtual bool StatusChanged() = 0; |
57 |
schoenebeck |
411 |
virtual float Volume() = 0; |
58 |
|
|
virtual void Volume(float f) = 0; |
59 |
schoenebeck |
660 |
virtual uint Channels() = 0; |
60 |
schoenebeck |
411 |
virtual void Connect(AudioOutputDevice* pAudioOut) = 0; |
61 |
|
|
virtual void DisconnectAudioOutputDevice() = 0; |
62 |
|
|
virtual void SetOutputChannel(uint EngineAudioChannel, uint AudioDeviceChannel) = 0; |
63 |
schoenebeck |
660 |
virtual int OutputChannel(uint EngineAudioChannel) = 0; |
64 |
schoenebeck |
411 |
virtual String InstrumentFileName() = 0; |
65 |
|
|
virtual String InstrumentName() = 0; |
66 |
|
|
virtual int InstrumentIndex() = 0; |
67 |
|
|
virtual int InstrumentStatus() = 0; |
68 |
|
|
virtual Engine* GetEngine() = 0; |
69 |
schoenebeck |
475 |
virtual String EngineName() = 0; |
70 |
schoenebeck |
411 |
|
71 |
schoenebeck |
660 |
int iSamplerChannelIndex; ///< FIXME: nasty hack, might be removed (should be 'virtual EngineChannel* EngineChannel() = 0;', but due to cyclic dependencies only a void* solution would be possible ATM) |
72 |
|
|
|
73 |
|
|
protected: |
74 |
|
|
virtual ~EngineChannel() {}; // MUST only be destroyed by EngineChannelFactory |
75 |
|
|
friend class EngineChannelFactory; |
76 |
schoenebeck |
411 |
}; |
77 |
schoenebeck |
660 |
|
78 |
schoenebeck |
411 |
} // namespace LinuxSampler |
79 |
schoenebeck |
660 |
|
80 |
schoenebeck |
411 |
#endif // __LS_ENGINECHANNEL_H__ |