public WaveformReaderPcm(FormAiffForm aFormFile, bool aIsOnMemory) { FormAiffSsnd lSsndChunk = ( FormAiffSsnd )aFormFile.GetChunk(FormAiffSsnd.ID); int lPosition = ( int )(lSsndChunk.position + lSsndChunk.offset + 8); int lLength = lSsndChunk.dataSize; FormAiffComm lChunkComm = ( FormAiffComm )aFormFile.GetChunk(FormAiffComm.ID); int lChannels = lChunkComm.numberOfChannels; int lSampleRate = ( int )lChunkComm.sampleRate; int lSampleBits = lChunkComm.bitsPerSamples; int lSamples = lLength / (lSampleBits / 8) / lChannels; format = new WaweformFormat(lChannels, lSamples, lSampleRate, lSampleBits); reader = new WaveformReader(format, aFormFile.name, lPosition, aIsOnMemory, AByteArray.Endian.Big); }
public WaveformPcm(FormAiffForm aFormFile) { FormAiffSsnd lSsndChunk = ( FormAiffSsnd )aFormFile.GetChunk(FormAiffSsnd.ID); int lPosition = ( int )(lSsndChunk.position + lSsndChunk.offset + 8); int lLength = lSsndChunk.dataSize; FormAiffComm lChunkComm = ( FormAiffComm )aFormFile.GetChunk(FormAiffComm.ID); int lChannels = lChunkComm.numberOfChannels; int lSampleRate = ( int )lChunkComm.sampleRate; int lSampleBits = lChunkComm.bitsPerSamples; int lSamples = lLength / (lSampleBits / 8) / lChannels; format = new WaweformFormat(lChannels, lSamples, lSampleRate, lSampleBits); using (FileStream u = new FileStream(aFormFile.name, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { AByteArray lByteArray = new ByteArrayLittle(u); data = new WaveformData(format, lByteArray, lPosition); } }