Diffstat (limited to 'noncore/multimedia/opierec/wavFile.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opierec/wavFile.h | 56 |
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 @@ | |||
1 | //wavFile.h | ||
2 | #ifndef WAVFILE_H | ||
3 | #define WAVFILE_H | ||
4 | |||
5 | #include <qobject.h> | ||
6 | #include <sys/soundcard.h> | ||
7 | #include <qfile.h> | ||
8 | #include <qstring.h> | ||
9 | |||
10 | typedef struct { | ||
11 | char riffID[4]; | ||
12 | unsigned long riffLen; | ||
13 | char wavID[4]; | ||
14 | char fmtID[4]; | ||
15 | unsigned long fmtLen; | ||
16 | unsigned short fmtTag; | ||
17 | unsigned short nChannels; | ||
18 | unsigned long sampleRate; | ||
19 | unsigned long avgBytesPerSec; | ||
20 | unsigned short nBlockAlign; | ||
21 | unsigned short bitsPerSample; | ||
22 | char dataID[4]; | ||
23 | unsigned long dataLen; | ||
24 | } wavhdr; | ||
25 | |||
26 | |||
27 | class WavFile : public QObject { | ||
28 | Q_OBJECT | ||
29 | public: | ||
30 | WavFile( QObject * parent=0,const QString &fileName=0, bool newFile=true, int sampleRate = 0, | ||
31 | int channels = 0, int resolution = 0, int format=0); | ||
32 | ~WavFile(); | ||
33 | wavhdr hdr; | ||
34 | bool adjustHeaders(int fd, int total); | ||
35 | QString currentFileName; | ||
36 | QString trackName(); | ||
37 | |||
38 | QFile track; | ||
39 | int wavHandle(); | ||
40 | int getFormat(); | ||
41 | int getResolution(); | ||
42 | int getSampleRate(); | ||
43 | int getNumberSamples(); | ||
44 | bool isTempFile(); | ||
45 | int openFile(const QString &); | ||
46 | bool newFile(); | ||
47 | void closeFile(); | ||
48 | |||
49 | private: | ||
50 | int wavFormat, wavChannels, wavResolution, wavSampleRate, wavNumberSamples; | ||
51 | bool useTmpFile; | ||
52 | bool setWavHeader(int fd, wavhdr *hdr); | ||
53 | int parseWavHeader(int fd); | ||
54 | }; | ||
55 | |||
56 | #endif | ||