示例#1
0
        public bool InitOpen(string fullPath, string[] buf, EnmMmlFileFormat srcFileFormat)
        {
            fullPath = fullPath.Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar);

            if (buf == null || buf.Length < 1)
            {
                return(false);
            }

            gwiFullPath = fullPath;
            errBox      = null;
            wrnBox      = null;
            InitFolderTree();
            editor.Text              = Path.GetFileName(fullPath);
            this.srcFileFormat       = srcFileFormat;
            editor.azukiControl.Text = string.Join("\r\n", buf);
            editor.azukiControl.ClearHistory();
            editor.Tag = this;
            editor.azukiControl.Tag = this;
            isNew = false;
            edit  = false;

            compileStatus = EnmCompileStatus.NeedCompile;
            dstFileFormat = EnmFileFormat.unknown;
            compiledData  = null;
            return(true);
        }
示例#2
0
        public void Init(bool isTrace, EnmMmlFileFormat mmlFileFormat, MIDIKbd midiKbd)
        {
            this.isTrace       = isTrace;
            this.mmlFileFormat = mmlFileFormat;
            this.midiKbd       = midiKbd;

            dicInst.Clear();
            Insts = new Dictionary <string, Dictionary <int, Dictionary <int, Instrument> > >();

            Conductor.Clear();
            AY8910.Clear();
            C140.Clear();
            HuC6280.Clear();
            K051649.Clear();
            K053260.Clear();
            QSound.Clear();
            RF5C164.Clear();
            SN76489.Clear();
            SegaPCM.Clear();
            YM2151.Clear();
            YM2203.Clear();
            YM2413.Clear();
            YM3526.Clear();
            Y8950.Clear();
            YM3812.Clear();
            YMF262.Clear();
            YM2608.Clear();
            YM2609.Clear();
            YM2610B.Clear();
            YM2612.Clear();
            YM2612X.Clear();
            PPZ8.Clear();
            VRC6.Clear();
            Gigatron.Clear();
        }
示例#3
0
        public bool InitOpen(string fullPath)
        {
            fullPath = fullPath.Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar);

            if (!File.Exists(fullPath))
            {
                return(false);
            }

            gwiFullPath = fullPath;
            errBox      = null;
            wrnBox      = null;
            InitFolderTree();
            editor.Text = Path.GetFileName(fullPath);
            switch (Path.GetExtension(fullPath).ToLower())
            {
            case ".muc":
                srcFileFormat            = EnmMmlFileFormat.MUC;
                editor.azukiControl.Text = File.ReadAllText(fullPath, Encoding.GetEncoding(932));
                break;

            case ".mml":
                srcFileFormat            = EnmMmlFileFormat.MML;
                editor.azukiControl.Text = File.ReadAllText(fullPath, Encoding.GetEncoding(932));
                break;

            case ".mdl":
                srcFileFormat            = EnmMmlFileFormat.MDL;
                editor.azukiControl.Text = File.ReadAllText(fullPath, Encoding.GetEncoding(932));
                break;

            case ".gwi":
            default:
                srcFileFormat            = EnmMmlFileFormat.GWI;
                editor.azukiControl.Text = File.ReadAllText(fullPath);
                break;
            }
            editor.azukiControl.ClearHistory();
            editor.Tag = this;
            editor.azukiControl.Tag = this;
            isNew = false;
            edit  = false;

            compileStatus = EnmCompileStatus.NeedCompile;
            dstFileFormat = EnmFileFormat.unknown;
            compiledData  = null;
            return(true);
        }
示例#4
0
 public void Request(string line, Point ciP, int parentID, EnmMmlFileFormat tp, object option)
 {
     Location = new Point(ciP.X, ciP.Y);
     //dgvItem.Rows.Clear();
     ss.Request(
         line,
         cbUpdateList,
         parentID,
         tp == EnmMmlFileFormat.GWI ? ".gwi" : (
             tp == EnmMmlFileFormat.MUC ? ".muc" : (
                 tp == EnmMmlFileFormat.MML ? ".mml" :
                 ""
                 )),
         option
         );
 }
示例#5
0
        public Document(Setting setting, bool isMUC)
        {
            gwiFullPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "(新規mmlファイル).gwi");
            errBox      = null;
            wrnBox      = null;
            InitFolderTree();
            editor      = new FrmEditor(setting, isMUC);
            editor.Text = Path.GetFileName(gwiFullPath + "*");
            string filename = Path.Combine(System.Windows.Forms.Application.StartupPath, "Template.gwi");

            editor.azukiControl.Text = "";
            try { editor.azukiControl.Text = File.ReadAllText(filename); } catch {; }
            editor.azukiControl.ClearHistory();
            editor.Tag = this;
            editor.azukiControl.Tag = this;
            isNew         = true;
            edit          = false;
            compileStatus = EnmCompileStatus.None;
            srcFileFormat = EnmMmlFileFormat.GWI;
            dstFileFormat = EnmFileFormat.unknown;
            compiledData  = null;
        }
示例#6
0
        public FrmReplaceBox(Setting setting, FrmEditor frmEditor)
        {
            InitializeComponent();
            DialogResult               = DialogResult.Cancel;
            this.BackColor             = Color.FromArgb(setting.ColorScheme.SearchBox_BackColor);
            this.ForeColor             = Color.FromArgb(setting.ColorScheme.SearchBox_ForeColor);
            this.cmbFrom.BackColor     = Color.FromArgb(setting.ColorScheme.SearchBox_BackColor);
            this.cmbFrom.ForeColor     = Color.FromArgb(setting.ColorScheme.SearchBox_ForeColor);
            this.cmbTo.BackColor       = Color.FromArgb(setting.ColorScheme.SearchBox_BackColor);
            this.cmbTo.ForeColor       = Color.FromArgb(setting.ColorScheme.SearchBox_ForeColor);
            this.btnPrevious.BackColor = Color.FromArgb(setting.ColorScheme.SearchBox_BackColor);
            this.btnPrevious.ForeColor = Color.FromArgb(setting.ColorScheme.SearchBox_ForeColor);
            this.btnNext.BackColor     = Color.FromArgb(setting.ColorScheme.SearchBox_BackColor);
            this.btnNext.ForeColor     = Color.FromArgb(setting.ColorScheme.SearchBox_ForeColor);
            this.groupBox2.BackColor   = Color.FromArgb(setting.ColorScheme.SearchBox_BackColor);
            this.groupBox2.ForeColor   = Color.FromArgb(setting.ColorScheme.SearchBox_ForeColor);

            this.cmbFrom.Items.AddRange(setting.other.SearchWordHistory.ToArray());
            this.cmbTo.Items.AddRange(setting.other.ReplaceToWordHistory.ToArray());
            ac           = frmEditor.azukiControl;
            fmt          = frmEditor.fmt;
            this.setting = setting;
        }
示例#7
0
        private string Analysis2(EnmMmlFileFormat fmt)
        {
            string waveFileName = tbWaveFileName.Text;
            int    samplerate   = int.Parse(tbSampleRate.Text);
            int    analyzeSize  = int.Parse(tbAnalyzeSize.Text);
            float  tempo        = float.Parse(tbTempo.Text);
            int    reso         = int.Parse(tbReso.Text);
            float  tlMul        = float.Parse(tbTLlevelMul.Text);
            int    indLen       = (int)(samplerate * 60.0 * 4.0 / (tempo * reso));

            Tool.CSM.FFT fft = new Tool.CSM.FFT(analyzeSize, samplerate);
            float[]      dat;
            using (WaveFileReader reader = new WaveFileReader(waveFileName))
            {
                dat = fft.ReadWave(reader);
            }
            int index = 0;

            string result;

            if (fmt == EnmMmlFileFormat.MUC)
            {
                result = string.Format("C C128 T{0} @2v15 S0,0,0,0 l{1}y$28,$F2 ; 4opの音色をセットしてね\r\n", tempo, reso);

                while (index < dat.Length)
                {
                    List <Tool.CSM.FFT.Result> lst = new List <Tool.CSM.FFT.Result>();

                    Complex[] trg = fft.GetTargetDat(dat, index);

                    while (true)
                    {
                        Complex[] fres = fft.FFTProcess2(trg, 0, out float[] res);
                        int       peek = fft.GetPeek(res, out Tool.CSM.FFT.Result val);
                        lst.Add(val);
                        if (lst.Count == 16)
                        {
                            break;
                        }

                        fres = fft.MakePeek(fres, peek);        //ピークのみのデータを作成
                        Complex[] rres = fft.RFFTProcess(fres); //逆フーリエ
                        fft.DecDat(trg, rres);                  //ターゲットのデータからrresを減算
                    }

                    lst = fft.VoiceFilter(lst);

                    fft.CalcFnumTl(lst, tlMul);
                    string r = "C "
                               + string.Format(" y$AD,${0:X02} y$A9,${1:X02} ", (byte)(lst[0].fnum >> 8), (byte)lst[0].fnum)
                               + string.Format(" y$AC,${0:X02} y$A8,${1:X02} ", (byte)(lst[2].fnum >> 8), (byte)lst[2].fnum)
                               + string.Format(" y$AE,${0:X02} y$AA,${1:X02} ", (byte)(lst[1].fnum >> 8), (byte)lst[1].fnum)
                               + string.Format(" y$A6,${0:X02} y$A2,${1:X02} ", (byte)(lst[3].fnum >> 8), (byte)lst[3].fnum)
                               + string.Format(" y$42,${0:X02}", (byte)lst[0].tl)
                               + string.Format(" y$4A,${0:X02}", (byte)lst[2].tl)
                               + string.Format(" y$46,${0:X02}", (byte)lst[1].tl)
                               + string.Format(" y$4E,${0:X02}", (byte)lst[3].tl)
                               + " r \r\n";

                    result += r;
                    index  += indLen;
                }

                result += "C y$28,$02 \r\n";
            }
            else
            {
                result = string.Format("'N3 T{0}@111EXONEX1234l{1}y$28,$F2 ; 4opの音色をセットしてね\r\n", tempo, reso);

                while (index < dat.Length)
                {
                    List <Tool.CSM.FFT.Result> lst = new List <Tool.CSM.FFT.Result>();

                    Complex[] trg = fft.GetTargetDat(dat, index);

                    while (true)
                    {
                        Complex[] fres = fft.FFTProcess2(trg, 0, out float[] res);
                        int       peek = fft.GetPeek(res, out Tool.CSM.FFT.Result val);
                        lst.Add(val);
                        if (lst.Count == 16)
                        {
                            break;
                        }

                        fres = fft.MakePeek(fres, peek);        //ピークのみのデータを作成
                        Complex[] rres = fft.RFFTProcess(fres); //逆フーリエ
                        fft.DecDat(trg, rres);                  //ターゲットのデータからrresを減算
                    }

                    //string f = "; ";
                    //foreach(Tool.CSM.FFT.Result val in lst)
                    //{
                    //    f += string.Format(" {0}Hz", val.freq);
                    //}
                    //f += "\r\n";
                    lst = fft.VoiceFilter(lst);
                    //f += "filter ";
                    //foreach (Tool.CSM.FFT.Result val in lst)
                    //{
                    //    f += string.Format(" {0}Hz", val.freq);
                    //}
                    //f += "\r\n";

                    fft.CalcFnumTl(lst, tlMul);
                    string r = "'N3 "
                               + string.Format(" y$AD,${0:X02} y$A9,${1:X02} ", (byte)(lst[0].fnum >> 8), (byte)lst[0].fnum)
                               + string.Format(" y$AC,${0:X02} y$A8,${1:X02} ", (byte)(lst[2].fnum >> 8), (byte)lst[2].fnum)
                               + string.Format(" y$AE,${0:X02} y$AA,${1:X02} ", (byte)(lst[1].fnum >> 8), (byte)lst[1].fnum)
                               + string.Format(" y$A6,${0:X02} y$A2,${1:X02} ", (byte)(lst[3].fnum >> 8), (byte)lst[3].fnum)
                               + string.Format(" y$42,${0:X02}", (byte)lst[0].tl)
                               + string.Format(" y$4A,${0:X02}", (byte)lst[2].tl)
                               + string.Format(" y$46,${0:X02}", (byte)lst[1].tl)
                               + string.Format(" y$4E,${0:X02}", (byte)lst[3].tl)
                               + " R \r\n";

                    result += r;
                    //fresult += f;
                    index += indLen;
                }

                result += "'N3 y$28,$02 EXOF\r\n";
                //result += fresult;
            }

            return(result);
        }