Beispiel #1
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="parentModule"></param>
            /// <param name="noteOnEvent"></param>
            /// <param name="programNumber"></param>
            /// <param name="slot"></param>
            public TMS5220Sound(TMS5220 parentModule, TMS5220SoundManager manager, TimbreBase timbre, int tindex, TaggedNoteOnEvent noteOnEvent, int slot) : base(parentModule, manager, timbre, tindex, noteOnEvent, slot)
            {
                this.parentModule = parentModule;
                this.timbre       = (TMS5220Timbre)timbre;

                bw = new BitWriter(parentModule);
            }
Beispiel #2
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;
            TMS5220Timbre tim       = context.Instance as TMS5220Timbre;

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

            TMS5220 inst = null;

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

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

            using (FormLpcEditor frm = new FormLpcEditor(inst, tim, singleSel))
            {
                frm.Tag = context;

                frm.LpcData       = (byte[])value;
                frm.ValueChanged += Frm_ValueChangedByte;

                DialogResult dr = frm.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    value = frm.LpcData;
                }
                else if (value != null)
                {
                    value = ((byte[])value).Clone();
                }
                else
                {
                    value = new byte[] { };
                }
            }
            return(value);
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        public FormLpcEditor(TMS5220 inst, TMS5220Timbre 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;
                }
            }

            InitializeComponent();

            Size = Settings.Default.LpcEdSize;
            setPresets();
        }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        public TMS5220(uint unitNumber) : base(unitNumber)
        {
            GainLeft  = DEFAULT_GAIN;
            GainRight = DEFAULT_GAIN;

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

            this.soundManager = new TMS5220SoundManager(this);

            processingThread = new Thread(new ThreadStart(processFifoQueue));
            processingThread.IsBackground = true;
            processingThread.Start();
        }