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-2009 Christian Schoenebeck * |
* Copyright (C) 2005-2008 Christian Schoenebeck * |
7 |
* Copyright (C) 2009 Grigor Iliev * |
* Copyright (C) 2009-2010 Christian Schoenebeck and Grigor Iliev * |
8 |
* * |
* * |
9 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
10 |
* 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 * |
23 |
***************************************************************************/ |
***************************************************************************/ |
24 |
|
|
25 |
#ifndef __LS_ABSTRACTENGINECHANNEL_H__ |
#ifndef __LS_ABSTRACTENGINECHANNEL_H__ |
26 |
#define __LS_ABSTRACTENGINECHANNEL_H__ |
#define __LS_ABSTRACTENGINECHANNEL_H__ |
27 |
|
|
28 |
#include "EngineChannel.h" |
#include "EngineChannel.h" |
29 |
#include "AbstractEngine.h" |
#include "AbstractEngine.h" |
75 |
|
|
76 |
virtual AbstractEngine::Format GetEngineFormat() = 0; |
virtual AbstractEngine::Format GetEngineFormat() = 0; |
77 |
|
|
78 |
|
friend class AbstractVoice; |
79 |
friend class AbstractEngine; |
friend class AbstractEngine; |
80 |
template<class TV, class TRR, class TR, class TD, class TIM, class TI> friend class EngineBase; |
template<class TV, class TRR, class TR, class TD, class TIM, class TI> friend class EngineBase; |
81 |
|
template<class EC, class R, class S, class D> friend class VoiceBase; |
82 |
|
|
83 |
protected: |
protected: |
84 |
AbstractEngineChannel(); |
AbstractEngineChannel(); |
85 |
virtual ~AbstractEngineChannel(); |
virtual ~AbstractEngineChannel(); |
86 |
|
|
87 |
AbstractEngine* pEngine; |
AbstractEngine* pEngine; |
88 |
|
public: // TODO: should be protected |
89 |
AudioChannel* pChannelLeft; ///< encapsulates the audio rendering buffer (left) |
AudioChannel* pChannelLeft; ///< encapsulates the audio rendering buffer (left) |
90 |
AudioChannel* pChannelRight; ///< encapsulates the audio rendering buffer (right) |
AudioChannel* pChannelRight; ///< encapsulates the audio rendering buffer (right) |
91 |
|
protected: |
92 |
int AudioDeviceChannelLeft; ///< audio device channel number to which the left channel is connected to |
int AudioDeviceChannelLeft; ///< audio device channel number to which the left channel is connected to |
93 |
int AudioDeviceChannelRight; ///< audio device channel number to which the right channel is connected to |
int AudioDeviceChannelRight; ///< audio device channel number to which the right channel is connected to |
94 |
MidiInputPort* pMidiInputPort; ///< Points to the connected MIDI input port or NULL if none assigned. |
MidiInputPort* pMidiInputPort; ///< Points to the connected MIDI input port or NULL if none assigned. |
114 |
int iLastPanRequest; ///< just for the return value of Pan(), so we don't have to make an injective function |
int iLastPanRequest; ///< just for the return value of Pan(), so we don't have to make an injective function |
115 |
int iEngineIndexSelf; ///< Reflects the index of this EngineChannel in the Engine's ArrayList. |
int iEngineIndexSelf; ///< Reflects the index of this EngineChannel in the Engine's ArrayList. |
116 |
bool bStatusChanged; ///< true in case an engine parameter has changed (e.g. new instrument, another volumet) |
bool bStatusChanged; ///< true in case an engine parameter has changed (e.g. new instrument, another volumet) |
117 |
|
uint32_t RoundRobinIndex; ///< counter for round robin sample selection, incremented for each note on |
118 |
|
|
119 |
SynchronizedConfig< ArrayList<VirtualMidiDevice*> > virtualMidiDevices; |
SynchronizedConfig< ArrayList<VirtualMidiDevice*> > virtualMidiDevices; |
120 |
SynchronizedConfig< ArrayList<VirtualMidiDevice*> >::Reader virtualMidiDevicesReader_AudioThread; |
SynchronizedConfig< ArrayList<VirtualMidiDevice*> >::Reader virtualMidiDevicesReader_AudioThread; |
121 |
SynchronizedConfig< ArrayList<VirtualMidiDevice*> >::Reader virtualMidiDevicesReader_MidiThread; |
SynchronizedConfig< ArrayList<VirtualMidiDevice*> >::Reader virtualMidiDevicesReader_MidiThread; |
122 |
|
|
123 |
|
// specialization of RTList that doesn't require the pool |
124 |
|
// to be provided at construction time |
125 |
|
template<typename T> |
126 |
|
class LazyList : public RTList<T> { |
127 |
|
public: |
128 |
|
using RTList<T>::allocAppend; |
129 |
|
using RTList<T>::pPool; |
130 |
|
|
131 |
|
LazyList() : RTList<T>(0) { } |
132 |
|
typename RTList<T>::Iterator allocAppend(Pool<T>* pool) { |
133 |
|
pPool = pool; |
134 |
|
return allocAppend(); |
135 |
|
} |
136 |
|
}; |
137 |
|
|
138 |
|
typedef std::map<uint, LazyList<Event>*> ActiveKeyGroupMap; |
139 |
|
ActiveKeyGroupMap ActiveKeyGroups; ///< Contains event queues for key groups, ordered by key group ID. |
140 |
|
|
141 |
virtual void ResetControllers(); |
virtual void ResetControllers(); |
142 |
virtual void ResetInternal(); |
virtual void ResetInternal(); |
143 |
virtual void RemoveAllFxSends(); |
virtual void RemoveAllFxSends(); |
144 |
|
|
145 |
void ImportEvents(uint Samples); |
void ImportEvents(uint Samples); |
146 |
|
|
147 |
|
void AddGroup(uint group); |
148 |
|
void HandleKeyGroupConflicts(uint KeyGroup, Pool<Event>::Iterator& itNoteOnEvent); |
149 |
|
void ClearGroupEventLists(); |
150 |
|
void DeleteGroupEventLists(); |
151 |
}; |
}; |
152 |
|
|
153 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |
154 |
|
|
155 |
#endif /* __LS_ABSTRACTENGINECHANNEL_H__ */ |
#endif /* __LS_ABSTRACTENGINECHANNEL_H__ */ |
156 |
|
|