blob: e2aaa4648b7ac7dd8a0d4c1d8e0f5396c0047838 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#include <kdebug.h>
#include <arts/soundserver.h>
#include <arts/flowsystem.h>
#include "kvolumecontrol.h"
KVolumeControl::KVolumeControl(Arts::SoundServerV2 server, KPlayObject *parent)
: TQObject(parent)
{
init(server);
}
KVolumeControl::KVolumeControl(double vol, Arts::SoundServerV2 server, KPlayObject *parent)
: TQObject(parent)
{
init(server);
setVolume(vol);
}
KVolumeControl::~KVolumeControl()
{
manager.stop();
volumeControl.stop();
}
void KVolumeControl::init(Arts::SoundServerV2 server)
{
manager = Arts::DynamicCast(server.createObject("Arts::Synth_AMAN_PLAY"));
if (manager.isNull())
{
kdError() << "Your OS is broken. Get an OS that installs KDE decently." << endl;
return;
}
manager.start();
volumeControl = Arts::DynamicCast(server.createObject("Arts::StereoVolumeControl"));
if (volumeControl.isNull())
{
kdError() << "Your OS is broken. Get an OS that installs KDE decently." << endl;
return;
}
volumeControl.start();
Arts::connect((static_cast<KPlayObject *>(parent()))->object(), "left", volumeControl, "inleft");
Arts::connect((static_cast<KPlayObject *>(parent()))->object(), "right", volumeControl, "inright");
Arts::connect(volumeControl, manager);
}
void KVolumeControl::setVolume(double d)
{
if (volumeControl.isNull())
return;
volumeControl.scaleFactor(d);
}
double KVolumeControl::volume(void)
{
if (volumeControl.isNull())
return -1;
return volumeControl.scaleFactor();
}
#include "kvolumecontrol.moc"
|