/// <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="SuperNATURALAcousticToneCommon"/> instance. /// </summary> /// <param name="tone">The parent model.</param> internal SuperNATURALAcousticToneCommon(SuperNATURALAcousticTone tone) : base(tone.Device) { Address = tone.Address; PropertyChanged += ModelPropertyChanged; }