Example #1
0
        static InputReplay Build(ASIPOptions asipOptions)
        {
            Console.Write("Creating touchpad... ");
            var touchpad = new ConfigurableTouchpad(asipOptions.TouchpadConfig, asipOptions.SmTpadConfig.TargetTouchpadOptions, EDevicePurpose.Target);

            Console.WriteLine("OK");
            Console.Write("Calculating notes coordinates... ");
            var noteCoords = new NoteCoordinates(asipOptions.InstrumentConfig);

            noteCoords.Calculate();
            Console.WriteLine("OK");

            ISongReplayBuilder parser = asipOptions.TrackerType switch
            {
                ETrackerType.SkyStudio => new Parsers.SkyStudio.SongReplayBuilder(noteCoords, touchpad),
                ETrackerType.COTL => new Parsers.COTLTracker.SongReplayBuilder(noteCoords, touchpad),
                _ => throw new NotImplementedException()
            };

            Console.Write("Parsing... ");
            parser.Parse(asipOptions.InFilePath);
            parser.NormalizeOctaves();
            Console.WriteLine("OK");
            Console.Write("Building replay... ");
            parser.BuildTouchpad(0);

            var replayBuilder = new InputReplayBuilder(parser.TickRate)
            {
                Name   = asipOptions.SongName ?? parser.GetName(),
                Author = asipOptions.SongAuthor ?? parser.GetAuthor(),
                About  = asipOptions.SongAbout ?? parser.GetAbout() + " " + "https://asip.arkprojects.space"
            };

            replayBuilder.AddDevice(touchpad);
            foreach (var devicesOptions in asipOptions.SmTpadConfig.TriggerDevicesOptions)
            {
                replayBuilder.AddDevice(new GenericTriggerDevice(devicesOptions));
            }
            var replay = replayBuilder.Build();

            Console.WriteLine("OK");
            return(replay);
        }
    }
 public SongReplayBuilder(NoteCoordinates coords, ITouchpad touchpad)
 {
     _noteCoords = coords;
     _touchpad   = touchpad;
 }
 public SongReplayBuilder(NoteCoordinates noteCoords, ITouchpad touchpad)
 {
     _noteCoords = noteCoords;
     _touchpad   = touchpad;
     TickRate    = 10;
 }