1 /*************************************************************************
2          RecordParams.h  -  holds parameters of the record plugin
3                              -------------------
4     begin                : Thu Sep 04 2003
5     copyright            : (C) 2003 by Thomas Eschenbacher
6     email                : Thomas.Eschenbacher@gmx.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #ifndef RECORD_PARAMS_H
19 #define RECORD_PARAMS_H
20 
21 #include "config.h"
22 
23 #include <QDateTime>
24 #include <QString>
25 #include <QStringList>
26 
27 #include "libkwave/Compression.h"
28 #include "libkwave/SampleFormat.h"
29 
30 namespace Kwave
31 {
32 
33     /**
34      * enum for the known recording methods
35      * (sorted, preferred first)
36      */
37     typedef enum {
38 	RECORD_NONE = 0,   /**< none selected */
39 	RECORD_JACK,       /**< Jack sound daemon */
40 	RECORD_QT,         /**< Qt Multimedia Audio */
41 	RECORD_PULSEAUDIO, /**< PulseAudio sound daemon */
42 	RECORD_ALSA,       /**< ALSA native */
43 	RECORD_OSS,        /**< OSS native or ALSA OSS emulation */
44 	RECORD_INVALID     /**< (keep this the last entry, EOL delimiter) */
45     } record_method_t;
46 
47     /** post-increment operator for the record method */
48     inline Kwave::record_method_t &operator ++(Kwave::record_method_t &m) {
49 	return (m = (m < Kwave::RECORD_INVALID) ?
50 		    static_cast<Kwave::record_method_t>(
51 		    static_cast<int>(m) + 1) : m);
52     }
53 
54     class RecordParams
55     {
56 
57     public:
58 
59 	/** Constructor, initializes everything with defaults */
60 	RecordParams();
61 
62 	/** Destructor */
63 	virtual ~RecordParams();
64 
65 	/**
66 	 * Parse from a QStringList
67 	 * @param list the QStringList to parse
68 	 * @return zero or -EINVAL if failed
69 	 */
70 	virtual int fromList(const QStringList &list);
71 
72 	/** Parse into a QStringList */
73 	virtual QStringList toList() const;
74 
75 	Kwave::record_method_t method;  /** method/class for recording */
76 
77 	bool pre_record_enabled;	/**< pre-record: feature enabled */
78 	unsigned int pre_record_time;	/**< pre-record: time in seconds */
79 
80 	bool record_time_limited;	/**< record time: limited */
81 	unsigned int record_time;	/**< record time: limit in seconds */
82 
83 	bool start_time_enabled;        /**< start time: feature enabled */
84 	QDateTime start_time;           /**< start time: date & time */
85 
86 	bool record_trigger_enabled;	/**< record trigger: feature enabled */
87 	unsigned int record_trigger;	/**< record trigger level in percent */
88 
89 	bool amplification_enabled;	/**< amplification: feature enabled */
90 	int amplification;		/**< amplification: value in decibel */
91 
92 	bool agc_enabled;		/**< agc: feature enabled */
93 	unsigned int agc_decay;		/**< agc: decay in milliseconds */
94 
95 	bool fade_in_enabled;		/**< fade in: feature enabled */
96 	unsigned int fade_in_time;	/**< fade in: time in milliseconds */
97 
98 	bool fade_out_enabled;		/**< fade out: feature enabled */
99 	unsigned int fade_out_time;	/**< fade out: time in milliseconds */
100 
101 	QString device_name;		/**< name of the input device */
102 	unsigned int tracks;		/**< number of tracks */
103 	double sample_rate;		/**< sample rate in samples/second */
104 	Kwave::Compression::Type compression; /**< compression type        */
105 	unsigned int bits_per_sample;	/**< resolution in bits per sample */
106 	Kwave::SampleFormat::Format sample_format;  /**< sample format */
107 
108 	unsigned int buffer_count;	/**< number of buffers */
109 	unsigned int buffer_size;	/**< power of the record buffer size */
110     };
111 }
112 
113 #endif /* RECORD_PARAMS_H */
114 
115 //***************************************************************************
116 //***************************************************************************
117