public OptionsForm() { InitializeComponent(); encodingParameters = new Dictionary <ExporterType, string>() { [ExporterType.MP3] = "", [ExporterType.OggVorbis] = "", [ExporterType.AAC_M4A] = "", }; hcaOptions = new HcaOptions(); adxOptions = new AdxOptions(); var exporters = new[] { new NVPair <ExporterType>(ExporterType.BRSTM, "BRSTM"), new NVPair <ExporterType>(ExporterType.BCSTM, "BCSTM"), new NVPair <ExporterType>(ExporterType.BFSTM, "BFSTM"), new NVPair <ExporterType>(ExporterType.DSP, "DSP (Nintendo)"), new NVPair <ExporterType>(ExporterType.IDSP, "IDSP (Nintendo)"), new NVPair <ExporterType>(ExporterType.HPS, "HPS (HAL)"), new NVPair <ExporterType>(ExporterType.ADX, "CRI ADX"), new NVPair <ExporterType>(ExporterType.HCA, "CRI HCA"), new NVPair <ExporterType>(ExporterType.MSF_PCM16BE, "MSF (PCM16, big-endian)"), new NVPair <ExporterType>(ExporterType.MSF_PCM16LE, "MSF (PCM16, little-endian)"), new NVPair <ExporterType>(ExporterType.MSU1, "MSU-1"), new NVPair <ExporterType>(ExporterType.WAV, "WAV"), new NVPair <ExporterType>(ExporterType.FLAC, "FLAC"), new NVPair <ExporterType>(ExporterType.MP3, "MP3"), new NVPair <ExporterType>(ExporterType.AAC_M4A, "AAC (.m4a)"), new NVPair <ExporterType>(ExporterType.AAC_ADTS, "AAC (ADTS .aac)"), new NVPair <ExporterType>(ExporterType.OggVorbis, "Ogg Vorbis") }; comboBox1.DataSource = exporters; if (comboBox1.SelectedIndex < 0) { comboBox1.SelectedIndex = 0; } comboBox1.SelectedIndexChanged += (o, e) => { switch ((ExporterType)comboBox1.SelectedValue) { case ExporterType.BRSTM: case ExporterType.BCSTM: case ExporterType.BFSTM: case ExporterType.MP3: case ExporterType.OggVorbis: case ExporterType.AAC_M4A: case ExporterType.AAC_ADTS: case ExporterType.HCA: case ExporterType.ADX: btnEncodingOptions.Visible = true; break; default: btnEncodingOptions.Visible = false; break; } switch ((ExporterType)comboBox1.SelectedValue) { case ExporterType.MP3: case ExporterType.FLAC: case ExporterType.AAC_M4A: case ExporterType.AAC_ADTS: chkWriteLoopingMetadata.Enabled = false; break; default: chkWriteLoopingMetadata.Enabled = true; break; } }; var unknownLoopBehaviors = new[] { new NVPair <UnknownLoopBehavior>(UnknownLoopBehavior.ForceLoop, "Force start-to-end loop"), new NVPair <UnknownLoopBehavior>(UnknownLoopBehavior.NoChange, "Keep as non-looping"), new NVPair <UnknownLoopBehavior>(UnknownLoopBehavior.Ask, "Ask"), new NVPair <UnknownLoopBehavior>(UnknownLoopBehavior.AskAll, "Ask for all files") }; ddlUnknownLoopBehavior.DataSource = unknownLoopBehaviors; if (ddlUnknownLoopBehavior.SelectedIndex < 0) { ddlUnknownLoopBehavior.SelectedIndex = 0; } numSimulTasks.Value = Math.Min(Environment.ProcessorCount, numSimulTasks.Maximum); runningTasks = new HashSet <Task>(); }
private void btnEncodingOptions_Click(object sender, EventArgs e) { switch ((ExporterType)comboBox1.SelectedValue) { case ExporterType.MP3: using (var form = new MP3QualityForm(encodingParameters[ExporterType.MP3])) { if (form.ShowDialog() != DialogResult.OK) { return; } encodingParameters[ExporterType.MP3] = form.EncodingParameters; } break; case ExporterType.OggVorbis: using (var form = new OggVorbisQualityForm(encodingParameters[ExporterType.OggVorbis])) { if (form.ShowDialog() != DialogResult.OK) { return; } encodingParameters[ExporterType.OggVorbis] = form.EncodingParameters; } break; case ExporterType.AAC_M4A: case ExporterType.AAC_ADTS: using (var form = new AACQualityForm(encodingParameters[ExporterType.AAC_M4A])) { if (form.ShowDialog() != DialogResult.OK) { return; } encodingParameters[ExporterType.AAC_M4A] = form.EncodingParameters; } break; case ExporterType.BRSTM: case ExporterType.BCSTM: case ExporterType.BFSTM: using (var f = new VGAudioOptionsForm <BxstmOptions, BxstmConfiguration>(bxstmOptions)) { if (f.ShowDialog(this) == DialogResult.OK) { bxstmOptions = f.SelectedObject; } }; break; case ExporterType.HCA: using (var f = new VGAudioOptionsForm <HcaOptions, HcaConfiguration>(hcaOptions)) { if (f.ShowDialog(this) == DialogResult.OK) { hcaOptions = f.SelectedObject; } }; break; case ExporterType.ADX: using (var f = new VGAudioOptionsForm <AdxOptions, AdxConfiguration>(adxOptions)) { if (f.ShowDialog(this) == DialogResult.OK) { adxOptions = f.SelectedObject; } }; break; default: break; } }
public void LoadOptions(string filename) { Options o = GetOptions(); try { OptionsSerialization.PopulateFromFile(filename, ref o); if (o.OutputDir != null) { txtOutputDir.Text = o.OutputDir; } chkMono.Checked = o.MaxChannels == 1; chkMaxSampleRate.Checked = o.MaxSampleRate != null; if (o.MaxSampleRate != null) { numMaxSampleRate.Value = o.MaxSampleRate.Value; } chkAmplifydB.Checked = o.AmplifydB != null; if (o.AmplifydB != null) { numAmplifydB.Value = o.AmplifydB.Value; } chkAmplifyRatio.Checked = o.AmplifyRatio != null; if (o.AmplifyRatio != null) { numAmplifyRatio.Value = o.AmplifyRatio.Value; } chkPitch.Checked = o.PitchSemitones != null; if (o.PitchSemitones != null) { numPitch.Value = o.PitchSemitones.Value; } chkTempo.Checked = o.TempoRatio != null; if (o.TempoRatio != null) { numTempo.Value = o.TempoRatio.Value; } if (o.ChannelSplit == ChannelSplit.Pairs) { radChannelsPairs.Checked = true; } else if (o.ChannelSplit == ChannelSplit.Each) { radChannelsSeparate.Checked = true; } else if (o.ChannelSplit == ChannelSplit.OneFile) { radChannelsTogether.Checked = true; } comboBox1.SelectedValue = o.ExporterType; encodingParameters[ExporterType.MP3] = o.MP3EncodingParameters; encodingParameters[ExporterType.OggVorbis] = o.OggVorbisEncodingParameters; encodingParameters[ExporterType.AAC_M4A] = o.AACEncodingParameters; hcaOptions = o.HcaOptions ?? new HcaOptions(); adxOptions = o.AdxOptions ?? new AdxOptions(); bxstmOptions = o.BxstmOptions ?? new BxstmOptions(); ddlUnknownLoopBehavior.SelectedValue = o.UnknownLoopBehavior; chk0End.Checked = o.ExportWholeSong; txt0EndFilenamePattern.Text = o.WholeSongSuffix; numNumberLoops.Value = o.NumberOfLoops; numFadeOutTime.Value = o.FadeOutSec; chkWriteLoopingMetadata.Checked = o.WriteLoopingMetadata; chk0Start.Checked = o.ExportPreLoop; txt0StartFilenamePattern.Text = o.PreLoopSuffix; chkStartEnd.Checked = o.ExportLoop; txtStartEndFilenamePattern.Text = o.LoopSuffix; numSimulTasks.Value = o.NumSimulTasks; } catch (Exception e) { MessageBox.Show(e.Message); } }