/// <summary> /// /// </summary> /// <param name="osc"></param> /// /// <param name="zone"></param> /// <param name="waveSequence"></param> public override void SetWaveSequence(int osc, int zone, IWaveSequence waveSequence) { IntParameter parameter = new IntParameter(); // ReSharper disable once SwitchStatementMissingSomeCases switch (PcgRoot.Model.OsVersion) { case Models.EOsVersion.EOsVersionKronos10_11: // FALL THROUGH case Models.EOsVersion.EOsVersionKronos15_16: var bankIndex = ((IBank)waveSequence.Parent).Index; if (bankIndex >= 0x40) { bankIndex -= 0x40; // 40..46.. U-A..U-G } parameter.Set(Root, Root.Content, GetZoneMsByteOffset(osc, zone) + 1, 7, 0, false, this); parameter.Value = bankIndex; parameter.Set(Root, Root.Content, GetZoneMsByteOffset(osc, zone) + 2, 7, 0, false, this); parameter.Value = waveSequence.Index; break; case Models.EOsVersion.EOsVersionKronos2x: // FALL THROUGH case Models.EOsVersion.EOsVersionKronos3x: parameter.SetMultiBytes(Root, Root.Content, GetZoneMsByteOffset(osc, zone), 2, false, false, null); parameter.Value = GetWaveSequenceIndex(waveSequence); break; default: throw new ApplicationException("Illegal (non Kronos) model"); } }
/// <summary> /// /// </summary> /// <param name="osc"></param> /// /// <param name="zone"></param> /// <param name="waveSequence"></param> public override void SetWaveSequence(int osc, int zone, IWaveSequence waveSequence) { IntParameter parameter = new IntParameter(); parameter.SetMultiBytes(Root, Root.Content, GetZoneMsByteOffset(osc, zone), 2, false, false, null); parameter.Value = GetWaveSequenceIndex(waveSequence); }
/// <summary> /// Sets used drum kit. /// </summary> /// <param name="osc"></param> /// <param name="zone"></param> /// <param name="drumKit"></param> /// <returns></returns> private void SetUsedDrumKit(int osc, int zone, IDrumKit drumKit) { IntParameter parameter = new IntParameter(); parameter.SetMultiBytes(Root, Root.Content, GetZoneMsByteOffset(osc, zone) + 2, 2, // + 2: Number (bank unused, alwyas 0?) false, false, null); int index = PcgRoot.DrumKitBanks.FindIndexOf(drumKit); if (index >= 0) { parameter.Value = index; } }
/// <summary> /// Returns the drum kit used by osc (zero based) and MS zone (zero based). /// </summary> /// <param name="osc"></param> /// <param name="zone"></param> /// <returns></returns> protected IDrumKit GetUsedDrumKit(int osc, int zone) { IntParameter parameter = new IntParameter(); parameter.SetMultiBytes(Root, Root.Content, GetZoneMsByteOffset(osc, zone) + 2, 2, // + 2: Number (bank unused, always 0?) false, false, null); int index = parameter.Value; IDrumKit drumKit = null; if (PcgRoot.DrumKitBanks != null) { drumKit = PcgRoot.DrumKitBanks.GetByIndex(index); } return(drumKit); }