示例#1
0
    private void Start()
    {
        evenGrain       = new Grain();
        evenGrain.Start = 0;

        oddGrain       = new Grain();
        oddGrain.Start = 0;

        int grainSizeSamples = (int)(AudioSettings.outputSampleRate * grainSizeMS / 1000f);

        window = NWindow.BlackmanHarris(grainSizeSamples);
    }
示例#2
0
    private void Update()
    {
        sampleLength = 1.0 / AudioSettings.outputSampleRate;
        int grainSizeSamples = (int)(AudioSettings.outputSampleRate * grainSizeMS / 1000f);

        evenGrain.Length = grainSizeSamples;
        oddGrain.Length  = grainSizeSamples;

        if (window.Length != grainSizeSamples)
        {
            window = NWindow.BlackmanHarris(grainSizeSamples);
        }
    }
        /// <summary>
        /// Creates and opens a child window of the specified owner window.
        /// </summary>
        /// <param name="ownerWindow"></param>
        private void OpenChildWindow(NWindow ownerWindow)
        {
            // Create the window
            NTopLevelWindow window = NApplication.CreateTopLevelWindow(ownerWindow);

            window.Title         = "Window " + m_ChildWindowIndex++;
            window.PreferredSize = WindowSize;

            // subscribe for window state events
            window.Opened      += new Function <NEventArgs>(OnWindowStateEvent);
            window.Activated   += new Function <NEventArgs>(OnWindowStateEvent);
            window.Deactivated += new Function <NEventArgs>(OnWindowStateEvent);
            window.Closing     += new Function <NEventArgs>(OnWindowStateEvent);
            window.Closed      += new Function <NEventArgs>(OnWindowStateEvent);

            // subscribe for window UI events
            window.GotFocus  += new Function <NFocusChangeEventArgs>(OnWindowUIEvent);
            window.LostFocus += new Function <NFocusChangeEventArgs>(OnWindowUIEvent);

            // Create its content
            NStackPanel stack = new NStackPanel();

            stack.FillMode = ENStackFillMode.First;
            stack.FitMode  = ENStackFitMode.First;

            string ownerName = ownerWindow is NTopLevelWindow ? ((NTopLevelWindow)ownerWindow).Title : "Examples Window";
            NLabel label     = new NLabel("Child Of \"" + ownerName + "\"");

            label.HorizontalPlacement = ENHorizontalPlacement.Center;
            label.VerticalPlacement   = ENVerticalPlacement.Center;
            stack.Add(label);

            stack.Add(CreateOpenChildWindowButton());
            window.Content = stack;

            // Open the window
            AddTreeViewItemForWindow(window);
            window.Open();

            if (ownerWindow is NTopLevelWindow)
            {
                window.X = ownerWindow.X + 25;
                window.Y = ownerWindow.Y + 25;
            }
        }
            /// <summary>
            /// Creates a custom appointment edit dialog.
            /// </summary>
            /// <returns></returns>
            public override NTopLevelWindow CreateEditDialog()
            {
                NSchedule schedule = (NSchedule)GetFirstAncestor(NSchedule.NScheduleSchema);
                NWindow   window   = schedule != null ? schedule.OwnerWindow : null;

                // Create a dialog window
                NTopLevelWindow dialog = NApplication.CreateTopLevelWindow(NWindow.GetFocusedWindowIfNull(window));

                dialog.SetupDialogWindow("Appointment with Image Editor", true);

                NStackPanel stack = new NStackPanel();

                stack.FillMode = ENStackFillMode.Last;
                stack.FitMode  = ENStackFitMode.Last;

                // Add an image box with the image
                NImageBox imageBox = new NImageBox((NImage)NSystem.SafeDeepClone(Image));

                stack.Add(imageBox);

                // Add property editors for some of the appointment properties
                NDesigner designer = NDesigner.GetDesigner(this);
                NList <NPropertyEditor> editors = designer.CreatePropertyEditors(this,
                                                                                 SubjectProperty,
                                                                                 StartProperty,
                                                                                 EndProperty);

                for (int i = 0; i < editors.Count; i++)
                {
                    stack.Add(editors[i]);
                }

                // Add a button strip with OK and Cancel buttons
                NButtonStrip buttonStrip = new NButtonStrip();

                buttonStrip.InitOKCancelButtonStrip();
                stack.Add(buttonStrip);

                dialog.Content = new NUniSizeBoxGroup(stack);

                return(dialog);
            }
示例#5
0
        private void OnAddChildItemButtonClick(NEventArgs arg)
        {
            NTopLevelWindow dialog = NApplication.CreateTopLevelWindow(NWindow.GetFocusedWindowIfNull(OwnerWindow));

            dialog.SetupDialogWindow("Enter element's name", false);

            NTextBox     textBox     = new NTextBox();
            NButtonStrip buttonStrip = new NButtonStrip();

            buttonStrip.InitOKCancelButtonStrip();

            NPairBox pairBox = new NPairBox(textBox, buttonStrip, ENPairBoxRelation.Box1AboveBox2);

            pairBox.Spacing = NDesign.VerticalSpacing;
            dialog.Content  = pairBox;

            dialog.Opened += delegate(NEventArgs args) {
                textBox.Focus();
            };

            dialog.Closed += delegate(NEventArgs args) {
                if (dialog.Result == ENWindowResult.OK)
                {
                    // Add an item with the specified name
                    m_TreeView.SelectedItem.Items.Add(CreateTreeViewItem(textBox.Text));
                    m_TreeView.SelectedItem.Expanded = true;

                    if (m_SerializeButton.Enabled == false)
                    {
                        m_SerializeButton.Enabled = true;
                    }
                }
            };

            dialog.Open();
        }