/[svn]/linuxsampler/trunk/src/engines/common/SignalUnitRack.h
ViewVC logotype

Annotation of /linuxsampler/trunk/src/engines/common/SignalUnitRack.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2224 - (hide annotations) (download) (as text)
Mon Aug 1 19:08:09 2011 UTC (12 years, 8 months ago) by iliev
File MIME type: text/x-c++hdr
File size: 4283 byte(s)
* implemented opcode pitchlfo_depthccN

1 iliev 2205 /***************************************************************************
2     * *
3     * LinuxSampler - modular, streaming capable sampler *
4     * *
5     * Copyright (C) 2011 Grigor Iliev *
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 __LS_SIGNALUNITRACK_H__
24     #define __LS_SIGNALUNITRACK_H__
25    
26     #include "Event.h"
27     #include "SignalUnit.h"
28     #include "../../common/Pool.h"
29    
30    
31     namespace LinuxSampler {
32 iliev 2218
33 iliev 2205 class SignalUnitRack {
34     protected:
35     uint CurrentStep; // The current time step
36    
37     public:
38 iliev 2218 FixedArray<SignalUnit*> Units; // A list of all signal units in this rack
39 iliev 2217
40 iliev 2218 /**
41     * @param maxUnitCount We are using fixed size array because of the real-time safe requirements.
42     */
43     SignalUnitRack(int maxUnitCount): CurrentStep(0), Units(maxUnitCount) { }
44    
45 iliev 2205 uint GetCurrentStep() { return CurrentStep; }
46    
47     virtual EndpointSignalUnit* GetEndpointUnit() = 0;
48    
49 iliev 2218 virtual void EnterFadeOutStage() = 0;
50    
51 iliev 2205 /**
52     * Will be called to increment the time with one sample point.
53     * Each unit should recalculate its current level on every call of this function.
54     */
55     virtual void Increment() {
56     CurrentStep++;
57    
58     for (int i = 0; i < Units.size(); i++) {
59     Units[i]->Increment();
60     }
61     }
62    
63     virtual void ProcessCCEvent(RTList<Event>::Iterator& itEvent) {
64     if ( !(itEvent->Type == Event::type_control_change && itEvent->Param.CC.Controller) ) return;
65     for (int i = 0; i < Units.size(); i++) {
66     Units[i]->ProcessCCEvent(itEvent->Param.CC.Controller, itEvent->Param.CC.Value);
67     }
68     }
69    
70     /** Initializes and triggers the rack. */
71     virtual void Trigger() {
72     CurrentStep = 0;
73     for (int i = 0; i < Units.size(); i++) {
74     Units[i]->Trigger();
75     }
76     }
77    
78 iliev 2217 /**
79     * When the rack belongs to a voice, this method is
80     * called when the voice enter the release stage.
81     */
82 iliev 2205 virtual void EnterReleaseStage() {
83     for (int i = 0; i < Units.size(); i++) {
84     Units[i]->EnterReleaseStage();
85     }
86     }
87    
88 iliev 2217 /**
89     * When the rack belongs to a voice, this method is
90     * called when the voice is of type which ignore note off.
91     */
92 iliev 2205 virtual void CancelRelease() {
93     for (int i = 0; i < Units.size(); i++) {
94     Units[i]->CancelRelease();
95     }
96     }
97     };
98     } // namespace LinuxSampler
99    
100     #endif /* __LS_SIGNALUNITRACK_H__ */

  ViewVC Help
Powered by ViewVC