示例#1
0
        private void ExportFamiTracker()
        {
            var filename = PlatformDialogs.ShowSaveFileDialog("Export FamiTracker Text File", "FamiTracker Text Format (*.txt)|*.txt");

            if (filename != null)
            {
                var props = dialog.GetPropertyPage((int)ExportFormat.FamiTracker);
                FamitrackerFile.Save(project, filename, GetSongIds(props.GetPropertyValue <bool[]>(0)));
            }
        }
示例#2
0
        private void ExportWav()
        {
            var filename = PlatformDialogs.ShowSaveFileDialog("Export Wave File", "Wave Audio File (*.wav)|*.wav");

            if (filename != null)
            {
                var props      = dialog.GetPropertyPage((int)ExportFormat.Wav);
                var songName   = props.GetPropertyValue <string>(0);
                var sampleRate = Convert.ToInt32(props.GetPropertyValue <string>(1));

                WaveFile.Save(project.GetSong(songName), filename, sampleRate);
            }
        }
示例#3
0
        private void ExportFamiTone2()
        {
            var props           = dialog.GetPropertyPage((int)ExportFormat.FamiTone2);
            var formatString    = props.GetPropertyValue <string>(0);
            var ext             = formatString == "CA65" ? "s" : "asm";
            var separate        = props.GetPropertyValue <bool>(1);
            var songIds         = GetSongIds(props.GetPropertyValue <bool[]>(4));
            var exportFormat    = (FamitoneMusicFile.OutputFormat)Enum.Parse(typeof(FamitoneMusicFile.OutputFormat), formatString);
            var songNamePattern = props.GetPropertyValue <string>(2);
            var dpcmNamePattern = props.GetPropertyValue <string>(3);

            if (separate)
            {
                var folderBrowserDialog = new FolderBrowserDialog();
                folderBrowserDialog.Description = "Select the export folder";

                if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
                {
                    foreach (var songId in songIds)
                    {
                        var song = project.GetSong(songId);
                        var formattedSongName = songNamePattern.Replace("{project}", project.Name).Replace("{song}", song.Name);
                        var formattedDpcmName = dpcmNamePattern.Replace("{project}", project.Name).Replace("{song}", song.Name);
                        var songFilename      = Path.Combine(folderBrowserDialog.SelectedPath, Utils.MakeNiceAsmName(formattedSongName) + "." + ext);
                        var dpcmFilename      = Path.Combine(folderBrowserDialog.SelectedPath, Utils.MakeNiceAsmName(formattedDpcmName) + ".dmc");

                        FamitoneMusicFile f = new FamitoneMusicFile(FamitoneMusicFile.FamiToneKernel.FamiTone2);
                        f.Save(project, new int[] { songId }, exportFormat, true, songFilename, dpcmFilename);
                    }
                }
            }
            else
            {
                var filename = PlatformDialogs.ShowSaveFileDialog("Export FamiTone2 Code", $"FamiTone2 Assembly File (*.{ext})|*.{ext}");
                if (filename != null)
                {
                    FamitoneMusicFile f = new FamitoneMusicFile(FamitoneMusicFile.FamiToneKernel.FamiTone2);
                    f.Save(project, songIds, exportFormat, false, filename, Path.ChangeExtension(filename, ".dmc"));
                }
            }
        }
示例#4
0
        private void ExportNsf()
        {
            var filename = PlatformDialogs.ShowSaveFileDialog("Export NSF File", "Nintendo Sound Files (*.nsf)|*.nsf");

            if (filename != null)
            {
                var props = dialog.GetPropertyPage((int)ExportFormat.Nsf);

#if DEBUG
                var kernel = (FamitoneMusicFile.FamiToneKernel)Enum.Parse(typeof(FamitoneMusicFile.FamiToneKernel), props.GetPropertyValue <string>(5));
#else
                var kernel = FamitoneMusicFile.FamiToneKernel.FamiTone2FS;
#endif

                NsfFile.Save(project, kernel, filename,
                             GetSongIds(props.GetPropertyValue <bool[]>(4)),
                             props.GetPropertyValue <string>(0),
                             props.GetPropertyValue <string>(1),
                             props.GetPropertyValue <string>(2));
            }
        }