2 |
* * |
* * |
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-2012 Christian Schoenebeck * |
7 |
|
* Copyright (C) 2009 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_GIG_ENGINECHANNEL_H__ |
#ifndef __LS_GIG_ENGINECHANNEL_H__ |
26 |
#define __LS_GIG_ENGINECHANNEL_H__ |
#define __LS_GIG_ENGINECHANNEL_H__ |
27 |
|
|
28 |
#if DEBUG_HEADERS |
#include "../AbstractEngine.h" |
29 |
# warning EngineChannel.h included |
#include "../EngineChannelBase.h" |
30 |
#endif // DEBUG_HEADERS |
#include "../EngineChannelFactory.h" |
|
|
|
|
#include "../common/Event.h" |
|
|
#include "../common/EngineChannel.h" |
|
|
#include "EngineGlobals.h" |
|
|
#include "Engine.h" |
|
31 |
#include "Voice.h" |
#include "Voice.h" |
32 |
#include "InstrumentResourceManager.h" |
#include <gig.h> |
33 |
|
|
34 |
namespace LinuxSampler { namespace gig { |
namespace LinuxSampler { namespace gig { |
35 |
|
class EngineChannel: public LinuxSampler::EngineChannelBase<Voice, ::gig::DimensionRegion, ::gig::Instrument> { |
36 |
|
public: |
37 |
|
virtual void SendProgramChange(uint8_t Program); |
38 |
|
virtual void LoadInstrument(); |
39 |
|
virtual void ResetInternal(); |
40 |
|
virtual String InstrumentFileName(); |
41 |
|
virtual String InstrumentFileName(int index); |
42 |
|
|
43 |
// just symbol prototyping |
virtual AbstractEngine::Format GetEngineFormat(); |
|
class midi_key_info_t; |
|
|
class Voice; |
|
44 |
|
|
45 |
class EngineChannel : public LinuxSampler::EngineChannel, public InstrumentConsumer { |
friend class Voice; |
46 |
public: |
friend class Engine; |
47 |
|
friend class LinuxSampler::EngineChannelFactory; |
48 |
|
|
49 |
|
protected: |
50 |
EngineChannel(); |
EngineChannel(); |
51 |
virtual ~EngineChannel(); |
virtual ~EngineChannel(); |
52 |
|
|
53 |
// implementation of abstract methods derived from interface class 'LinuxSampler::EngineChannel' |
float CurrentKeyDimension; ///< Current value (0-1.0) for the keyboard dimension, altered by pressing a keyswitching key. |
54 |
virtual void PrepareLoadInstrument(const char* FileName, uint Instrument); |
|
55 |
virtual void LoadInstrument(); |
virtual void ProcessKeySwitchChange(int key); |
|
virtual void SendNoteOn(uint8_t Key, uint8_t Velocity); |
|
|
virtual void SendNoteOff(uint8_t Key, uint8_t Velocity); |
|
|
virtual void SendPitchbend(int Pitch); |
|
|
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) |
|
|
float GlobalPanLeft; |
|
|
float GlobalPanRight; |
|
|
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. |
|
56 |
|
|
|
friend class Engine; |
|
|
friend class Voice; |
|
|
friend class InstrumentResourceManager; |
|
|
|
|
|
private: |
|
|
void ResetInternal(); |
|
57 |
}; |
}; |
58 |
|
|
59 |
}} // namespace LinuxSampler::gig |
}} // namespace LinuxSampler::gig |
60 |
|
|
61 |
#endif // __LS_GIG_ENGINECHANNEL_H__ |
#endif /* __LS_GIG_ENGINECHANNEL_H__ */ |