示例#1
0
        private void DoTrackSplitting(SplitTrackList tracks, ICreateTrackMarkerNames trackMarkerNameBuilder)
        {
            //App.FindRenderer("FLAC Audio", "flac");
            //foreach (ISfRenderer r in App.Renderers)
            //{
            //    Output.LineBreakToScriptWindow();
            //    Output.ToScriptWindow(r.Name);
            //    Output.ToScriptWindow(r.Extension);
            //    Output.ToScriptWindow(r.Guid);
            //    foreach (ISfGenericPreset preset in r.Templates)
            //    {
            //        Output.ToScriptWindow(preset.Name);
            //    }
            //}
            //tracks.Clear();
            foreach (SplitTrackDefinition track in tracks)
            {
                ISfFileHost trackFile = _file.NewFile(track.GetSelectionWithFades());
                trackFile.Markers.Clear();
                trackFile.Summary.Album   = _tbxAlbum.Text;
                trackFile.Summary.Artist  = _tbxArtist.Text;
                trackFile.Summary.TrackNo = string.Concat(track.Number, "/", tracks.Count);

                FileTasks trackTasks = new FileTasks(trackFile);
                if (track.AddFadeIn)
                {
                    Output.ToScriptWindow("Track {0}: Fade In {1} Samples", track.Number, track.FadeInLength);
                    trackFile.Window.SetSelectionAndScroll(0, track.FadeInLength, DataWndScrollTo.NoMove);
                    App.DoMenuAndWait("Process.FadeIn", false);
                }
                if (track.AddFadeOut)
                {
                    Output.ToScriptWindow("Track {0}: Fade Out {1} Samples", track.Number, track.FadeOutLength);
                    trackFile.Window.SetSelectionAndScroll(track.FadeOutStartPosition, trackFile.Length, DataWndScrollTo.NoMove);
                    App.DoMenuAndWait("Process.FadeOut", false);
                }
                trackTasks.ApplyEffectPreset(App, trackTasks.SelectAll(), "iZotope MBIT+ Dither", "Convert to 16 bit (advanced light dither)", EffectOptions.EffectOnly, Output.ToScriptWindow);

                string savePath = string.Concat(_outputDirectory, Path.DirectorySeparatorChar, trackMarkerNameBuilder.GetRegionMarkerName(track.Number) + ".flac");
                trackFile.SaveAs(savePath, "FLAC Audio", "44,100 Hz, 16 Bit, Stereo", RenderOptions.SaveMetadata);
                trackFile.Close(CloseOptions.QuerySaveIfChanged);

                Output.ToScriptWindow("Saved '{0}'", savePath);
                Output.LineBreakToScriptWindow();
            }
        }