Exemplo n.º 1
0
        private bool AddCommonVideoProperties(PropertyPage page, string[] songNames)
        {
            // TODO : Make this part of the VideoEncoder.
            canExportToVideo = (!PlatformUtils.IsDesktop || (!string.IsNullOrEmpty(Settings.FFmpegExecutablePath) && File.Exists(Settings.FFmpegExecutablePath)));

            if (canExportToVideo)
            {
                page.AddDropDownList("Song :", songNames, songNames[0]);                                                                                                // 0
                page.AddDropDownList("Resolution :", VideoResolution.Names, VideoResolution.Names[0]);                                                                  // 1
                page.AddDropDownList("Frame Rate :", new[] { "50/60 FPS", "25/30 FPS" }, "50/60 FPS");                                                                  // 2
                page.AddDropDownList("Audio Bit Rate (Kb/s) :", new[] { "64", "96", "112", "128", "160", "192", "224", "256" }, "128");                                 // 3
                page.AddDropDownList("Video Bit Rate (Kb/s):", new[] { "250", "500", "750", "1000", "1500", "2000", "3000", "4000", "5000", "8000", "10000" }, "8000"); // 4
                page.AddNumericUpDown("Loop Count :", 1, 1, 8);                                                                                                         // 5
                return(true);
            }
            else
            {
                page.AddLabel(null, "Video export requires FFmpeg. Please go in the application settings and look for the 'FFmpeg' section.", true);
                // HACK : Last minute hack, too lazy to debug GTK layouting issues right now.
                if (PlatformUtils.IsGTK)
                {
                    page.AddLabel(null, " ");
                }
                return(false);
            }
        }
Exemplo n.º 2
0
        public void AddProperties()
        {
            firstPropIdx = props.PropertyCount;

            if (song.UsesFamiTrackerTempo)
            {
                if (patternIdx < 0)
                {
                    famitrackerTempoPropIdx = props.AddNumericUpDown("Tempo :", song.FamitrackerTempo, 32, 255, TempoTooltip); // 0
                    famitrackerSpeedPropIdx = props.AddNumericUpDown("Speed :", song.FamitrackerSpeed, 1, 31, SpeedTooltip);   // 1
                }

                var notesPerBeat    = patternIdx < 0 ? song.BeatLength    : song.GetPatternBeatLength(patternIdx);
                var notesPerPattern = patternIdx < 0 ? song.PatternLength : song.GetPatternLength(patternIdx);
                var bpm             = Song.ComputeFamiTrackerBPM(song.Project.PalMode, song.FamitrackerSpeed, song.FamitrackerTempo, notesPerBeat);

                notesPerBeatPropIdx    = props.AddNumericUpDown("Notes per Beat :", notesPerBeat, 1, 256, NotesPerBeatTooltip);                        // 2
                notesPerPatternPropIdx = props.AddNumericUpDown("Notes per Pattern :", notesPerPattern, 1, Pattern.MaxLength, NotesPerPatternTooltip); // 3
                bpmLabelPropIdx        = props.AddLabel("BPM :", bpm.ToString("n1"), false, BPMTooltip);                                               // 4

                props.ShowWarnings = true;

                UpdateWarnings();
            }
            else
            {
                var noteLength      = (patternIdx < 0 ? song.NoteLength    : song.GetPatternNoteLength(patternIdx));
                var notesPerBeat    = (patternIdx < 0 ? song.BeatLength    : song.GetPatternBeatLength(patternIdx));
                var notesPerPattern = (patternIdx < 0 ? song.PatternLength : song.GetPatternLength(patternIdx));
                var groove          = (patternIdx < 0 ? song.Groove        : song.GetPatternGroove(patternIdx));

                tempoList = FamiStudioTempoUtils.GetAvailableTempos(song.Project.PalMode, notesPerBeat / noteLength);
                var tempoIndex = FamiStudioTempoUtils.FindTempoFromGroove(tempoList, groove);
                Debug.Assert(tempoIndex >= 0);
                tempoStrings = tempoList.Select(t => t.bpm.ToString("n1") + (t.groove.Length == 1 ? " *": "")).ToArray();

                var grooveList  = FamiStudioTempoUtils.GetAvailableGrooves(tempoList[tempoIndex].groove);
                var grooveIndex = Array.FindIndex(grooveList, g => Utils.CompareArrays(g, groove) == 0);
                Debug.Assert(grooveIndex >= 0);
                grooveStrings = grooveList.Select(g => string.Join("-", g)).ToArray();

                famistudioBpmPropIdx   = props.AddDropDownList("BPM : ", tempoStrings, tempoStrings[tempoIndex], BPMTooltip);                                                     // 0
                notesPerBeatPropIdx    = props.AddNumericUpDown("Notes per Beat : ", notesPerBeat / noteLength, 1, 256, NotesPerBeatTooltip);                                     // 1
                notesPerPatternPropIdx = props.AddNumericUpDown("Notes per Pattern : ", notesPerPattern / noteLength, 1, Pattern.MaxLength / noteLength, NotesPerPatternTooltip); // 2
                framesPerNotePropIdx   = props.AddLabel("Frames per Note :", noteLength.ToString(), false, FramesPerNoteTooltip);                                                 // 3

                props.ShowWarnings = true;
                props.BeginAdvancedProperties();
                groovePropIdx    = props.AddDropDownList("Groove : ", grooveStrings, grooveStrings[grooveIndex], GrooveTooltip);                                               // 4
                groovePadPropIdx = props.AddDropDownList("Groove Padding : ", GroovePaddingType.Names, GroovePaddingType.Names[song.GroovePaddingMode], GroovePaddingTooltip); // 5

                originalNoteLength   = noteLength;
                originalNotesPerBeat = notesPerBeat;

                UpdateWarnings();
            }
        }
Exemplo n.º 3
0
        private PropertyPage CreatePropertyPage(PropertyPage page, ConfigSection section)
        {
            switch (section)
            {
            case ConfigSection.General:
            {
                page.AddCheckBox("Check for updates:", Settings.CheckUpdates, CheckUpdatesTooltip);                // 0
                page.AddCheckBox("Show Tutorial at Startup:", Settings.ShowTutorial, ShowTutorialTooltip);         // 1
                page.AddCheckBox("Trackpad controls:", Settings.TrackPadControls, TrackpadControlsTooltip);        // 2
                page.AddCheckBox("Clear Undo/Redo on save:", Settings.ClearUndoRedoOnSave, ClearUndoRedoTooltip);  // 3
                page.AddCheckBox("Open last project on start:", Settings.OpenLastProjectOnStart, OpenLastTooltip); // 4
                page.AddCheckBox("Autosave a copy every 2 minutes:", Settings.AutoSaveCopy, AutosaveTooltip);      // 5
                page.AddButton(null, "Open Autosave folder", AutosaveFolderTooltip);                               // 6
                page.PropertyClicked += PageGeneral_PropertyClicked;
                page.PropertyChanged += PageGeneral_PropertyChanged;
                page.SetPropertyVisible(0, PlatformUtils.IsDesktop);
                page.SetPropertyVisible(2, PlatformUtils.IsDesktop);
                page.SetPropertyVisible(3, PlatformUtils.IsDesktop);
                page.SetPropertyVisible(4, PlatformUtils.IsDesktop);
                page.SetPropertyVisible(5, PlatformUtils.IsDesktop);
                page.SetPropertyVisible(6, PlatformUtils.IsDesktop);
                break;
            }

            case ConfigSection.UserInterface:
            {
                var scalingValues   = BuildDpiScalingList();
                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.AddDropDownList("Scaling (Requires restart):", scalingValues, scalingValues[scalingIndex], ScalingTooltip);        // 0
                page.AddDropDownList("Time Format:", TimeFormatStrings, TimeFormatStrings[timeFormatIndex], TimeFormatTooltip);         // 1
                page.AddDropDownList("Follow Mode:", FollowModeStrings, FollowModeStrings[followModeIndex], FollowModeTooltip);         // 2
                page.AddDropDownList("Following Views:", FollowSyncStrings, FollowSyncStrings[followSyncIndex], FollowingViewsTooltip); // 3
                page.AddDropDownList("Scroll Bars:", ScrollBarsStrings, ScrollBarsStrings[Settings.ScrollBars], ScrollBarsTooltip);     // 4
                page.AddCheckBox("Show Piano Roll View Range:", Settings.ShowPianoRollViewRange, ShowPianoRollRangeTooltip);            // 5
                page.AddCheckBox("Show Note Labels:", Settings.ShowNoteLabels, ShowNoteLabelsTooltip);                                  // 6
                page.AddCheckBox("Show FamiTracker Stop Notes:", Settings.ShowImplicitStopNotes, ShowFamitrackerStopNotesTooltip);      // 7
                page.AddCheckBox("Show Oscilloscope:", Settings.ShowOscilloscope, ShowOscilloscopeTooltip);                             // 8
                page.AddCheckBox("Force Compact Sequencer:", Settings.ForceCompactSequencer, CompactSequencerTooltip);                  // 9
                page.SetPropertyVisible(0, !PlatformUtils.IsMacOS);                                                                     // No manual DPI selection on MacOS.
                page.SetPropertyVisible(3, PlatformUtils.IsDesktop);
                page.SetPropertyVisible(4, PlatformUtils.IsDesktop);
                page.SetPropertyVisible(8, PlatformUtils.IsDesktop);
                page.SetPropertyVisible(9, PlatformUtils.IsDesktop);
                break;
            }

            case ConfigSection.Sound:
            {
                page.AddNumericUpDown("Number of buffered frames:", Settings.NumBufferedAudioFrames, 2, 16, NumBufferedFramesTooltip); // 0
                page.AddNumericUpDown("Stop instruments after (sec):", Settings.InstrumentStopTime, 0, 10, StopInstrumentTooltip);     // 1
                page.AddCheckBox("Prevent popping on square channels:", Settings.SquareSmoothVibrato, PreventPoppingTooltip);          // 2
                page.AddCheckBox("Mute drag sounds during playback:", Settings.NoDragSoungWhenPlaying, NoDragSoundTooltip);            // 3
                page.AddSlider("Metronome volume:", Settings.MetronomeVolume, 1.0, 200.0, 1.0, 0, null, MetronomeVolumeTooltip);       // 4
                break;
            }

            case ConfigSection.Mixer:
            {
                page.AddSlider("Global Volume:", Settings.GlobalVolume, -10.0, 3.0, 0.1, 1, "{0:+0.0;-0.0} dB", GlobalVolumeTooltip);                                             // 0
                page.AddDropDownList("Expansion:", ExpansionType.Names, ExpansionType.Names[0], ExpansionTooltip);                                                                // 1
                page.AddSlider("Expansion Volume:", Settings.ExpansionMixerSettings[ExpansionType.None].volume, -10.0, 10.0, 0.1, 1, "{0:+0.0;-0.0} dB", ExpansionVolumeTooltip); // 2
                page.AddSlider("Expansion Treble:", Settings.ExpansionMixerSettings[ExpansionType.None].treble, -100.0, 5.0, 0.1, 1, "{0:+0.0;-0.0} dB", ExpansionTrebleTooltip); // 3
                page.AddButton(PlatformUtils.IsDesktop ? null : "Reset", "Reset expansion to default", "Resets this expansion to the default settings.");                         // 4
                page.AddLabel(PlatformUtils.IsDesktop ? null : "Note", "Note : These will have no effect on NSF, ROM, FDS and sound engine exports.", true);                      // 5
                page.PropertyChanged += MixerPage_PropertyChanged;
                page.PropertyClicked += MixerPage_PropertyClicked;
                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.AddDropDownList("Device :", midiDevices.ToArray(), midiDevice, MidiDeviceTooltip);     // 0
                break;
            }

            case ConfigSection.FFmpeg:
                page.AddLabel(null, "Video export requires FFmpeg. If you already have it, set the path to the ffmpeg executable by clicking the button below, otherwise follow the download link.", true); // 0
                page.AddButton(null, Settings.FFmpegExecutablePath, "Path to FFmpeg executable. On Windows this is ffmpeg.exe. To download and install ffpmeg, check the link below.");                     // 1
                // GTK LinkButtons dont work on MacOS, use a button (https://github.com/quodlibet/quodlibet/issues/2306)
                if (PlatformUtils.IsMacOS)
                {
                    page.AddButton(" ", "Download FFmpeg here");     // 2
                }
                else
                {
                    page.AddLinkLabel(" ", "Download FFmpeg here", "https://famistudio.org/doc/ffmpeg/");     // 3
                }
                page.PropertyClicked += FFmpegPage_PropertyClicked;
                break;

            case ConfigSection.QWERTY:
            {
                page.AddLabel(null, "Double click in the 2 last columns to assign a key. Right click to clear a key.", true);                                                                               // 0
                page.AddMultiColumnList(new[] { new ColumnDesc("Octave", 0.2f), new ColumnDesc("Note", 0.2f), new ColumnDesc("Key", 0.3f), new ColumnDesc("Key (alt)", 0.3f) }, GetQwertyMappingStrings()); // 1
                page.AddButton(null, "Reset to default");
                page.PropertyClicked += QwertyPage_PropertyClicked;
                break;
            }

            case ConfigSection.MacOS:
            {
                page.AddCheckBox("Reverse trackpad direction:", Settings.ReverseTrackPad);                      // 0
                page.AddNumericUpDown("Trackpad movement sensitivity:", Settings.TrackPadMoveSensitity, 1, 16); // 1
                page.AddNumericUpDown("Trackpad zoom sensitivity:", Settings.TrackPadZoomSensitity, 1, 32);     // 2
                page.SetPropertyEnabled(0, Settings.TrackPadControls);
                page.SetPropertyEnabled(1, Settings.TrackPadControls);
                page.SetPropertyEnabled(2, Settings.TrackPadControls);
                break;
            }

            case ConfigSection.Mobile:
            {
                page.AddCheckBox("Allow vibration:", Settings.AllowVibration, AllowVibrationTooltip);            // 0
                page.AddCheckBox("Double-tap to delete:", Settings.DoubleClickDelete, DoubleClickDeleteTooltip); // 1
                break;
            }
            }

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

            return(page);
        }
Exemplo n.º 4
0
        private PropertyPage CreatePropertyPage(PropertyPage page, ExportFormat format)
        {
            var songNames = GetSongNames();

            switch (format)
            {
            case ExportFormat.WavMp3:
                page.AddDropDownList("Song :", songNames, songNames[0]);                                             // 0
                page.AddDropDownList("Format :", AudioFormatType.Names, AudioFormatType.Names[0]);                   // 1
                page.AddDropDownList("Sample Rate :", new[] { "11025", "22050", "44100", "48000" }, "44100");        // 2
                page.AddDropDownList("Bit Rate :", new[] { "96", "112", "128", "160", "192", "224", "256" }, "128"); // 3
                page.AddDropDownList("Mode :", new[] { "Loop N times", "Duration" }, "Loop N times");                // 4
                page.AddNumericUpDown("Loop count:", 1, 1, 10);                                                      // 5
                page.AddNumericUpDown("Duration (sec):", 120, 1, 1000);                                              // 6
                page.AddCheckBox("Separate channel files", false);                                                   // 7
                page.AddCheckBox("Separate intro file", false);                                                      // 8
                page.AddCheckBox("Stereo", false);                                                                   // 9
                if (PlatformUtils.IsDesktop)
                {
                    page.AddMultiColumnList(new[] { new ColumnDesc("", 0.0f, ColumnType.CheckBox), new ColumnDesc("Channel", 0.4f), new ColumnDesc("Pan (% L/R)", 0.6f, ColumnType.Slider, "{0} %") }, GetDefaultChannelsGridData(), 200);     // 10
                }
                else
                {
                    page.AddCheckBoxList("Channels", GetChannelNames(), GetDefaultActiveChannels());     // 10
                }
                page.SetPropertyEnabled(3, false);
                page.SetPropertyEnabled(6, false);
                page.SetPropertyVisible(7, PlatformUtils.IsDesktop);     // No separate files on mobile.
                page.SetPropertyVisible(8, PlatformUtils.IsDesktop);     // No separate files on mobile.
                page.SetPropertyVisible(9, PlatformUtils.IsDesktop);     // No stereo on mobile.
                page.SetColumnEnabled(10, 2, false);
                page.PropertyChanged += WavMp3_PropertyChanged;
                page.PropertyClicked += WavMp3_PropertyClicked;
                break;

            case ExportFormat.VideoPianoRoll:
                if (AddCommonVideoProperties(page, songNames))                                                                                                                                                                                // 0-5
                {
                    page.AddDropDownList("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."); // 6
                    page.AddCheckBox("Stereo", false);                                                                                                                                                                                        // 7
                    if (PlatformUtils.IsDesktop)
                    {
                        page.AddMultiColumnList(new[] { new ColumnDesc("", 0.0f, ColumnType.CheckBox), new ColumnDesc("Channel", 0.4f), new ColumnDesc("Pan (% L/R)", 0.6f, ColumnType.Slider, "{0} %") }, GetDefaultChannelsGridData(), 200);     // 8
                    }
                    else
                    {
                        page.AddCheckBoxList("Channels", GetChannelNames(), GetDefaultActiveChannels());     // 8
                    }
                    page.SetColumnEnabled(8, 2, false);
                    page.SetPropertyVisible(7, PlatformUtils.IsDesktop);     // Stereo on mobile.
                    page.PropertyChanged += VideoPage_PropertyChanged;
                }
                break;

            case ExportFormat.VideoOscilloscope:
                if (AddCommonVideoProperties(page, songNames))                                                                                                           // 0-5
                {
                    page.AddNumericUpDown("Oscilloscope Columns :", 1, 1, 5);                                                                                            // 6
                    page.AddNumericUpDown("Oscilloscope Thickness :", 1, 1, 4);                                                                                          // 7
                    page.AddDropDownList("Oscilloscope Color :", OscilloscopeColorType.Names, OscilloscopeColorType.Names[OscilloscopeColorType.InstrumentsAndSamples]); // 8
                    page.AddCheckBox("Stereo", false);                                                                                                                   // 9
                    if (PlatformUtils.IsDesktop)
                    {
                        page.AddMultiColumnList(new[] { new ColumnDesc("", 0.0f, ColumnType.CheckBox), new ColumnDesc("Channel", 0.4f), new ColumnDesc("Pan (% L/R)", 0.6f, ColumnType.Slider, "{0} %") }, GetDefaultChannelsGridData(), 200);     // 10
                    }
                    else
                    {
                        page.AddCheckBoxList("Channels", GetChannelNames(), GetDefaultActiveChannels());     // 10
                    }
                    page.SetColumnEnabled(10, 2, false);
                    page.SetPropertyVisible(9, PlatformUtils.IsDesktop);     // Stereo on mobile.
                    page.PropertyChanged += VideoPage_PropertyChanged;
                }
                break;

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

            case ExportFormat.Rom:
                page.AddDropDownList("Type :", new[] { "NES ROM", "FDS Disk" }, project.UsesFdsExpansion ? "FDS Disk" : "NES ROM"); // 0
                page.AddTextBox("Name :", project.Name.Substring(0, Math.Min(28, project.Name.Length)), 28);                        // 1
                page.AddTextBox("Artist :", project.Author.Substring(0, Math.Min(28, project.Author.Length)), 28);                  // 2
                page.AddDropDownList("Mode :", new[] { "NTSC", "PAL" }, project.PalMode ? "PAL" : "NTSC");                          // 3
                page.AddCheckBoxList(PlatformUtils.IsDesktop ? null : "Songs", songNames, null);                                    // 4
                if (project.UsesAnyExpansionAudio)
                {
                    page.AddLabel(PlatformUtils.IsDesktop ? null : "Note", "ROM export does not support audio expansions. FDS disk export only supports the FDS expansion. Any incompatible expansion channel(s) will be ignored during the export.", true);
                }
                page.SetPropertyEnabled(0, project.UsesFdsExpansion);
                page.SetPropertyEnabled(3, !project.UsesAnyExpansionAudio);
                break;

            case ExportFormat.Midi:
                page.AddDropDownList("Song :", songNames, songNames[0]);                                                                         // 0
                page.AddCheckBox("Export volume as velocity :", true);                                                                           // 1
                page.AddCheckBox("Export slide notes as pitch wheel :", true);                                                                   // 2
                page.AddNumericUpDown("Pitch wheel range :", 24, 1, 24);                                                                         // 3
                page.AddDropDownList("Instrument Mode :", MidiExportInstrumentMode.Names, MidiExportInstrumentMode.Names[0]);                    // 4
                page.AddMultiColumnList(new[] { new ColumnDesc("", 0.4f), new ColumnDesc("", 0.6f, MidiFileReader.MidiInstrumentNames) }, null); // 5
                page.PropertyChanged += Midi_PropertyChanged;
                break;

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

            case ExportFormat.FamiTracker:
                if (!project.UsesMultipleExpansionAudios)
                {
                    page.AddCheckBoxList(null, songNames, null);     // 0
                    canExportToFamiTracker = true;
                }
                else
                {
                    page.AddLabel(null, "The original FamiTracker does not support multiple audio expansions. Limit yourself to a single expansion to enable export.", true);
                    canExportToFamiTracker = false;
                }
                break;

            case ExportFormat.FamiTone2Music:
            case ExportFormat.FamiStudioMusic:
                if (format == ExportFormat.FamiTone2Music && project.UsesAnyExpansionAudio)
                {
                    page.AddLabel(null, "FamiTone2 does not support audio expansions.", true);
                    canExportToSoundEngine = false;
                }
                else if (format == ExportFormat.FamiStudioMusic && project.UsesMultipleExpansionAudios)
                {
                    page.AddLabel(null, "The FamiStudio Sound Engine only supports a single expansion at a time. Limit yourself to a single expansion to enable export.", true);
                    canExportToSoundEngine = false;
                }
                else
                {
                    page.AddDropDownList("Format :", AssemblyFormat.Names, AssemblyFormat.Names[0]); // 0
                    page.AddCheckBox("Separate Files :", false);                                     // 1
                    page.AddTextBox("Song Name Pattern :", "{project}_{song}");                      // 2
                    page.AddTextBox("DMC Name Pattern :", "{project}");                              // 3
                    page.AddCheckBox("Generate song list include :", false);                         // 4
                    page.AddCheckBoxList(null, songNames, null);                                     // 5
                    page.SetPropertyEnabled(2, false);
                    page.SetPropertyEnabled(3, false);
                    page.PropertyChanged  += SoundEngine_PropertyChanged;
                    canExportToSoundEngine = true;
                }
                break;

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

            case ExportFormat.Share:
                page.AddRadioButtonList("Sharing mode", new[] { "Copy to Storage", "Share" }, 0, "Copy the FamiStudio project to your phone's storage, or share it to another application.");
                break;
            }

            page.Build();

            return(page);
        }
Exemplo n.º 5
0
        private PropertyPage CreatePropertyPage(PropertyPage page, ExportFormat format)
        {
            var songNames = GetSongNames();

            switch (format)
            {
            case ExportFormat.WavMp3:
                page.AddDropDownList("Song :", songNames, songNames[0]);                                             // 0
                page.AddDropDownList("Format :", new[] { "WAV", "MP3" }, "WAV");                                     // 1
                page.AddDropDownList("Sample Rate :", new[] { "11025", "22050", "44100", "48000" }, "44100");        // 2
                page.AddDropDownList("Bit Rate :", new[] { "96", "112", "128", "160", "192", "224", "256" }, "128"); // 3
                page.AddDropDownList("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.AddCheckBox("Separate channel files", false);                                                   // 7
                page.AddCheckBox("Separate intro file", false);                                                      // 8
                page.AddCheckBoxList("Channels :", GetChannelNames(), GetDefaultSelectedChannels());                 // 9
                page.SetPropertyEnabled(3, false);
                page.SetPropertyEnabled(6, false);
                page.PropertyChanged += WavMp3_PropertyChanged;
                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.AddDropDownList("Song :", songNames, songNames[0]);                                                                                                                                                                  // 2
                page.AddDropDownList("Resolution :", VideoResolution.Names, VideoResolution.Names[0]);                                                                                                                                    // 3
                page.AddDropDownList("Frame Rate :", new[] { "50/60 FPS", "25/30 FPS" }, "50/60 FPS");                                                                                                                                    // 4
                page.AddDropDownList("Audio Bit Rate (Kb/s) :", new[] { "64", "96", "112", "128", "160", "192", "224", "256" }, "128");                                                                                                   // 5
                page.AddDropDownList("Video Bit Rate (Kb/s):", new[] { "250", "500", "1000", "2000", "4000", "8000", "10000", "12000", "14000", "16000", "18000", "20000" }, "12000");                                                    // 6
                page.AddDropDownList("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.AddCheckBoxList("Channels :", GetChannelNames(), GetDefaultSelectedChannels());                                                                                                                                      // 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.AddDropDownList("Mode :", MachineType.Names, MachineType.Names[project.PalMode ? MachineType.PAL : MachineType.NTSC]); // 3
                page.AddCheckBoxList(null, songNames, null);                                                                                // 4
#if DEBUG
                page.AddDropDownList("Engine :", FamiToneKernel.Names, FamiToneKernel.Names[FamiToneKernel.FamiStudio]);                    // 5
#endif
                page.SetPropertyEnabled(3, !project.UsesExpansionAudio);
                break;

            case ExportFormat.Rom:
                page.AddDropDownList("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.AddDropDownList("Mode :", new[] { "NTSC", "PAL" }, project.PalMode ? "PAL" : "NTSC");                                             // 3
                page.AddCheckBoxList(null, songNames, null);                                                                                           // 2
                page.SetPropertyEnabled(0, project.ExpansionAudio == ExpansionType.Fds);
                page.SetPropertyEnabled(3, !project.UsesExpansionAudio);
                break;

            case ExportFormat.Midi:
                page.AddDropDownList("Song :", songNames, songNames[0]);                                                      // 0
                page.AddCheckBox("Export volume as velocity :", true);                                                        // 1
                page.AddCheckBox("Export slide notes as pitch wheel :", true);                                                // 2
                page.AddIntegerRange("Pitch wheel range :", 24, 1, 24);                                                       // 3
                page.AddDropDownList("Instrument Mode :", MidiExportInstrumentMode.Names, MidiExportInstrumentMode.Names[0]); // 4
                page.AddLabel(null, "Double-click on a row to change.");                                                      // 5
                page.AddMultiColumnList(new[] { "", "" }, null, MidiInstrumentDoubleClick, null);                             // 6
                page.PropertyChanged += Midi_PropertyChanged;
                break;

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

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

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

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

            page.Build();

            if (format == ExportFormat.Midi)
            {
                UpdateMidiInstrumentMapping();
            }

            return(page);
        }
Exemplo n.º 6
0
        private PropertyPage CreatePropertyPage(PropertyPage page, ConfigSection section)
        {
            switch (section)
            {
            case ConfigSection.General:
            {
                page.AddCheckBox("Check for updates:", Settings.CheckUpdates);     // 0
                page.AddCheckBox("Trackpad controls:", Settings.TrackPadControls); // 1
#if FAMISTUDIO_MACOS
                page.PropertyChanged += PageGeneral_PropertyChanged;
#endif
                break;
            }

            case ConfigSection.UserInterface:
            {
#if FAMISTUDIO_WINDOWS || FAMISTUDIO_LINUX
                var scalingValues = new[] { "System", "100%", "150%", "200%" };
#elif FAMISTUDIO_MACOS
                var scalingValues = new[] { "System", "100%", "200%" };
#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.AddDropDownList("Scaling (Requires restart):", scalingValues, scalingValues[scalingIndex]); // 0
                page.AddDropDownList("Time Format:", TimeFormatStrings, TimeFormatStrings[timeFormatIndex]);     // 1
                page.AddDropDownList("Follow Mode:", FollowModeStrings, FollowModeStrings[followModeIndex]);     // 2
                page.AddDropDownList("Following Views:", FollowSyncStrings, FollowSyncStrings[followSyncIndex]); // 3
                page.AddCheckBox("Show Piano Roll View Range:", Settings.ShowPianoRollViewRange);                // 4
                page.AddCheckBox("Show Note Labels:", Settings.ShowNoteLabels);                                  // 5
                page.AddCheckBox("Show FamiTracker Stop Notes:", Settings.ShowImplicitStopNotes);                // 6
                page.AddCheckBox("Show Scroll Bars:", Settings.ShowScrollBars);                                  // 7
                page.AddCheckBox("Show Oscilloscope:", Settings.ShowOscilloscope);                               // 8
                page.AddCheckBox("Force Compact Sequencer:", Settings.ForceCompactSequencer);                    // 9
                break;
            }

            case ConfigSection.Sound:
            {
                page.AddIntegerRange("Number of buffered frames:", Settings.NumBufferedAudioFrames, 2, 16);         // 0
                page.AddIntegerRange("Stop instruments after (sec):", Settings.InstrumentStopTime, 0, 10);          // 1
                page.AddCheckBox("Prevent popping on square channels:", Settings.SquareSmoothVibrato);              // 2
                page.AddCheckBox("Mute piano roll interactions during playback:", Settings.NoDragSoungWhenPlaying); // 3
                break;
            }

            case ConfigSection.Mixer:
            {
                // MATTT : Tooltips.
                page.AddDropDownList("Expansion:", ExpansionType.Names, ExpansionType.Names[0]);                                            // 0
                page.AddSlider("Volume:", Settings.ExpansionMixerSettings[ExpansionType.None].volume, -10.0, 10.0, 0.1, 1, FormatDecibels); // 1
                page.AddSlider("Treble:", Settings.ExpansionMixerSettings[ExpansionType.None].treble, -100.0, 5.0, 0.1, 1, FormatDecibels); // 2
                page.AddButton(null, "Reset to default", ResetMixerClicked, "Resets this expansion to the default settings.");
                page.AddLabel(null, "Note : These will have no effect on NSF, ROM, FDS and sound engine exports.", true);                   // 4 // MATTT : Test this in HIDPI.
                page.PropertyChanged += MixerPage_PropertyChanged;
                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.AddDropDownList("Device :", midiDevices.ToArray(), midiDevice);     // 0
                break;
            }

            case ConfigSection.QWERTY:
            {
                page.AddLabel(null, "Double click in the 2 last columns to assign a key. Right click to clear a key.", true);                                        // 0
                page.AddMultiColumnList(new[] { "Octave", "Note", "Key", "Key (alt)" }, GetQwertyMappingStrings(), QwertyListDoubleClicked, QwertyListRightClicked); // 1
                page.AddButton(null, "Reset to default", ResetQwertyClicked);
                break;
            }

#if FAMISTUDIO_MACOS
            case ConfigSection.MacOS:
            {
                page.AddCheckBox("Reverse trackpad direction:", Settings.ReverseTrackPad);                     // 0
                page.AddIntegerRange("Trackpad movement sensitivity:", Settings.TrackPadMoveSensitity, 1, 16); // 1
                page.AddIntegerRange("Trackpad zoom sensitivity:", Settings.TrackPadZoomSensitity, 1, 32);     // 2
                page.SetPropertyEnabled(0, Settings.TrackPadControls);
                page.SetPropertyEnabled(1, Settings.TrackPadControls);
                page.SetPropertyEnabled(2, Settings.TrackPadControls);
                break;
            }
#endif
            }

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

            return(page);
        }