1
/***************************************************************************
2
copyright : (C) 2003 by Arnold Krille
3
email : arnold@arnoldarts.de
4
***************************************************************************/
6
/***************************************************************************
8
* This program is free software; you can redistribute it and/or modify *
9
* it under the terms of the GNU General Public License as published by *
10
* the Free Software Foundation; version 2 of the License. *
12
***************************************************************************/
14
#ifndef KREC_EXPORT_TEMPLATE_H
15
#define KREC_EXPORT_TEMPLATE_H
20
#include <qstringlist.h>
22
#include <arts/common.h>
25
* This class is the template for all exportitems in KRec.
27
* To register your ExportItem you have to do @code registerAtGlobal( this ); @code
28
* at the end of your constructor.
30
* @author Arnold Krille <arnold@arnoldarts.de>
32
class KRecExportItem : public QObject {
35
/// Controls wether an export is running, or not...
37
int _samplingRate, _bits, _channels;
39
KRecExportItem( QObject*, const char* =0, const QStringList& =0 );
42
* This registers this class at the KRecGlobal.
44
static void registerAtGlobal( KRecExportItem* );
46
int samplingRate() const;
50
/// Helpers for reading and writing to an char-array
51
Q_INT16 read16( char* array, int index );
52
void write16( char* array, Q_INT16 value, int index );
53
void write32( char* array, Q_INT32 value, int index );
58
* Returns a new Item for your export.
60
virtual KRecExportItem* newItem()=0;
62
/// Returns a list with the extensions.
63
virtual QStringList extensions()=0;
64
/// Returns the export format.
65
virtual QString exportFormat()=0;
67
bool running() const { return _running; }
70
* Initializes the sound-settings.
71
* Has to be called before the initialize( const QString & ) function.
73
void initialize( int samplingRate, int bits, int channels );
74
/// Initializes the export.
75
virtual bool initialize( const QString &filename )=0;
77
* Start the real export (including the emission of @see getData() while running=true).
78
* Best way to do this is to use @see QTimer::singleShot() since then the events are
79
* put at the end of the EventLoop not blocking the gui and everything else.
82
virtual bool process() =0;
84
/// Stops the export by setting running=false.
86
/// Finish the export.
87
virtual bool finalize()=0;
88
//virtual void data( QByteArray& );
90
/// Is emitted when this Item wants data to export.
91
void getData( QByteArray& );