1 |
/*************************************************************************** |
/*************************************************************************** |
2 |
* * |
* * |
3 |
* Copyright (C) 2005 - 2007 Christian Schoenebeck * |
* Copyright (C) 2005 - 2012 Christian Schoenebeck * |
4 |
* * |
* * |
5 |
* This program is free software; you can redistribute it and/or modify * |
* 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 * |
* it under the terms of the GNU General Public License as published by * |
21 |
#ifndef __LS_ENGINECHANNEL_H__ |
#ifndef __LS_ENGINECHANNEL_H__ |
22 |
#define __LS_ENGINECHANNEL_H__ |
#define __LS_ENGINECHANNEL_H__ |
23 |
|
|
24 |
|
#include "../EventListeners.h" |
25 |
#include "../drivers/audio/AudioOutputDevice.h" |
#include "../drivers/audio/AudioOutputDevice.h" |
26 |
#include "../drivers/midi/midi.h" |
#include "../drivers/midi/midi.h" |
27 |
#include "../drivers/midi/MidiInputDevice.h" |
#include "../drivers/midi/MidiInputDevice.h" |
28 |
#include "../drivers/midi/MidiInputPort.h" |
#include "../drivers/midi/MidiInputPort.h" |
29 |
|
#include "../drivers/midi/VirtualMidiDevice.h" |
30 |
#include "Engine.h" |
#include "Engine.h" |
31 |
#include "FxSend.h" |
#include "FxSend.h" |
32 |
|
|
33 |
namespace LinuxSampler { |
namespace LinuxSampler { |
34 |
|
|
35 |
// just symbol prototyping |
// just symbol prototyping |
36 |
|
class Sampler; |
37 |
|
class SamplerChannel; |
38 |
class AudioOutputDevice; |
class AudioOutputDevice; |
39 |
class MidiInputPort; |
class MidiInputPort; |
40 |
class FxSend; |
class FxSend; |
61 |
virtual void PrepareLoadInstrument(const char* FileName, uint Instrument) = 0; |
virtual void PrepareLoadInstrument(const char* FileName, uint Instrument) = 0; |
62 |
virtual void LoadInstrument() = 0; |
virtual void LoadInstrument() = 0; |
63 |
virtual void Reset() = 0; |
virtual void Reset() = 0; |
64 |
virtual void SendNoteOn(uint8_t Key, uint8_t Velocity) = 0; |
virtual void SendNoteOn(uint8_t Key, uint8_t Velocity, uint8_t MidiChannel) = 0; |
65 |
virtual void SendNoteOn(uint8_t Key, uint8_t Velocity, int32_t FragmentPos) = 0; |
virtual void SendNoteOn(uint8_t Key, uint8_t Velocity, uint8_t MidiChannel, int32_t FragmentPos) = 0; |
66 |
virtual void SendNoteOff(uint8_t Key, uint8_t Velocity) = 0; |
virtual void SendNoteOff(uint8_t Key, uint8_t Velocity, uint8_t MidiChannel) = 0; |
67 |
virtual void SendNoteOff(uint8_t Key, uint8_t Velocity, int32_t FragmentPos) = 0; |
virtual void SendNoteOff(uint8_t Key, uint8_t Velocity, uint8_t MidiChannel, int32_t FragmentPos) = 0; |
68 |
virtual void SendPitchbend(int Pitch) = 0; |
virtual void SendPitchbend(int Pitch, uint8_t MidiChannel) = 0; |
69 |
virtual void SendPitchbend(int Pitch, int32_t FragmentPos) = 0; |
virtual void SendPitchbend(int Pitch, uint8_t MidiChannel, int32_t FragmentPos) = 0; |
70 |
virtual void SendControlChange(uint8_t Controller, uint8_t Value) = 0; |
virtual void SendControlChange(uint8_t Controller, uint8_t Value, uint8_t MidiChannel) = 0; |
71 |
virtual void SendControlChange(uint8_t Controller, uint8_t Value, int32_t FragmentPos) = 0; |
virtual void SendControlChange(uint8_t Controller, uint8_t Value, uint8_t MidiChannel, int32_t FragmentPos) = 0; |
72 |
|
virtual void SendProgramChange(uint8_t Program) = 0; |
73 |
virtual bool StatusChanged(bool bNewStatus = false) = 0; |
virtual bool StatusChanged(bool bNewStatus = false) = 0; |
74 |
virtual float Volume() = 0; |
virtual float Volume() = 0; |
75 |
virtual void Volume(float f) = 0; |
virtual void Volume(float f) = 0; |
76 |
|
virtual float Pan() = 0; |
77 |
|
virtual void Pan(float f) = 0; |
78 |
virtual uint Channels() = 0; |
virtual uint Channels() = 0; |
79 |
virtual void Connect(AudioOutputDevice* pAudioOut) = 0; |
virtual void Connect(AudioOutputDevice* pAudioOut) = 0; |
80 |
virtual void DisconnectAudioOutputDevice() = 0; |
virtual void DisconnectAudioOutputDevice() = 0; |
95 |
virtual FxSend* GetFxSend(uint FxSendIndex) = 0; |
virtual FxSend* GetFxSend(uint FxSendIndex) = 0; |
96 |
virtual uint GetFxSendCount() = 0; |
virtual uint GetFxSendCount() = 0; |
97 |
virtual void RemoveFxSend(FxSend* pFxSend) = 0; |
virtual void RemoveFxSend(FxSend* pFxSend) = 0; |
98 |
|
virtual void Connect(VirtualMidiDevice* pDevice) = 0; |
99 |
|
virtual void Disconnect(VirtualMidiDevice* pDevice) = 0; |
100 |
|
|
101 |
|
|
102 |
///////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////// |
252 |
void ResetMidiRpnController(); |
void ResetMidiRpnController(); |
253 |
|
|
254 |
/** |
/** |
255 |
|
* Set MIDI Non-Registered Parameter Number (NRPN) Controller |
256 |
|
* (upper 8 bits / coarse). |
257 |
|
*/ |
258 |
|
void SetMidiNrpnControllerMsb(uint8_t CtrlMSB); |
259 |
|
|
260 |
|
/** |
261 |
|
* Set MIDI Non-Registered Parameter Number (NRPN) Controller |
262 |
|
* (lower 8 bits / fine). |
263 |
|
*/ |
264 |
|
void SetMidiNrpnControllerLsb(uint8_t CtrlLSB); |
265 |
|
|
266 |
|
/** |
267 |
|
* Reset to no NRPN controller currently selected. |
268 |
|
*/ |
269 |
|
void ResetMidiNrpnController(); |
270 |
|
|
271 |
|
/** |
272 |
|
* Registers the specified listener to be notified when the number |
273 |
|
* of effect sends on this channel is changed. |
274 |
|
*/ |
275 |
|
void AddFxSendCountListener(FxSendCountListener* l); |
276 |
|
|
277 |
|
/** |
278 |
|
* Removes the specified listener. |
279 |
|
*/ |
280 |
|
void RemoveFxSendCountListener(FxSendCountListener* l); |
281 |
|
|
282 |
|
/** |
283 |
|
* Removes all listeners. |
284 |
|
*/ |
285 |
|
void RemoveAllFxSendCountListeners(); |
286 |
|
|
287 |
|
/** |
288 |
* Get currently selected MIDI Registered Parameter Number |
* Get currently selected MIDI Registered Parameter Number |
289 |
* (RPN) Controller, this method will return the already merged |
* (RPN) Controller, this method will return the already merged |
290 |
* value (MSB and LSB value). |
* value (MSB and LSB value). |
299 |
*/ |
*/ |
300 |
int GetMidiRpnController(); |
int GetMidiRpnController(); |
301 |
|
|
302 |
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) |
/** |
303 |
|
* Get currently selected MIDI Non-Registered Parameter Number |
304 |
|
* (NRPN) Controller, this method will return the already merged |
305 |
|
* value (MSB and LSB value). |
306 |
|
* |
307 |
|
* @e WARNING: you have to call @c ResetMidiNrpnController() |
308 |
|
* after using this value, otherwise all subsequent MIDI CC #6 |
309 |
|
* (Data) messages are interpreted as NRPN controller value |
310 |
|
* messages. |
311 |
|
* |
312 |
|
* @returns currently selected NRPN controller number, a negative |
313 |
|
* value if no NRPN controller currently selected |
314 |
|
*/ |
315 |
|
int GetMidiNrpnController(); |
316 |
|
|
317 |
|
/** |
318 |
|
* Gets the current number of active voices. |
319 |
|
*/ |
320 |
|
uint GetVoiceCount(); |
321 |
|
|
322 |
|
/** |
323 |
|
* Sets the current number of active voices. |
324 |
|
*/ |
325 |
|
void SetVoiceCount(uint Voices); |
326 |
|
|
327 |
|
/** |
328 |
|
* Gets the current number of active disk streams. |
329 |
|
*/ |
330 |
|
uint GetDiskStreamCount(); |
331 |
|
|
332 |
|
/** |
333 |
|
* Sets the current number of active disk streams. |
334 |
|
*/ |
335 |
|
void SetDiskStreamCount(uint Streams); |
336 |
|
|
337 |
|
SamplerChannel* GetSamplerChannel(); |
338 |
|
|
339 |
|
void SetSamplerChannel(SamplerChannel* pChannel); |
340 |
|
|
341 |
|
/** Returns the sampler to which this channel belongs */ |
342 |
|
Sampler* GetSampler(); |
343 |
|
|
344 |
|
/** |
345 |
|
* Performs a program change on the channel. |
346 |
|
* |
347 |
|
* This method is not real-time safe. |
348 |
|
*/ |
349 |
|
void ExecuteProgramChange(uint32_t Program); |
350 |
|
|
351 |
protected: |
protected: |
352 |
EngineChannel(); |
EngineChannel(); |
353 |
virtual ~EngineChannel() {}; // MUST only be destroyed by EngineChannelFactory |
virtual ~EngineChannel(); // MUST only be destroyed by EngineChannelFactory |
354 |
|
|
355 |
|
/** |
356 |
|
* Notifies listeners that the number of effect sends |
357 |
|
* on a this channel is changed. |
358 |
|
* @param ChannelId The numerical ID of the sampler channel. |
359 |
|
* @param NewCount The new number of sampler channels. |
360 |
|
*/ |
361 |
|
void fireFxSendCountChanged(int ChannelId, int NewCount); |
362 |
|
|
363 |
friend class EngineChannelFactory; |
friend class EngineChannelFactory; |
364 |
|
|
365 |
private: |
private: |
366 |
int iMute; |
struct private_data_t; |
367 |
bool bSolo; |
private_data_t* const p; |
|
uint8_t uiMidiProgram; |
|
|
uint8_t uiMidiBankMsb; |
|
|
uint8_t uiMidiBankLsb; |
|
|
uint8_t uiMidiRpnMsb; ///< MIDI Registered Parameter Number (upper 8 bits / coarse) |
|
|
uint8_t uiMidiRpnLsb; ///< MIDI Registered Parameter Number (lower 8 bits / fine) |
|
|
bool bMidiBankMsbReceived; |
|
|
bool bMidiBankLsbReceived; |
|
|
bool bProgramChangeReceived; |
|
|
bool bMidiRpnReceived; |
|
|
int iMidiInstrumentMap; |
|
368 |
}; |
}; |
369 |
|
|
370 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |