/[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 2124 - (show annotations) (download) (as text)
Sat Sep 18 09:24:41 2010 UTC (13 years, 6 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 4253 byte(s)
* implemented support for internal LADSPA effects (work in progress)

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
34 /**
35 * Abstract base class for sampler internal effects.
36 */
37 class Effect {
38 public:
39 /////////////////////////////////////////////////////////////////
40 // abstract methods
41 // (these have to be implemented by the descendant)
42
43 /**
44 * Use the input audio signal given with @a ppInputChannels, render the
45 * effect and mix the result into the effect's output channels.
46 *
47 * @param Samples - amount of sample points to process
48 */
49 virtual void RenderAudio(uint Samples) = 0;
50
51 /**
52 * Will be called by the sampler before using the effect the first time.
53 * This method can be implemented by the effect to adjust itself to the
54 * requirements given by the audio output device.
55 *
56 * This is the perfect place to create the required audio input and
57 * output channels! ;-)
58 *
59 * @param pDevice - audio output device which is going to play the signal
60 * @throws Exception - if effect could not be initialized successfully
61 */
62 virtual void InitEffect(AudioOutputDevice* pDevice) throw (Exception);
63
64 /**
65 * Destructor, deletes all audio input and output channels.
66 */
67 virtual ~Effect();
68
69
70
71 /////////////////////////////////////////////////////////////////
72 // normal methods
73 // (usually not to be overriden by descendant)
74
75 /**
76 * Returns audio input channel with index \a ChannelIndex or NULL if
77 * index out of bounds.
78 */
79 AudioChannel* InputChannel(uint ChannelIndex) const;
80
81 /**
82 * Returns the amount of audio input channels the effect is currently
83 * providing.
84 */
85 uint InputChannelCount() const;
86
87 /**
88 * Returns audio output channel with index \a ChannelIndex or NULL if
89 * index out of bounds.
90 */
91 AudioChannel* OutputChannel(uint ChannelIndex) const;
92
93 /**
94 * Returns the amount of audio output channels the effect is currently
95 * providing.
96 */
97 uint OutputChannelCount() const;
98
99 /**
100 * Returns effect parameter with index \a ControlIndex or NULL if index
101 * out of bounds.
102 */
103 EffectControl* InputControl(uint ControlIndex) const;
104
105 /**
106 * Returns the amount of effect parameters the effect provides.
107 */
108 uint InputControlCount() const;
109
110 protected:
111 std::vector<AudioChannel*> vInputChannels;
112 std::vector<AudioChannel*> vOutputChannels;
113 std::vector<EffectControl*> vInputControls;
114 std::vector<EffectControl*> vOutputControls; ///< yet unused
115 };
116
117 } // namespace LinuxSampler
118
119 #endif // LS_EFFECT_H

  ViewVC Help
Powered by ViewVC