double newGainStep; // set when Volume changes and takes effect when byte interval resets. /**<summary>If a multiply is cued, perform operation on all relevant members at the start of a stream read.</summary>*/ public void MultiplyByteInterval() { lock (_multLock) { if (intervalMultiplyCued) { BeatCollection.MultiplyBeatValues(); double mult = intervalMultiplyFactor * ByteInterval; ByteInterval = (int)mult; Layer.Remainder *= intervalMultiplyFactor; Layer.Remainder += mult - ByteInterval; if (Layer.Remainder >= 1) { ByteInterval += (int)Layer.Remainder; Layer.Remainder -= (int)Layer.Remainder; } // multiply the offset aswell if (hasOffset) { mult = intervalMultiplyFactor * InitialOffset; InitialOffset = (int)mult; OffsetRemainder *= intervalMultiplyFactor; OffsetRemainder += mult - InitialOffset; } intervalMultiplyCued = false; } } }
/**<summary>Perform a cued byte interval multiplication.</summary>*/ public void MultiplyByteInterval() { lock (_multLock) { if (intervalMultiplyCued) { BeatCollection.MultiplyBeatValues(); double div = ByteInterval / 4; div *= intervalMultiplyFactor; Layer.Remainder *= intervalMultiplyFactor; // multiply remainder as well Layer.Remainder += div - (int)div; ByteInterval = (int)div * 4; if (Layer.Remainder >= 1) { ByteInterval += (int)Layer.Remainder * 4; Layer.Remainder -= (int)Layer.Remainder; } // multiply the offset aswell if (hasOffset) { div = initialOffset / 4; div *= intervalMultiplyFactor; offsetRemainder *= intervalMultiplyFactor; offsetRemainder += div - (int)div; initialOffset = (int)div * 4; } //// do the hihat cutoff interval if (IsHiHatOpen && CurrentHiHatDuration != 0) { div = CurrentHiHatDuration / 4; CurrentHiHatDuration = (int)(div * intervalMultiplyFactor) * 4; } // recalculate the hihat count and byte to cutoff values if (IsHiHatOpen && Layer.HasHiHatClosed) { int countDiff = HiHatCycleToMute - cycle; int totalBytes = countDiff * 2560 + HiHatByteToMute; totalBytes = (int)(totalBytes * intervalMultiplyFactor); HiHatCycleToMute = cycle + totalBytes / 2560; HiHatByteToMute = totalBytes % 2560; HiHatByteToMute -= HiHatByteToMute % 4; // align } intervalMultiplyCued = false; } } }