Main Page   Class Hierarchy   Compound List   File List   Compound Members  

VowelSample.h

00001 /* VowelSample.h
00002  *
00003  * Copyright (C) 2002-2003 -- Sebastian Nowozin
00004  */
00005 
00006 #ifndef VOWELSAMPLE_H
00007 #define VOWELSAMPLE_H
00008 
00009 #include <audio/AUFile.h>
00010 #include <audio/AudioPreprocessing.h>
00011 
00012 #include <inttypes.h>
00013 
00014 
00015 /* le/be access macros
00016  */
00017 #define VOWEL_FILE2HOST_32(x) \
00018         ((((unsigned char *) (&(x)))[0] << 24) | \
00019         (((unsigned char *) (&(x)))[1] << 16) | \
00020         (((unsigned char *) (&(x)))[2] << 8) | \
00021         (((unsigned char *) (&(x)))[3]))
00022 #define VOWEL_HOST2FILE_32(x) AUDIO_AU_FILE2HOST(x)
00023 
00024 #define VOWEL_FILE_MAGIC        0x6e746963
00025 
00034 typedef struct {
00035 #ifdef OLD_GCC_PRAGMAS
00036 #pragma pack(1)
00037         uint32_t        magic;
00038         uint32_t        sample_type;
00039 #else
00040 
00041         uint32_t        magic __attribute__ ((packed));
00043         uint32_t        sample_type __attribute__ ((packed));
00044 #endif
00045 } VowelSampleInformation;
00046 
00050 enum VowelSampleType { A = 0, E = 1, I = 2, O = 3, U = 4, Unknown = 5 };
00051 
00057 class
00058 VowelSample {
00059 public:
00064         VowelSampleType type_correct;
00065 
00071         vector<double>  sample;
00072 
00076         vector<double>  fft_energy;
00077 
00080         char *          filename;
00081 
00086         AUFile *        raw;
00087 
00093         VowelSample (bool record = false);
00094 
00097         ~VowelSample (void);
00098 
00113         bool open (const char *filename, AudioPreprocessing& prep_template);
00114 
00117         VowelSample (VowelSample& source);
00118 
00123         void setCorrectVowel (VowelSampleType type);
00124 
00132         bool saveRawSample (const char *filename = 0);
00133 
00139         bool isValidUserInformation (void)
00140         {
00141                 return (info_success);
00142         }
00143 
00144 private:
00147         bool                    info_success;
00148 
00153         VowelSampleInformation  info;
00154 
00160         bool convertUserinfoToC (void);
00161 
00164         void convertCtoUserinfo (void);
00165 };
00166 
00167 #endif
00168 
00169 

Generated on Mon Feb 24 19:37:43 2003 by doxygen1.3-rc3