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
|
/***************************************************************************
copyright : (C) 2003 by Arnold Krille
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* 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; version 2 of the License. *
* *
***************************************************************************/
#ifndef KREC_EXPORT_TEMPLATE_H
#define KREC_EXPORT_TEMPLATE_H
#include <tqobject.h>
#include <tqstring.h>
#include <tqstringlist.h>
#include <tqcstring.h>
#include <arts/common.h>
/**
* This class is the template for all exportitems in KRec.
*
* To register your ExportItem you have to do @code registerAtGlobal( this ); @code
* at the end of your constructor.
*
* @author Arnold Krille <[email protected]>
*/
class KRecExportItem : public TQObject {
Q_OBJECT
private:
/// Controls wether an export is running, or not...
bool _running;
int _samplingRate, _bits, _channels;
protected:
KRecExportItem( TQObject*, const char* =0, const TQStringList& =0 );
/**
* This registers this class at the KRecGlobal.
*/
static void registerAtGlobal( KRecExportItem* );
int samplingRate() const;
int bits() const;
int channels() const;
/// Helpers for reading and writing to an char-array
TQ_INT16 read16( char* array, int index );
void write16( char* array, TQ_INT16 value, int index );
void write32( char* array, TQ_INT32 value, int index );
public:
~KRecExportItem();
/**
* Returns a new Item for your export.
*/
virtual KRecExportItem* newItem()=0;
/// Returns a list with the extensions.
virtual TQStringList extensions()=0;
/// Returns the export format.
virtual TQString exportFormat()=0;
bool running() const { return _running; }
public slots:
/**
* Initializes the sound-settings.
* Has to be called before the initialize( const TQString & ) function.
*/
void initialize( int samplingRate, int bits, int channels );
/// Initializes the export.
virtual bool initialize( const TQString &filename )=0;
/**
* Start the real export (including the emission of @see getData() while running=true).
* Best way to do this is to use @see TQTimer::singleShot() since then the events are
* put at the end of the EventLoop not blocking the gui and everything else.
*/
bool start();
virtual bool process() =0;
/// Stops the export by setting running=false.
void stop();
/// Finish the export.
virtual bool finalize()=0;
//virtual void data( TQByteArray& );
signals:
/// Is emitted when this Item wants data to export.
void getData( TQByteArray& );
void running( bool );
};
#endif
|