00001 // -*- c++ -*- 00002 // Generated by assa-genesis 00003 //------------------------------------------------------------------------------ 00004 // $Id: WavPause.h,v 1.4 2003/02/07 05:15:08 vlg Exp $ 00005 //------------------------------------------------------------------------------ 00006 // WavPause.h 00007 //------------------------------------------------------------------------------ 00008 // 00009 // Author : Vladislav Grinchenko 00010 // Date : Sun Dec 9 17:14:29 2001 00011 // 00012 // History: 00013 // 00014 // When Who What 00015 // ---------- --- -------------------------- 00016 // 12/09/01 VLG Created 00017 // 00018 //------------------------------------------------------------------------------ 00019 #ifndef WavPause_H 00020 #define WavPause_H 00021 00022 #include <assa/GenServer.h> 00023 #include <assa/Singleton.h> 00024 #include <assa/TimeVal.h> 00025 00026 using ASSA::GenServer; 00027 00028 #include <audiofile.h> 00029 00030 #include <string> 00031 using std::string; 00032 00033 class info { 00034 public: 00035 info (); 00036 void dump () const; 00037 00038 public: 00039 int in_file_format; 00040 int version; 00041 int sample_format; 00042 int sample_width; 00043 int channel_count; 00044 int frame_size; 00045 double sample_rate; 00046 AFframecount total_frames; 00047 }; 00048 00049 inline 00050 00051 info::info () 00052 : in_file_format (AF_FILE_WAVE), // 4 00053 version (0), // 0 00054 sample_format (AF_SAMPFMT_TWOSCOMP), // 401 - linear two's complement 00055 sample_width (16), // 16 bits 00056 channel_count (2), // 2 - stereo 00057 frame_size (4), // 4 bytes 00058 sample_rate (44100.0) // 44100.0 00059 { 00060 /* no-op */ 00061 } 00062 00063 00064 class WavPause : 00065 public GenServer, 00066 public ASSA::Singleton<WavPause> 00067 { 00068 public: 00069 WavPause (); 00070 00071 virtual void initServer (); 00072 virtual void processServer (); 00073 00074 int get_exit_value () const { return m_exit_value; } 00075 void set_exit_value (int v_); 00076 00077 private: 00078 static const unsigned short int FRAME_BUFFER_SIZE; 00079 00080 int read_input_file (); 00081 00082 private: 00083 info m_info; // File configuration 00084 string m_output_file; // Output file name 00085 string m_input_file; // Input file name 00086 00087 int m_exit_value; // Return status of the process 00088 bool m_percent; // Show percentage completion 00089 double m_duration; // Pause length in seconds 00090 int m_multiplier; // Pause multiplier (relative) 00091 bool m_relative; // Is the pause length relative on absolute? 00092 }; 00093 00094 00095 inline void 00096 00097 WavPause::set_exit_value (int v_) 00098 { 00099 m_exit_value = v_; 00100 setStopServerFlag (); 00101 } 00102 00103 #endif // WavPause_H 00104