private IEnumerable <Tuple <string, double> > GetPositions(int channelIndex) { var positions = new List <Tuple <string, double> >(); var currentPosition = 0D; for (var i = 0; i < 32; i++) { var sampleKey = _sampleKeys[channelIndex]; var audioSection = _channelPlayers[channelIndex].GetAudioSection(sampleKey, sampleKey); var sampleLength = audioSection.Length; var bpm = audioSection.Bpm; var adjustedLength = BpmHelper.GetAdjustedAudioLength(sampleLength, bpm, _targetBpm); positions.Add(new Tuple <string, double>(sampleKey, currentPosition)); currentPosition += adjustedLength; if (currentPosition > _loopLength) { break; } } return(positions); }
private double GetAdjustedSampleLenth(string streamKey, string sampleKey) { var audioFile = Module.AudioFiles.FirstOrDefault(x => x.Key == streamKey); var sample = audioFile?.Samples.FirstOrDefault(x => x.Key == sampleKey); if (sample == null) { return(0); } var bpm = BpmHelper.GetBpmFromLoopLength(sample.Length); return(BpmHelper.GetAdjustedAudioLength(sample.Length, bpm, Module.Bpm)); }