Beispiel #1
0
        static void Main(string[] args)
        {
            string inputPath, outputPath;

            if (args.Length < 1)
            {
                // Display usage
                Console.WriteLine("Usage: song.fsgmub output.mid");
                return;
            }
            else if (args.Length == 1)
            {
                // Copies arguments
                inputPath  = args[0];
                outputPath = ReplaceExtension(inputPath, ".mid");
            }
            else
            {
                inputPath  = args[0];
                outputPath = args[1];
            }

            Mub       mub = Mub.FromFile(inputPath);
            MubExport mid = new MubExport(mub);

            mid.Export(outputPath);
        }
Beispiel #2
0
        public override ChartFormat DecodeChart(FormatData data, ProgressIndicator progress)
        {
            IList <Stream> streams = GetChartStreams(data);

            float bpm = 0;

            NoteChart chart = new NoteChart();

            chart.BPM.Add(new Midi.TempoEvent(0, (uint)(Mid.MicrosecondsPerMinute / bpm)));
            chart.Signature.Add(new Midi.TimeSignatureEvent(0, 4, 2, 24, 8));

            Mub mub = null;             // TODO: Determine charts by filenames or some shit

            chart.PartGuitar = new NoteChart.Guitar(chart);
            NoteChart.Instrument instrument = chart.PartGuitar;

            NoteChart.IGems       gems = instrument as NoteChart.IGems;
            NoteChart.IForcedHopo hopo = instrument as NoteChart.IForcedHopo;

            NoteChart.Difficulty difficulty = NoteChart.Difficulty.Expert;
            int fadeposition = 0;

            foreach (Mub.Node node in mub.Nodes)
            {
                ulong          time      = (ulong)(node.Time * chart.Division.TicksPerBeat / 4);
                ulong          duration  = (ulong)(node.Duration * chart.Division.TicksPerBeat / 4);
                NoteChart.Note fullnote  = new NoteChart.Note(time, duration);
                NoteChart.Note note      = new NoteChart.Note(time, chart.Division.TicksPerBeat / 4U);
                NoteChart.Note prevnote  = new NoteChart.Note(time - chart.Division.TicksPerBeat / 2U, chart.Division.TicksPerBeat / 4U);
                int            greennote = fadeposition < 0 ? 0 : 1;
                int            bluenote  = fadeposition > 0 ? 4 : 3;

                switch (node.Type)
                {
                case 0x00:                         // Green dot
                    gems.Gems[difficulty][greennote].Add(note);
                    hopo.ForceHammeron[difficulty].Add(note);
                    break;

                case 0x01:                         // Blue dot
                    gems.Gems[difficulty][bluenote].Add(note);
                    hopo.ForceHammeron[difficulty].Add(note);
                    break;

                case 0x02:                         // Red dot
                    gems.Gems[difficulty][2].Add(note);
                    hopo.ForceHammeron[difficulty].Add(note);
                    break;

                case 0x09:                         // Blue Crossfade right
                    fadeposition = 1;
                    gems.Gems[difficulty][4].Add(note);
                    gems.Gems[difficulty][fadeposition < 0 ? 0 : 3].Add(prevnote);
                    hopo.ForceHammeron[difficulty].Add(note);
                    break;

                case 0x0A:                         // Green Crossfade left (revert to rightish normal)
                    fadeposition = 0;
                    break;

                case 0x0B:                         // Green Crossfade left
                    fadeposition = -1;
                    gems.Gems[difficulty][0].Add(note);
                    gems.Gems[difficulty][fadeposition > 0 ? 4 : 1].Add(prevnote);
                    hopo.ForceHammeron[difficulty].Add(note);
                    break;

                case 0x0C:                         // Weird whammy thing on left green
                    gems.Gems[difficulty][greennote].Add(fullnote);
                    hopo.ForceHammeron[difficulty].Add(note);
                    break;

                case 0x0D:                         // ?? Not sure, Weird whammy thing on right blue maybe
                    gems.Gems[difficulty][bluenote].Add(fullnote);
                    hopo.ForceHammeron[difficulty].Add(note);
                    break;

                default:
                    break;
                }
            }

            return(new ChartFormat(chart));
        }