Пример #1
0
        public MusicPcm(FormAiffForm aFormFile)
        {
            Name     = aFormFile.name;
            Waveform = new WaveformReaderPcm(aFormFile, false);
            Length   = new SoundTime(Waveform.format.sampleRate, Waveform.format.samples);

            loopList = new List <List <LoopInformation> >();
            loopList.Add(new List <LoopInformation>());
            loopList[0].Add(new LoopInformation(Length.sampleRate, -1, -1));
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
            }
        }