Example #1
0
        private PropertyPage CreatePropertyPage(PropertyPage page, ConfigSection section)
        {
            switch (section)
            {
            case ConfigSection.UserInterface:
            {
#if FAMISTUDIO_WINDOWS
                var scalingValues = new[] { "System", "100%", "150%", "200%" };
#else
                var scalingValues = new[] { "System", "100%", "200%" };
#endif
                var idx = Settings.DpiScaling == 0 ? 0 : Array.IndexOf(scalingValues, $"{Settings.DpiScaling}%");

                page.AddStringList("Scaling (Requires Restart):", scalingValues, scalingValues[idx]); // 0
                page.AddBoolean("Check for updates:", true);                                          // 1
                break;
            }

            case ConfigSection.Sound:
            {
                page.AddIntegerRange("Stop Instruments After (sec):", Settings.InstrumentStopTime, 0, 10);     // 0
                break;
            }

            case ConfigSection.MIDI:
            {
                int midiDeviceCount = Midi.InputCount;
                var midiDevices     = new List <string>();
                for (int i = 0; i < midiDeviceCount; i++)
                {
                    midiDevices.Add(Midi.GetDeviceName(i));
                }

                var midiDevice = "";

                if (Settings.MidiDevice.Length > 0 && midiDevices.Contains(Settings.MidiDevice))
                {
                    midiDevice = Settings.MidiDevice;
                }
                else if (midiDevices.Count > 0)
                {
                    midiDevice = midiDevices[0];
                }

                page.AddStringList("Device :", midiDevices.ToArray(), midiDevice);     // 0
                break;
            }
            }

            page.Build();
            pages[(int)section] = page;

            return(page);
        }
Example #2
0
        private PropertyPage CreatePropertyPage(ExportFormat format)
        {
            PropertyPage page = new PropertyPage();

            page.Dock = DockStyle.Fill;
            panelProps.Controls.Add(page);

            var songName = GetSongNames();

            switch (format)
            {
            case ExportFormat.Wav:
                page.AddStringList("Song :", songName, songName[0]);                                        // 0
                page.AddStringList("Sample Rate :", new[] { "11025", "22050", "44100", "48000" }, "44100"); // 1
                break;

            case ExportFormat.Nsf:
                page.AddString("Name :", project.Name, 31);                            // 0
                page.AddString("Artist :", project.Author, 31);                        // 1
                page.AddString("Copyright :", project.Copyright, 31);                  // 2
                page.AddStringList("Mode :", new[] { "NTSC", "PAL", "Dual" }, "NTSC"); // 3
                page.AddStringListMulti(null, songName, null);                         // 4
                page.SetPropertyEnabled(3, false);
                break;

            case ExportFormat.FamiTracker:
                page.AddStringListMulti(null, songName, null);     // 0
                break;

            case ExportFormat.FamiTone2:
                page.AddStringList("Format :", new[] { "NESASM", "CA65", "ASM6" }, "NESASM"); // 0
                page.AddBoolean("Separate Files :", false);                                   // 1
                page.AddString("Song Name Pattern :", "{project}_{song}");                    // 2
                page.AddString("DMC Name Pattern :", "{project}");                            // 3
                page.AddStringListMulti(null, songName, null);                                // 4
                page.SetPropertyEnabled(2, false);
                page.SetPropertyEnabled(3, false);
                break;
            }

            page.Build();
            page.PropertyChanged += Page_PropertyChanged;
            page.Visible          = format == 0;

            return(page);
        }
Example #3
0
        private PropertyPage CreatePropertyPage(PropertyPage page, ExportFormat format)
        {
            var songName = GetSongNames();

            switch (format)
            {
            case ExportFormat.Wav:
                page.AddStringList("Song :", songName, songName[0]);                                        // 0
                page.AddStringList("Sample Rate :", new[] { "11025", "22050", "44100", "48000" }, "44100"); // 1
                break;

            case ExportFormat.Nsf:
                page.AddString("Name :", project.Name, 31);                                                                                                          // 0
                page.AddString("Artist :", project.Author, 31);                                                                                                      // 1
                page.AddString("Copyright :", project.Copyright, 31);                                                                                                // 2
                page.AddStringList("Mode :", new[] { "NTSC", "PAL", "Dual" }, "NTSC");                                                                               // 3
                page.AddStringListMulti(null, songName, null);                                                                                                       // 4
#if DEBUG
                page.AddStringList("Kernel :", Enum.GetNames(typeof(FamitoneMusicFile.FamiToneKernel)), Enum.GetNames(typeof(FamitoneMusicFile.FamiToneKernel))[0]); // 5
#endif
                page.SetPropertyEnabled(3, false);
                break;

            case ExportFormat.FamiTracker:
                page.AddStringListMulti(null, songName, null);     // 0
                break;

            case ExportFormat.FamiTone2:
                page.AddStringList("Format :", Enum.GetNames(typeof(FamitoneMusicFile.OutputFormat)), Enum.GetNames(typeof(FamitoneMusicFile.OutputFormat))[0]); // 0
                page.AddBoolean("Separate Files :", false);                                                                                                      // 1
                page.AddString("Song Name Pattern :", "{project}_{song}");                                                                                       // 2
                page.AddString("DMC Name Pattern :", "{project}");                                                                                               // 3
                page.AddStringListMulti(null, songName, null);                                                                                                   // 4
                page.SetPropertyEnabled(2, false);
                page.SetPropertyEnabled(3, false);
                break;
            }

            page.Build();
            page.PropertyChanged += Page_PropertyChanged;

            return(page);
        }
Example #4
0
        private PropertyPage CreatePropertyPage(PropertyPage page, ExportFormat format)
        {
            var songNames = GetSongNames();

            switch (format)
            {
            case ExportFormat.Wav:
                page.AddStringList("Song :", songNames, songNames[0]);                                      // 0
                page.AddStringList("Sample Rate :", new[] { "11025", "22050", "44100", "48000" }, "44100"); // 1
                break;

            case ExportFormat.Nsf:
                page.AddString("Name :", project.Name, 31);                                                                                                          // 0
                page.AddString("Artist :", project.Author, 31);                                                                                                      // 1
                page.AddString("Copyright :", project.Copyright, 31);                                                                                                // 2
                page.AddStringList("Mode :", Enum.GetNames(typeof(MachineType)), Enum.GetNames(typeof(MachineType))[0]);                                             // 3
                page.AddStringListMulti(null, songNames, null);                                                                                                      // 4
#if DEBUG
                page.AddStringList("Engine :", Enum.GetNames(typeof(FamitoneMusicFile.FamiToneKernel)), Enum.GetNames(typeof(FamitoneMusicFile.FamiToneKernel))[0]); // 5
#endif
                page.SetPropertyEnabled(3, !project.UsesExpansionAudio);
                break;

            case ExportFormat.Rom:
                page.AddString("Name :", project.Name.Substring(0, Math.Min(28, project.Name.Length)), 28);       // 0
                page.AddString("Artist :", project.Author.Substring(0, Math.Min(28, project.Author.Length)), 28); // 1
                page.AddStringListMulti(null, songNames, null);                                                   // 2
                break;

            case ExportFormat.Text:
                page.AddStringListMulti(null, songNames, null);     // 0
                break;

            case ExportFormat.FamiTracker:
                page.AddStringListMulti(null, songNames, null);     // 0
                break;

            case ExportFormat.FamiTone2:
                page.AddStringList("Variant :", Enum.GetNames(typeof(FamitoneMusicFile.FamiToneKernel)), Enum.GetNames(typeof(FamitoneMusicFile.FamiToneKernel))[0]); // 0
                page.AddStringList("Format :", Enum.GetNames(typeof(FamitoneMusicFile.OutputFormat)), Enum.GetNames(typeof(FamitoneMusicFile.OutputFormat))[0]);      // 1
                page.AddBoolean("Separate Files :", false);                                                                                                           // 2
                page.AddString("Song Name Pattern :", "{project}_{song}");                                                                                            // 3
                page.AddString("DMC Name Pattern :", "{project}");                                                                                                    // 4
                page.AddStringListMulti(null, songNames, null);                                                                                                       // 5
                page.SetPropertyEnabled(3, false);
                page.SetPropertyEnabled(4, false);
                break;
            }

            page.Build();
            page.PropertyChanged += Page_PropertyChanged;

            return(page);
        }
Example #5
0
        private PropertyPage CreatePropertyPage(PropertyPage page, ExportFormat format)
        {
            var songNames = GetSongNames();

            switch (format)
            {
            case ExportFormat.WavMp3:
                page.AddStringList("Song :", songNames, songNames[0]);                                                    // 0
                page.AddStringList("Format :", new[] { "WAV", "MP3" }, "WAV");                                            // 1
                page.AddStringList("Sample Rate :", new[] { "11025", "22050", "44100", "48000" }, "44100");               // 2
                page.AddStringList("Bit Rate :", new[] { "96", "112", "128", "160", "192", "224", "256", "320" }, "128"); // 3
                page.AddStringList("Mode :", new[] { "Loop N times", "Duration" }, "Loop N times");                       // 4
                page.AddIntegerRange("Loop count:", 1, 1, 10);                                                            // 5
                page.AddIntegerRange("Duration (sec):", 120, 1, 1000);                                                    // 6
                page.AddBoolean("Separate channel files", false);                                                         // 7
                page.AddStringListMulti("Channels :", GetChannelNames(), null);                                           // 8
                page.SetPropertyEnabled(3, false);
                page.SetPropertyEnabled(6, false);
                break;

            case ExportFormat.Video:
                page.AddButton("Path To FFmpeg:", Settings.FFmpegExecutablePath, FFmpegPathButtonClicked, "Path to FFmpeg executable. On Windows this is ffmpeg.exe. To download and install ffpmeg, check the link below.");     // 0
#if FAMISTUDIO_MACOS
                // GTK LinkButtons dont work on MacOS, use a button (https://github.com/quodlibet/quodlibet/issues/2306)
                page.AddButton(" ", "Download FFmpeg here", FFmpegDownloadButtonClicked);                                                                                                                                               // 1
#else
                page.AddLinkLabel(" ", "Download FFmpeg here", "https://famistudio.org/doc/ffmpeg/");                                                                                                                                   // 1
#endif
                page.AddStringList("Song :", songNames, songNames[0]);                                                                                                                                                                  // 2
                page.AddStringList("Resolution :", VideoResolution.Names, VideoResolution.Names[0]);                                                                                                                                    // 3
                page.AddStringList("Frame Rate :", new[] { "50/60 FPS", "25/30 FPS" }, "50/60 FPS");                                                                                                                                    // 4
                page.AddStringList("Audio Bit Rate (Kb/s) :", new[] { "64", "96", "112", "128", "160", "192", "224", "256", "320" }, "128");                                                                                            // 5
                page.AddStringList("Video Bit Rate (Kb/s):", new[] { "250", "500", "1000", "2000", "4000", "8000", "10000", "12000", "14000", "16000", "18000", "20000" }, "12000");                                                    // 6
                page.AddStringList("Piano Roll Zoom :", new[] { "12.5%", "25%", "50%", "100%", "200%", "400%", "800%" }, project.UsesFamiTrackerTempo ? "100%" : "25%", "Higher zoom values scrolls faster and shows less far ahead."); // 7
                page.AddIntegerRange("Loop Count :", 1, 1, 8);                                                                                                                                                                          // 8
                page.AddStringListMulti("Channels :", GetChannelNames(), null);                                                                                                                                                         // 9
                break;

            case ExportFormat.Nsf:
                page.AddString("Name :", project.Name, 31);                                                                               // 0
                page.AddString("Artist :", project.Author, 31);                                                                           // 1
                page.AddString("Copyright :", project.Copyright, 31);                                                                     // 2
                page.AddStringList("Mode :", MachineType.Names, MachineType.Names[project.PalMode ? MachineType.PAL : MachineType.NTSC]); // 3
                page.AddStringListMulti(null, songNames, null);                                                                           // 4
#if DEBUG
                page.AddStringList("Engine :", FamiToneKernel.Names, FamiToneKernel.Names[FamiToneKernel.FamiStudio]);                    // 5
#endif
                page.SetPropertyEnabled(3, !project.UsesExpansionAudio);
                break;

            case ExportFormat.Rom:
                page.AddStringList("Type :", new[] { "NES ROM", "FDS Disk" }, project.ExpansionAudio == ExpansionType.Fds ? "FDS Disk" : "NES ROM"); // 0
                page.AddString("Name :", project.Name.Substring(0, Math.Min(28, project.Name.Length)), 28);                                          // 1
                page.AddString("Artist :", project.Author.Substring(0, Math.Min(28, project.Author.Length)), 28);                                    // 2
                page.AddStringList("Mode :", new[] { "NTSC", "PAL" }, project.PalMode ? "PAL" : "NTSC");                                             // 3
                page.AddStringListMulti(null, songNames, null);                                                                                      // 2
                page.SetPropertyEnabled(0, project.ExpansionAudio == ExpansionType.Fds);
                page.SetPropertyEnabled(3, !project.UsesExpansionAudio);
                break;

            case ExportFormat.Text:
                page.AddStringListMulti(null, songNames, null);     // 0
                page.AddBoolean("Delete unused data :", false);     // 1
                break;

            case ExportFormat.FamiTracker:
                page.AddStringListMulti(null, songNames, null);     // 0
                break;

            case ExportFormat.FamiTone2Music:
            case ExportFormat.FamiStudioMusic:
                page.AddStringList("Format :", AssemblyFormat.Names, AssemblyFormat.Names[0]); // 0
                page.AddBoolean("Separate Files :", false);                                    // 1
                page.AddString("Song Name Pattern :", "{project}_{song}");                     // 2
                page.AddString("DMC Name Pattern :", "{project}");                             // 3
                page.AddBoolean("Generate song list include :", false);                        // 4
                page.AddStringListMulti(null, songNames, null);                                // 5
                page.SetPropertyEnabled(2, false);
                page.SetPropertyEnabled(3, false);
                break;

            case ExportFormat.FamiTone2Sfx:
            case ExportFormat.FamiStudioSfx:
                page.AddStringList("Format :", AssemblyFormat.Names, AssemblyFormat.Names[0]);                                            // 0
                page.AddStringList("Mode :", MachineType.Names, MachineType.Names[project.PalMode ? MachineType.PAL : MachineType.NTSC]); // 1
                page.AddBoolean("Generate SFX list include :", false);                                                                    // 2
                page.AddStringListMulti(null, songNames, null);                                                                           // 3
                break;
            }

            page.Build();
            page.PropertyChanged += Page_PropertyChanged;

            return(page);
        }
Example #6
0
        private PropertyPage CreatePropertyPage(PropertyPage page, ConfigSection section)
        {
            switch (section)
            {
            case ConfigSection.UserInterface:
            {
#if FAMISTUDIO_WINDOWS
                var scalingValues = new[] { "System", "100%", "150%", "200%" };
#elif FAMISTUDIO_MACOS
                var scalingValues = new[] { "System", "100%", "200%" };
#else
                var scalingValues = new[] { "System" };
#endif
                var scalingIndex    = Settings.DpiScaling == 0 ? 0 : Array.IndexOf(scalingValues, $"{Settings.DpiScaling}%");
                var timeFormatIndex = Settings.TimeFormat < (int)TimeFormat.Max ? Settings.TimeFormat : 0;
                var followModeIndex = Settings.FollowMode <= 0 ? 0 : Settings.FollowMode % FollowModeStrings.Length;
                var followSyncIndex = Settings.FollowSync <= 0 ? 0 : Settings.FollowSync % FollowSyncStrings.Length;

                page.AddStringList("Scaling (Requires restart):", scalingValues, scalingValues[scalingIndex]); // 0
                page.AddStringList("Time Format:", TimeFormatStrings, TimeFormatStrings[timeFormatIndex]);     // 1
                page.AddStringList("Follow Mode:", FollowModeStrings, FollowModeStrings[followModeIndex]);     // 2
                page.AddStringList("Following Views:", FollowSyncStrings, FollowSyncStrings[followSyncIndex]); // 3
                page.AddBoolean("Check for updates:", Settings.CheckUpdates);                                  // 4
                page.AddBoolean("Show Piano Roll View Range:", Settings.ShowPianoRollViewRange);               // 5
                page.AddBoolean("Show Note Labels:", Settings.ShowNoteLabels);                                 // 6
                page.AddBoolean("Trackpad controls:", Settings.TrackPadControls);                              // 7
#if FAMISTUDIO_MACOS
                page.AddBoolean("Reverse trackpad direction:", Settings.ReverseTrackPad);                      // 8
                page.SetPropertyEnabled(8, Settings.TrackPadControls);
                page.PropertyChanged += Page_PropertyChanged;
#endif
#if FAMISTUDIO_LINUX
                page.SetPropertyEnabled(0, false);
#endif

                break;
            }

            case ConfigSection.Sound:
            {
                page.AddIntegerRange("Stop instruments after (sec):", Settings.InstrumentStopTime, 0, 10);         // 0
                page.AddBoolean("Prevent popping on square channels:", Settings.SquareSmoothVibrato);              // 1
                page.AddBoolean("Mute piano roll interactions during playback:", Settings.NoDragSoungWhenPlaying); // 2

                break;
            }

            case ConfigSection.MIDI:
            {
                int midiDeviceCount = Midi.InputCount;
                var midiDevices     = new List <string>();
                for (int i = 0; i < midiDeviceCount; i++)
                {
                    var name = Midi.GetDeviceName(i);
                    if (!string.IsNullOrEmpty(name))
                    {
                        midiDevices.Add(name);
                    }
                }

                var midiDevice = "";

                if (!string.IsNullOrEmpty(Settings.MidiDevice) && midiDevices.Contains(Settings.MidiDevice))
                {
                    midiDevice = Settings.MidiDevice;
                }
                else if (midiDevices.Count > 0)
                {
                    midiDevice = midiDevices[0];
                }

                page.AddStringList("Device :", midiDevices.ToArray(), midiDevice);     // 0
                break;
            }
            }

            page.Build();
            pages[(int)section] = page;

            return(page);
        }
        private PropertyPage CreatePropertyPage(PropertyPage page, ExportFormat format)
        {
            var songNames = GetSongNames();

            switch (format)
            {
            case ExportFormat.Wav:
                page.AddStringList("Song :", songNames, songNames[0]);                                      // 0
                page.AddStringList("Sample Rate :", new[] { "11025", "22050", "44100", "48000" }, "44100"); // 1
                page.AddStringList("Mode :", new[] { "Loop N times", "Duration" }, "Loop N times");         // 2
                page.AddIntegerRange("Loop count:", 1, 1, 10);                                              // 3
                page.AddIntegerRange("Duration (sec):", 120, 1, 1000);                                      // 4
                page.AddStringListMulti("Channels :", GetChannelNames(), null);                             // 5
                page.SetPropertyEnabled(4, false);
                break;

            case ExportFormat.Nsf:
                page.AddString("Name :", project.Name, 31);                                                                                                          // 0
                page.AddString("Artist :", project.Author, 31);                                                                                                      // 1
                page.AddString("Copyright :", project.Copyright, 31);                                                                                                // 2
                page.AddStringList("Mode :", Enum.GetNames(typeof(MachineType)), Enum.GetNames(typeof(MachineType))[project.PalMode ? 1 : 0]);                       // 3
                page.AddStringListMulti(null, songNames, null);                                                                                                      // 4
#if DEBUG
                page.AddStringList("Engine :", Enum.GetNames(typeof(FamitoneMusicFile.FamiToneKernel)), Enum.GetNames(typeof(FamitoneMusicFile.FamiToneKernel))[1]); // 5
#endif
                page.SetPropertyEnabled(3, !project.UsesExpansionAudio);
                break;

            case ExportFormat.Rom:
                page.AddStringList("Type :", new[] { "NES ROM", "FDS Disk" }, project.ExpansionAudio == Project.ExpansionFds ? "FDS Disk" : "NES ROM"); // 0
                page.AddString("Name :", project.Name.Substring(0, Math.Min(28, project.Name.Length)), 28);                                             // 1
                page.AddString("Artist :", project.Author.Substring(0, Math.Min(28, project.Author.Length)), 28);                                       // 2
                page.AddStringList("Mode :", new[] { "NTSC", "PAL" }, project.PalMode ? "PAL" : "NTSC");                                                // 3
                page.AddStringListMulti(null, songNames, null);                                                                                         // 2
                page.SetPropertyEnabled(0, project.ExpansionAudio == Project.ExpansionFds);
                page.SetPropertyEnabled(3, !project.UsesExpansionAudio);
                break;

            case ExportFormat.Text:
                page.AddStringListMulti(null, songNames, null);     // 0
                page.AddBoolean("Delete unused data :", false);     // 1
                break;

            case ExportFormat.FamiTracker:
                page.AddStringListMulti(null, songNames, null);     // 0
                break;

            case ExportFormat.FamiTone2Music:
            case ExportFormat.FamiStudioMusic:
                page.AddStringList("Format :", Enum.GetNames(typeof(AssemblyFormat)), Enum.GetNames(typeof(AssemblyFormat))[0]); // 0
                page.AddBoolean("Separate Files :", false);                                                                      // 1
                page.AddString("Song Name Pattern :", "{project}_{song}");                                                       // 2
                page.AddString("DMC Name Pattern :", "{project}");                                                               // 3
                page.AddStringListMulti(null, songNames, null);                                                                  // 4
                page.SetPropertyEnabled(2, false);
                page.SetPropertyEnabled(3, false);
                break;

            case ExportFormat.FamiTone2Sfx:
            case ExportFormat.FamiStudioSfx:
                page.AddStringList("Format :", Enum.GetNames(typeof(AssemblyFormat)), Enum.GetNames(typeof(AssemblyFormat))[0]);               // 0
                page.AddStringList("Mode :", Enum.GetNames(typeof(MachineType)), Enum.GetNames(typeof(MachineType))[project.PalMode ? 1 : 0]); // 1
                page.AddStringListMulti(null, songNames, null);                                                                                // 2
                break;
            }

            page.Build();
            page.PropertyChanged += Page_PropertyChanged;

            return(page);
        }