/// <summary> /// Initializes the <see cref="TemporaryTone"/> with the given <see cref="IBankSelect"/> interface. /// </summary> /// <param name="bankselect"></param> /// <exception cref="IntegraException">When the type is <see cref="IntegraToneTypes.Unavailable"/>.</exception> /// <remarks><i> /// <b>Important</b><br/> /// The <see cref="StudioSetPart"/> has to be initialized before the <see cref="TemporaryTone"/>.<br/> /// The method is invoked when a <see cref="Integra.ToneChanged"/> event is received which is generated by the <see cref="StudioSetPart"/>.<br/> /// </i></remarks> private void InitializeTemporaryTone(IBankSelect bankselect) { // IMPORTANT! Quick tone changes can corrupt the model initialization queue, dequeue the temporary tone as prevention Device.Dequeue(this); SuperNATURALAcousticTone?.Dispose(); SuperNATURALSynthTone?.Dispose(); SuperNATURALDrumKit?.Dispose(); PCMSynthTone?.Dispose(); PCMDrumKit?.Dispose(); MFX.Dispose(); MSB = bankselect.MSB; LSB = bankselect.LSB; PC = bankselect.PC; Type = bankselect.ToneType(); IsEditable = bankselect.IsEditable(); MFX = new MFX(this); switch (Type) { case IntegraToneTypes.SuperNATURALAcousticTone: SuperNATURALAcousticTone = new SuperNATURALAcousticTone(this); MFX.Address |= SuperNATURALAcousticTone.Address; break; case IntegraToneTypes.SuperNATURALSynthTone: SuperNATURALSynthTone = new SuperNATURALSynthTone(this); MFX.Address |= SuperNATURALSynthTone.Address; break; case IntegraToneTypes.SuperNATURALDrumkit: SuperNATURALDrumKit = new SuperNATURALDrumKit(this); MFX.Address |= SuperNATURALDrumKit.Address; break; case IntegraToneTypes.PCMSynthTone: PCMSynthTone = new PCMSynthTone(this); MFX.Address |= PCMSynthTone.Address; break; case IntegraToneTypes.PCMDrumkit: PCMDrumKit = new PCMDrumKit(this); MFX.Address |= PCMDrumKit.Address; break; default: throw new IntegraException($"[{nameof(TemporaryTone)}.{nameof(InitializeTemporaryTone)}({Part})]\n" + $"Unspecified temporary tone type."); } Device.Enqueue(this); }
/// <summary> /// Creates a new <see cref="SuperNATURALDrumKitNotes"/> instance. /// </summary> /// <param name="drumKit">The <see cref="SuperNATURALDrumKit"/> to connect the collection.</param> internal SuperNATURALDrumKitNotes(SuperNATURALDrumKit drumKit) : base(drumKit.Device, false) { Address += drumKit.Address; IntegraRequest request = new(Attribute.Request); Requests.Add(request); for (int i = 0; i < Size; i++) { SuperNATURALDrumKitNote?note = Activator.CreateInstance(typeof(SuperNATURALDrumKitNote), BindingFlags.Instance | BindingFlags.NonPublic, null, new object[] { drumKit, i }, null) as SuperNATURALDrumKitNote; Debug.Assert(note != null); Add(note); } Connect(); }
public SuperNATURALDrumKitCommon(SuperNATURALDrumKit drumKit) : base(drumKit.Device) { Address = drumKit.Address; }