21 #ifndef SH_AUDIODATA_H
22 #define SH_AUDIODATA_H
50 template<AUDIOSAMPLETYPE Type,
class ValueType,
class SampleValueType = AudioSampleValue<Type,ValueType> >
64 std::vector<ValueType>
Data ;
73 template<AUDIOSAMPLETYPE Type,
class ValueType,
class SampleValueType>
80 Data.push_back (readValue(io)) ;
85 for (
UWORD32 i = 0 ; i < n ; i++) {
86 Data[i] = readValue(io) ;
94 throw SteghideError (
_(
"an error occured while reading the audio data from the file \"%s\"."), io->
getName().c_str()) ;
100 throw SteghideError (
_(
"premature end of file \"%s\" while reading audio data."), io->
getName().c_str()) ;
106 throw SteghideError (
_(
"an error occured while reading the audio data from standard input.")) ;
112 throw SteghideError (
_(
"premature end of data from standard input while reading audio data.")) ;
119 template<AUDIOSAMPLETYPE Type,
class ValueType,
class SampleValueType>
126 for (
UWORD32 i = 0 ; i < n ; i++) {
127 writeValue (io, Data[i]) ;
134 throw SteghideError (
_(
"an error occured while writing the audio data to the file \"%s\"."), io->
getName().c_str()) ;
140 throw SteghideError (
_(
"an error occured while writing the audio data to standard output.")) ;
147 template<AUDIOSAMPLETYPE Type,
class ValueType,
class SampleValueType>
153 template<AUDIOSAMPLETYPE Type,
class ValueType,
class SampleValueType>
157 return ((
SampleValue*)
new SampleValueType (Data[pos])) ;
160 template<AUDIOSAMPLETYPE Type,
class ValueType,
class SampleValueType>
163 const SampleValueType* sample =
dynamic_cast<const SampleValueType*
> (s) ;
166 Data[pos] = sample->getValue() ;
169 #endif // ndef SH_AUDIODATA_H