~ubuntu-branches/ubuntu/breezy/kdemultimedia/breezy

« back to all changes in this revision

Viewing changes to arts/modules/mixers/simplemixerchannel_impl.cc

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-03-24 04:48:58 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050324044858-8ff88o9jxej6ii3d
Tags: 4:3.4.0-0ubuntu3
Add kubuntu_02_hide_arts_menu_entries.diff to hide artsbuilder and artscontrol k-menu entries

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "artsmodulesmixers.h"
 
2
#include "flowsystem.h"
 
3
#include "stdsynthmodule.h"
 
4
#include "connect.h"
 
5
 
 
6
namespace Arts {
 
7
class SimpleMixerChannel_impl : virtual public SimpleMixerChannel_skel,
 
8
                                                                virtual public StdSynthModule
 
9
{
 
10
protected:
 
11
        Synth_STD_EQUALIZER _equalizerLeft, _equalizerRight;
 
12
        StereoEffectStack _insertEffects;
 
13
        Synth_MUL mulGainLeft, mulGainRight;
 
14
        Synth_MUL mulVolumeLeft, mulVolumeRight;
 
15
        float _gainLeft, _gainRight, _pan, _volumeLeft, _volumeRight, pLeft, pRight;
 
16
        std::string _name;
 
17
public:
 
18
        SimpleMixerChannel_impl()
 
19
                : _gainLeft(1.0), _gainRight(1.0), _pan(0), _volumeLeft(1.0), _volumeRight(1.0), pLeft(1), pRight(1)
 
20
        {
 
21
                setValue(mulVolumeLeft,"invalue2",_volumeLeft*pLeft);
 
22
                setValue(mulVolumeRight,"invalue2",_volumeRight*pRight);
 
23
                setValue(mulGainLeft,"invalue2",_gainLeft);
 
24
                setValue(mulGainRight,"invalue2",_gainRight);
 
25
        }
 
26
 
 
27
        Synth_STD_EQUALIZER equalizerLeft() { return _equalizerLeft; }
 
28
        Synth_STD_EQUALIZER equalizerRight() { return _equalizerRight; }
 
29
        StereoEffectStack insertEffects() { return _insertEffects; }
 
30
 
 
31
        float gainLeft() { return _gainLeft; }
 
32
        void gainLeft(float g)
 
33
        {
 
34
                if(g != _gainLeft) {
 
35
                        _gainLeft = g;
 
36
                        setValue(mulGainLeft,"invalue2",g);
 
37
                        gainLeft_changed(g);
 
38
                }
 
39
        }
 
40
 
 
41
        float gainRight() { return _gainRight; }
 
42
        void gainRight(float g)
 
43
        {
 
44
                if(g != _gainRight) {
 
45
                        _gainRight = g;
 
46
                        setValue(mulGainRight,"invalue2",g);
 
47
                        gainRight_changed(g);
 
48
                }
 
49
        }
 
50
 
 
51
        float volumeLeft() { return _volumeLeft; }
 
52
        void volumeLeft(float v)
 
53
        {
 
54
                if(v != _volumeLeft) {
 
55
                        _volumeLeft = v;
 
56
                        setValue(mulVolumeLeft,"invalue2",v*pLeft);
 
57
                        volumeLeft_changed(v);
 
58
                }
 
59
        }
 
60
 
 
61
        float volumeRight() { return _volumeRight; }
 
62
        void volumeRight(float v)
 
63
        {
 
64
                if(v != _volumeRight) {
 
65
                        _volumeRight = v;
 
66
                        setValue(mulVolumeRight,"invalue2",v*pRight);
 
67
                        volumeRight_changed(v);
 
68
                }
 
69
        }
 
70
 
 
71
        float pan() { return _pan; }
 
72
        void pan(float p)
 
73
        {
 
74
                if(p != _pan)
 
75
                {
 
76
                        _pan = p;
 
77
                        pLeft = 1.0;
 
78
                        pRight = 1.0;
 
79
                        if(p > 0)
 
80
                                pLeft = 1-p;
 
81
                        else
 
82
                                pRight = 1+p;
 
83
                        setValue(mulVolumeLeft,"invalue2",_volumeLeft*pLeft);
 
84
                        setValue(mulVolumeRight,"invalue2",_volumeRight*pRight);
 
85
                        pan_changed(p);
 
86
                }
 
87
        }
 
88
 
 
89
        std::string name() { return _name; }
 
90
        void name(const std::string& newName)
 
91
        {
 
92
                if(_name != newName) {
 
93
                        _name = newName;
 
94
                        name_changed(newName);
 
95
                }
 
96
        }
 
97
 
 
98
        void streamInit()
 
99
        {
 
100
                _equalizerLeft.start();
 
101
                _equalizerRight.start();
 
102
                _insertEffects.start();
 
103
                mulVolumeLeft.start();
 
104
                mulVolumeRight.start();
 
105
                mulGainLeft.start();
 
106
                mulGainRight.start();
 
107
 
 
108
                _node()->virtualize("inleft",mulGainLeft._node(),"invalue1");
 
109
                _node()->virtualize("inright",mulGainRight._node(),"invalue1");
 
110
                connect(mulGainLeft,"outvalue",_equalizerLeft,"invalue");
 
111
                connect(mulGainRight,"outvalue",_equalizerRight,"invalue");
 
112
                connect(_equalizerLeft,"outvalue",_insertEffects,"inleft");
 
113
                connect(_equalizerRight,"outvalue",_insertEffects,"inright");
 
114
                connect(_insertEffects,"outleft",mulVolumeLeft,"invalue1");
 
115
                connect(_insertEffects,"outright",mulVolumeRight,"invalue1");
 
116
                _node()->virtualize("outleft",mulVolumeLeft._node(),"outvalue");
 
117
                _node()->virtualize("outright",mulVolumeRight._node(),"outvalue");
 
118
        }
 
119
        void streamEnd()
 
120
        {
 
121
                _equalizerLeft.stop();
 
122
                _equalizerRight.stop();
 
123
                _insertEffects.stop();
 
124
                mulVolumeLeft.stop();
 
125
                mulVolumeRight.stop();
 
126
                mulGainLeft.stop();
 
127
                mulGainRight.stop();
 
128
        }
 
129
};
 
130
REGISTER_IMPLEMENTATION(SimpleMixerChannel_impl);
 
131
}
 
132