/[svn]/linuxsampler/trunk/src/effects/Effect.h
ViewVC logotype

Contents of /linuxsampler/trunk/src/effects/Effect.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2135 - (show annotations) (download) (as text)
Thu Sep 30 20:00:43 2010 UTC (13 years, 6 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 5229 byte(s)
* added and implemented a set of 19 new LSCP commands for controlling
  internal effects:
  - added LSCP command "GET AVAILABLE_EFFECTS"
  - added LSCP command "LIST AVAILABLE_EFFECTS"
  - added LSCP command "GET EFFECT INFO <effect-index>"
  - added LSCP command "CREATE EFFECT_INSTANCE <effect-index>"
  - added LSCP command
    "CREATE EFFECT_INSTANCE <effect-system> <module> <effect-name>"
  - added LSCP command "DESTROY EFFECT_INSTANCE <effect-instance>"
  - added LSCP command "GET EFFECT_INSTANCES"
  - added LSCP command "LIST EFFECT_INSTANCES"
  - added LSCP command "GET EFFECT_INSTANCE INFO <effect-instance>"
  - added LSCP command "GET EFFECT_INSTANCE_INPUT_CONTROL INFO
    <effect-instance> <input-control>"
  - added LSCP command "SET EFFECT_INSTANCE_INPUT_CONTROL <effect-instance>
    <input-control> <value>"
  - added LSCP command "GET MASTER_EFFECT_CHAINS <audio-device>"
  - added LSCP command "LIST MASTER_EFFECT_CHAINS <audio-device>"
  - added LSCP command "ADD MASTER_EFFECT_CHAIN <audio-device>"
  - added LSCP command
    "REMOVE MASTER_EFFECT_CHAIN <audio-device> <effect-chain>"
  - added LSCP command
    "GET MASTER_EFFECT_CHAIN INFO <audio-device> <effect-chain>"
  - added LSCP command "APPEND MASTER_EFFECT_CHAIN EFFECT <audio-device>
    <effect-chain> <effect-instance>"
  - added LSCP command "INSERT MASTER_EFFECT_CHAIN EFFECT <audio-device>
    <effect-chain> <effect-instance> <effect-chain-pos>"
  - added LSCP command "REMOVE MASTER_EFFECT_CHAIN EFFECT <audio-device>
    <effect-chain> <effect-instance>"
* bumped version to 1.0.0.cvs7

1 /***************************************************************************
2 * *
3 * Copyright (C) 2008, 2010 Christian Schoenebeck *
4 * *
5 * 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 *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software *
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
18 * MA 02111-1307 USA *
19 ***************************************************************************/
20
21 #ifndef LS_EFFECT_H
22 #define LS_EFFECT_H
23
24 #include <vector>
25 #include "../drivers/audio/AudioChannel.h"
26 #include "../common/Exception.h"
27 #include "EffectControl.h"
28
29 namespace LinuxSampler {
30
31 // just symbol prototyping
32 class AudioOutputDevice;
33 class EffectInfo;
34
35 /**
36 * Abstract base class for sampler internal effects.
37 */
38 class Effect {
39 public:
40 /////////////////////////////////////////////////////////////////
41 // abstract methods
42 // (these have to be implemented by the descendant)
43
44 /**
45 * General information about this effect type, that is independent of this
46 * instance of this effect type.
47 *
48 * @returns general effect information
49 */
50 virtual EffectInfo* GetEffectInfo() = 0;
51
52 /**
53 * Use the input audio signal given with @a ppInputChannels, render the
54 * effect and mix the result into the effect's output channels.
55 *
56 * @param Samples - amount of sample points to process
57 */
58 virtual void RenderAudio(uint Samples) = 0;
59
60 /**
61 * Will be called by the sampler before using the effect the first time.
62 * This method can be implemented by the effect to adjust itself to the
63 * requirements given by the audio output device.
64 *
65 * This is the perfect place to create the required audio input and
66 * output channels! ;-)
67 *
68 * @param pDevice - audio output device which is going to play the signal
69 * @throws Exception - if effect could not be initialized successfully
70 */
71 virtual void InitEffect(AudioOutputDevice* pDevice) throw (Exception);
72
73 /**
74 * Constructor, initializes variables.
75 */
76 Effect();
77
78 /**
79 * Destructor, deletes all audio input and output channels.
80 */
81 virtual ~Effect();
82
83
84
85 /////////////////////////////////////////////////////////////////
86 // normal methods
87 // (usually not to be overriden by descendant)
88
89 /**
90 * Returns audio input channel with index \a ChannelIndex or NULL if
91 * index out of bounds.
92 */
93 AudioChannel* InputChannel(uint ChannelIndex) const;
94
95 /**
96 * Returns the amount of audio input channels the effect is currently
97 * providing.
98 */
99 uint InputChannelCount() const;
100
101 /**
102 * Returns audio output channel with index \a ChannelIndex or NULL if
103 * index out of bounds.
104 */
105 AudioChannel* OutputChannel(uint ChannelIndex) const;
106
107 /**
108 * Returns the amount of audio output channels the effect is currently
109 * providing.
110 */
111 uint OutputChannelCount() const;
112
113 /**
114 * Returns effect parameter with index \a ControlIndex or NULL if index
115 * out of bounds.
116 */
117 EffectControl* InputControl(uint ControlIndex) const;
118
119 /**
120 * Returns the amount of effect parameters the effect provides.
121 */
122 uint InputControlCount() const;
123
124 /**
125 * Shall be called to set the object that uses this effect, e.g. to
126 * determine whether an effect is currently in use.
127 */
128 void SetParent(void* pParent);
129
130 /**
131 * Returns object which currently uses this effect.
132 */
133 void* Parent() const;
134
135 /**
136 * Sets the unique numerical ID of this effect within the sampler instance.
137 * This method is usually only called by the EffectFactory class.
138 */
139 void SetId(int id);
140
141 /**
142 * Returns unique numerical ID of this effect within the sampler instance,
143 * as previously set by SetId() .
144 */
145 int ID() const;
146
147 protected:
148 std::vector<AudioChannel*> vInputChannels;
149 std::vector<AudioChannel*> vOutputChannels;
150 std::vector<EffectControl*> vInputControls;
151 std::vector<EffectControl*> vOutputControls; ///< yet unused
152 void* pParent;
153 int iID;
154 };
155
156 } // namespace LinuxSampler
157
158 #endif // LS_EFFECT_H

  ViewVC Help
Powered by ViewVC