summaryrefslogtreecommitdiffstats
path: root/plugins/recording/reccfg_interfaces.cpp
blob: 9cbc9e64d69e24f5984cbac3ede79c2a9dcb670b (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/***************************************************************************
                          reccfg_interfaces.cpp  -  description
                             -------------------
    begin                : Sun May 01 2005
    copyright            : (C) 2005by Martin Witte
    email                : witte@kawo1.rwth-aachen.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include <linux/soundcard.h>
#include "reccfg_interfaces.h"

// IRecCfg

IF_IMPL_SENDER  (   IRecCfg::notifyEncoderBufferChanged (size_t BufferSize, size_t BufferCount),
                    noticeEncoderBufferChanged(BufferSize, BufferCount)
                );
IF_IMPL_SENDER  (   IRecCfg::notifySoundFormatChanged(const SoundFormat &sf),
                    noticeSoundFormatChanged(sf)
                );
IF_IMPL_SENDER  (   IRecCfg::notifyMP3QualityChanged(int q),
                    noticeMP3QualityChanged(q)
                );
IF_IMPL_SENDER  (   IRecCfg::notifyOggQualityChanged(float q),
                    noticeOggQualityChanged(q)
                );
IF_IMPL_SENDER  (   IRecCfg::notifyRecordingDirectoryChanged(const TQString &dir),
                    noticeRecordingDirectoryChanged(dir)
                );
IF_IMPL_SENDER  (   IRecCfg::notifyOutputFormatChanged(RecordingConfig::OutputFormat of),
                    noticeOutputFormatChanged(of)
                );
IF_IMPL_SENDER  (   IRecCfg::notifyPreRecordingChanged(bool enable, int seconds),
                    noticePreRecordingChanged(enable, seconds)
                );
IF_IMPL_SENDER  (   IRecCfg::notifyRecordingConfigChanged   (const RecordingConfig &cfg),
                    noticeRecordingConfigChanged(cfg)
                );

// IRecCfgClient

IF_IMPL_SENDER  (   IRecCfgClient::sendEncoderBuffer (size_t BufferSize, size_t BufferCount),
                    setEncoderBuffer(BufferSize, BufferCount)
                );
IF_IMPL_SENDER  (   IRecCfgClient::sendSoundFormat(const SoundFormat &sf),
                    setSoundFormat(sf)
                );
IF_IMPL_SENDER  (   IRecCfgClient::sendMP3Quality(int q),
                    setMP3Quality(q)
                );
IF_IMPL_SENDER  (   IRecCfgClient::sendOggQuality(float q),
                    setOggQuality(q)
                );
IF_IMPL_SENDER  (   IRecCfgClient::sendRecordingDirectory(const TQString &dir),
                    setRecordingDirectory(dir)
                );
IF_IMPL_SENDER  (   IRecCfgClient::sendOutputFormat(RecordingConfig::OutputFormat of),
                    setOutputFormat(of)
                );
IF_IMPL_SENDER  (   IRecCfgClient::sendPreRecording(bool enable, int seconds),
                    setPreRecording(enable, seconds)
                );
IF_IMPL_SENDER  (   IRecCfgClient::sendRecordingConfig(const RecordingConfig &cfg),
                    setRecordingConfig(cfg)
                );

IF_IMPL_QUERY   (   void IRecCfgClient::queryEncoderBuffer(size_t &BufferSize, size_t &BufferCount),
                    getEncoderBuffer(BufferSize, BufferCount),

                );

static SoundFormat defaultSoundFormat;
IF_IMPL_QUERY   (   const SoundFormat &IRecCfgClient::querySoundFormat (),
                    getSoundFormat(),
                    defaultSoundFormat
                );

IF_IMPL_QUERY   (   int IRecCfgClient::queryMP3Quality (),
                    getMP3Quality(),
                    7
                );

IF_IMPL_QUERY   (   float IRecCfgClient::queryOggQuality (),
                    getOggQuality(),
                    7
                );

static TQString defaultRecDir("/tmp");
IF_IMPL_QUERY   (   const TQString &IRecCfgClient::queryRecordingDirectory(),
                    getRecordingDirectory(),
                    defaultRecDir
                );

IF_IMPL_QUERY   (   RecordingConfig::OutputFormat  IRecCfgClient::queryOutputFormat(),
                    getOutputFormat(),
                    RecordingConfig::outputWAV
                );

IF_IMPL_QUERY   (   bool IRecCfgClient::queryPreRecording(int &seconds),
                    getPreRecording(seconds),
                    false
                );

static RecordingConfig defaultRecConfig;
IF_IMPL_QUERY   (   const RecordingConfig &IRecCfgClient::queryRecordingConfig(),
                    getRecordingConfig(),
                    defaultRecConfig
                );

void IRecCfgClient::noticeConnectedI    (cmplInterface *, bool /*pointer_valid*/)
{
    size_t bs = 0, bc = 0;
    queryEncoderBuffer(bs, bc);
    noticeEncoderBufferChanged(bs, bc);
    noticeSoundFormatChanged(querySoundFormat());
    noticeMP3QualityChanged (queryMP3Quality());
    noticeOggQualityChanged (queryOggQuality());
    noticeRecordingDirectoryChanged(queryRecordingDirectory());
    noticeOutputFormatChanged(queryOutputFormat());
    int  s = 0;
    bool e = queryPreRecording(s);
    noticePreRecordingChanged(e, s);
    noticeRecordingConfigChanged(queryRecordingConfig());
}


void IRecCfgClient::noticeDisconnectedI (cmplInterface *, bool /*pointer_valid*/)
{
    size_t bs = 0, bc = 0;
    queryEncoderBuffer(bs, bc);
    noticeEncoderBufferChanged(bs, bc);
    noticeSoundFormatChanged(querySoundFormat());
    noticeMP3QualityChanged (queryMP3Quality());
    noticeOggQualityChanged (queryOggQuality());
    noticeRecordingDirectoryChanged(queryRecordingDirectory());
    noticeOutputFormatChanged(queryOutputFormat());
    int  s = 0;
    bool e = queryPreRecording(s);
    noticePreRecordingChanged(e, s);
    noticeRecordingConfigChanged(queryRecordingConfig());
}