Ejemplo n.º 1
0
    public static void Main(string[] args)
    {
        if (args.Length < 1) {
            Console.WriteLine ("usage: mono playbin-player.exe audio_file_uri");
            return;
        }

        songs = args;

        Gst.Application.Init ();
        loop = new MainLoop ();

        play = ElementFactory.Make ("playbin", "play") as PlayBin;

        if (play == null) {
            Console.WriteLine ("error creating a playbin gstreamer object");
            return;
        }

        play.Uri = songs[song_idx++];
        play.Bus.AddWatch (new BusFunc (BusCb));
        play.SetState (State.Playing);

        loop.Run ();
    }
Ejemplo n.º 2
0
  public static void Main (string[] args) {
    Application.Init();
    loop = new MainLoop();

    // Construct all the elements
    pipeline = new Pipeline();
    appsrc = new Gst.App.AppSrc ("AppSrcDemo");
    Element color = ElementFactory.Make ("ffmpegcolorspace");
    Element sink = ElementFactory.Make ("autovideosink");

    // Link the elements
    pipeline.Add (appsrc, color, sink);
    Element.Link (appsrc, color, sink);

    // Set the caps on the AppSrc to RGBA, 640x480, 4 fps, square pixels
    Gst.Video.VideoFormat fmt = (BitConverter.IsLittleEndian) ? Gst.Video.VideoFormat.BGRA : Gst.Video.VideoFormat.ARGB;
    appsrc.Caps = Gst.Video.VideoUtil.FormatNewCaps (fmt, 640, 480, 4, 1, 1, 1);

    // Connect the handlers
    appsrc.NeedData += PushAppData;
    pipeline.Bus.AddSignalWatch();
    pipeline.Bus.Message += MessageHandler;

    // Run, loop, run!
    pipeline.SetState (State.Playing);
    loop.Run();
    pipeline.SetState (State.Null);
  }
Ejemplo n.º 3
0
        public virtual MainLoop MainLoop()
        {
            MainLoop mainLoop = new MainLoop();
            mainLoop.Configuration = DslConfig();

            return mainLoop;
        }
Ejemplo n.º 4
0
        static Global()
        {
            BmpManager = new SurfaceResourceManager(1024 * 1024 * 4,
                BitmapUtil.Load,
                (bmp, w, h) => bmp.SplitToBitmaps(w, h));

            ChipSize = new Size(32, 32);
            Encoding = XEncoding.SJIS;
            MainLoop = new MainLoop(30);
            Random = new Random();
        }
Ejemplo n.º 5
0
    public HelloWorld(string [] args)
    {
        Application.Init();

        loop = new MainLoop();
        pipeline = new Pipeline ("audio-player");

        if ( (source = ElementFactory.Make ("filesrc", "file-source")) == null) {
          Console.WriteLine ("Could not create file-source");
        }

        parser = ElementFactory.Make ("oggdemux", "ogg-parser");
        decoder = ElementFactory.Make ("vorbisdec", "vorbis-decoder");
        conv = ElementFactory.Make ("audioconvert", "converter");
        identity = ElementFactory.Make ("identity", "identitye");
        sink = ElementFactory.Make ("alsasink", "alsa-output");

        source["location"] = args[0];

        Bin bin = (Bin) pipeline;
        bin.Bus.AddWatch (new BusFunc (BusCall));

        bin.Add (source, parser, decoder, conv, identity, sink);

        if (!source.Link (parser)) {
          Console.WriteLine ("link failed between source and parser");
        }

        if (!decoder.Link (conv)) {
          Console.WriteLine ("link failed between decoder and converter");
        }

        if (!conv.Link (identity)) {
          Console.WriteLine ("link failed between converter and identity");
        }

        if (!identity.Link (sink)) {
          Console.Error.WriteLine ("link failed between identity and sink");
        }

        parser.PadAdded += new PadAddedHandler (OnPadAdded);
        identity.Connect ("handoff", OnHandoff);

        pipeline.SetState (State.Playing);

        Console.WriteLine ("Playing [" + args[0] + "]");

        loop.Run();

        pipeline.SetState (State.Null);
        pipeline.Dispose();
    }
Ejemplo n.º 6
0
Archivo: RL.cs Proyecto: eddaly/elvis
    void populateReferences()
    {
        GameObject foundObject;

        foundObject = GameObject.Find( "MainCamera" );
        if( foundObject != null )
            m_MainCamera = foundObject.GetComponent<Camera>();

        foundObject = GameObject.Find( "MainLoop" );
        if( foundObject != null )
            m_MainLoop = foundObject.GetComponent<MainLoop>();

        foundObject = GameObject.Find( "TitleScreen" );
        if( foundObject != null )
            m_EntryScreen = foundObject.GetComponent<EntryScreen>();

        foundObject = GameObject.Find( "Environment" );
        if( foundObject != null )
            m_Environment = foundObject.GetComponent<EnvironmentManager>();

        foundObject = GameObject.Find( "Obstacles" );
        if( foundObject != null )
            m_Obstacles = foundObject.GetComponent<ObstacleManager>();

        foundObject = GameObject.Find( "Sequencer" );
        if( foundObject != null )
            m_Sequencer = foundObject.GetComponent<SequenceManager>();

        foundObject = GameObject.Find( "Prototype" );
        if( foundObject != null )
            m_Prototype = foundObject.GetComponent<PrototypeConfiguration>();

        foundObject = GameObject.Find( "Player" );
        if( foundObject != null )
            m_Player = foundObject.GetComponent<Player>();

        foundObject = GameObject.FindWithTag( "SoundController" );
        if( foundObject != null )
        {
            m_SoundController = foundObject.GetComponent<EPSoundController>();
            m_MusicPlayer = foundObject.GetComponent<EPMusicPlayer>();
        }
    }
Ejemplo n.º 7
0
    static void Main()
    {
        MainLoop ml = new MainLoop ();
        Stamp ("Start");
        ml.AddTimeout (TimeSpan.FromSeconds (1), x => {
            Stamp ("second");
            return true;
        });

        int i = 0;
        ml.AddTimeout (TimeSpan.FromSeconds (3), x => {
            Stamp ("three");
            if (++i >= 3)
                return false;
            return true;
        });

        ml.Run ();
    }
 public void OnMouseEnterToggle(UnityEngine.GameObject go)
 {
     MainLoop.callAppropriateSystemMethod("IARDreamFragmentManager", "OnMouseEnterToggle", go);
 }
Ejemplo n.º 9
0
    public static void Run () {

      MySrc.Register ();
      MySink.Register ();

      MySrc mysrc = Gst.ElementFactory.Make ("mysrc") as MySrc;
      MySink mysink = Gst.ElementFactory.Make ("mysink") as MySink;

      Gst.Pipeline pipeline = new Pipeline ("pipeline");
      pipeline.Add (mysrc, mysink);
      Assert.IsTrue (mysrc.Link (mysink));

      loop = new MainLoop ();

      pipeline.Bus.AddWatch (new BusFunc (BusCb));
      pipeline.SetState (Gst.State.Playing);

      loop.Run ();

      pipeline.SetState (Gst.State.Null);
    }
 public void OnMouseExitToggle(System.Int32 instanceID)
 {
     MainLoop.callAppropriateSystemMethod("IARDreamFragmentManager", "OnMouseExitToggle", instanceID);
 }
 public void SolveGearsEnigma()
 {
     MainLoop.callAppropriateSystemMethod("IARGearsEnigma", "SolveGearsEnigma", null);
 }
 public void ZoomDocument(System.Single value)
 {
     MainLoop.callAppropriateSystemMethod("IARDreamFragmentManager", "ZoomDocument", value);
 }
Ejemplo n.º 13
0
        static void Run(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var statistics = new HostStatistics();

            var eye = new Beholder.Eyes.SharpDX11.Winforms.WinformsEye();
            var graphicsWindowHandle = eye.CreateNewWindow(200, 150, "Stream", true);
            var colorFormatInfo = eye.Adapters[0].GetSupportedWindowedDisplayFormats().First(x => x.ExplicitFormat == ExplicitFormat.R8G8B8A8_UNORM);
            #if DEBUG
            var deviceFlags = DeviceInitializationFlags.Debug;
            #else
            var deviceFlags = DeviceInitializationFlags.None;
            #endif
            eye.Initialize(eye.Adapters[0], graphicsWindowHandle, new SwapChainDescription(2, colorFormatInfo.ID, false, 0, Sampling.NoMultisampling, true), deviceFlags, new StraightforwardFileSystem());
            var device = eye.Device;

            var pclWorkarounds = new PclWorkarounds();
            var byteArrayPool = new ByteArrayPool();

            var logger = new FileLogger();
            var settings = new HostSettings();
            var globalEvents = new HostGlobalEvents();

            var broadcaster = settings.FromFile
                ? (IStreamBroadcaster)new FileStreamBroadcaster()
                : new TcpStreamBroadcaster(settings, globalEvents, logger);
            var broadcastingStage = new BroadcastStage(broadcaster);
            var cpuSideCodec = new CpuSideCodec(pclWorkarounds, byteArrayPool);
            var cpuCompressionStage = new CpuCompressionStage(statistics, cpuSideCodec);
            var gpuReadBackStage = new GpuReadBackStage(statistics, device, byteArrayPool, 1);
            var debugStage = new DebugStage(device);
            var gpuProcessingStage = new GpuProcessingStage(device);
            //var screenCaptor = new ScreenCaptor9(statistics, device);
            var screenCaptor = new ScreenCaptor11(statistics, device);
            var mainLoop = new MainLoop(statistics, globalEvents, device, screenCaptor);

            PipelineBuilder
                .BeginWith(mainLoop)
                .ContinueWith(gpuProcessingStage)
                //.ContinueWith(debugStage)
                .ContinueWith(gpuReadBackStage)
                .ContinueWith(cpuCompressionStage)
                .EndWith(broadcastingStage);

            broadcaster.Start();
            cpuCompressionStage.Start();

            eye.NewFrame += mainLoop.OnNewFrame;

            statistics.ShowForm();

            using (mainLoop)
            using (eye)
                eye.RunLoop(device.PrimarySwapChain.Window);

            cpuCompressionStage.Stop();
            broadcaster.Stop();
        }
Ejemplo n.º 14
0
 public Service(MainLoop mainLoop)
 {
     InitializeComponent();
     _mainLoop = mainLoop;
 }
 public void OpenLink()
 {
     MainLoop.callAppropriateSystemMethod("IARDreamFragmentManager", "OpenLink", null);
 }
Ejemplo n.º 16
0
        internal void TouchCheck(Vector2 Point)
        {
            if (!Loading.SimulationSetup)
            {
                return;
            }

            if (renderer.Camera.CurrentMode != CameraViewMode.Interior && renderer.Camera.CurrentMode != CameraViewMode.InteriorLookAhead)
            {
                return;
            }

            TrainManager.Car Car = TrainManager.PlayerTrain.Cars[TrainManager.PlayerTrain.DriverCar];
            int add = Car.CarSections[0].CurrentAdditionalGroup + 1;

            if (add >= Car.CarSections[0].Groups.Length)
            {
                return;
            }

            TrainManager.TouchElement[] TouchElements = Car.CarSections[0].Groups[add].TouchElements;

            if (TouchElements == null)
            {
                return;
            }

            ObjectState pickedObject = ParseFBO(Point, 5, 5);

            foreach (TrainManager.TouchElement TouchElement in TouchElements)
            {
                if (TouchElement.Element.internalObject != pickedObject)
                {
                    continue;
                }

                for (int i = 0; i < Interface.CurrentControls.Length; i++)
                {
                    if (Interface.CurrentControls[i].Method != Interface.ControlMethod.Touch)
                    {
                        continue;
                    }

                    bool EnableOption = false;

                    for (int j = 0; j < Translations.CommandInfos.Length; j++)
                    {
                        if (Interface.CurrentControls[i].Command == Translations.CommandInfos[j].Command)
                        {
                            EnableOption = Translations.CommandInfos[j].EnableOption;
                            break;
                        }
                    }

                    if (TouchElement.Command == Interface.CurrentControls[i].Command)
                    {
                        if (EnableOption && TouchElement.CommandOption != Interface.CurrentControls[i].Option)
                        {
                            continue;
                        }

                        Interface.CurrentControls[i].AnalogState  = 1.0;
                        Interface.CurrentControls[i].DigitalState = Interface.DigitalControlState.Pressed;
                        MainLoop.AddControlRepeat(i);
                    }
                }
            }

            prePickedObject = pickedObject;
        }
 public void SwitchTab(UnityEngine.GameObject newSelectedTab)
 {
     MainLoop.callAppropriateSystemMethod("IARTabNavigation", "SwitchTab", newSelectedTab);
 }
 public void closeIar()
 {
     MainLoop.callAppropriateSystemMethod("IARTabNavigation", "closeIar", null);
 }
 public void openIar(System.Int32 tabId)
 {
     MainLoop.callAppropriateSystemMethod("IARTabNavigation", "openIar", tabId);
 }
 public void openLastQuestions()
 {
     MainLoop.callAppropriateSystemMethod("IARTabNavigation", "openLastQuestions", null);
 }
 public void ResetFragment()
 {
     MainLoop.callAppropriateSystemMethod("IARDreamFragmentManager", "ResetFragment", null);
 }
 public void OnClickDreamToggle(UnityEngine.UI.Toggle t)
 {
     MainLoop.callAppropriateSystemMethod("IARDreamFragmentManager", "OnClickDreamToggle", t);
 }
 public void CopySessionID()
 {
     MainLoop.callAppropriateSystemMethod("LoadGameContent", "CopySessionID", null);
 }
Ejemplo n.º 24
0
 public void updatePnCompletion()
 {
     MainLoop.callAppropriateSystemMethod("HelpSystem", "updatePnCompletion", null);
 }
Ejemplo n.º 25
0
	public static void Main (string[] args) 
	{
		// Initialize GObject type system
		g_type_init ();

		main_loop = new MainLoop ();

		if (args.Length == 0 || Array.IndexOf (args, "--help") > -1 || Array.IndexOf (args, "--usage") > -1)
			PrintUsageAndExit ();

		if (Array.IndexOf (args, "--version") > -1) {
			VersionFu.PrintVersion ();
			Environment.Exit (0);
		}

		StringBuilder query_str =  new StringBuilder ();

		query = new Query ();

		QueryDomain domain = 0;

		// Parse args
		int i = 0;
		while (i < args.Length) {
			switch (args [i]) {

			case "--live-query":
				keep_running = true;
				break;
			case "--verbose":
				verbose = true;
				break;
			case "--cache":
				display_cached_text = true;
				break;
			case "--stats-only":
				verbose = true;
				display_hits = false;
				break;
			case "--max-hits":
			    if (++i >= args.Length) PrintUsageAndExit ();
				query.MaxHits = Int32.Parse (args[i]);
				break;
			case "--flood":
				flood = true;
				break;
			case "--listener":
				listener = true;
				keep_running = true;
				break;
			case "--raw-uri":
				raw_uri = true;
				break;
			case "--keywords":
				PropertyKeywordFu.ReadKeywordMappings ();

				Console.WriteLine ("Supported query keywords are:");

				foreach (string key in PropertyKeywordFu.Keys) {
					foreach (QueryKeywordMapping mapping in PropertyKeywordFu.Properties (key)) {
						// Dont print properties without description; they confuse people
						if (string.IsNullOrEmpty (mapping.Description))
							continue;
						Console.WriteLine ("  {0,-20} for {1}", key, mapping.Description);
					}
				}

				System.Environment.Exit (0);
				break;

			case "--domain":
				if (++i >= args.Length) PrintUsageAndExit ();
				switch (args [i].ToLower ()) {
				case "local":
					domain |= QueryDomain.Local;
					break;

				case "system":
					domain |= QueryDomain.System;
					break;

				case "network":
					domain |= QueryDomain.Neighborhood;
					break;

				case "global":
					domain |= QueryDomain.Global;
					break;

				case "all":
					domain |= QueryDomain.All;
					break;

				default:
					PrintUsageAndExit ();
					break;
				}
				break;

			default:
				if (args [i].StartsWith ("--"))
					PrintUsageAndExit ();
				if (query_str.Length > 0)
					query_str.Append (' ');
				query_str.Append (args [i]);
				
				break;
			}

			++i;
		}

		if (domain != 0)
			query.QueryDomain = domain;

		if (listener) {
			query.IsIndexListener = true;
		} else {
			if (query_str.Length > 0)
				query.AddText (query_str.ToString ());
		}

		query.HitsAddedEvent += OnHitsAdded;
		query.HitsSubtractedEvent += OnHitsSubtracted;

		if (! keep_running)
			query.FinishedEvent += OnFinished;
		else
			query.ClosedEvent += OnClosed;

		SendQuery ();

		main_loop.Run ();
	}
Ejemplo n.º 26
0
 public void OnPlayerAskHelp()
 {
     MainLoop.callAppropriateSystemMethod("HelpSystem", "OnPlayerAskHelp", null);
 }
Ejemplo n.º 27
0
        internal void LeaveCheck(Vector2 Point)
        {
            if (!Loading.SimulationSetup)
            {
                return;
            }

            if (renderer.Camera.CurrentMode != CameraViewMode.Interior && renderer.Camera.CurrentMode != CameraViewMode.InteriorLookAhead)
            {
                return;
            }

            TrainManager.Car Car = TrainManager.PlayerTrain.Cars[TrainManager.PlayerTrain.DriverCar];
            int add = Car.CarSections[0].CurrentAdditionalGroup + 1;

            if (add >= Car.CarSections[0].Groups.Length)
            {
                return;
            }

            TrainManager.TouchElement[] TouchElements = Car.CarSections[0].Groups[add].TouchElements;

            if (TouchElements == null)
            {
                return;
            }

            ObjectState pickedObject = ParseFBO(Point, 5, 5);

            foreach (TrainManager.TouchElement TouchElement in TouchElements)
            {
                if (TouchElement.Element.internalObject == pickedObject)
                {
                    Car.CarSections[0].CurrentAdditionalGroup = TouchElement.JumpScreenIndex;
                    Car.ChangeCarSection(TrainManager.CarSectionType.Interior);

                    if (TouchElement.SoundIndex >= 0 && TouchElement.SoundIndex < Car.Sounds.Touch.Length)
                    {
                        SoundBuffer             Buffer   = Car.Sounds.Touch[TouchElement.SoundIndex].Buffer;
                        OpenBveApi.Math.Vector3 Position = Car.Sounds.Touch[TouchElement.SoundIndex].Position;
                        Program.Sounds.PlaySound(Buffer, 1.0, 1.0, Position, TrainManager.PlayerTrain.Cars[TrainManager.PlayerTrain.DriverCar], false);
                    }
                }

                // HACK: Normally terminate the command issued once.
                if (TouchElement.Element.internalObject == pickedObject || (pickedObject != prePickedObject && TouchElement.Element.internalObject == prePickedObject))
                {
                    for (int i = 0; i < Interface.CurrentControls.Length; i++)
                    {
                        if (Interface.CurrentControls[i].Method != Interface.ControlMethod.Touch)
                        {
                            continue;
                        }

                        bool EnableOption = false;

                        for (int j = 0; j < Translations.CommandInfos.Length; j++)
                        {
                            if (Interface.CurrentControls[i].Command == Translations.CommandInfos[j].Command)
                            {
                                EnableOption = Translations.CommandInfos[j].EnableOption;
                                break;
                            }
                        }

                        if (TouchElement.Command == Interface.CurrentControls[i].Command)
                        {
                            if (EnableOption && TouchElement.CommandOption != Interface.CurrentControls[i].Option)
                            {
                                continue;
                            }

                            Interface.CurrentControls[i].AnalogState  = 0.0;
                            Interface.CurrentControls[i].DigitalState = Interface.DigitalControlState.Released;
                            MainLoop.RemoveControlRepeat(i);
                        }
                    }
                }
            }
        }
 public void RotateDocument(System.Single angle)
 {
     MainLoop.callAppropriateSystemMethod("IARDreamFragmentManager", "RotateDocument", angle);
 }
Ejemplo n.º 29
0
 public Server()
 {
     ml       = new MainLoop("server");
     Server.s = this;
 }
 public void SetFragments(System.Boolean virtualDreamFragment)
 {
     MainLoop.callAppropriateSystemMethod("LoadGameContent", "SetFragments", virtualDreamFragment);
 }