Esempio n. 1
0
        public Output(JObject obj, OscTree.Tree oscParent, OutputList parent)
        {
            id          = obj.ContainsKey("ID") ? (string)obj["ID"] : String.Empty;
            Name        = obj.ContainsKey("Name") ? (string)obj["Name"] : string.Empty;
            Description = obj.ContainsKey("Description") ? (string)obj["Description"] : string.Empty;
            type        = obj.ContainsKey("Type") ? StringToOutputtype((string)obj["Type"]) : OutputType.MIDI;
            var details = obj.ContainsKey("Details") ? obj["Details"] : null;

            setOutput((JObject)details);

            this.parent = parent;

            osc = new OscTree.Object(new OscTree.Address(Name, id), typeof(int));
            oscParent.Add(osc);
            osc.Endpoints.Add(new OscTree.Endpoint("Send", (args) =>
            {
                if (output == null)
                {
                    return;
                }
                if (args.Count() > 0)
                {
                    output.SendInt(Convert.ToInt32(args[0]));
                }
            }, typeof(int)));
        }
Esempio n. 2
0
 private void SetRoot(OscTree.Tree root)
 {
     this.root = root;
     TreeGui.SetRoot(root);
     TreeGui.OnRouteChanged += () =>
     {
         EvaluateRoute();
     };
 }
Esempio n. 3
0
        public MainWindow()
        {
            InitializeComponent();
            Root = new OscTree.Tree(new OscTree.Address("Root", "Root"));
            Gui2.OscTree.Endpoints.Add(new OscTree.Endpoint("Activate", (args) => { }, typeof(object)));
            Root.Add(Gui1.OscTree);
            Root.Add(Gui2.OscTree);

            GuiInspector.OscRoot = Root;

            Gui1.SetInspector(GuiInspector);
            Gui2.SetInspector(GuiInspector);
            Gui1.SetGridSize(4, 4);
            Gui2.SetGridSize(8, 8);
        }
Esempio n. 4
0
        public SoundGrid(string name, string ID, string soundPath)
        {
            InitializeComponent();
            Name      = name;
            SoundPath = soundPath;
            System.IO.Directory.CreateDirectory(soundPath);

            tree = new OscTree.Tree(new OscTree.Address(name, ID));
            Osc.Tree.ServerSounds.Add(tree);

            GuiTimer          = new DispatcherTimer();
            GuiTimer.Tick    += GuiTimer_Tick;
            GuiTimer.Interval = new TimeSpan(0, 0, 0, 0, 100);
            GuiTimer.Start();
        }
Esempio n. 5
0
        public RouteSelector(OscTree.Object origin, OscTree.Tree root, bool showClear = false)
        {
            InitializeComponent();
            Origin = origin;
            SidePanelVisible(false, false);

            SetRoot(root);

            if (!showClear)
            {
                ClearButton.Visibility = Visibility.Hidden;
            }

            serverSide = Osc.Tree.Server.Contains(origin);
            ComboBoxGroups.ItemsSource = Project.Project.Current.Groups.List;
        }
Esempio n. 6
0
        public OutputList(string name, string ID)
        {
            InitializeComponent();
            Name = name;

            tree = new OscTree.Tree(new OscTree.Address(name, ID));
            Osc.Tree.ServerRouters.Add(tree);

            GuiTimer          = new DispatcherTimer();
            GuiTimer.Tick    += GuiTimer_Tick;
            GuiTimer.Interval = new TimeSpan(0, 0, 0, 0, 10);
            previousTickCount = Environment.TickCount;
            GuiTimer.Start();

            Panel.ItemsSource = Outputs;
        }
Esempio n. 7
0
 public void SetRoot(OscTree.Tree root)
 {
     TreeGui.SetRoot(root);
     TreeGui.OnRouteChanged += () =>
     {
         OkButton.IsEnabled = (TreeGui.SelectedRoute != null);
         if (TreeGui.SelectedRoute != null)
         {
             TreeGui.SelectedRoute.CurrentStep = 0;
             TreeGui.SelectedRoute.ScreenName  = root.GetNameOfRoute(TreeGui.SelectedRoute);
             CurrentRouteName.Content          = TreeGui.SelectedRoute.ScreenName;
         }
         else
         {
             CurrentRouteName.Content = "";
         }
     };
 }
Esempio n. 8
0
        public MainPage()
        {
            InitializeComponent();
            Tree = new OscTree.Tree(new OscTree.Address("Root", "Root"));

            Tree.Add(OscView.OscTree);

            var    assembly = IntrospectionExtensions.GetTypeInfo(typeof(MainPage)).Assembly;
            Stream stream   = assembly.GetManifestResourceStream("OscGuiDemo.gui1.json");
            string text     = string.Empty;

            using (var reader = new StreamReader(stream))
            {
                text = reader.ReadToEnd();
            }
            OscView.LoadJSON(text);
            OscView.LoadJSON(text);
        }
Esempio n. 9
0
 public void SetRoot(OscTree.Tree root)
 {
     this.root = root;
     addPanel(root);
 }
Esempio n. 10
0
        public SoundControl(JObject obj, OscTree.Tree oscParent, string soundPath, SoundGrid parentGrid)
        {
            InitializeComponent();

            originalFileName = obj.ContainsKey("OriginalFileName") ? (string)obj["OriginalFileName"] : String.Empty;
            projectFileName  = obj.ContainsKey("ProjectFileName") ? (string)obj["ProjectFileName"] : String.Empty;
            id              = obj.ContainsKey("ID") ? (string)obj["ID"] : String.Empty;
            soundName       = obj.ContainsKey("Name") ? (string)obj["Name"] : string.Empty;
            Loop            = obj.ContainsKey("Loop") ? (bool)obj["Loop"] : false;
            this.parentGrid = parentGrid;


            this.DataContext = this;

            if (projectFileName != string.Empty)
            {
                sound = Yse.Yse.Handle.Interface.NewSound();

                var path = System.IO.Path.Combine(soundPath, projectFileName);
                sound.Create(path, null, false, 1, true);
                sound.Doppler          = false;
                PositionSlider.Minimum = 0;
                PositionSlider.Maximum = sound.Length;
            }

            osc = new OscTree.Object(new OscTree.Address(soundName, id), typeof(float));
            oscParent.Add(osc);
            osc.Endpoints.Add(new OscTree.Endpoint("Play", (args) =>
            {
                if (sound == null)
                {
                    return;
                }

                if (args.Count() > 0)
                {
                    try
                    {
                        if (Convert.ToBoolean(args[0]) == true)
                        {
                            sound.Play();
                        }
                        else
                        {
                            sound.Stop();
                        }
                    }
                    catch (Exception)
                    {
                        sound.Play();
                    }
                }
                else
                {
                    sound.Play();
                }
            }, typeof(bool)));

            osc.Endpoints.Add(new OscTree.Endpoint("Restart", (args) =>
            {
                if (sound == null)
                {
                    return;
                }
                if (sound.Playing)
                {
                    sound.Time = 0;
                }
                else
                {
                    sound.Play();
                }
            }));

            osc.Endpoints.Add(new OscTree.Endpoint("Stop", (args) =>
            {
                if (sound == null)
                {
                    return;
                }
                sound.Stop();
            }, typeof(bool)));

            osc.Endpoints.Add(new OscTree.Endpoint("Pause", (args) =>
            {
                if (sound == null)
                {
                    return;
                }
                sound.Pause();
            }, typeof(bool)));

            osc.Endpoints.Add(new OscTree.Endpoint("Time", (args) =>
            {
                if (sound == null)
                {
                    return;
                }

                if (args.Count() > 0)
                {
                    sound.Time = Convert.ToSingle(args[0]);
                }
            }, typeof(float)));

            osc.Endpoints.Add(new OscTree.Endpoint("Volume", (args) =>
            {
                if (sound == null)
                {
                    return;
                }
                if (args.Count() > 0)
                {
                    sound.Volume = Convert.ToSingle(args[0]);
                }
            }, typeof(float)));

            osc.Endpoints.Add(new OscTree.Endpoint("Speed", (args) =>
            {
                if (sound == null)
                {
                    return;
                }
                if (args.Count() > 0)
                {
                    sound.Speed = Convert.ToSingle(args[0]);
                }
            }, typeof(float)));

            osc.Endpoints.Add(new OscTree.Endpoint("Loop", (args) =>
            {
                if (sound == null)
                {
                    return;
                }
                if (args.Count() > 0)
                {
                    sound.Loop = Convert.ToBoolean(args[0]);
                }
            }, typeof(bool)));

            osc.Endpoints.Add(new OscTree.Endpoint("Pos", (args) =>
            {
                if (sound == null)
                {
                    return;
                }
                try
                {
                    IYse.Pos pos = new IYse.Pos();
                    if (args.Count() > 1)
                    {
                        pos.X = Convert.ToSingle(args[0]) * 10;
                        pos.Z = Convert.ToSingle(args[1]) * 10;
                    }
                    sound.SetPos(pos);
                }
                catch (Exception) { }
            }, typeof(object)));
        }