Beispiel #1
0
        static void playlistTest()
        {
            var w    = new Audio.Walkman();
            var play = w.createPlaylist("s.mp3", "s.flac", "t.mp3", "r.mp3");

            w.tagMaster.add(new Audio.Music("s.mp3"), "mp3");
            w.tagMaster.add(new Audio.Music("t.mp3"), "mp3");
            w.tagMaster.add(new Audio.Music("r.mp3"), "mp3");

            var mp3 = w.Query(play, new Audio.Tag("mp3"));

            Script script = new Script();


            string test = @"
function test(x)
	return x * x
end

return test";

            var t   = script.DoString(test);
            var fun = t.Function;

            Console.WriteLine(fun.GetType());
            var res = fun.Call(2);

            Console.WriteLine(res.CastToNumber());

            Console.WriteLine(mp3);
            Console.ReadKey();
        }
Beispiel #2
0
 public PlaylistViewContainer(Audio.Walkman p)
 {
     player = p;
     player.PlaylistAdded += PlaylistAddedHandler;
     label            = new Label("test");
     this.SwitchPage += SwitchPageHandler;
 }
Beispiel #3
0
 public VolumeSlider(Audio.Walkman p) : base(0, 150, 5)
 {
     player       = p;
     DrawValue    = false;
     WidthRequest = 1;
     this.SetSizeRequest(10, 10);
     this.ValueChanged += VolumeSlider_ValueChanged;
     Value              = 100;
     //Value = player.GetVolume();
 }
Beispiel #4
0
        public PlaytimeSlider(Audio.Walkman p)
        {
            player = p;

            slider.DrawValue = false;
            PackStart(timeLabel, false, false, 5);
            PackStart(slider, true, true, 0);
            timeoutID                  = GLib.Timeout.Add(50, Update);
            slider.MoveSlider         += Slider_MoveSlider;
            slider.ButtonPressEvent   += PlaytimeSlider_ButtonPressEvent;
            slider.ButtonReleaseEvent += PlaytimeSlider_ButtonReleaseEvent;
            Destroyed                 += RemoveTimeout;
        }
Beispiel #5
0
            public GUI() : base("yo")
            {
                //GLib.Timeout.Add(5, GlobalKeyChecker);
                Destroyed     += quit;
                KeyPressEvent += OpenConsole;

                player = new Audio.Walkman();
                player.Volume(0.3);
                consoleHide = false;
                console     = new AConsole(player);
                menu        = new Menu(player);


                label = new Label("shit");
                box   = new VBox();
                music = new PlaylistViewContainer(player);

                //box.Add(menu);
                //box.Add(music);
                //box.Add(console);
                var menutest = new MenuBar();

                menutest.Add(new Label("test"));
                menutest.Style = menu.Style;
                //menutest.HeightRequest = 30;
                //box.PackStart(menutest, false, false, 0);
                menu.HeightRequest = 30;

                var hboxtest = new HBox();

                hboxtest.HeightRequest = 30;
                box.PackStart(menu, false, false, 0);
                box.PackStart(music, true, true, 0);
                box.PackStart(console, false, false, 0);
                this.SetDefaultSize(1280, 720);

                var p = player.createPlaylist("Play1", "s.flac", "s.mp3", "reaper.flac", "t.mp3");

                player.createPlaylist("Test", "r.mp3", "reaper.flac");
                player.setPlaylist(p);
                Add(box);
            }
Beispiel #6
0
        public Menu(Audio.Walkman p)
        {
            player          = p;
            slider          = WidgetToTool(new VolumeSlider(p));
            playtime        = WidgetToTool(new PlaytimeSlider(p));
            playtime.Expand = true;

            ToolbarStyle = ToolbarStyle.Icons;
            Insert(start, 0);
            Insert(stop, 1);
            Insert(pause, 2);
            Insert(previous, 3);
            Insert(next, 4);
            Insert(slider, 5);
            Insert(playtime, 6);
            //AddWidget(slider, 5);
            //AddWidget(playtime, 6);
            ConnectSignals();
            this.HeightRequest = 40;
        }
Beispiel #7
0
        public PlaylistView(Audio.Playlist play, Audio.Walkman walk, Scrollable parent) : base(parent)
        {
            //Create target list
            var combined = this.targets.Concat(t).ToArray();

            Gtk.Drag.DestSet(this, DestDefaults.All, combined, DragAction.Move | DragAction.Copy);

            internalPlaylist = play;
            player           = walk;

            fileName.Title = "File Name";
            AppendColumn(fileName);

            artist.Title = "Artist";
            AppendColumn(artist);

            updateView();

            fileName.PackStart(fileNameCell, false);

            artist.PackStart(artistCell, false);

            fileName.AddAttribute(fileNameCell, "text", 0);
            fileName.Resizable = true;
            artist.AddAttribute(artistCell, "text", 1);
            artist.Resizable = true;

            this.ResizeMode       = ResizeMode.Immediate;
            this.HeadersClickable = true;

            Model = musicList;

            Selection.Mode = SelectionMode.Multiple;
            RubberBanding  = true;

            ConnectSignals();
        }
Beispiel #8
0
 public PlaylistViewWindow(Audio.Playlist play, Audio.Walkman walk)
 {
     tree = new PlaylistView(play, walk, this);
     Add(tree);
     playlist = tree.internalPlaylist;
 }
Beispiel #9
0
        public AConsole(Audio.Walkman walk)
        {
            player = walk;
            label.SetAlignment(0, 0);

            input = new ConsoleInput(this);

            script.Options.DebugPrint = s => { println(s); };
            MoonSharp.Interpreter.UserData.RegisterType <Audio.Walkman>();
            MoonSharp.Interpreter.UserData.RegisterType <Audio.Playlist>();
            MoonSharp.Interpreter.UserData.RegisterType <Audio.Music>();
            MoonSharp.Interpreter.UserData.RegisterType <Audio.Tag>();
            MoonSharp.Interpreter.UserData.RegisterType <Audio.PlaylistList>();
            MoonSharp.Interpreter.UserData.RegisterType <LuaTest>();
            DynValue luaWalk = MoonSharp.Interpreter.UserData.Create(player);
            var      t       = MoonSharp.Interpreter.UserData.Create(new LuaTest(player));

            //debugging purposes, will remove later
            script.Globals.Set("system", luaWalk);

            script.Globals["volume"]         = (Action <double>)player.Volume;
            script.Globals["play"]           = (System.Action)player.Play;
            script.Globals["pause"]          = (System.Action)player.Pause;
            script.Globals["stop"]           = (System.Action)player.Stop;
            script.Globals["next"]           = (System.Action)player.Next;
            script.Globals["previous"]       = (System.Action)player.Previous;
            script.Globals["createPlaylist"] = (playlistType)player.createPlaylist;


            //Gdk.Color col = new Gdk.Color();
            //Gdk.Color.Parse("purple", ref col);
            //labelWrapper.ModifyBg(StateType.Normal, col);
            labelWrapper.Add(label);

            //awful and hacky way to make lua evalute expressions, but it works
            string newRepl = @"
                        sm = setmetatable
                        function infix(f)
                          local mt = { __div = function(self, b) return f(self[1], b) end }
                          return sm({}, { __div = function(a, _) return sm({ a }, mt) end })
                        end

                        p = infix(function(a, b) return b(a) end)

                        function print_results(...)
                            if select('#', ...) > 1 then
                                print(select(2, ...))
                            end
                        end

                        function repl(input)
                            local f, err = load('return ' .. input)
                            local is_statement = false
                            if err then
                                is_statement = true
                                f = load(input)
                            elseif f == nil then
                                is_statement = true
                            end
                            
                            if f then
                                if is_statement then
                                    pcall(f)
                                else
                                    print_results(pcall(f))
                                end
                            else
                                print(err)
                            end
                        end
";

            script.DoString(newRepl);


            input.Activated += inputTextHandler;

            scrolledText.Add(text);


            PackStart(scrolledText, true, true, 0);
            PackStart(input, false, false, 0);
            HeightRequest = 200;

            println("//Use the global variable 'player' to play music, etc.");
            println("//For example, player.play() plays the current track and player.stop() stops");
        }
Beispiel #10
0
 public LuaTest(Audio.Walkman p)
 {
     play = p;
 }