summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opierec/wavFile.h
authorllornkcor <llornkcor>2003-04-04 03:03:38 (UTC)
committer llornkcor <llornkcor>2003-04-04 03:03:38 (UTC)
commitce6388c4f44e9e76342a338954fff598372e06f0 (patch) (side-by-side diff)
tree895c202343fc394335e6effdb535ccb864a587d3 /noncore/multimedia/opierec/wavFile.h
parent487971af0c1b70babcc39fd549dc0d8142cd4865 (diff)
downloadopie-ce6388c4f44e9e76342a338954fff598372e06f0.zip
opie-ce6388c4f44e9e76342a338954fff598372e06f0.tar.gz
opie-ce6388c4f44e9e76342a338954fff598372e06f0.tar.bz2
bitches owe me money. initial commit. zaurus/vercel has sound drivers that doesnt actually change samplerates, so this kinda has problems, currently
Diffstat (limited to 'noncore/multimedia/opierec/wavFile.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opierec/wavFile.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/noncore/multimedia/opierec/wavFile.h b/noncore/multimedia/opierec/wavFile.h
new file mode 100644
index 0000000..51366ec
--- a/dev/null
+++ b/noncore/multimedia/opierec/wavFile.h
@@ -0,0 +1,56 @@
+//wavFile.h
+#ifndef WAVFILE_H
+#define WAVFILE_H
+
+#include <qobject.h>
+#include <sys/soundcard.h>
+#include <qfile.h>
+#include <qstring.h>
+
+typedef struct {
+ char riffID[4];
+ unsigned long riffLen;
+ char wavID[4];
+ char fmtID[4];
+ unsigned long fmtLen;
+ unsigned short fmtTag;
+ unsigned short nChannels;
+ unsigned long sampleRate;
+ unsigned long avgBytesPerSec;
+ unsigned short nBlockAlign;
+ unsigned short bitsPerSample;
+ char dataID[4];
+ unsigned long dataLen;
+ } wavhdr;
+
+
+class WavFile : public QObject {
+Q_OBJECT
+public:
+ WavFile( QObject * parent=0,const QString &fileName=0, bool newFile=true, int sampleRate = 0,
+ int channels = 0, int resolution = 0, int format=0);
+ ~WavFile();
+ wavhdr hdr;
+ bool adjustHeaders(int fd, int total);
+ QString currentFileName;
+ QString trackName();
+
+ QFile track;
+ int wavHandle();
+ int getFormat();
+ int getResolution();
+ int getSampleRate();
+ int getNumberSamples();
+ bool isTempFile();
+ int openFile(const QString &);
+ bool newFile();
+ void closeFile();
+
+private:
+ int wavFormat, wavChannels, wavResolution, wavSampleRate, wavNumberSamples;
+ bool useTmpFile;
+ bool setWavHeader(int fd, wavhdr *hdr);
+ int parseWavHeader(int fd);
+};
+
+#endif