コード例 #1
0
        public bool IsCurrentSelectionGreaterThan(IScriptableApp app, double minimumLengthInSeconds)
        {
            ISfDataWnd window = _file.Window;
            double     selectionLengthSeconds = _file.PositionToSeconds(window.Selection.Length);

            return(selectionLengthSeconds >= minimumLengthInSeconds);
        }
コード例 #2
0
        public SfAudioSelection EnforceNoisePrintSelection(IScriptableApp app, double noiseprintLength)
        {
            if (!IsCurrentSelectionGreaterThan(app, noiseprintLength))
            {
                throw new ScriptAbortedException("A noise selection of {0} seconds or more must be made before running this script.", noiseprintLength);
            }

            ISfDataWnd window = _file.Window;

            WindowTasks.SelectBothChannels(window);

            long             noiseprintSampleLength = _file.SecondsToPosition(noiseprintLength);
            SfAudioSelection selection = new SfAudioSelection(window.Selection.Start, noiseprintSampleLength, 0);

            return(selection);
        }
コード例 #3
0
        public static void SelectBothChannels(ISfDataWnd window)
        {
            if (window.File.Channels != 2)
            {
                throw new ScriptAbortedException("Expected a 2-channel file.");
            }
            switch (window.Selection.ChanMask)
            {
            case 0:
                // both
                return;

            case 1:
                // left-only
                window.ForwardKey(Keys.Tab);
                window.ForwardKey(Keys.Tab);
                return;

            case 2:
                // right-only
                window.ForwardKey(Keys.Tab);
                break;
            }
        }