Don't use scoped_lock objects to hold locks requested by libcurl. Should fix bug...
[gnash.git] / libsound / WAVWriter.h
blob3af9b33a7f520525aabe226688b6863987014592
1 // WAVWriter.h: .wav audio writer
2 //
3 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
4 // Foundation, Inc
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef GNASH_SOUND_WAVWRITER_H
21 #define GNASH_SOUND_WAVWRITER_H
23 #include <fstream> // for composition (file_stream)
24 #include <boost/cstdint.hpp>
26 namespace gnash {
27 namespace sound {
29 /// WAV writer class
30 class WAVWriter {
32 public:
34 WAVWriter(const std::string& outfile);
36 ~WAVWriter();
38 /// Write samples to file
40 /// @param from
41 /// The buffer to read samples from.
42 /// Buffer must be big enough to hold nSamples samples.
43 ///
44 /// @param nSamples
45 /// The amount of samples to read.
46 /// NOTE: this number currently refers to "mono" samples
47 /// due to some bad design decision. It is so expected
48 /// that the user fetches 44100 * 2 samples which has to
49 /// be interpreted as series of left,right channel couples.
50 /// TODO: use actual number of samples so that it's expected
51 /// to fetch 44100 per second and let expose a function
52 /// to give interpretation of what comes back (how many
53 /// bytes per channel, which format).
54 ///
55 void pushSamples(boost::int16_t* from, unsigned int nSamples);
57 private:
59 /// File stream for dump file
61 /// TODO: move to base class ?
62 ///
63 std::ofstream file_stream;
65 // write a .WAV file header
66 void write_wave_header(std::ofstream& outfile);
70 } // gnash.sound namespace
71 } // namespace gnash
73 #endif // GNASH_SOUND_WAVWRITER_H