| 287 | } |
| 288 | |
| 289 | LMemoryBlock CtrlrLuaAudioConverter::convertToUInt8 (AudioFormatReader *sourceFormatReader, const int numSamples, const int sampleOffset, const int sourceChannel, const bool sourceIsInterleaved) |
| 290 | { |
| 291 | AudioSampleBuffer tempBuffer (1, numSamples); |
| 292 | MemoryBlock mb(numSamples, true); |
| 293 | |
| 294 | if (sourceFormatReader) |
| 295 | { |
| 296 | sourceFormatReader->read (&tempBuffer, 0, numSamples, sampleOffset, true, true); |
| 297 | |
| 298 | if (sourceIsInterleaved) |
| 299 | { |
| 300 | AudioData::ConverterInstance < AudioData::Pointer <AudioData::Float32, |
| 301 | AudioData::NativeEndian, |
| 302 | AudioData::Interleaved, |
| 303 | AudioData::Const>, |
| 304 | AudioData::Pointer <AudioData::UInt8, |
| 305 | AudioData::NativeEndian, |
| 306 | AudioData::Interleaved, |
| 307 | AudioData::NonConst> |
| 308 | > converter; |
| 309 | |
| 310 | converter.convertSamples (mb.getData(), tempBuffer.getReadPointer (sourceChannel, 0), numSamples); |
| 311 | } |
| 312 | else |
| 313 | { |
| 314 | AudioData::ConverterInstance < AudioData::Pointer <AudioData::Float32, |
| 315 | AudioData::NativeEndian, |
| 316 | AudioData::NonInterleaved, |
| 317 | AudioData::Const>, |
| 318 | AudioData::Pointer <AudioData::UInt8, |
| 319 | AudioData::NativeEndian, |
| 320 | AudioData::Interleaved, |
| 321 | AudioData::NonConst> |
| 322 | > converter; |
| 323 | |
| 324 | converter.convertSamples (mb.getData(), tempBuffer.getReadPointer (sourceChannel, 0), numSamples); |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | return (mb); |
| 329 | } |
| 330 | |
| 331 | void CtrlrLuaAudioConverter::wrapForLua (lua_State *L) |
| 332 | { |
nothing calls this directly
no test coverage detected