コード例 #1
0
ファイル: TemporaryTone.cs プロジェクト: X-Lars/IntegraXL
        /// <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);
        }
コード例 #2
0
 public PCMSynthTonePMT(PCMSynthTone synthTone) : base(synthTone.Device)
 {
     Address += synthTone.Address;
 }
コード例 #3
0
 internal PCMSynthToneCommon02(PCMSynthTone pcmSynthTone) : base(pcmSynthTone.Device)
 {
     Address += pcmSynthTone.Address;
 }
コード例 #4
0
 public PCMSynthToneCommon(PCMSynthTone synthTone) : base(synthTone.Device)
 {
     Address = synthTone.Address;
 }