/// <summary> /// From a RIFF wave. WIP. /// </summary> /// <param name="r"></param> public FISP(RiffWave r) { regions = new List <RegionInfo>(); tracks = new List <TrackInfo>(); data = new DataInfo(); stream = new StreamInfo(); //Data. if (r.fmt.bitsPerSample == 16) { short[][] pcm16 = new short[r.data.channels.Count][]; for (int i = 0; i < r.data.channels.Count; i++) { pcm16[i] = r.data.channels[i].pcm16.ToArray(); } data.data = pcm16.ToList(); } else { byte[][] pcm8 = new byte[r.data.channels.Count][]; for (int i = 0; i < r.data.channels.Count; i++) { pcm8[i] = r.data.channels[i].pcm8.ToArray(); } data.data = EncoderFactory.Pcm8ToPcm16(pcm8).ToList(); } //Stream info. stream.sampleRate = r.fmt.sampleRate; stream.encoding = 2; if (data.data.Count > 0) { stream.loopEnd = (uint)data.data[0].Length; } if (r.smpl != null) { if (r.smpl.loops.Count > 0) { stream.isLoop = true; stream.loopStart = stream.originalLoopStart = r.smpl.loops[0].startSample; stream.loopEnd = stream.originalLoopEnd = r.smpl.loops[0].endSample; } } }