/[svn]/linuxsampler/trunk/src/eg_vca.h
ViewVC logotype

Contents of /linuxsampler/trunk/src/eg_vca.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download) (as text)
Sun Jan 18 20:31:31 2004 UTC (20 years, 2 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 2736 byte(s)
* Added JACK support: Audio rendering process is now callback based and
  independant of used audio output system. Interfaces to other audio output
  systems can be added by creating a class derived from abstract base class
  'AudioIO' and embedding the new class into linuxsampler.cpp.
* src/audiothread.cpp: applied patch from Vladimir Senkov which fixes
  hanging notes in conjunction with the sustain pedal

1 /***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * Copyright (C) 2003 by Benno Senoner and Christian Schoenebeck *
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the Free Software *
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
20 * MA 02111-1307 USA *
21 ***************************************************************************/
22
23 #ifndef __EG_VCA_H__
24 #define __EG_VCA_H__
25
26 #include <math.h>
27
28 #include "global.h"
29 #include "modulationsystem.h"
30
31 #define EG_ENVELOPE_LIMIT 0.001
32 #define EG_MIN_RELEASE_TIME 0.005
33
34 /**
35 * VCA Envelope Generator
36 *
37 * This EG controls volume attenuation.
38 */
39 class EG_VCA {
40 public:
41 enum stage_t {
42 stage_attack,
43 stage_sustain,
44 stage_release,
45 stage_end
46 };
47
48 static const double Limit;
49
50 EG_VCA();
51 void Process(uint Samples);
52 void Trigger(uint PreAttack, double Attack, double Release);
53 void Release();
54 inline EG_VCA::stage_t GetStage() { return Stage; };
55 protected:
56 float Level;
57 bool ReleaseSignalReceived;
58 stage_t Stage;
59 float AttackCoeff;
60 long AttackStepsLeft; ///< number of sample points til end of attack stage
61 float ReleaseCoeff;
62 long ReleaseStepsLeft; ///< number of sample points til end of release stage
63
64 inline long Min(long A, long B) {
65 return (A > B) ? B : A;
66 }
67 };
68
69 #endif // __EG_VCA_H__

  ViewVC Help
Powered by ViewVC