00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00024
00025 #ifndef SFML_SOUNDRECORDER_HPP
00026 #define SFML_SOUNDRECORDER_HPP
00027
00029
00031 #include <SFML/System/Thread.hpp>
00032 #include <vector>
00033
00034
00035 namespace sf
00036 {
00041 class SFML_API SoundRecorder : private Thread
00042 {
00043 public :
00044
00049 SoundRecorder();
00050
00055 virtual ~SoundRecorder();
00056
00065 void Start(unsigned int SampleRate = 44100);
00066
00071 void Stop();
00072
00079 unsigned int GetSampleRate() const;
00080
00088 static bool CanCapture();
00089
00090 private :
00091
00101 virtual bool ProcessSamples(const Int16* Samples, std::size_t SamplesCount) = 0;
00102
00107 virtual void Run();
00108
00113 void ProcessCapturedSamples();
00114
00119 void CleanUp();
00120
00122
00124 std::vector<Int16> mySamples;
00125 unsigned int mySampleRate;
00126 bool myIsCapturing;
00127 };
00128
00129 }
00130
00131
00132 #endif // SFML_SOUNDRECORDER_HPP