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
#include "krecexport_template.h"
15
#include "krecexport_template.moc"
17
#include "krecglobal.h"
22
KRecExportItem::KRecExportItem( QObject* p, const char* n, const QStringList& ) : QObject( p,n ), _running( false ) {
23
//kdDebug( 60005 ) << k_funcinfo << endl;
25
KRecExportItem::~KRecExportItem() {
26
//kdDebug( 60005 ) << k_funcinfo << endl;
28
int KRecExportItem::samplingRate() const {
29
//kdDebug( 60005 ) << k_funcinfo << _samplingRate << endl;
32
int KRecExportItem::bits() const {
33
//kdDebug( 60005 ) << k_funcinfo << _bits << endl;
36
int KRecExportItem::channels() const {
37
//kdDebug( 60005 ) << k_funcinfo << _channels << endl;
41
void KRecExportItem::registerAtGlobal( KRecExportItem* item ) {
42
//kdDebug( 60005 ) << k_funcinfo << endl;
43
bool registered = false;
44
if ( !registered ) registered = KRecGlobal::the()->registerExport( item );
45
//if ( registered ) kdDebug( 60005 ) << "Register successful!" << endl;
46
// else kdDebug( 60005 ) << "Register NOT successful!" << endl;
49
void KRecExportItem::initialize( int samplingRate, int bits, int channels ) {
50
kdDebug( 60005 ) << k_funcinfo << "samplingRate:" << samplingRate << " bits:" << bits << " channels:" << channels << endl;
51
_samplingRate = samplingRate;
55
bool KRecExportItem::start() {
56
kdDebug( 60005 ) << k_funcinfo << endl;
60
QTimer::singleShot( 0, this, SLOT( process() ) );
61
emit running( running() );
67
void KRecExportItem::stop() {
68
kdDebug( 60005 ) << k_funcinfo << endl;
70
emit running( running() );
73
Q_INT16 KRecExportItem::read16( char* array, int index ) {
75
tmp = array[ index ] + ( array[ index + 1 ] << 8 ) & 0xff;
78
/// Helper: writes an integer into an char* formated for wave-files
79
void KRecExportItem::write16( char* array, Q_INT16 value, int index ) {
80
array[ index ] = ( value >> 0 ) & 0xff;
81
array[ index + 1 ] = ( value >> 8 ) & 0xff;
83
void KRecExportItem::write32( char* array, Q_INT32 value, int index ) {
84
write16( array, value, index );
85
array[ index + 2 ] = ( value >> 16 ) & 0xff;
86
array[ index + 3 ] = ( value >> 24 ) & 0xff;