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, 2006 Christian Schoenebeck * |
* Copyright (C) 2005 - 2007 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
9 |
* 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 |
#ifndef __LS_GIG_VOICE_H__ |
#ifndef __LS_GIG_VOICE_H__ |
25 |
#define __LS_GIG_VOICE_H__ |
#define __LS_GIG_VOICE_H__ |
26 |
|
|
27 |
#include "../../common/global.h" |
#include "../../common/global_private.h" |
28 |
|
|
29 |
#include <gig.h> |
#include <gig.h> |
30 |
|
|
31 |
#include "../../common/RTMath.h" |
#include "../../common/RTMath.h" |
|
#include "../../common/RingBuffer.h" |
|
32 |
#include "../../common/Pool.h" |
#include "../../common/Pool.h" |
33 |
#include "../../drivers/audio/AudioOutputDevice.h" |
#include "../../drivers/audio/AudioOutputDevice.h" |
|
#include "../common/BiquadFilter.h" |
|
34 |
#include "Engine.h" |
#include "Engine.h" |
35 |
#include "EngineChannel.h" |
#include "EngineChannel.h" |
36 |
#include "Stream.h" |
#include "Stream.h" |
144 |
double Pos; ///< Current playback position in sample |
double Pos; ///< Current playback position in sample |
145 |
float PitchBase; ///< Basic pitch depth, stays the same for the whole life time of the voice |
float PitchBase; ///< Basic pitch depth, stays the same for the whole life time of the voice |
146 |
float PitchBend; ///< Current pitch value of the pitchbend wheel |
float PitchBend; ///< Current pitch value of the pitchbend wheel |
147 |
|
float PitchBendRange; ///< The pitch range of the pitchbend wheel, value is in cents / 8192 |
148 |
float CutoffBase; ///< Cutoff frequency before control change, EG and LFO are applied |
float CutoffBase; ///< Cutoff frequency before control change, EG and LFO are applied |
149 |
::gig::Sample* pSample; ///< Pointer to the sample to be played back |
::gig::Sample* pSample; ///< Pointer to the sample to be played back |
150 |
::gig::DimensionRegion* pDimRgn; ///< Pointer to the articulation information of current dimension region of this voice |
::gig::DimensionRegion* pDimRgn; ///< Pointer to the articulation information of current dimension region of this voice |
151 |
|
bool Orphan; ///< true if this voice is playing a sample from an instrument that is unloaded. When the voice dies, the sample (and dimension region) will be handed back to the instrument resource manager. |
152 |
playback_state_t PlaybackState; ///< When a sample will be triggered, it will be first played from RAM cache and after a couple of sample points it will switch to disk streaming and at the end of a disk stream we have to add null samples, so the interpolator can do it's work correctly |
playback_state_t PlaybackState; ///< When a sample will be triggered, it will be first played from RAM cache and after a couple of sample points it will switch to disk streaming and at the end of a disk stream we have to add null samples, so the interpolator can do it's work correctly |
153 |
bool DiskVoice; ///< If the sample is very short it completely fits into the RAM cache and doesn't need to be streamed from disk, in that case this flag is set to false |
bool DiskVoice; ///< If the sample is very short it completely fits into the RAM cache and doesn't need to be streamed from disk, in that case this flag is set to false |
154 |
Stream::reference_t DiskStreamRef; ///< Reference / link to the disk stream |
Stream::reference_t DiskStreamRef; ///< Reference / link to the disk stream |
162 |
EGDecay EG3; ///< Envelope Generator 3 (Pitch) |
EGDecay EG3; ///< Envelope Generator 3 (Pitch) |
163 |
midi_ctrl VCFCutoffCtrl; |
midi_ctrl VCFCutoffCtrl; |
164 |
midi_ctrl VCFResonanceCtrl; |
midi_ctrl VCFResonanceCtrl; |
|
static const float FILTER_CUTOFF_COEFF; |
|
165 |
LFOUnsigned* pLFO1; ///< Low Frequency Oscillator 1 (Amplification) |
LFOUnsigned* pLFO1; ///< Low Frequency Oscillator 1 (Amplification) |
166 |
LFOUnsigned* pLFO2; ///< Low Frequency Oscillator 2 (Filter cutoff frequency) |
LFOUnsigned* pLFO2; ///< Low Frequency Oscillator 2 (Filter cutoff frequency) |
167 |
LFOSigned* pLFO3; ///< Low Frequency Oscillator 3 (Pitch) |
LFOSigned* pLFO3; ///< Low Frequency Oscillator 3 (Pitch) |
182 |
static float CalculateFilterCutoffCoeff(); |
static float CalculateFilterCutoffCoeff(); |
183 |
|
|
184 |
// Methods |
// Methods |
185 |
void KillImmediately(); |
Stream::Handle KillImmediately(bool bRequestNotification = false); |
186 |
void ProcessEvents(uint Samples); |
void ProcessEvents(uint Samples); |
187 |
void Synthesize(uint Samples, sample_t* pSrc, uint Skip); |
void Synthesize(uint Samples, sample_t* pSrc, uint Skip); |
188 |
void processTransitionEvents(RTList<Event>::Iterator& itEvent, uint End); |
void processTransitionEvents(RTList<Event>::Iterator& itEvent, uint End); |