public WaveformReaderPcm(RiffWaveRiff aRiffWaveRiff, bool aIsOnMemory) { RiffWaveData lRiffWaveData = ( RiffWaveData )aRiffWaveRiff.GetChunk(RiffWaveData.ID); int lPosition = ( int )lRiffWaveData.position; int lLength = ( int )lRiffWaveData.Size; RiffWaveFmt_ lRiffWaveFmt_ = ( RiffWaveFmt_ )aRiffWaveRiff.GetChunk(RiffWaveFmt_.ID); int lChannels = lRiffWaveFmt_.channels; int lSampleRate = ( int )lRiffWaveFmt_.samplesPerSec; int lSampleBits = lRiffWaveFmt_.bitsPerSample; int lSamples = lLength / (lSampleBits / 8) / lChannels; format = new WaweformFormat(lChannels, lSamples, lSampleRate, lSampleBits); reader = new WaveformReader(format, aRiffWaveRiff.name, lPosition, aIsOnMemory, AByteArray.Endian.Little); }
public WaveformPcm(RiffWaveRiff aRiffFile) { RiffWaveData lRiffWaveData = ( RiffWaveData )aRiffFile.GetChunk(RiffWaveData.ID); int lPosition = ( int )lRiffWaveData.position; int lLength = ( int )lRiffWaveData.Size; RiffWaveFmt_ lRiffWaveFmt_ = ( RiffWaveFmt_ )aRiffFile.GetChunk(RiffWaveFmt_.ID); int lChannels = lRiffWaveFmt_.channels; int lSampleRate = ( int )lRiffWaveFmt_.samplesPerSec; int lSampleBits = lRiffWaveFmt_.bitsPerSample; int lSamples = lLength / (lSampleBits / 8) / lChannels; format = new WaweformFormat(lChannels, lSamples, lSampleRate, lSampleBits); using (FileStream u = new FileStream(aRiffFile.name, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { AByteArray lByteArray = new ByteArrayLittle(u); data = new WaveformData(format, lByteArray, lPosition); } }