public ReduceWhenSpeechAudioRule(IAudioSystem audioSystem, float volumeFactor = 0.2f, float fadeOutTimeInSeconds = 0.8f, Func <float, float> easing = null)
 {
     _targetVolumeFactor   = volumeFactor;
     _fadeOutTimeInSeconds = fadeOutTimeInSeconds;
     _easing      = easing;
     _enabled     = true;
     _audioSystem = audioSystem;
     _modifier    = new VolumeModifier(volumeFactor);
 }
예제 #2
0
 public void SetUp()
 {
     _animationSystem         = Substitute.For <IAnimationSystem>();
     _audioSystem             = Substitute.For <IAudioSystem>();
     _behaviorSystem          = Substitute.For <IBehaviorSystem>();
     _entityDestructionSystem = Substitute.For <IEntityDestructionSystem>();
     _inputSystem             = Substitute.For <IInputSystem>();
     _physicsSystem           = Substitute.For <IPhysicsSystem>();
     _renderingSystem         = Substitute.For <IRenderingSystem>();
 }
예제 #3
0
        public ALAudioClip(string id, ISoundData soundData, IAudioSystem system, IAudioErrors errors, IAudioBackend backend)
		{
			_soundData = soundData;
			_errors = errors;
            _backend = backend;
			ID = id;
			_buffer = new Lazy<int> (() => generateBuffer());
			_system = system;
			Volume = 1f;
			Pitch = 1f;
		}
예제 #4
0
 public ALAudioClip(string id, ISoundData soundData, IAudioSystem system, IAudioErrors errors, IAudioBackend backend)
 {
     _soundData = soundData;
     _errors    = errors;
     _backend   = backend;
     ID         = id;
     _buffer    = new Lazy <int> (() => generateBuffer());
     _system    = system;
     Volume     = 1f;
     Pitch      = 1f;
 }
예제 #5
0
 public ALAudioClip(string id, ISoundData soundData, IAudioSystem system, IAudioErrors errors, IAudioBackend backend)
 {
     _soundData     = soundData;
     _errors        = errors;
     _backend       = backend;
     ID             = id;
     _buffer        = new Lazy <int> (() => generateBuffer());
     Duration       = getDuration(soundData.DataLength, soundData.Channels, soundData.BitsPerSample, soundData.SampleRate);
     _playingSounds = new AGSConcurrentHashSet <ISound>();
     _system        = system;
     Volume         = 1f;
     Pitch          = 1f;
 }
예제 #6
0
 public ALAudioFactory(IResourceLoader loader, Resolver resolver, IAudioSystem audioSystem)
 {
     _audioSystem = audioSystem;
     _loader      = loader;
     _resolver    = resolver;
     _decoders    = new Dictionary <string, List <ISoundDecoder> >
     {
         { ".WAV", new List <ISoundDecoder> {
               new WaveDecoder()
           } }
         , { ".OGG", new List <ISoundDecoder> {
                 new OggDecoder()
             } }
         , { ".FLAC", new List <ISoundDecoder> {
                 new FlacDecoder()
             } }
     };
     RegisterExternalDecoders?.Invoke(_decoders);
 }
예제 #7
0
        public void SetUp()
        {
            _coreDiagnosticInfoProvider = Substitute.For <ICoreDiagnosticInfoProvider>();
            _gameTimeProvider           = Substitute.For <IGameTimeProvider>();
            _engineSystems = Substitute.For <IEngineSystems>();
            _sceneManager  = Substitute.For <ISceneManagerForGameLoop>();
            _performanceStatisticsRecorder = Substitute.For <IPerformanceStatisticsRecorder>();

            _animationSystem = Substitute.For <IAnimationSystem>();
            _engineSystems.AnimationSystem.Returns(_animationSystem);
            _engineSystems.AnimationSystemName.Returns(AnimationSystemName);
            _audioSystem = Substitute.For <IAudioSystem>();
            _engineSystems.AudioSystem.Returns(_audioSystem);
            _engineSystems.AudioSystemName.Returns(AudioSystemName);
            _behaviorSystem = Substitute.For <IBehaviorSystem>();
            _engineSystems.BehaviorSystem.Returns(_behaviorSystem);
            _engineSystems.BehaviorSystemName.Returns(BehaviorSystemName);
            _entityDestructionSystem = Substitute.For <IEntityDestructionSystem>();
            _engineSystems.EntityDestructionSystem.Returns(_entityDestructionSystem);
            _engineSystems.EntityDestructionSystemName.Returns(EntityDestructionSystemName);
            _inputSystem = Substitute.For <IInputSystem>();
            _engineSystems.InputSystem.Returns(_inputSystem);
            _engineSystems.InputSystemName.Returns(InputSystemName);
            _physicsSystem = Substitute.For <IPhysicsSystem>();
            _engineSystems.PhysicsSystem.Returns(_physicsSystem);
            _engineSystems.PhysicsSystemName.Returns(PhysicsSystemName);
            _renderingSystem = Substitute.For <IRenderingSystem>();
            _engineSystems.RenderingSystem.Returns(_renderingSystem);
            _engineSystems.RenderingSystemName.Returns(RenderingSystemName);
            _customSystem1 = Substitute.For <ICustomSystem>();
            _customSystem1.Name.Returns(CustomSystem1Name);
            _customSystem2 = Substitute.For <ICustomSystem>();
            _customSystem2.Name.Returns(CustomSystem2Name);
            _customSystem3 = Substitute.For <ICustomSystem>();
            _customSystem3.Name.Returns(CustomSystem3Name);
            _engineSystems.CustomSystems.Returns(new[] { _customSystem1, _customSystem2, _customSystem3 });
        }
예제 #8
0
 public static void Provide(IAudioSystem audioSystem)
 {
     _audio = audioSystem == null ? new NullAudioSystem() : audioSystem;
 }
예제 #9
0
 static Services()
 {
     _audio = new NullAudioSystem();
 }
예제 #10
0
 public Fahrzeug(IMotor motor, IBremse bremse, IAudioSystem audioSystem)
 {
     this.motor       = motor;
     this.bremse      = bremse;
     this.audioSystem = audioSystem;
 }
예제 #11
0
 public AudioEngine()
 {
     audioSystem = new AudioSystemBass();
     tracks = new LinkedList<AUDIOTRACK>();
     init();
 }
예제 #12
0
        public EngineSystems(
            IAnimationSystem animationSystem,
            IAudioSystem audioSystem,
            IBehaviorSystem behaviorSystem,
            IEntityDestructionSystem entityDestructionSystem,
            IInputSystem inputSystem,
            IPhysicsSystem physicsSystem,
            IRenderingSystem renderingSystem,
            IEnumerable <ICustomSystem> customSystems,
            CoreConfiguration configuration)
        {
            AnimationSystem         = animationSystem;
            AudioSystem             = audioSystem;
            BehaviorSystem          = behaviorSystem;
            EntityDestructionSystem = entityDestructionSystem;
            InputSystem             = inputSystem;
            PhysicsSystem           = physicsSystem;
            RenderingSystem         = renderingSystem;

            var customSystemsExecutionOrder = configuration.CustomSystemsExecutionOrder;
            var customSystemsList           = customSystems.ToList();
            var customSystemsSortedList     = new List <ICustomSystem>();

            Log.Info("Searching for custom systems...");
            foreach (var customSystem in customSystemsList)
            {
                Log.Info($"Custom system found: {customSystem.Name}");
            }

            if (customSystemsExecutionOrder.Count != customSystemsExecutionOrder.Distinct().Count())
            {
                throw new ArgumentException("Configuration specifies duplicated custom systems. Each custom system can be specified only once.");
            }

            var customSystemsNames = customSystemsList.Select(cs => cs.Name).ToList();

            if (customSystemsNames.Count != customSystemsNames.Distinct().Count())
            {
                throw new ArgumentException("There are custom system with duplicated names. Each system must have unique name.");
            }

            foreach (var systemName in customSystemsExecutionOrder)
            {
                var customSystem = customSystemsList.SingleOrDefault(cs => cs.Name == systemName);
                if (customSystem == null)
                {
                    throw new ArgumentException($"Cannot find custom system specified in configuration. Custom system name: {systemName}");
                }

                customSystemsSortedList.Add(customSystem);
            }

            CustomSystems = customSystemsSortedList.AsReadOnly();

            SystemsNames = new[]
            {
                AnimationSystemName,
                AudioSystemName,
                BehaviorSystemName,
                EntityDestructionSystemName,
                InputSystemName,
                PhysicsSystemName,
                RenderingSystemName
            }.Concat(CustomSystems.Select(cs => cs.Name)).OrderBy(n => n).ToList().AsReadOnly();

            Log.Info("Custom systems has been configured to execute in following order:");
            foreach (var customSystem in CustomSystems)
            {
                Log.Info($"Custom system name: {customSystem.Name}");
            }
        }
예제 #13
0
		public AGSAudioSettings(IAudioSystem system, ICrossFading roomMusicCrossFading)
		{
			_system = system;
			RoomMusicCrossFading = roomMusicCrossFading;
		}
예제 #14
0
 public void SetAudioSystem(IAudioSystem audioSystemParam)
 {
     audioSystem = audioSystemParam;
 }
예제 #15
0
 public void SetAudioSystem(IAudioSystem audioSystem)
 {
     Demo.SetAudioSystem(audioSystem);
 }
예제 #16
0
        protected override void OnLoad(EventArgs e)
        {
            PauseSyncButton = new Button(Key.Space);
            PrevSceneButton = new Button(Key.F3);
            NextSceneButton = new Button(Key.F4);

            ReloadDemoButton = new Button(Key.F5);
            RestartDemoOrRetreatSceneButton = new Button(Key.F6);
            AdvanceSceneButton = new Button(Key.F7);
            InputEnabledButton = new Button(Key.F8);

            CameraModeButton      = new Button(Key.F9);
            CameraSpeedDownButton = new Button(Key.F10);
            CameraSpeedUpButton   = new Button(Key.F11);
            PrintFrameButton      = new Button(Key.F12);

            tunableManager = TunableManager.GetSingleton();
            syncSystem     = SyncSystem.GetSingleton();
            renderer       = Renderer.GetSingleton();

            string dataFolder = "data";

            AssetManager.WorkingDir = dataFolder;
            AssetManager assetManager = AssetManager.GetSingleton();

            Logger.LogPhase("Asset manager is created");
            assetManager.LoadAll();
            assetManager.printLoadedAssets();
            Logger.LogPhase("Assets have been loaded");

            tunableManager.ReloadValues();
            Logger.LogPhase("Config file have been loaded");

            demoWrapper = new DemoWrapper();
            demoWrapper.Create();
            demoSettings = demoWrapper.Demo.GetDemoSettings();

            // Audio ....................................

            Logger.LogPhase("Initializing audio system");

            if (demoSettings.AudioEngineSetting == DemoSettings.AudioEngine.System)
            {
                audioSystem = new SystemAudio();
            }
            if (demoSettings.AudioEngineSetting == DemoSettings.AudioEngine.Dummy)
            {
                if (demoSettings.AudioEnabled == true)
                {
                    Logger.LogError(Logger.ErrorState.User, "Initialized dummy audio when Audio is enabled.");
                }
                audioSystem = new DummyAudioSystem();
            }
            bool audioInitOk = audioSystem.Initialize();

            if (!audioInitOk)
            {
                Logger.LogError(Logger.ErrorState.Critical, "Audio system failed to initialize.");
                return;
            }
            Logger.LogPhase("Audio has been initialized");
            demoWrapper.SetAudioSystem(audioSystem);


            // Sync.............................

            if (demoSettings.SyncEnabled)
            {
                syncSystem.Start(demoSettings.SyncFilePrefix);
            }
            else
            {
                syncSystem.StartManual();
            }

            // Rendering .................
            Size windowSize = new Size((int)demoSettings.Resolution.X, (int)demoSettings.Resolution.Y);

            base.Size = windowSize;
            if (demoSettings.Fullscreen)
            {
                base.WindowState = WindowState.Fullscreen;
            }
            renderer.ResizeScreen((int)demoSettings.Resolution.X, (int)demoSettings.Resolution.Y);


            CursorVisible = false;
            testScene     = new TestScene();
            testScene.Load(assetManager);

            loadingScene = new LoadingScene();
            loadingScene.Load(assetManager);

            applicationTime = new Stopwatch();

            LoadDemo();
            Logger.LogPhase("OnLoad complete");
            loadCompleted = true;
            running       = true;
            applicationTime.Start();
        }
 private void Start()
 {
     audioSystem = GetComponent <IAudioSystem>();
 }
예제 #18
0
 public AGSAudioSettings(IAudioSystem system, ICrossFading roomMusicCrossFading)
 {
     _system = system;
     RoomMusicCrossFading = roomMusicCrossFading;
 }
예제 #19
0
 public Auto(IBremse bremse, IMotor motor, IAudioSystem audioSystem)
 {
     this.bremse      = bremse ?? throw new ArgumentNullException(nameof(bremse));
     this.motor       = motor ?? throw new ArgumentNullException(nameof(motor));
     this.audioSystem = audioSystem ?? throw new ArgumentNullException(nameof(audioSystem));
 }