Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

FileWrite.h
1 #ifndef STK_FILEWRITE_H
2 #define STK_FILEWRITE_H
3
4 #include "Stk.h"
5
6 namespace stk {
7
8 /***************************************************/
29 /***************************************************/
30
31 class FileWrite : public Stk
32 {
33 public:
34
35 typedef unsigned long FILE_TYPE;
36
37 static const FILE_TYPE FILE_RAW;
38 static const FILE_TYPE FILE_WAV;
39 static const FILE_TYPE FILE_SND;
40 static const FILE_TYPE FILE_AIF;
41 static const FILE_TYPE FILE_MAT;
43
44 FileWrite( void );
45
47
50 FileWrite( std::string fileName, unsigned int nChannels = 1, FILE_TYPE type = FILE_WAV, Stk::StkFormat format = STK_SINT16 );
51
53 virtual ~FileWrite();
54
56
59 void open( std::string fileName, unsigned int nChannels = 1,
60 FileWrite::FILE_TYPE type = FILE_WAV, Stk::StkFormat format = STK_SINT16 );
61
63 void close( void );
64
66 bool isOpen( void );
67
69
74 void write( StkFrames& buffer );
75
76 protected:
77
78 // Write STK RAW file header.
79 bool setRawFile( std::string fileName );
80
81 // Write WAV file header.
82 bool setWavFile( std::string fileName );
83
84 // Close WAV file, updating the header.
85 void closeWavFile( void );
86
87 // Write SND (AU) file header.
88 bool setSndFile( std::string fileName );
89
90 // Close SND file, updating the header.
91 void closeSndFile( void );
92
93 // Write AIFF file header.
94 bool setAifFile( std::string fileName );
95
96 // Close AIFF file, updating the header.
97 void closeAifFile( void );
98
99 // Write MAT-file header.
100 bool setMatFile( std::string fileName );
101
102 // Close MAT-file, updating the header.
103 void closeMatFile( void );
104
105 FILE *fd_;
106 FILE_TYPE fileType_;
107 StkFormat dataType_;
108 unsigned int channels_;
109 unsigned long frameCounter_;
110 bool byteswap_;
111
112 };
113
114 } // stk namespace
115
116 #endif

The Synthesis ToolKit in C++ (STK)
©1995--2017 Perry R. Cook and Gary P. Scavone. All Rights Reserved.