Exemple #1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sfxSystem"></param>
 /// <param name="fxEvent"></param>
 public SfxInstance( SfxSystem sfxSystem, FXEvent fxEvent )
 {
     this.sfxSystem	=	sfxSystem;
     this.rw			=	sfxSystem.rw;
     this.sw			=	sfxSystem.sw;
     this.fxEvent	=	fxEvent;
 }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        public override void Initialize()
        {
            try
            {
                if (Device == null)
                {
                    Device = new XAudio2(XAudio2Flags.None, ProcessorSpecifier.DefaultProcessor, XAudio2Version.Version27);
                    Device.StartEngine();
                }

                var DeviceFormat = Device.GetDeviceDetails(0).OutputFormat;

                // Just use the default device.
                const int deviceId = 0;

                if (MasterVoice == null)
                {
                    // Let windows autodetect number of channels and sample rate.
                    MasterVoice = new MasteringVoice(Device, XAudio2.DefaultChannels, XAudio2.DefaultSampleRate, deviceId);
                    MasterVoice.SetVolume(_masterVolume, 0);
                }

                // The autodetected value of MasterVoice.ChannelMask corresponds to the speaker layout.
                var deviceDetails = Device.GetDeviceDetails(deviceId);
                Speakers = deviceDetails.OutputFormat.ChannelMask;

                var dev3d = Device3D;

                Log.Debug("Audio devices :");
                for (int devId = 0; devId < Device.DeviceCount; devId++)
                {
                    var device = Device.GetDeviceDetails(devId);

                    Log.Debug("[{1}] {0}", device.DisplayName, devId);
                    Log.Debug("    role : {0}", device.Role);
                    Log.Debug("    id   : {0}", device.DeviceID);
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());

                // Release the device and null it as
                // we have no audio support.
                if (Device != null)
                {
                    Device.Dispose();
                    Device = null;
                }

                MasterVoice = null;
            }


            soundWorld = new SoundWorld(Game);
        }
Exemple #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="game"></param>
        public SfxSystem( ShooterClient client, World world )
        {
            this.world	=	world;
            this.client	=	client;
            this.game	=	client.Game;
            this.rw		=	game.RenderSystem.RenderWorld;
            this.sw		=	game.SoundSystem.SoundWorld;

            Game_Reloading(this, EventArgs.Empty);
            game.Reloading +=	Game_Reloading;

            SfxInstance.EnumerateSFX( type => sfxDict.Add( type.Name, type ) );
        }
		/// <summary>
		/// 
		/// </summary>
        public override void Initialize()
        {
            try
            {
                if (Device == null) {
                    Device = new XAudio2(XAudio2Flags.None, ProcessorSpecifier.DefaultProcessor);
                    Device.StartEngine();
                }

				var DeviceFormat = Device.GetDeviceDetails(0).OutputFormat;

                // Just use the default device.
                const int deviceId = 0;

                if (MasterVoice == null) {
                    // Let windows autodetect number of channels and sample rate.
                    MasterVoice = new MasteringVoice(Device, XAudio2.DefaultChannels, XAudio2.DefaultSampleRate, deviceId);
                    MasterVoice.SetVolume(_masterVolume, 0);
                }

                // The autodetected value of MasterVoice.ChannelMask corresponds to the speaker layout.
                var deviceDetails = Device.GetDeviceDetails(deviceId);
                Speakers = deviceDetails.OutputFormat.ChannelMask;

				var dev3d = Device3D;

				Log.Debug("Audio devices :");
				for ( int devId = 0; devId < Device.DeviceCount; devId++ ) {
					var device = Device.GetDeviceDetails( devId );

					Log.Debug( "[{1}] {0}", device.DisplayName, devId );
					Log.Debug( "    role : {0}", device.Role );
					Log.Debug( "    id   : {0}", device.DeviceID );
				}
            }
            catch
            {
                // Release the device and null it as
                // we have no audio support.
                if (Device != null)
                {
                    Device.Dispose();
                    Device = null;
                }

                MasterVoice = null;
            }


			soundWorld	=	new SoundWorld(Game);
        }