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 Christian Schoenebeck * |
* Copyright (C) 2005 - 2008 Christian Schoenebeck * |
7 |
|
* Copyright (C) 2009 - 2012 Christian Schoenebeck and Grigor Iliev * |
8 |
|
* Copyright (C) 2012 - 2016 Christian Schoenebeck and Andreas Persson * |
9 |
* * |
* * |
10 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
11 |
* 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 * |
24 |
***************************************************************************/ |
***************************************************************************/ |
25 |
|
|
26 |
#ifndef __LS_GIG_ENGINECHANNEL_H__ |
#ifndef __LS_GIG_ENGINECHANNEL_H__ |
27 |
#define __LS_GIG_ENGINECHANNEL_H__ |
#define __LS_GIG_ENGINECHANNEL_H__ |
28 |
|
|
29 |
#if DEBUG_HEADERS |
#include "../AbstractEngine.h" |
30 |
# warning EngineChannel.h included |
#include "../EngineChannelBase.h" |
31 |
#endif // DEBUG_HEADERS |
#include "../EngineChannelFactory.h" |
|
|
|
|
#include "../common/Event.h" |
|
|
#include "../common/EngineChannel.h" |
|
|
#include "EngineGlobals.h" |
|
|
#include "Engine.h" |
|
32 |
#include "Voice.h" |
#include "Voice.h" |
33 |
#include "InstrumentResourceManager.h" |
#include <gig.h> |
34 |
|
|
35 |
namespace LinuxSampler { namespace gig { |
namespace LinuxSampler { namespace gig { |
|
|
|
|
// just symbol prototyping |
|
|
class midi_key_info_t; |
|
36 |
class Voice; |
class Voice; |
37 |
|
|
38 |
class EngineChannel : public LinuxSampler::EngineChannel, public InstrumentConsumer { |
class EngineChannel: public LinuxSampler::EngineChannelBase<Voice, ::gig::DimensionRegion, ::gig::Instrument> { |
39 |
public: |
public: |
40 |
EngineChannel(); |
virtual void SendProgramChange(uint8_t Program); |
41 |
virtual ~EngineChannel(); |
virtual void LoadInstrument(); |
42 |
|
virtual void ResetInternal(bool bResetEngine) OVERRIDE; |
43 |
// implementation of abstract methods derived from interface class 'LinuxSampler::EngineChannel' |
virtual String InstrumentFileName(); |
44 |
virtual void PrepareLoadInstrument(const char* FileName, uint Instrument); |
virtual String InstrumentFileName(int index); |
45 |
virtual void LoadInstrument(); |
|
46 |
virtual void SendNoteOn(uint8_t Key, uint8_t Velocity); |
virtual AbstractEngine::Format GetEngineFormat(); |
47 |
virtual void SendNoteOff(uint8_t Key, uint8_t Velocity); |
|
48 |
virtual void SendPitchbend(int Pitch); |
void reloadScript(::gig::Script* script); |
|
virtual void SendControlChange(uint8_t Controller, uint8_t Value); |
|
|
virtual float Volume(); |
|
|
virtual void Volume(float f); |
|
|
virtual uint Channels(); |
|
|
virtual void Connect(AudioOutputDevice* pAudioOut); |
|
|
virtual void DisconnectAudioOutputDevice(); |
|
|
virtual void SetOutputChannel(uint EngineAudioChannel, uint AudioDeviceChannel); |
|
|
virtual int OutputChannel(uint EngineAudioChannel); |
|
|
virtual String InstrumentFileName(); |
|
|
virtual String InstrumentName(); |
|
|
virtual int InstrumentIndex(); |
|
|
virtual int InstrumentStatus(); |
|
|
virtual LinuxSampler::Engine* GetEngine(); |
|
|
|
|
|
// implementation of abstract methods derived from interface class 'InstrumentConsumer' |
|
|
virtual void ResourceToBeUpdated(::gig::Instrument* pResource, void*& pUpdateArg); |
|
|
virtual void ResourceUpdated(::gig::Instrument* pOldResource, ::gig::Instrument* pNewResource, void* pUpdateArg); |
|
|
|
|
|
//protected: |
|
|
Engine* pEngine; |
|
|
float* pOutputLeft; ///< Audio output channel buffer (left) |
|
|
float* pOutputRight; ///< Audio output channel buffer (right) |
|
|
int AudioDeviceChannelLeft; ///< audio device channel number to which the left channel is connected to |
|
|
int AudioDeviceChannelRight; ///< audio device channel number to which the right channel is connected to |
|
|
RingBuffer<Event>* pEventQueue; ///< Input event queue. |
|
|
uint8_t ControllerTable[128]; ///< Reflects the current values (0-127) of all MIDI controllers for this engine / sampler channel. |
|
|
midi_key_info_t* pMIDIKeyInfo; ///< Contains all active voices sorted by MIDI key number and other informations to the respective MIDI key |
|
|
Pool<uint>* pActiveKeys; ///< Holds all keys in it's allocation list with active voices. |
|
|
std::map<uint,uint*> ActiveKeyGroups; ///< Contains active keys (in case they belong to a key group) ordered by key group ID. |
|
|
::gig::Instrument* pInstrument; |
|
|
bool SustainPedal; ///< true if sustain pedal is down |
|
|
double GlobalVolume; ///< overall volume (a value < 1.0 means attenuation, a value > 1.0 means amplification) |
|
|
int Pitch; ///< Current (absolute) MIDI pitch value. |
|
|
int CurrentKeyDimension; ///< Current value (0-127) for the keyboard dimension, altered by pressing a keyswitching key. |
|
|
String InstrumentFile; |
|
|
int InstrumentIdx; |
|
|
String InstrumentIdxName; |
|
|
int InstrumentStat; |
|
|
RTList<Voice>::Iterator itLastStolenVoice; ///< Only for voice stealing: points to the last voice which was theft in current audio fragment, NULL otherwise. |
|
|
RTList<uint>::Iterator iuiLastStolenKey; ///< Only for voice stealing: key number of last key on which the last voice was theft in current audio fragment, NULL otherwise. |
|
49 |
|
|
|
friend class Engine; |
|
50 |
friend class Voice; |
friend class Voice; |
51 |
friend class InstrumentResourceManager; |
friend class Engine; |
52 |
|
friend class LinuxSampler::EngineChannelFactory; |
53 |
private: |
|
54 |
void ResetInternal(); |
protected: |
55 |
|
EngineChannel(); |
56 |
|
virtual ~EngineChannel(); |
57 |
|
|
58 |
|
float CurrentKeyDimension; ///< Current value (0-1.0) for the keyboard dimension, altered by pressing a keyswitching key. |
59 |
|
::gig::Script* CurrentGigScript; ///< Only used when a script is updated (i.e. by instrument editor), to check whether this engine channel is actually using that specific script reference. |
60 |
|
|
61 |
|
virtual void ProcessKeySwitchChange(int key); |
62 |
|
|
63 |
}; |
}; |
64 |
|
|
65 |
}} // namespace LinuxSampler::gig |
}} // namespace LinuxSampler::gig |
66 |
|
|
67 |
#endif // __LS_GIG_ENGINECHANNEL_H__ |
#endif /* __LS_GIG_ENGINECHANNEL_H__ */ |