Ejemplo n.º 1
0
        public AudioManager(string settingsFile, string soundbankFile, string waveBankFile, string streamingBankFile)
        {
            if (_instance != null)
            {
                throw new Exception("Audio Manager already created");
            }

            try
            {
                _audioEngine = new AudioEngine(settingsFile);
                _soundBank = new SoundBank(_audioEngine, soundbankFile);
                _waveBank = new WaveBank(_audioEngine, waveBankFile);
                _streamingBank = new WaveBank(_audioEngine, streamingBankFile, 0, 16);
            }
            catch
            {
            }

            _sounds = new List<ISound>(100);
            _soundsToRemove = new List<ISound>(10);

            _channelVolume = new float[(int)AudioChannel.Count];
            _channelMuted = new bool[(int)AudioChannel.Count];
            _channelGoalVolume = new float[(int)AudioChannel.Count];
            _channelFadeElapsed = new float[(int)AudioChannel.Count];
            _channelFadeDuration = new float[(int)AudioChannel.Count];
            _channelFading = new bool[(int)AudioChannel.Count];

            _instance = this;
        }
Ejemplo n.º 2
0
Archivo: G.cs Proyecto: bostelk/delta
        public G(int screenWidth, int screenHeight, bool vSync, string contentDirectory)
            : base()
        {
            _instance = this;
            Content = base.Content;
            Content.RootDirectory = contentDirectory;
            IsFixedTimeStep = true;
            _graphicsDeviceManager = new GraphicsDeviceManager(this);
            _graphicsDeviceManager.PreferredBackBufferWidth = screenWidth;
            _graphicsDeviceManager.PreferredBackBufferHeight = screenHeight;
            _graphicsDeviceManager.DeviceReset += OnDeviceReset;
            _graphicsDeviceManager.PreparingDeviceSettings += OnPreparingDeviceSettings;
            _graphicsDeviceManager.SynchronizeWithVerticalRetrace = vSync;
            _embedded = new ResourceContentManager(Services, EmbeddedContent.ResourceManager);
#if DEBUG
            base.IsMouseVisible = true;
            Window.AllowUserResizing = true;
#endif
            World = new World();
            UI = new UIManager();
            Random = new Random();
            Input = new InputManager();
            Audio = new AudioManager(@"Content\Audio\audio.xgs", @"Content\Audio\Sound Bank.xsb", @"Content\Audio\Wave Bank.xwb", @"Content\Audio\StreamingBank.xwb");
            Collision = new CollisionWorld(new SeperatingAxisNarrowphase(), new UniformGridBroadphase());
            ScreenArea = new Rectangle(0, 0, screenWidth, screenHeight);
            ScreenCenter = ScreenArea.Center.ToVector2();
#if WINDOWS
            Process = Process.GetCurrentProcess();
            GameForm = (Form)Control.FromHandle(Window.Handle);
            EditorForm = new EditorForm();
            EditorForm.Icon = GameForm.Icon;
#endif
        }