예제 #1
0
        /// <summary>
        ///
        /// </summary>
        public SP0256(uint unitNumber) : base(unitNumber)
        {
            GainLeft  = DEFAULT_GAIN;
            GainRight = DEFAULT_GAIN;

            Timbres = new SP0256Timbre[InstrumentBase.DEFAULT_MAX_TIMBRES];
            for (int i = 0; i < InstrumentBase.DEFAULT_MAX_TIMBRES; i++)
            {
                Timbres[i] = new SP0256Timbre();
            }
            setPresetInstruments();

            this.soundManager = new SP0256SoundManager(this);

            processingThread = new Thread(new ThreadStart(processFifoQueue));
            processingThread.IsBackground = true;
            processingThread.Start();
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        public FormAllophonesEditor(SP0256 inst, SP0256Timbre timbre, bool singleSelect)
        {
            this.inst   = inst;
            this.timbre = timbre;
            for (int i = 0; i < inst.BaseTimbres.Length; i++)
            {
                if (inst.BaseTimbres[i] == timbre)
                {
                    timbreNo = i;
                    break;
                }
            }

            InitializeComponent();

            metroTextBoxAllophones.Text = timbre.Allophones;

            Size = Settings.Default.AllophonesEdSize;
        }
예제 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="parentModule"></param>
 /// <param name="noteOnEvent"></param>
 /// <param name="programNumber"></param>
 /// <param name="slot"></param>
 public SP0256Sound(SP0256 parentModule, SP0256SoundManager manager, TimbreBase timbre, int tindex, TaggedNoteOnEvent noteOnEvent, int slot) : base(parentModule, manager, timbre, tindex, noteOnEvent, slot)
 {
     this.parentModule = parentModule;
     this.timbre       = (SP0256Timbre)timbre;
 }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService editorService = null;

            if (provider != null)
            {
                editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
            }

            if (editorService == null)
            {
                return(value);
            }

            bool         singleSel = true;
            SP0256Timbre tim       = context.Instance as SP0256Timbre;

            SP0256Timbre[] tims = value as SP0256Timbre[];
            if (tims != null)
            {
                tim       = tims[0];
                singleSel = false;
            }

            SP0256 inst = null;

            try
            {
                //InstrumentManager.ExclusiveLockObject.EnterReadLock();

                inst = InstrumentManager.FindParentInstrument(InstrumentType.SP0256, tim) as SP0256;
            }
            finally
            {
                //InstrumentManager.ExclusiveLockObject.ExitReadLock();
            }

            using (FormAllophonesEditor frm = new FormAllophonesEditor(inst, tim, singleSel))
            {
                frm.Tag           = context;
                frm.Allophones    = (string)value;
                frm.ValueChanged += (s, e) =>
                {
                    try
                    {
                        //InstrumentManager.ExclusiveLockObject.EnterWriteLock();

                        context.PropertyDescriptor.SetValue(context.Instance, frm.Allophones);
                    }
                    finally
                    {
                        //InstrumentManager.ExclusiveLockObject.ExitWriteLock();
                    }
                };

                DialogResult dr = frm.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    value = frm.Allophones;
                }
                else if (value != null)
                {
                    value = ((string)value + " ").Clone();
                }
            }
            return(value);
        }