public SandboxAudioController(IAudioController source)
        {
            _devices = new List <SandboxDevice>();

            //Get a copy of the current system audio devices
            //then create a copy of the current state of the system
            //this allows us to "debug" macros against a "test" system
            _defaultPlaybackDeviceId     = source.DefaultPlaybackDevice?.Id ?? Guid.Empty;
            _defaultPlaybackCommDeviceId = source.DefaultPlaybackCommunicationsDevice?.Id ?? Guid.Empty;
            _defaultCaptureDeviceId      = source.DefaultCaptureDevice?.Id ?? Guid.Empty;
            _defaultCaptureCommDeviceId  = source.DefaultCaptureCommunicationsDevice?.Id ?? Guid.Empty;

            foreach (var sourceDev in source.GetDevices(DeviceType.All, DeviceState.All))
            {
                var dev = new SandboxDevice(this)
                {
                    id            = sourceDev.Id,
                    interfaceName = sourceDev.InterfaceName,
                    icon          = sourceDev.Icon,
                    name          = sourceDev.Name,
                    isMuted       = sourceDev.IsMuted,
                    fullName      = sourceDev.FullName,
                    type          = sourceDev.DeviceType,
                    state         = sourceDev.State,
                    volume        = sourceDev.Volume,
                    iconPath      = sourceDev.IconPath
                };
                _devices.Add(dev);
            }
        }
 public static void AddAudioSwitcherLibrary(this IExecutionContext context, IAudioController controller)
 {
     if (context is JsExecutionContext)
     {
         context.AddLibrary("AudioSwitcher", new AudioSwitcherLibrary(controller));
     }
 }
        internal CoreAudioDevice(IMMDevice device, IAudioController <CoreAudioDevice> controller)
            : base(controller)
        {
            _device = device;
            ComThread.Assert();

            if (device == null)
            {
                throw new ArgumentNullException("device");
            }

            LoadProperties(device);

            GetAudioMeterInformation(device);
            GetAudioEndpointVolume(device);

            if (AudioEndpointVolume != null)
            {
                AudioEndpointVolume.OnVolumeNotification += AudioEndpointVolume_OnVolumeNotification;
            }

            controller.AudioDeviceChanged +=
                new EventHandler <AudioDeviceChangedEventArgs>(EnumeratorOnAudioDeviceChanged)
                .MakeWeak(x =>
            {
                controller.AudioDeviceChanged -= x;
            });
        }
Exemple #4
0
 private void Awake()
 {
     CreateTetromonioPool();
     audioController = FindObjectOfType <AudioController>();
     OnGameOver     += GameOver;
     level.InitializeLevelData();
 }
Exemple #5
0
        protected AudioListProviderItemsViewModelBase(IAudioService audioService, IAudioController audioController)
            : base(audioService, audioController)
        {
            IsActiveChanged += FilterIsActiveChanged;

            this.items = new ObservableCollection <TItem>();
            ItemsView  = CollectionViewSource.GetDefaultView(this.items);
        }
Exemple #6
0
        public AudioSwitcherLibrary(ScriptEngine engine, IAudioController controller)
            : base(engine)
        {
            AudioController = controller;
            _deviceType     = new JavaScriptDeviceType(engine);
            _deviceState    = new JavaScriptDeviceState(engine);

            PopulateFields();
            PopulateFunctions();
        }
 public AudioSinkAdapter(CaptureSource captureSource, IAudioController audioController, MediaConfig mediaConfig, IMediaEnvironment mediaEnvironment, AudioFormat playedAudioFormat)
 {
     ClientLogger.Debug(GetType().Name + " created.");
     CaptureSource      = captureSource;
     AudioController    = audioController;
     _mediaConfig       = mediaConfig;
     _mediaEnvironment  = mediaEnvironment;
     _playedAudioFormat = playedAudioFormat;
     _logger            = new AudioSinkAdapterLogger();
 }
Exemple #8
0
 protected Device(IAudioController controller)
 {
     Controller        = controller;
     _muteChanged      = new Broadcaster <DeviceMuteChangedArgs>();
     _stateChanged     = new Broadcaster <DeviceStateChangedArgs>();
     _volumeChanged    = new Broadcaster <DeviceVolumeChangedArgs>();
     _defaultChanged   = new Broadcaster <DefaultDeviceChangedArgs>();
     _propertyChanged  = new Broadcaster <DevicePropertyChangedArgs>();
     _peakValueChanged = new Broadcaster <DevicePeakValueChangedArgs>();
 }
        public AudioSwitcherLibrary(ScriptEngine engine, IAudioController controller)
            : base(engine)
        {
            AudioController = controller;
            _deviceType = new JavaScriptDeviceType(engine);
            _deviceState = new JavaScriptDeviceState(engine);

            PopulateFields();
            PopulateFunctions();
        }
 public FromFileAudioSinkAdapter(
     CaptureSource captureSource,
     IAudioController audioController,
     MediaConfig mediaConfig,
     IMediaEnvironment mediaEnvironment,
     AudioFormat playedAudioFormat,
     List <byte[]> testFrames)
     : base(captureSource, audioController, mediaConfig, mediaEnvironment, playedAudioFormat)
 {
     _testFrames = testFrames;
 }
 public TimingAudioSinkAdapter(
     AudioContext audioContext,
     CaptureSource captureSource,
     IAudioController audioController,
     MediaConfig mediaConfig,
     IMediaEnvironment mediaEnvironment,
     AudioFormat playedAudioFormat)
     : base(captureSource, audioController, mediaConfig, mediaEnvironment, playedAudioFormat)
 {
     _audioContext = audioContext;
     ClientLogger.Debug(GetType().Name + " created.");
 }
Exemple #12
0
 public MediaSinkFactory(IAudioController audioController,
                         IVideoController videoController,
                         MediaConfig mediaConfig,
                         IMediaEnvironment mediaEnvironment,
                         IVideoQualityController videoQualityController)
 {
     _audioController        = audioController;
     _videoController        = videoController;
     _mediaConfig            = mediaConfig;
     _mediaEnvironment       = mediaEnvironment;
     _videoQualityController = videoQualityController;
 }
        protected AudioListProviderViewModelBase(IAudioService audioService, IAudioController audioController)
        {
            Contract.Requires(audioService != null);
            Contract.Requires(audioController != null);

            this.audioService    = audioService;
            this.audioController = audioController;

            IsActiveChanged += FilterIsActiveChanged;

            this.uiDispatcher = Application.Current.Dispatcher;
        }
 public BlockJoinController(IBlockShapeUtil shapeUtil,
                            ILevelModel levelModel,
                            IBlockModelStorage blockStorage,
                            IBlockShapeTextureProvider shapeTextureProvider,
                            IAudioController audioController)
 {
     _shapeUtil            = shapeUtil;
     _levelModel           = levelModel;
     _blockStorage         = blockStorage;
     _shapeTextureProvider = shapeTextureProvider;
     _audioController      = audioController;
 }
 public BlockRotationHandler(IBlockMotionInputController inputController,
                             IGameCameraView gameCamera,
                             IBlockMotionController motionController,
                             IAudioController audioController)
 {
     _inputController  = inputController;
     _gameCamera       = gameCamera;
     _motionController = motionController;
     _audioController  = audioController;
     _inputController.RegisterListener(EBlockMotionEvent.RotateRight, OnRotateRight);
     _inputController.RegisterListener(EBlockMotionEvent.RotateLeft, OnRotateLeft);
     _inputController.RegisterListener(EBlockMotionEvent.RotateDown, OnRotateDown);
     _inputController.RegisterListener(EBlockMotionEvent.RotateUp, OnRotateUp);
 }
 public BlockMovementHandler(IBlockMotionInputController inputController,
                             IGameCameraView gameCamera,
                             IBlockMotionController motionController,
                             IAudioController audioController)
 {
     _inputController  = inputController;
     _gameCamera       = gameCamera;
     _motionController = motionController;
     _audioController  = audioController;
     _inputController.RegisterListener(EBlockMotionEvent.MoveForward, OnMoveForward);
     _inputController.RegisterListener(EBlockMotionEvent.MoveBackward, OnMoveBackward);
     _inputController.RegisterListener(EBlockMotionEvent.MoveLeft, OnMoveLeft);
     _inputController.RegisterListener(EBlockMotionEvent.MoveRight, OnMoveRight);
 }
Exemple #17
0
 public AudioMediaStreamSource(IAudioController audioController, AudioFormat audioFormat)
 {
     AudioController            = audioController;
     _waveFormat                = new WaveFormat();
     _waveFormat.FormatTag      = WaveFormatType.Pcm;
     _waveFormat.BitsPerSample  = AudioConstants.BitsPerSample;
     _waveFormat.Channels       = AudioConstants.Channels;
     _waveFormat.SamplesPerSec  = audioFormat.SamplesPerSecond;
     _waveFormat.AvgBytesPerSec = (AudioConstants.BitsPerSample / 8) * AudioConstants.Channels * audioFormat.SamplesPerSecond;
     _waveFormat.Ext            = null;
     _waveFormat.BlockAlign     = AudioConstants.Channels * (AudioConstants.BitsPerSample / 8);
     _waveFormat.Size           = 0;
     AudioBufferLength          = 50;    //  audioFormat.MillisecondsPerFrame * 2; // 15 is the smallest buffer length that it will accept.
 }
Exemple #18
0
        static void Main(string[] args)
        {
            OLEDScreen        screen                  = new OLEDScreen(5, 1920, 1080);
            LithiumLonBattery battery                 = new LithiumLonBattery(4000);
            PhoneSpeaker      speaker                 = new PhoneSpeaker(1000, new ConsoleOutput());
            SimCorpMobile     simMobile               = new SimCorpMobile(screen, battery, speaker);
            SamsungHeadset    samsungHeadsetComp      = new SamsungHeadset(300, new ConsoleOutput());
            IPhoneHeadset     iPhoneHeadsetComp       = new IPhoneHeadset(350, new ConsoleOutput());
            IAudioController  samsungHeadset          = (IAudioController)samsungHeadsetComp;
            IAudioController  iPhoneHeadset           = (IAudioController)iPhoneHeadsetComp;
            List <string>     playComponentsMenuItems = new List <string>();

            playComponentsMenuItems.Add("Phone speaker");
            playComponentsMenuItems.Add("Samsung Headset");
            playComponentsMenuItems.Add("iPhone Headset");
            int userPlaybackChoice = 0;

            while (true)
            {
                while (userPlaybackChoice == 0)
                {
                    Console.WriteLine(simMobile.ToString());
                    Console.WriteLine("Please select component (specify index)\n");
                    foreach (string item in playComponentsMenuItems)
                    {
                        Console.Write(playComponentsMenuItems.IndexOf(item) + 1 + ". ");
                        Console.WriteLine(item);
                    }
                    Console.Write("\nYour choice: ");
                    userPlaybackChoice = CheckUserInput(Console.ReadLine(), playComponentsMenuItems);
                }
                switch (userPlaybackChoice)
                {
                case 1:
                    simMobile.Play();
                    break;

                case 2:
                    simMobile.Play(samsungHeadset);
                    break;

                case 3:
                    simMobile.Play(iPhoneHeadset);
                    break;
                }
                userPlaybackChoice = 0;
                Console.ReadKey();
                Console.Clear();
            }
        }
        private void Awake()
        {
            if (Instance != null)
            {
                Destroy(gameObject);
                return;
            }

            Instance = this;
            DontDestroyOnLoad(gameObject);

            InitializeMusicContainer();
            InitializeSoundContainer();
        }
 internal JavaScriptAudioDevice(IAudioController controller, IDevice device)
 {
     Controller    = controller;
     Id            = device.Id.ToString();
     Name          = device.Name;
     Interface     = device.InterfaceName;
     FullName      = device.FullName;
     IsPlayback    = device.IsPlaybackDevice;
     IsCapture     = device.IsCaptureDevice;
     Type          = JavaScriptDeviceType.GetJavascriptDeviceType(device.DeviceType);
     State         = JavaScriptDeviceState.GetJavascriptDeviceState(device.State);
     IsDefault     = device.IsDefaultDevice;
     IsDefaultComm = device.IsDefaultCommunicationsDevice;
 }
        internal JavaScriptAudioDevice(ScriptEngine engine, IAudioController controller, IDevice device)
            : base(engine)
        {
            Controller = controller;
            Id = device.Id.ToString();
            Name = device.Name;
            Interface = device.InterfaceName;
            FullName = device.FullName;
            IsPlayback = device.IsPlaybackDevice;
            IsCapture = device.IsCaptureDevice;
            Type = JavaScriptDeviceType.GetJavascriptDeviceType(device.DeviceType);
            State = JavaScriptDeviceState.GetJavascriptDeviceState(device.State);
            IsDefault = device.IsDefaultDevice;
            IsDefaultComm = device.IsDefaultCommunicationsDevice;

            PopulateFields();
            PopulateFunctions();
        }
Exemple #22
0
        public MainModule(IAudioController audioController)
        {
            Get("/", parameters =>
            {
                return(Response.AsFile($"{Program.RootDir}/index.html", "text/html"));
            });

            Get("/volume/set/{Volume}", async parameters =>
            {
                Logger.Info($"Request: /volume/set/{parameters.Volume}");
                await audioController.SetVolume(parameters.Volume);
                return(string.Empty);
            });

            Get("/volume/get/", async parameters =>
            {
                Logger.Info($"Request: /volume/get/");
                int volume = await audioController.GetVolume();
                return(volume.ToString());
            });
        }
        internal CoreAudioDevice(IMMDevice device, IAudioController<CoreAudioDevice> controller)
            : base(controller)
        {
            ComThread.Assert();

            _device = device;

            if (device == null)
                throw new ArgumentNullException("device");

            LoadProperties(device);

            ReloadAudioMeterInformation(device);
            ReloadAudioEndpointVolume(device);

            controller.AudioDeviceChanged +=
                new EventHandler<DeviceChangedEventArgs>(EnumeratorOnAudioDeviceChanged)
                    .MakeWeak(x =>
                    {
                        controller.AudioDeviceChanged -= x;
                    });
        }
 public AudioSwitcherLibrary(IAudioController controller)
 {
     AudioController = controller;
     _deviceType     = new JavaScriptDeviceType();
     _deviceState    = new JavaScriptDeviceState();
 }
Exemple #25
0
 public TestDevice(Guid id, DeviceType dFlow, IAudioController<TestDevice> controller)
     : base(controller)
 {
     _id = id;
     _deviceType = dFlow;
 }
Exemple #26
0
 public SandboxDevice(IAudioController controller)
     : base(controller)
 {
 }
Exemple #27
0
 public SearchProviderViewModel(IAudioService audioService, IAudioController audioController)
     : base(audioService, audioController)
 {
 }
 protected override void BeginProcessing()
 {
     //lazy setup of the controll
     _controller = new CoreAudioController();
 }
 protected override void BeginProcessing()
 {
     //lazy setup of the controll
     _controller = new CoreAudioController();
 }
 public MyAudioListProviderViewModel(IAudioService audioService, IAudioController audioController)
     : base(audioService, audioController)
 {
     
 }
Exemple #31
0
 public TestDevice(Guid id, DeviceType dFlow, IAudioController <TestDevice> controller)
     : base(controller)
 {
     _id         = id;
     _deviceType = dFlow;
 }
Exemple #32
0
 protected Device(IAudioController controller)
 {
     Controller = controller;
 }
 public AudioCurrentViewModel(IAudioController audioController)
 {
     Audio = audioController;
     DownloadAllCommand = new DelegateCommand(Audio.DownloadAll);
 }
 public AudioListViewModel(IAudioController audioController)
 {
     Audio = audioController;
 }
Exemple #35
0
 public TestAudioSinkAdapter(CaptureSource captureSource, IAudioController audioController = null)
     : base(captureSource, audioController, MediaConfig.Default, new TestMediaEnvironment(), AudioFormat.Default)
 {
     _audioController = audioController;
 }
Exemple #36
0
 protected Device(IAudioController controller)
 {
     Controller = controller;
 }
Exemple #37
0
 private void Awake()
 {
     spawnController = FindObjectOfType <SpawnController>();
     audioController = FindObjectOfType <AudioController>();
 }
 public AudioControllerRpcServer(IAudioController service)
 {
     _dispatcher = new CalledProxyDispatcher<AudioControllerCalledProxy>(new AudioControllerCalledProxy(service), OnSendPacket);
     BackgroundMediaPlayer.MessageReceivedFromForeground += BackgroundMediaPlayer_MessageReceivedFromForeground;
 }
Exemple #39
0
 public FilteredProviderViewModel(IAudioService audioService, IAudioController audioController)
     : base(audioService, audioController)
 {
 }
 public AudioListViewModel(IAudioController audioController)
 {
     Audio = audioController;
 }
Exemple #41
0
 public SandboxDevice(IAudioController controller)
     : base(controller)
 {
 }
 protected override void BeginProcessing()
 {
     _controller = new CoreAudioController();
 }