コード例 #1
0
        public AudioPlayer(int int0, WaveFormat waveFormat0, int int1, float volume, bool bool3, Delegate3 delegate31)
        {
            WaitCallback waitCallback   = null;
            var          volumeListener = new VolumeListener();

            volumeListener.Volume = volume;
            _delegate40           = Class165.smethod_0;
            _object0 = new object();
            //base..ctor();
            volumeListener.AudioPlayer = this;
            _bool2      = bool3;
            _byte0      = (byte)((waveFormat0.short_2 == 8) ? 128 : 0);
            _delegate30 = delegate31;
            Exception4.smethod_1(
                Class162.waveOutOpen(out _intptr0, int0, waveFormat0, _delegate40, 0, Class162.Enum17.Const3),
                "waveOutOpen");
            method_7(waveFormat0.method_0(int1 / 5), 5);
            _thread0 = new Thread(method_6);
            SetVolume(0f);
            _thread0.Start();
            if (waitCallback == null)
            {
                waitCallback = volumeListener.StartListener;
            }
            ThreadPool.QueueUserWorkItem(waitCallback);
        }
コード例 #2
0
        private void Initialize()
        {
            this.MarioInputK = new InputControllerKeyboard();
            this.MarioInputG = new InputControllerGamePad(PlayerIndex.One);

            this.PauseK = new InputControllerKeyboard();
            this.PauseG = new InputControllerGamePad(PlayerIndex.One);

            KeyListener pause  = new PauseKeyListener(this.game, this.MarioInputK, this.MarioInputG);
            KeyListener right  = new MarioMovementKeyListener(this.game, 1);
            KeyListener left   = new MarioMovementKeyListener(this.game, -1);
            KeyListener jump   = new MarioJumpKeyListener(this.game);
            KeyListener crouch = new MarioCrouchKeyListener(this.game);
            KeyListener dash   = new MarioDashFireballKeyListener(this.game);
            KeyListener mute   = new MuteListener(this.game);
            KeyListener volume = new VolumeListener(this.game);

            this.MarioInputK.RegisterKeyListener(Keys.Right, right);
            this.MarioInputK.RegisterKeyListener(Keys.Left, left);
            this.MarioInputK.RegisterKeyListener(Keys.D, right);
            this.MarioInputK.RegisterKeyListener(Keys.A, left);
            this.MarioInputK.RegisterKeyListener(Keys.W, jump);
            this.MarioInputK.RegisterKeyListener(Keys.Up, jump);
            this.MarioInputK.RegisterKeyListener(Keys.Down, crouch);
            this.MarioInputK.RegisterKeyListener(Keys.S, crouch);
            this.MarioInputK.RegisterKeyListener(Keys.Space, dash);

            this.MarioInputK.RegisterKeyListener(Keys.Y, new StandardMarioKeyListener(this.game));
            this.MarioInputK.RegisterKeyListener(Keys.U, new SuperMarioKeyListener(this.game));
            this.MarioInputK.RegisterKeyListener(Keys.I, new FireMarioKeyListener(this.game));



            this.MarioInputK.RegisterKeyListener(Keys.M, mute);
            this.MarioInputK.RegisterKeyListener(Keys.OemComma, volume);
            this.MarioInputK.RegisterKeyListener(Keys.OemPeriod, volume);

            this.MarioInputG.RegisterKeyListener(Buttons.DPadLeft, left);
            this.MarioInputG.RegisterKeyListener(Buttons.DPadRight, right);
            this.MarioInputG.RegisterKeyListener(Buttons.DPadUp, jump);
            this.MarioInputG.RegisterKeyListener(Buttons.DPadDown, crouch);
            this.MarioInputG.RegisterKeyListener(Buttons.B, dash);

            this.PauseK.RegisterKeyListener(Keys.P, pause);
            this.PauseG.RegisterKeyListener(Buttons.Start, pause);

            this.InputControllers.Add(this.MarioInputK);
            this.InputControllers.Add(this.MarioInputG);
            this.InputControllers.Add(this.PauseK);
            this.InputControllers.Add(this.PauseG);
        }
コード例 #3
0
ファイル: VolAdjFix.cs プロジェクト: sarim/VolAdjFix
    static void Main(string[] args)
    {
        float          targetVolume = float.Parse(args[0]);
        VolumeListener listener;

        Console.WriteLine("VolAdj Monitoring started. Target Volume: {0}", targetVolume);
        AudioManager.SetMasterVolume(targetVolume);

        listener = new VolumeListener(targetVolume);
        AudioManager.SetMasterVolumeNotifier(listener);

        while (true)
        {
            System.Threading.Thread.Sleep(10000);
        }
    }
コード例 #4
0
ファイル: AudioManager.cs プロジェクト: sarim/VolAdjFix
        public static void SetMasterVolumeNotifier(VolumeListener listner)
        {
            IAudioEndpointVolume        masterVol = null;
            AudioEndpointVolumeCallback callBack;

            try
            {
                masterVol = GetMasterVolumeObject();
                if (masterVol == null)
                {
                    return;
                }

                callBack = new AudioEndpointVolumeCallback(listner);
                Marshal.ThrowExceptionForHR(masterVol.RegisterControlChangeNotify(callBack));
            }
            finally
            {
                // if (masterVol != null)
                // Marshal.ReleaseComObject(masterVol);
            }
        }
コード例 #5
0
ファイル: AudioManager.cs プロジェクト: sarim/VolAdjFix
 internal AudioEndpointVolumeCallback(VolumeListener parent)
 {
     this.parent = parent;
 }
コード例 #6
0
 // Use this for initialization
 void Start()
 {
     vol          = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <VolumeListener> ();
     volumeSlider = GameObject.FindGameObjectWithTag("VolumeSlider").GetComponent <Slider>();
 }