Example #1
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="parentModule"></param>
            /// <param name="noteOnEvent"></param>
            /// <param name="programNumber"></param>
            /// <param name="slot"></param>
            public C140Sound(C140 parentModule, C140SoundManager manager, TimbreBase timbre, int tindex, TaggedNoteOnEvent noteOnEvent, int slot, byte timbreIndex) : base(parentModule, manager, timbre, tindex, noteOnEvent, slot)
            {
                this.parentModule = parentModule;
                this.timbreIndex  = timbreIndex;
                this.timbre       = (C140Timbre)timbre;

                lastSoundType = this.timbre.SoundType;
                if (lastSoundType == SoundType.INST)
                {
                    baseFreq   = this.timbre.BaseFreqency;
                    sampleRate = this.timbre.SampleRate;
                    loopPoint  = this.timbre.LoopPoint;
                    loopEn     = this.timbre.LoopEnable;
                }

                /*
                 * else if (lastSoundType == SoundType.DRUM)
                 * {
                 *  var pct = (C140PcmTimbre)parentModule.DrumSoundTable.PcmTimbres[noteOnEvent.NoteNumber];
                 *  baseFreq = pct.BaseFreqency;
                 *  sampleRate = pct.SampleRate;
                 *  loopPoint = pct.LoopPoint;
                 *  loopEn = pct.LoopEnable;
                 * }*/
            }
Example #2
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);
            }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tone"></param>
        protected override void ApplyTone(TimbreBase timbre, Tone tone)
        {
            YM2608Timbre tim = (YM2608Timbre)timbre;

            tim.ToneType = ToneType.FM;

            tim.ALG = (byte)tone.AL;
            tim.FB  = (byte)tone.FB;
            tim.AMS = (byte)tone.AMS;
            tim.FMS = (byte)tone.PMS;
            tim.GlobalSettings.Enable = false;
            tim.GlobalSettings.LFRQ   = null;
            tim.GlobalSettings.LFOEN  = null;

            for (int i = 0; i < 4; i++)
            {
                tim.Ops[i].Enable = 1;
                tim.Ops[i].AR     = (byte)tone.aOp[i].AR;
                tim.Ops[i].D1R    = (byte)tone.aOp[i].DR;
                tim.Ops[i].D2R    = tone.aOp[i].SR < 0 ? (byte)0 : (byte)tone.aOp[i].SR;
                tim.Ops[i].RR     = (byte)tone.aOp[i].RR;
                tim.Ops[i].SL     = (byte)tone.aOp[i].SL;
                tim.Ops[i].TL     = (byte)tone.aOp[i].TL;
                tim.Ops[i].RS     = (byte)tone.aOp[i].KS;
                tim.Ops[i].MUL    = (byte)tone.aOp[i].ML;
                tim.Ops[i].DT1    = (byte)tone.aOp[i].DT;
                tim.Ops[i].AM     = (byte)tone.aOp[i].AM;
                tim.Ops[i].SSG    = (byte)tone.aOp[i].SSG;
            }
            timbre.TimbreName = tone.Name;
        }
Example #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tone"></param>
        protected override void ApplyTimbre(TimbreBase timbre)
        {
            YM2608Timbre tim = (YM2608Timbre)timbre;

            this.timbre = tim;

            tim.ToneType = ToneType.FM;

            this["General"].Target = tim;
            ((RegisterValue)this["General"]["ALG"]).Value = tim.ALG;
            ((RegisterValue)this["General"]["FB"]).Value  = tim.FB;
            ((RegisterValue)this["General"]["AMS"]).Value = tim.AMS;
            ((RegisterValue)this["General"]["FMS"]).Value = tim.FMS;
            ((RegisterFlag)this["General"]["GlobalSettings.EN"]).Value             = tim.GlobalSettings.Enable;
            ((RegisterValue)this["General"]["GlobalSettings.LFOEN"]).NullableValue = tim.GlobalSettings.LFOEN;
            ((RegisterValue)this["General"]["GlobalSettings.LFRQ"]).NullableValue  = tim.GlobalSettings.LFRQ;

            for (int i = 0; i < 4; i++)
            {
                this["Operator " + (i + 1)].Target = tim.Ops[i];
                ((RegisterFlag)this["Operator " + (i + 1)]["EN"]).Value   = tim.Ops[i].Enable == 0 ? false : true;
                ((RegisterValue)this["Operator " + (i + 1)]["AR"]).Value  = tim.Ops[i].AR;
                ((RegisterValue)this["Operator " + (i + 1)]["D1R"]).Value = tim.Ops[i].D1R;
                ((RegisterValue)this["Operator " + (i + 1)]["D2R"]).Value = tim.Ops[i].D2R;
                ((RegisterValue)this["Operator " + (i + 1)]["RR"]).Value  = tim.Ops[i].RR;
                ((RegisterValue)this["Operator " + (i + 1)]["SL"]).Value  = tim.Ops[i].SL;
                ((RegisterValue)this["Operator " + (i + 1)]["TL"]).Value  = tim.Ops[i].TL;
                ((RegisterValue)this["Operator " + (i + 1)]["RS"]).Value  = tim.Ops[i].RS;
                ((RegisterValue)this["Operator " + (i + 1)]["MUL"]).Value = tim.Ops[i].MUL;
                ((RegisterValue)this["Operator " + (i + 1)]["DT1"]).Value = tim.Ops[i].DT1;
                ((RegisterValue)this["Operator " + (i + 1)]["AM"]).Value  = tim.Ops[i].AM;
                ((RegisterValue)this["Operator " + (i + 1)]["SSG"]).Value = tim.Ops[i].SSG;
            }
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tone"></param>
        protected override void ApplyTimbre(TimbreBase timbre)
        {
            YMF262Timbre tim = (YMF262Timbre)timbre;

            this.timbre = tim;

            this["General"].Target = tim;
            ((RegisterValue)this["General"]["ALG"]).Value = tim.ALG;
            ((RegisterValue)this["General"]["FB"]).Value  = tim.FB;
            ((RegisterFlag)this["General"]["GlobalSettings.EN"]).Value           = tim.GlobalSettings.Enable;
            ((RegisterValue)this["General"]["GlobalSettings.DAM"]).NullableValue = tim.GlobalSettings.DAM;
            ((RegisterValue)this["General"]["GlobalSettings.DVB"]).NullableValue = tim.GlobalSettings.DVB;
            for (int i = 0; i < 4; i++)
            {
                this["Operator " + (i + 1)].Target = tim.Ops[i];
                ((RegisterValue)this["Operator " + (i + 1)]["AR"]).Value         = tim.Ops[i].AR;
                ((RegisterValue)this["Operator " + (i + 1)]["DR"]).Value         = tim.Ops[i].DR;
                ((RegisterValue)this["Operator " + (i + 1)]["RR"]).Value         = tim.Ops[i].RR;
                ((RegisterValue)this["Operator " + (i + 1)]["SL"]).Value         = tim.Ops[i].SL;
                ((RegisterValue)this["Operator " + (i + 1)]["SR"]).NullableValue = tim.Ops[i].SR;
                ((RegisterValue)this["Operator " + (i + 1)]["TL"]).Value         = tim.Ops[i].TL;
                ((RegisterValue)this["Operator " + (i + 1)]["KSL"]).Value        = tim.Ops[i].KSL;
                ((RegisterValue)this["Operator " + (i + 1)]["KSR"]).Value        = tim.Ops[i].KSR;
                ((RegisterValue)this["Operator " + (i + 1)]["MFM"]).Value        = tim.Ops[i].MFM;
                ((RegisterValue)this["Operator " + (i + 1)]["VIB"]).Value        = tim.Ops[i].VIB;
                ((RegisterValue)this["Operator " + (i + 1)]["EG"]).Value         = tim.Ops[i].EG;
                ((RegisterValue)this["Operator " + (i + 1)]["WS"]).Value         = tim.Ops[i].WS;
            }
        }
Example #6
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="parentModule"></param>
            /// <param name="noteOnEvent"></param>
            /// <param name="programNumber"></param>
            /// <param name="slot"></param>
            public SN76496Sound(SN76496 parentModule, SN76496SoundManager manager, TimbreBase timbre, int tindex, TaggedNoteOnEvent noteOnEvent, int slot) : base(parentModule, manager, timbre, tindex, noteOnEvent, slot)
            {
                this.parentModule = parentModule;
                this.timbre       = (SN76496Timbre)timbre;

                lastSoundType = this.timbre.SoundType;
            }
Example #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tone"></param>
        protected override void ApplyTimbre(TimbreBase timbre)
        {
            YM2414Timbre tim = (YM2414Timbre)timbre;

            this.timbre = tim;

            this["General"].Target = tim;
            ((RegisterValue)this["General"]["ALG"]).Value                          = tim.ALG;
            ((RegisterValue)this["General"]["FB"]).Value                           = tim.FB;
            ((RegisterValue)this["General"]["AMS"]).Value                          = tim.AMS;
            ((RegisterValue)this["General"]["PMS"]).Value                          = tim.PMS;
            ((RegisterValue)this["General"]["AMS2"]).Value                         = tim.AMS2;
            ((RegisterValue)this["General"]["PMS2"]).Value                         = tim.PMS2;
            ((RegisterFlag)this["General"]["GlobalSettings.EN"]).Value             = tim.GlobalSettings.Enable;
            ((RegisterValue)this["General"]["GlobalSettings.LFRQ"]).NullableValue  = tim.GlobalSettings.LFRQ;
            ((RegisterValue)this["General"]["GlobalSettings.LFRQ2"]).NullableValue = tim.GlobalSettings.LFRQ2;

            ((RegisterValue)this["General"]["GlobalSettings.LFOF"]).NullableValue  = tim.GlobalSettings.LFOF;
            ((RegisterValue)this["General"]["GlobalSettings.LFOD"]).NullableValue  = tim.GlobalSettings.LFOD;
            ((RegisterValue)this["General"]["GlobalSettings.LFOF2"]).NullableValue = tim.GlobalSettings.LFOF2;
            ((RegisterValue)this["General"]["GlobalSettings.LFOD2"]).NullableValue = tim.GlobalSettings.LFOD2;

            ((RegisterValue)this["General"]["GlobalSettings.LFD"]).NullableValue  = tim.GlobalSettings.LFD;
            ((RegisterValue)this["General"]["GlobalSettings.LFD2"]).NullableValue = tim.GlobalSettings.LFD2;

            ((RegisterValue)this["General"]["GlobalSettings.LFOW"]).NullableValue  = tim.GlobalSettings.LFOW;
            ((RegisterValue)this["General"]["GlobalSettings.LFOW2"]).NullableValue = tim.GlobalSettings.LFOW2;

            ((RegisterValue)this["General"]["GlobalSettings.SYNC"]).NullableValue  = tim.GlobalSettings.SYNC;
            ((RegisterValue)this["General"]["GlobalSettings.SYNC2"]).NullableValue = tim.GlobalSettings.SYNC2;

            for (int i = 0; i < 4; i++)
            {
                this["Operator " + (i + 1)].Target = tim.Ops[i];
                ((RegisterFlag)this["Operator " + (i + 1)]["EN"]).Value    = tim.Ops[i].Enable == 0 ? false : true;
                ((RegisterValue)this["Operator " + (i + 1)]["AR"]).Value   = tim.Ops[i].AR;
                ((RegisterValue)this["Operator " + (i + 1)]["D1R"]).Value  = tim.Ops[i].D1R;
                ((RegisterValue)this["Operator " + (i + 1)]["D2R"]).Value  = tim.Ops[i].D2R;
                ((RegisterValue)this["Operator " + (i + 1)]["RR"]).Value   = tim.Ops[i].RR;
                ((RegisterValue)this["Operator " + (i + 1)]["SL"]).Value   = tim.Ops[i].SL;
                ((RegisterValue)this["Operator " + (i + 1)]["TL"]).Value   = tim.Ops[i].TL;
                ((RegisterValue)this["Operator " + (i + 1)]["RS"]).Value   = tim.Ops[i].RS;
                ((RegisterValue)this["Operator " + (i + 1)]["MUL"]).Value  = tim.Ops[i].MUL;
                ((RegisterValue)this["Operator " + (i + 1)]["DT1"]).Value  = tim.Ops[i].DT1;
                ((RegisterValue)this["Operator " + (i + 1)]["AM"]).Value   = tim.Ops[i].AM;
                ((RegisterValue)this["Operator " + (i + 1)]["DT2"]).Value  = tim.Ops[i].DT2;
                ((RegisterValue)this["Operator " + (i + 1)]["FINE"]).Value = tim.Ops[i].FINE;
                ((RegisterValue)this["Operator " + (i + 1)]["FIX"]).Value  = tim.Ops[i].FIX;
                ((RegisterValue)this["Operator " + (i + 1)]["FIXR"]).Value = tim.Ops[i].FIXR;
                ((RegisterValue)this["Operator " + (i + 1)]["FIXF"]).Value = tim.Ops[i].FIXF;
                ((RegisterValue)this["Operator " + (i + 1)]["OSCW"]).Value = tim.Ops[i].OSCW;
                ((RegisterValue)this["Operator " + (i + 1)]["EGSF"]).Value = tim.Ops[i].EGSF;
                ((RegisterValue)this["Operator " + (i + 1)]["REV"]).Value  = tim.Ops[i].REV;
                ((RegisterValue)this["Operator " + (i + 1)]["LS"]).Value   = tim.Ops[i].LS;
                ((RegisterValue)this["Operator " + (i + 1)]["KVS"]).Value  = tim.Ops[i].KVS;
            }
        }
Example #8
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="parentModule"></param>
            /// <param name="noteOnEvent"></param>
            /// <param name="programNumber"></param>
            /// <param name="slot"></param>
            public GbSound(GB_APU parentModule, GBSoundManager manager, TimbreBase timbre, int tindex, TaggedNoteOnEvent noteOnEvent, int slot) : base(parentModule, manager, timbre, tindex, noteOnEvent, slot)
            {
                this.parentModule = parentModule;
                this.timbre       = (GBAPUTimbre)timbre;

                lastSoundType = this.timbre.SoundType;
                if (lastSoundType == SoundType.PSG && this.timbre.PartialReserveSPSG)
                {
                    partialReserveSpsg = 1;
                }
            }
Example #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tone"></param>
        protected override void ApplyTone(TimbreBase timbre, Tone tone)
        {
            YM3812Timbre tim = (YM3812Timbre)timbre;

            bool native = false;

            if (tone.CNT == -1)
            {
                tim.ALG = (byte)tone.AL;
            }
            else
            {
                tim.ALG = (byte)tone.CNT;
                native  = true;
            }

            tim.FB = (byte)tone.FB;
            tim.GlobalSettings.Enable = false;
            tim.GlobalSettings.AMD    = null;
            tim.GlobalSettings.VIB    = null;

            for (int i = 0; i < 2; i++)
            {
                if (!native)
                {
                    tim.Ops[i].AR = (byte)(tone.aOp[i].AR / 2);
                    tim.Ops[i].DR = (byte)(tone.aOp[i].DR / 2);
                    tim.Ops[i].SR = (byte)(tone.aOp[i].SR / 2);
                    tim.Ops[i].TL = (byte)(tone.aOp[i].TL / 2);
                }
                else
                {
                    tim.Ops[i].AR = (byte)(tone.aOp[i].AR);
                    tim.Ops[i].DR = (byte)(tone.aOp[i].DR);
                    tim.Ops[i].SR = null;
                    tim.Ops[i].TL = (byte)(tone.aOp[i].TL);
                }
                tim.Ops[i].RR  = (byte)tone.aOp[i].RR;
                tim.Ops[i].SL  = (byte)tone.aOp[i].SL;
                tim.Ops[i].KSL = (byte)tone.aOp[i].KS;
                tim.Ops[i].KSR = 0;
                tim.Ops[i].MFM = (byte)tone.aOp[i].ML;
                tim.Ops[i].AM  = (byte)tone.aOp[i].AM;
                tim.Ops[i].VR  = 0;
                tim.Ops[i].EG  = 0;
                tim.Ops[i].WS  = 0;
            }
            timbre.TimbreName = tone.Name;
        }
Example #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tone"></param>
        protected override void ApplyTone(TimbreBase timbre, Tone tone)
        {
            YM2151Timbre tim = (YM2151Timbre)timbre;

            tim.ALG = (byte)tone.AL;
            tim.FB  = (byte)tone.FB;
            tim.AMS = (byte)tone.AMS;
            tim.PMS = (byte)tone.PMS;
            tim.GlobalSettings.Enable = false;
            tim.GlobalSettings.LFRQ   = (byte?)tone.LFRQ;
            tim.GlobalSettings.LFOF   = (byte?)tone.LFOF;
            tim.GlobalSettings.LFOD   = (byte?)tone.LFOD;
            tim.GlobalSettings.LFOW   = (byte?)tone.LFOW;
            tim.GlobalSettings.NE     = (byte?)tone.NE;
            tim.GlobalSettings.NFRQ   = (byte?)tone.NF;
            if (tim.GlobalSettings.NE > 0 ||
                tim.GlobalSettings.LFRQ > 0 ||
                tim.GlobalSettings.LFOW > 0 ||
                tim.GlobalSettings.LFOD > 0
                )
            {
                tim.GlobalSettings.Enable = true;
            }

            for (int i = 0; i < 4; i++)
            {
                tim.Ops[i].Enable = 1;
                tim.Ops[i].AR     = (byte)tone.aOp[i].AR;
                tim.Ops[i].D1R    = (byte)tone.aOp[i].DR;
                tim.Ops[i].D2R    = tone.aOp[i].SR < 0 ? (byte)0 : (byte)tone.aOp[i].SR;
                tim.Ops[i].RR     = (byte)tone.aOp[i].RR;
                tim.Ops[i].SL     = (byte)tone.aOp[i].SL;
                tim.Ops[i].TL     = (byte)tone.aOp[i].TL;
                tim.Ops[i].RS     = (byte)tone.aOp[i].KS;
                tim.Ops[i].MUL    = (byte)tone.aOp[i].ML;
                tim.Ops[i].DT1    = (byte)tone.aOp[i].DT;
                tim.Ops[i].AM     = (byte)tone.aOp[i].AM;
                tim.Ops[i].DT2    = (byte)tone.aOp[i].DT2;
            }
            timbre.TimbreName = tone.Name;
        }
Example #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tone"></param>
        protected override void ApplyTimbre(TimbreBase timbre)
        {
            YM2413Timbre tim = (YM2413Timbre)timbre;

            this.timbre = tim;

            this["General"].Target = tim;
            ((RegisterValue)this["General"]["FB"]).Value  = tim.FB;
            ((RegisterValue)this["General"]["SUS"]).Value = tim.SUS;

            this["Modulator"].Target = tim.Modulator;
            ((RegisterValue)this["Modulator"]["AR"]).Value         = tim.Modulator.AR;
            ((RegisterValue)this["Modulator"]["DR"]).Value         = tim.Modulator.DR;
            ((RegisterValue)this["Modulator"]["RR"]).Value         = tim.Modulator.RR;
            ((RegisterValue)this["Modulator"]["SL"]).Value         = tim.Modulator.SL;
            ((RegisterValue)this["Modulator"]["SR"]).NullableValue = tim.Modulator.SR;
            ((RegisterValue)this["Modulator"]["TL"]).Value         = tim.Modulator.TL;
            ((RegisterValue)this["Modulator"]["KSL"]).Value        = tim.Modulator.KSL;
            ((RegisterValue)this["Modulator"]["KSR"]).Value        = tim.Modulator.KSR;
            ((RegisterValue)this["Modulator"]["MUL"]).Value        = tim.Modulator.MUL;
            ((RegisterValue)this["Modulator"]["AM"]).Value         = tim.Modulator.AM;
            ((RegisterValue)this["Modulator"]["VIB"]).Value        = tim.Modulator.VIB;
            ((RegisterValue)this["Modulator"]["EG"]).Value         = tim.Modulator.EG;
            ((RegisterValue)this["Modulator"]["DIST"]).Value       = tim.Modulator.DIST;

            this["Career"].Target = tim.Career;
            ((RegisterValue)this["Career"]["AR"]).Value         = tim.Career.AR;
            ((RegisterValue)this["Career"]["DR"]).Value         = tim.Career.DR;
            ((RegisterValue)this["Career"]["RR"]).Value         = tim.Career.RR;
            ((RegisterValue)this["Career"]["SL"]).Value         = tim.Career.SL;
            ((RegisterValue)this["Career"]["SR"]).NullableValue = tim.Career.SR;
            ((RegisterValue)this["Career"]["KSL"]).Value        = tim.Career.KSL;
            ((RegisterValue)this["Career"]["KSR"]).Value        = tim.Career.KSR;
            ((RegisterValue)this["Career"]["MUL"]).Value        = tim.Career.MUL;
            ((RegisterValue)this["Career"]["AM"]).Value         = tim.Career.AM;
            ((RegisterValue)this["Career"]["VIB"]).Value        = tim.Career.VIB;
            ((RegisterValue)this["Career"]["EG"]).Value         = tim.Career.EG;
            ((RegisterValue)this["Career"]["DIST"]).Value       = tim.Career.DIST;
        }
Example #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tone"></param>
        protected override void ApplyTone(TimbreBase timbre, Tone tone)
        {
            YM2413Timbre tim = (YM2413Timbre)timbre;

            tim.FB  = (byte)tone.FB;
            tim.SUS = 0;

            tim.Modulator.AR   = (byte)(tone.aOp[0].AR / 2);
            tim.Modulator.DR   = (byte)(tone.aOp[0].DR / 2);
            tim.Modulator.RR   = (byte)(tone.aOp[0].RR);
            tim.Modulator.SL   = (byte)(tone.aOp[0].SL);
            tim.Modulator.SR   = (byte)(tone.aOp[0].SR / 2);
            tim.Modulator.TL   = (byte)(tone.aOp[0].TL / 2);
            tim.Modulator.KSL  = (byte)(tone.aOp[0].KS);
            tim.Modulator.KSR  = (byte)(0);
            tim.Modulator.MUL  = (byte)(tone.aOp[0].ML);
            tim.Modulator.AM   = (byte)(tone.aOp[0].AM);
            tim.Modulator.VIB  = (byte)(0);
            tim.Modulator.EG   = (byte)(0);
            tim.Modulator.DIST = (byte)(0);

            tim.Career.AR   = (byte)(tone.aOp[1].AR / 2);
            tim.Career.DR   = (byte)(tone.aOp[1].DR / 2);
            tim.Career.RR   = (byte)(tone.aOp[1].RR);
            tim.Career.SL   = (byte)(tone.aOp[1].SL);
            tim.Career.SR   = (byte)(tone.aOp[1].SR / 2);
            tim.Career.KSL  = (byte)(tone.aOp[1].KS);
            tim.Career.KSR  = (byte)(0);
            tim.Career.MUL  = (byte)(tone.aOp[1].ML);
            tim.Career.AM   = (byte)(tone.aOp[1].AM);
            tim.Career.VIB  = (byte)(0);
            tim.Career.EG   = (byte)(0);
            tim.Career.DIST = (byte)(0);

            timbre.TimbreName = tone.Name;
        }
Example #13
0
 public TimbreItem(TimbreBase timbre, int number)
 {
     Timbre = timbre;
     Number = number;
 }
Example #14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tone"></param>
        protected override void ApplyTone(TimbreBase timbre, Tone tone)
        {
            YM2414Timbre tim = (YM2414Timbre)timbre;

            tim.ALG  = (byte)tone.AL;
            tim.FB   = (byte)tone.FB;
            tim.AMS  = (byte)tone.AMS;
            tim.PMS  = (byte)tone.PMS;
            tim.AMS2 = (byte)tone.AMS2;
            tim.PMS2 = (byte)tone.PMS2;

            tim.GlobalSettings.NE   = (byte?)tone.NE;
            tim.GlobalSettings.NFRQ = (byte?)tone.NF;

            tim.GlobalSettings.LFRQ  = (byte?)tone.LFRQ;
            tim.GlobalSettings.LFRQ2 = (byte?)tone.LFRQ2;
            tim.GlobalSettings.LFOF  = (byte?)tone.LFOF;
            tim.GlobalSettings.LFOD  = (byte?)tone.LFOD;
            tim.GlobalSettings.LFOF2 = (byte?)tone.LFOF2;
            tim.GlobalSettings.LFOD2 = (byte?)tone.LFOD2;
            tim.GlobalSettings.LFOW  = (byte?)tone.LFOW;
            tim.GlobalSettings.LFOW2 = (byte?)tone.LFOW2;

            tim.GlobalSettings.LFD  = (byte?)tone.LFD;
            tim.GlobalSettings.LFD2 = (byte?)tone.LFD2;

            tim.GlobalSettings.SYNC  = (byte?)tone.SY;
            tim.GlobalSettings.SYNC2 = (byte?)tone.SY2;

            if (tim.GlobalSettings.NE > 0 ||
                tim.GlobalSettings.LFRQ > 0 ||
                tim.GlobalSettings.LFRQ2 > 0 ||
                tim.GlobalSettings.LFOW > 0 ||
                tim.GlobalSettings.LFOW2 > 0 ||
                tim.GlobalSettings.LFOD > 0 ||
                tim.GlobalSettings.LFOD2 > 0
                )
            {
                tim.GlobalSettings.Enable = true;
            }

            for (int i = 0; i < 4; i++)
            {
                tim.Ops[i].Enable = 1;
                tim.Ops[i].AR     = (byte)tone.aOp[i].AR;
                tim.Ops[i].D1R    = (byte)tone.aOp[i].DR;
                tim.Ops[i].D2R    = tone.aOp[i].SR < 0 ? (byte)0 : (byte)tone.aOp[i].SR;
                tim.Ops[i].RR     = (byte)tone.aOp[i].RR;
                tim.Ops[i].SL     = (byte)tone.aOp[i].SL;
                tim.Ops[i].TL     = (byte)tone.aOp[i].TL;
                tim.Ops[i].RS     = (byte)tone.aOp[i].KS;
                tim.Ops[i].MUL    = (byte)tone.aOp[i].ML;
                tim.Ops[i].DT1    = (byte)tone.aOp[i].DT;
                tim.Ops[i].AM     = (byte)tone.aOp[i].AM;
                tim.Ops[i].DT2    = (byte)tone.aOp[i].DT2;
                tim.Ops[i].FINE   = (byte)tone.aOp[i].FINE;
                tim.Ops[i].FIX    = (byte)tone.aOp[i].FIX;
                tim.Ops[i].FIXR   = (byte)tone.aOp[i].FIXR;
                tim.Ops[i].FIXF   = (byte)tone.aOp[i].FIXF;
                tim.Ops[i].OSCW   = (byte)tone.aOp[i].OSCW;
                tim.Ops[i].EGSF   = (byte)tone.aOp[i].EGSF;
                tim.Ops[i].REV    = (byte)tone.aOp[i].REV;
                tim.Ops[i].LS     = (byte)tone.aOp[i].LS;
                tim.Ops[i].KVS    = (byte)tone.aOp[i].KVS;
            }
            timbre.TimbreName = tone.Name;
        }
Example #15
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="noteOnEvent"></param>
 public NoteOnTimbreInfo(TimbreBase timbre, int timbreNo)
 {
     Timbre   = timbre;
     TimbreNo = timbreNo;
 }
Example #16
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;
 }
Example #17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tone"></param>
        protected override void ApplyTone(TimbreBase timbre, Tone tone)
        {
            YMF262Timbre tim = (YMF262Timbre)timbre;

            int  alg    = 0;
            bool native = false;

            if (tone.CNT == -1)
            {
                switch (tone.AL)
                {
                case 0:
                    alg = 2;
                    break;

                case 1:
                    alg = 4;        //?
                    break;

                case 2:
                    alg = 4;        //?
                    break;

                case 3:
                    alg = 3;        //?
                    break;

                case 4:
                    alg = 3;
                    break;

                case 5:
                    alg = 5;        //?
                    break;

                case 6:
                    alg = 5;        //?
                    break;

                case 7:
                    alg = 5;
                    break;
                }
            }
            else
            {
                alg    = tone.CNT;
                native = true;
            }

            tim.ALG = (byte)alg;
            tim.FB  = (byte)tone.FB;
            tim.FB2 = (byte)tone.FB2;
            tim.GlobalSettings.Enable = false;
            tim.GlobalSettings.DAM    = null;
            tim.GlobalSettings.DVB    = null;

            for (int i = 0; i < 3; i++)
            {
                if (!native)
                {
                    tim.Ops[i].AR = (byte)(tone.aOp[i].AR / 2);
                    tim.Ops[i].DR = (byte)(tone.aOp[i].DR / 2);
                    tim.Ops[i].SR = (byte)(tone.aOp[i].SR / 2);
                    tim.Ops[i].TL = (byte)(tone.aOp[i].TL / 2);
                }
                else
                {
                    tim.Ops[i].AR = (byte)(tone.aOp[i].AR);
                    tim.Ops[i].DR = (byte)(tone.aOp[i].DR);
                    tim.Ops[i].SR = null;
                    tim.Ops[i].TL = (byte)(tone.aOp[i].TL);
                }
                tim.Ops[i].RR  = (byte)tone.aOp[i].RR;
                tim.Ops[i].SL  = (byte)tone.aOp[i].SL;
                tim.Ops[i].KSL = (byte)tone.aOp[i].KS;
                tim.Ops[i].KSR = (byte)tone.aOp[i].KSR;
                tim.Ops[i].MFM = (byte)tone.aOp[i].ML;
                tim.Ops[i].AM  = (byte)tone.aOp[i].AM;
                tim.Ops[i].VIB = (byte)tone.aOp[i].VIB;
                tim.Ops[i].EG  = (byte)tone.aOp[i].EG;
                tim.Ops[i].WS  = (byte)tone.aOp[i].WS;
            }

            tim.MDS.KeyShift   = tone.KeyShift;
            tim.MDS.PitchShift = tone.PitchShift;
            timbre.TimbreName  = tone.Name;
        }
Example #18
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="parentModule"></param>
 /// <param name="noteOnEvent"></param>
 /// <param name="programNumber"></param>
 /// <param name="slot"></param>
 public BeepSound(Beep parentModule, BeepSoundManager manager, TimbreBase timbre, int tindex, TaggedNoteOnEvent noteOnEvent, int slot) : base(parentModule, manager, timbre, tindex, noteOnEvent, slot)
 {
     this.parentModule = parentModule;
     this.timbre       = (BeepTimbre)timbre;
 }
Example #19
0
        /// <summary>
        ///
        /// </summary>
        public FormFmEditor(InstrumentBase inst, TimbreBase timbre, bool singleSelect)
        {
            InitializeComponent();

            this.singleSelect = singleSelect;

            for (int nn = 0; nn < 128; nn++)
            {
                toolStripComboBoxNote.Items.Add(MidiManager.GetNoteName((SevenBitNumber)nn) + "(" + nn + ")");
                toolStripComboBoxVelo.Items.Add(nn);
            }

            toolStripComboBoxNote.SelectedIndex = 60;
            toolStripComboBoxVelo.SelectedIndex = 127;
            toolStripComboBoxGate.SelectedIndex = 0;
            toolStripComboBoxCh.SelectedIndex   = 0;
            toolStripComboBoxCC.SelectedIndex   = 0;

            Settings.Default.SettingsLoaded    += Default_SettingsLoaded;
            toolStripButtonPlay.Checked         = Settings.Default.FmPlayOnEdit;
            toolStripButtonHook.Checked         = Settings.Default.FmHook;
            toolStripComboBoxVelo.SelectedIndex = Settings.Default.FmVelocity;
            toolStripComboBoxGate.SelectedIndex = Settings.Default.FmGateTime;
            toolStripComboBoxNote.SelectedIndex = Settings.Default.FmNote;

            if (singleSelect)
            {
                pianoControl1.TargetTimbres = new TimbreBase[] { timbre }
            }
            ;
            this.Timbre     = timbre;
            this.Instrument = inst;

            ignoreMetroComboBoxTimbres_SelectedIndexChanged = true;
            for (int i = 0; i < Instrument.BaseTimbres.Length; i++)
            {
                metroComboBoxTimbres.Items.Add(new TimbreItem(inst.BaseTimbres[i], i));
                if (inst.BaseTimbres[i] == timbre)
                {
                    TimbreNo = i;
                }
            }
            metroComboBoxTimbres.SelectedIndex = TimbreNo;
            ignoreMetroComboBoxTimbres_SelectedIndexChanged = false;

            if (singleSelect)
            {
                metroComboBoxTimbres.Enabled    = false;
                metroButtonImportAll.Enabled    = false;
                metroButtonImportAllGit.Enabled = false;
            }

            setTitle();

            InstrumentManager.InstrumentChanged += InstrumentManager_InstrumentChanged;
            InstrumentManager.InstrumentRemoved += InstrumentManager_InstrumentRemoved;

            pianoControl1.NoteOn           += PianoControl1_NoteOn;
            pianoControl1.NoteOff          += PianoControl1_NoteOff;
            pianoControl1.EntryDataChanged += PianoControl1_EntryDataChanged;

            Midi.MidiManager.MidiEventHooked += MidiManager_MidiEventHooked;
        }
Example #20
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="parentModule"></param>
 /// <param name="noteOnEvent"></param>
 /// <param name="programNumber"></param>
 /// <param name="slot"></param>
 public uPD1771Sound(uPD1771C parentModule, uPD1771SoundManager manager, TimbreBase timbre, int tindex, TaggedNoteOnEvent noteOnEvent, int slot) : base(parentModule, manager, timbre, tindex, noteOnEvent, slot)
 {
     this.parentModule = parentModule;
     this.timbre       = (uPD1771Timbre)timbre;
 }
Example #21
0
 /// <summary>
 ///
 /// </summary>
 public FormFmEditor(InstrumentBase inst, TimbreBase timbre) : this(inst, timbre, true)
 {
 }
Example #22
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="parentModule"></param>
 /// <param name="noteOnEvent"></param>
 /// <param name="programNumber"></param>
 /// <param name="slot"></param>
 public NAMCO_CUS30Sound(NAMCO_CUS30 parentModule, NAMCO_CUS30SoundManager manager, TimbreBase timbre, int tindex, TaggedNoteOnEvent noteOnEvent, int slot) : base(parentModule, manager, timbre, tindex, noteOnEvent, slot)
 {
     this.parentModule = parentModule;
     this.timbre       = (NAMCO_CUS30Timbre)timbre;
 }
Example #23
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="tone"></param>
 protected virtual void ApplyTimbre(TimbreBase timbre)
 {
     //nothing
 }
Example #24
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="tone"></param>
 protected virtual void ApplyTone(TimbreBase timbre, Tone tone)
 {
     //nothing
 }
Example #25
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="parentModule"></param>
 /// <param name="noteOnEvent"></param>
 /// <param name="programNumber"></param>
 /// <param name="slot"></param>
 public MT32Sound(MT32 parentModule, MT32SoundManager manager, TimbreBase timbre, int tindex, TaggedNoteOnEvent noteOnEvent, int slot) : base(parentModule, manager, timbre, tindex, noteOnEvent, slot)
 {
     this.parentModule  = parentModule;
     this.programNumber = (SevenBitNumber)parentModule.ProgramNumbers[noteOnEvent.Channel];
     this.timbre        = (MT32Timbre)timbre;
 }