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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2217 - (show annotations) (download) (as text)
Tue Jul 26 15:51:30 2011 UTC (12 years, 9 months ago) by iliev
File MIME type: text/x-c++hdr
File size: 4023 byte(s)
* removed helper classes SignalUnitBase,
  EndpointSignalUnitBase, SignalUnitRackBase
* clean up sf2::Voice
* bumped version to 1.0.0.cvs12

1 /***************************************************************************
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 class SignalUnitRack {
33 protected:
34 uint CurrentStep; // The current time step
35
36 public:
37 ArrayList<SignalUnit*> Units; // A list of all signal units in this rack
38
39 SignalUnitRack(): CurrentStep(0) { }
40 uint GetCurrentStep() { return CurrentStep; }
41
42 virtual EndpointSignalUnit* GetEndpointUnit() = 0;
43
44 /**
45 * Will be called to increment the time with one sample point.
46 * Each unit should recalculate its current level on every call of this function.
47 */
48 virtual void Increment() {
49 CurrentStep++;
50
51 for (int i = 0; i < Units.size(); i++) {
52 Units[i]->Increment();
53 }
54 }
55
56 virtual void ProcessCCEvent(RTList<Event>::Iterator& itEvent) {
57 if ( !(itEvent->Type == Event::type_control_change && itEvent->Param.CC.Controller) ) return;
58 for (int i = 0; i < Units.size(); i++) {
59 Units[i]->ProcessCCEvent(itEvent->Param.CC.Controller, itEvent->Param.CC.Value);
60 }
61 }
62
63 /** Initializes and triggers the rack. */
64 virtual void Trigger() {
65 CurrentStep = 0;
66 for (int i = 0; i < Units.size(); i++) {
67 Units[i]->Trigger();
68 }
69 }
70
71 /**
72 * When the rack belongs to a voice, this method is
73 * called when the voice enter the release stage.
74 */
75 virtual void EnterReleaseStage() {
76 for (int i = 0; i < Units.size(); i++) {
77 Units[i]->EnterReleaseStage();
78 }
79 }
80
81 /**
82 * When the rack belongs to a voice, this method is
83 * called when the voice is of type which ignore note off.
84 */
85 virtual void CancelRelease() {
86 for (int i = 0; i < Units.size(); i++) {
87 Units[i]->CancelRelease();
88 }
89 }
90 };
91 } // namespace LinuxSampler
92
93 #endif /* __LS_SIGNALUNITRACK_H__ */

  ViewVC Help
Powered by ViewVC