|
Urbi SDK Remote for C++
2.7.5
|
00001 /* 00002 * Copyright (C) 2007-2011, Gostai S.A.S. 00003 * 00004 * This software is provided "as is" without warranty of any kind, 00005 * either expressed or implied, including but not limited to the 00006 * implied warranties of fitness for a particular purpose. 00007 * 00008 * See the LICENSE file for more information. 00009 */ 00010 00012 #ifndef URBI_USOUND_HH 00013 # define URBI_USOUND_HH 00014 00015 # include <iosfwd> 00016 00017 # include <urbi/export.hh> 00018 00019 namespace urbi 00020 { 00021 00022 /*---------------. 00023 | USoundFormat. | 00024 `---------------*/ 00025 enum USoundFormat 00026 { 00027 SOUND_RAW = 0, 00028 SOUND_WAV = 1, 00029 SOUND_MP3 = 2, 00030 SOUND_OGG = 3, 00031 SOUND_UNKNOWN = 4, 00032 }; 00033 00035 URBI_SDK_API USoundFormat parse_sound_format(const std::string&); 00036 00038 URBI_SDK_API const char* format_string(USoundFormat f); 00039 00040 00041 /*---------------------. 00042 | USoundSampleFormat. | 00043 `---------------------*/ 00044 enum USoundSampleFormat 00045 { 00046 SAMPLE_SIGNED = 1, 00047 SAMPLE_UNSIGNED = 2, 00048 SAMPLE_FLOAT = 3, 00049 }; 00050 00051 std::istream& operator>> (std::istream& is, USoundSampleFormat& f); 00052 00053 00054 /*---------. 00055 | USound. | 00056 `---------*/ 00057 00062 class URBI_SDK_API USound 00063 { 00064 public: 00067 static USound make(); 00068 00071 void init(); 00072 00074 const char* format_string() const; 00075 00076 bool operator==(const USound &b) const; 00077 00078 // For debugging. 00079 std::ostream& dump(std::ostream& o) const; 00080 00082 char* data; 00084 size_t size; 00086 size_t channels; 00088 size_t rate; 00090 size_t sampleSize; 00091 00093 USoundFormat soundFormat; 00094 00096 USoundSampleFormat sampleFormat; 00097 00098 private: 00099 friend class UBinary; 00100 // The UBinary headers. 00101 std::string headers_() const; 00102 }; 00103 00104 // Bounce to USound::dump. 00105 std::ostream& operator<< (std::ostream& o, const USound& s); 00106 00107 00108 } // end namespace urbi 00109 00110 #endif // ! URBI_USOUND_HH