Example #1
0
        /// <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 uninitialized MIDI enabled partial collection.
        /// </summary>
        /// <param name="device">The device for data transmission.</param>
        internal SuperNATURALSynthTonePartials(SuperNATURALSynthTone tone) : base(tone.Device, false)
        {
            Address = tone.Address;

            IntegraRequest request = new(Attribute.Request);

            Requests.Add(request);

            for (int i = 0; i < Size; i++)
            {
                SuperNATURALSynthTonePartial?partial = Activator.CreateInstance(typeof(SuperNATURALSynthTonePartial), BindingFlags.Instance | BindingFlags.NonPublic, null, new object[] { tone, i }, null) as SuperNATURALSynthTonePartial;

                Debug.Assert(partial != null);

                Add(partial);
            }

            Connect();
        }
 public SuperNATURALSynthToneCommon(SuperNATURALSynthTone tone) : base(tone.Device)
 {
     Address = tone.Address;
 }
Example #4
0
 internal SuperNATURALSynthToneMisc(SuperNATURALSynthTone tone) : base(tone.Device)
 {
     Address += tone.Address;
 }