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

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

            this.soundManager = new SAMSoundManager(this);
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        public FormPhonemesEditor(SAM inst, SAMTimbre 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();

            metroTextBoxAllophones.Text = timbre.Phonemes;

            Size = Settings.Default.PhonemesEdSize;
        }
Exemple #3
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;
            SAMTimbre tim       = context.Instance as SAMTimbre;

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

            SAM inst = null;

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

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

            using (var frm = new FormPhonemesEditor(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);
        }
Exemple #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="parentModule"></param>
 /// <param name="noteOnEvent"></param>
 /// <param name="programNumber"></param>
 /// <param name="slot"></param>
 public SAMSound(SAM parentModule, SAMSoundManager manager, TimbreBase timbre, int tindex, TaggedNoteOnEvent noteOnEvent, int slot) : base(parentModule, manager, timbre, tindex, noteOnEvent, slot)
 {
     this.parentModule = parentModule;
     this.timbre       = (SAMTimbre)timbre;
 }