• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Audio.SoundBank类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.Xna.Framework.Audio.SoundBank的典型用法代码示例。如果您正苦于以下问题:C# SoundBank类的具体用法?C# SoundBank怎么用?C# SoundBank使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SoundBank类属于Microsoft.Xna.Framework.Audio命名空间,在下文中一共展示了SoundBank类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AudioManager

 private AudioManager(Microsoft.Xna.Framework.Game game, string settingsFile, string waveBankFile, string soundBankFile)
     : base(game)
 {
     this.SoundEffectInstances = new List<SoundEffectInstance>();
     try
     {
         this.audioEngine = new AudioEngine(settingsFile);
         this.waveBank = new WaveBank(this.audioEngine, waveBankFile, 0, 16);
         this.soundBank = new SoundBank(this.audioEngine, soundBankFile);
     }
     catch (NoAudioHardwareException)
     {
         this.audioEngine = null;
         this.waveBank = null;
         this.soundBank = null;
     }
     catch (InvalidOperationException)
     {
         this.audioEngine = null;
         this.waveBank = null;
         this.soundBank = null;
     }
     while (!this.waveBank.IsPrepared)
     {
         this.audioEngine.Update();
     }
 }
开发者ID:castroev,项目名称:StardriveBlackBox-verRadicalElements-,代码行数:27,代码来源:AudioManager.cs


示例2: InitializeAudioManager

        public static void InitializeAudioManager(ContentManager cm)
        {
            audioEngine = new AudioEngine("Content//Music//music.xgs");
            waveBank = new WaveBank(audioEngine, "Content//Music//Wave Bank.xwb");
            soundBank = new SoundBank(audioEngine, "Content//Music//Sound Bank.xsb");

            //TODO: initialize SoundEffects
            worldShatter = cm.Load<SoundEffect>("SFX/DimensionShatter");
            doorClose = cm.Load<SoundEffect>("SFX/DoorClose");
            doorOpen = cm.Load<SoundEffect>("SFX/DoorOpen");
            portal = cm.Load<SoundEffect>("SFX/EnterPortal");
            bridgeBarrier = cm.Load<SoundEffect>("SFX/HitBarrier");
            objectDestroyed = cm.Load<SoundEffect>("SFX/ObjectDestroyed");
            playerDie = cm.Load<SoundEffect>("SFX/PlayerDie");
            playerRevive = cm.Load<SoundEffect>("SFX/PlayerRevive");
            portalItem = cm.Load<SoundEffect>("SFX/PortalItemGet");
            switchActivate = cm.Load<SoundEffect>("SFX/SwitchActivate");
            switchDeactivate = cm.Load<SoundEffect>("SFX/SwitchDeactivate");
            bridgeBreaking = cm.Load<SoundEffect>("SFX/ObjectDestroyed");       //Change
            playerJump = cm.Load<SoundEffect>("SFX/PlayerJump");
            playerLand = cm.Load<SoundEffect>("SFX/PlayerLand");
            playerPsyActivate = cm.Load<SoundEffect>("SFX/PsyActivate");
            playerPsyDeactivate = cm.Load<SoundEffect>("SFX/PsyDeactivate");
            checkpoint = worldShatter;                                          //Change?
            signal = bridgeBarrier;                                             //Do  -> Change?

            pause = cm.Load<SoundEffect>("SFX/pause");                          //Change
            //menuMove = cm.Load<SoundEffect>("SFX/menuBlip");
            menuMove = bridgeBarrier;
            //menuSelect = cm.Load<SoundEffect>("SFX/menuSelect");
            menuSelect = worldShatter;
        }
开发者ID:jacobnelson,项目名称:WorldsApart,代码行数:32,代码来源:AudioManager.cs


示例3: Load

        public override void Load()
        {
            try
            {
                m_AudioEngine = new AudioEngine(m_RootDirectory + "sounds.xgs");

                if (m_AudioEngine != null)
                {
                    m_WaveBank = new WaveBank(m_AudioEngine, (m_RootDirectory + "Wave Bank.xwb"));
                    m_SoundBank = new SoundBank(m_AudioEngine, (m_RootDirectory + "Sound Bank.xsb"));

                    // Get sound categories
                    AudioCategory soundCategory = m_AudioEngine.GetCategory("Sounds");
                    AudioCategory musicCategory = m_AudioEngine.GetCategory("Music");

                    // Set into the custom categories
                    m_SoundCategory = new CustomAudioCategory(soundCategory);
                    m_MusicCategory = new CustomAudioCategory(musicCategory);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }
开发者ID:Imortilize,项目名称:Psynergy-Engine,代码行数:25,代码来源:XACTEngine.cs


示例4: FieldPong

        public FieldPong()
        {
            graphics = new GraphicsDeviceManager(this);
            content = new ContentManager(Services);

            graphics.PreferredBackBufferWidth = 1024;
            graphics.PreferredBackBufferHeight = 768;
            graphics.MinimumPixelShaderProfile = ShaderProfile.PS_2_0;
            graphics.SynchronizeWithVerticalRetrace = true;

            physicsSimulator = new PhysicsSimulator(new Vector2(0));
            physicsSimulator.AllowedPenetration = 0.3f;
            physicsSimulator.BiasFactor = 1.0f;
            Services.AddService(typeof(PhysicsSimulator), physicsSimulator);

            screenManager = new ScreenManager(this);
            Components.Add(screenManager);

            bloomProcessor = new BloomPostProcessor(this);
            Components.Add(bloomProcessor);

            // Uncomment this to monitor the FPS:

            //fpsCounter = new FrameRateCounter(this);
            //Components.Add(fpsCounter);

            audioEngine = new AudioEngine("Content\\Audio\\FieldPongAudio.xgs");
            waveBank = new WaveBank(audioEngine, "Content\\Audio\\Wave Bank.xwb");
            soundBank = new SoundBank(audioEngine, "Content\\Audio\\Sound Bank.xsb");

            backgroundMusic = soundBank.GetCue("GameSong0010 16 Bit");
            backgroundMusic.Play();
        }
开发者ID:zpconn,项目名称:FieldPong,代码行数:33,代码来源:FieldPong.cs


示例5: bolt

        protected int timeTillNextRBolt = 4000; // Electricity bolt ( right )

        #endregion Fields

        #region Constructors

        public FinalBoss(Texture2D textureImage, Texture2D pulseCannonTex, Texture2D boltCannonTex, Texture2D defendersPlatformTex, Texture2D defenderTex, Texture2D pulseTex, Texture2D boltTex, Player player, Rectangle window, ExplosionManager explosionManager, SoundBank soundBank)
            : base(textureImage, new Point(1, 1),  new Vector2(window.Width / 2f, window.Height + 400), Vector2.Zero, window, explosionManager, soundBank)
        {
            this.pulseCannonTex = pulseCannonTex;
            this.boltCannonTex = boltCannonTex;
            this.defendersPlatformTex = defendersPlatformTex;
            this.defenderTex = defenderTex;
            this.pulseTex = pulseTex;
            this.boltTex = boltTex;

            this.player = player;

            this.explosionDamage = 200f;
            this.explosionRadius = 300f;
            this.scoreOnDeath = 3000;
            this.health = 14000;
            this.materialDensity = 10f;

            this.rotation = (float)Math.PI;

            boltR = new Bolt(boltTex, new Point(1, 4), position - new Vector2(230 + 105 + 10, 15), 60, false, window, explosionManager);
            boltL = new Bolt(boltTex, new Point(1, 4), position + new Vector2(230 + 105 + 10, -15), 60, true, window, explosionManager);

            this.side = Side.Aliens;

            soundBank.PlayCue("FinalBossFlyBy");
        }
开发者ID:urgamedev,项目名称:code-monogame,代码行数:33,代码来源:FinalBoss.cs


示例6: WinningScreen

        public WinningScreen(Texture2D background, Texture2D buttonTex, SpriteFont font, Color color, Difficulty difficulty,Texture2D control, Player player, bool superShipWasAvailable, bool superShipAvailable, TimeSpan TotalTime, Rectangle window, SoundBank soundBack)
            : base(background, WallpaperType.Streched, buttonTex, font, window, soundBack)
        {
            this.playerTex = player.GetTexture;
            this.control = control;

            this.AddButton("Play Again", color, new Vector2(buttonTex.Width / 2f + buttonTex.Height / 3f, window.Height - buttonTex.Height / 3f));
            this.AddButton("Exit", color, new Vector2(buttonTex.Width * 2f + buttonTex.Height / 3f, window.Height - buttonTex.Height / 3f));

            this.AddLabel("Well Done! You have finished the game!", new Vector2(50));

            float w = window.Width / 2f-150;
            float h = window.Height / 14f;
            float t = 100;

            this.AddLabel("Bullets fired : " + player.GetBulletsFired,new Vector2(w,h+t));
            this.AddLabel("      Accuracy: " + player.GetBulletsAccuracy + "%", new Vector2(w, h * 2 + t));
            this.AddLabel("Missiles fired: " + player.GetMissilesFired, new Vector2(w, h * 3 + t));
            this.AddLabel("      Accuracy: " + player.GetMissilesAccuracy + "%", new Vector2(w, h * 4 + t));
            this.AddLabel("Total Accuracy: " + player.GetTotalAccuracy + "%", new Vector2(w, h * 5 + t));
            this.AddLabel("MidKits Used  : " + player.GetMidkitsUsed, new Vector2(w, h * 6 + t));
            this.AddLabel("Player Score  : " + player.GetPlayerScore , new Vector2(w, h * 7 + t));
            this.AddLabel("Time played     " + TotalTime.Hours +":" + TotalTime.Minutes + ":" + TotalTime.Seconds , new Vector2(w, h * 8 + t));

            this.AddAnimation( new Animation(playerTex, new Point(4, 1),new Vector2(100,window.Height/2f),20,true,font,difficulty.ToString(),window));
            this.AddAnimation( new Animation(control,new Point(1,3),new Vector2(150,window.Height/2f+100),700,false,font,"",window));

            if (superShipAvailable && !superShipWasAvailable)
                this.AddLabel("*Congratulations!! You've unlocked a new ship,The ultimate ship.", new Vector2(100, h * 9f + t));
        }
开发者ID:urgamedev,项目名称:code-monogame,代码行数:30,代码来源:WinningScreen.cs


示例7: GameRoot

        public GameRoot()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            Instance = this;
            //http://msdn.microsoft.com/en-us/library/dd231915%28v=xnagamestudio.31%29.aspx nores on how to load audio engine. had to add xact.dll reference located in programfiles/microsoftxna/.../win/xact.dll
            //http://xboxforums.create.msdn.com/forums/p/102228/608489.aspx how to find other audio devices.

            // Initialize audio objects.
            engine = new AudioEngine(@"Content\Audio\Xact.xgs",TimeSpan.Zero,"{0.0.0.00000000}.{a26fe1c0-9b55-4670-a6fd-76d91685f704}");
            soundBank = new SoundBank(engine, @"Content\Audio\Sound Bank.xsb");
            waveBank = new WaveBank(engine, @"Content\Audio\Wave Bank.xwb");

            //Console.WriteLine("SOUND ENGINE: " + engine.RendererDetails.ToString()); used to determine the redndererID
            //foreach (var r in engine.RendererDetails)
            //{
            //    Console.WriteLine(r.FriendlyName +","+ r.RendererId);
            //}

            graphics.PreferredBackBufferWidth = 1680;//(int)DisplaySize.X-150;
            graphics.PreferredBackBufferHeight = 1050;//(int)DisplaySize.Y -350;

            bloom = new BloomComponent(this);
            Components.Add(bloom);
            bloom.Settings = new BloomSettings(null, .25f, 4, 2, 1, 1.5f, 1);

            IsFixedTimeStep = true;
            //TargetElapsedTime = TimeSpan.FromSeconds(1.0 / 120);
        }
开发者ID:Crysco,项目名称:Invasion,代码行数:29,代码来源:GameRoot.cs


示例8: GridMenu

        public GridMenu(int xloc, int yloc, int cols, Texture2D texture, SoundBank soundbank)
        {
            m_xpos = xloc;
            m_ypos = yloc;
            m_columns = cols;
            m_texture = texture;
            m_soundbank = soundbank;

            Console.WriteLine("Starting Drawing at [" + xloc + ", " + yloc + "]");

            m_x = -1;
            m_y = 0;
            m_rows = 1;
            m_num_items = 0;
            m_selected_x = -1;
            m_selected_y = -1;

            m_list = new List<SelectionItem>();
            m_grid = new GridItem[m_rows, m_columns];

            for (int i = 0; i < m_columns; i++)
            {
                m_grid[m_rows-1, i] = new GridItem();
                m_grid[m_rows-1, i].m_selectable = false;
            }
        }
开发者ID:andressbarajas,项目名称:Pong,代码行数:26,代码来源:GridMenu.cs


示例9: World

        /// <summary>
        /// Create an empty world.
        /// </summary>
        /// <param name="parentScreen">The screen this world will be updated in.</param>
        public World(Screen parentScreen, Player player)
            : base(parentScreen)
        {
            this.worldObjects = new List<WorldObject>();
            this.player = player;
            ParentScreen.Components.Add(player);
            this.interactiveLayers = new Dictionary<int, TileMapLayer>();
            this.parallaxLayers = new Dictionary<int, TileMapLayer>();
            batchService = (ISpriteBatchService)this.Game.Services.GetService(typeof(ISpriteBatchService));
            otherMaps = new List<TileMap>();

            //Set up Sound systems
            audioEngine = new AudioEngine("Content\\System\\Sounds\\Win\\SoundFX.xgs");
            soundBank = new SoundBank(audioEngine, "Content\\System\\Sounds\\Win\\GameSoundBank.xsb");
            waveBank = new WaveBank(audioEngine, "Content\\System\\Sounds\\Win\\GameWavs.xwb");

            // Set up our collision systems:
            spriteCollisionManager = new SpriteSpriteCollisionManager(this.Game, batchService, 40, 40);
            ParentScreen.Components.Add(spriteCollisionManager);

            bgm = this.Game.Content.Load<Song>("System\\Music\\DesertBGM");
            MediaPlayer.IsRepeating = true;
            MediaPlayer.Play(bgm);

            LoadCtorInfos();
        }
开发者ID:RochesterIndiesAnonymous,项目名称:Ironstag,代码行数:30,代码来源:World.cs


示例10: AudioManager

 public AudioManager(AudioEngine e, WaveBank wb, SoundBank sb)
 {
     Engine = e;
     WaveBank = wb;
     SoundBank = sb;
     singleton = this;
 }
开发者ID:poz2k4444,项目名称:TDA3Engine,代码行数:7,代码来源:AudioManager.cs


示例11: cAudio

 public cAudio()
 {
     _instance = this;
     _engine = new AudioEngine("Resources/Audio/Portal2DSounds.xgs");
     _waveBank = new WaveBank(_engine, "Resources/Audio/Wave Bank.xwb");
     _soundBank = new SoundBank(_engine, "Resources/Audio/Sound Bank.xsb");
 }
开发者ID:mikecann,项目名称:Portal2D-XNA,代码行数:7,代码来源:cAudio.cs


示例12: GameplayScreen

        public GameplayScreen(GraphicsDevice g, byte _gameType)
        {
            audioEngine = new AudioEngine(@"Content\Audio\Sounds.xgs");
            waveBank = new WaveBank(audioEngine, @"Content\Audio\Wave Bank.xwb");
            soundBank = new SoundBank(audioEngine, @"Content\Audio\Sound Bank.xsb");
            BGM = new Cue[9];
            graphicsDevice = g;
            graphicsDevice.RenderState.DepthBufferEnable = true;
            spriteBatch = new SpriteBatch(g);
            GameOverScreen = new MessageBoxScreen(" " + Score, false);
            CongratulationsScreen = new MessageBoxScreen(" ", false);
            PauseMenu = new PauseMenuScreen();
            WorldMatrix = Matrix.Identity;
            SwitchCue = false; PauseCue = false; GameOverState = false;

            tmrVibrate = new TimeSpan();
            tmrVibrate = TimeSpan.Zero;
            sourceRect = new Rectangle(0, 0, 64, 16);
            GameType = _gameType;
            currentcue = 0;
            if (GameType > 0)
            {
                timespan = 10;
                Randomizer = new Random();
                tmrTimer = new TimeSpan();
                tmrTimer = TimeSpan.Zero;
            }
        }
开发者ID:123Spork,项目名称:demodulate,代码行数:28,代码来源:GameplayScreen.cs


示例13: NunChuckEnemy

        public NunChuckEnemy(Random rand, AudioEngine engine, SoundBank soundBank, WaveBank waveBank)
        {
            this.engine = engine;
            this.soundBank = soundBank;
            this.waveBank = waveBank;

            int side = rand.Next(5);
            if (side == 1)
            {
                position = new Vector2(rand.Next(GraphicsViewport.Width), 0f);
            }
            if (side == 2)
            {
                position = new Vector2(0f, rand.Next(GraphicsViewport.Height));
            }
            if (side == 3)
            {
                position = new Vector2(rand.Next(GraphicsViewport.Width), GraphicsViewport.Height);
            }
            if (side == 4)
            {
                position = new Vector2(GraphicsViewport.Width, rand.Next(GraphicsViewport.Height));
            }

            origin = new Vector2(0f, 0f);
            rotation = 0;
            velocity = 10;
            boxSize = 25;
            tint = new Color(255, 255, 255, 255);
            collided = false;
            fired = false;
        }
开发者ID:LittleZ,项目名称:Interview-samples,代码行数:32,代码来源:NunChuckEnemy.cs


示例14: Sound

        /// <summary>
        /// Create sound
        /// </summary>
        static Sound()
        {
            try
            {
                string dir = Directories.SoundsDirectory;
                audioEngine = new AudioEngine(
                    Path.Combine(dir, "XnaShooter.xgs"));
                waveBank = new WaveBank(audioEngine,
                    Path.Combine(dir, "Wave Bank.xwb"));

                // Dummy wavebank call to get rid of the warning that waveBank is
                // never used (well it is used, but only inside of XNA).
                if (waveBank != null)
                    soundBank = new SoundBank(audioEngine,
                        Path.Combine(dir, "Sound Bank.xsb"));

                // Get the music category to change the music volume and stop music
                musicCategory = audioEngine.GetCategory("Music");
            } // try
            catch (Exception ex)
            {
                // Audio creation crashes in early xna versions, log it and ignore it!
                Log.Write("Failed to create sound class: " + ex.ToString());
            } // catch
        }
开发者ID:kiichi7,项目名称:XnaShooter,代码行数:28,代码来源:Sound.cs


示例15: PlaySound

        public static void PlaySound(String asset, String cueName)
        {
            if (!mSounds.ContainsKey(asset))
                mSounds[asset] = new SoundBank(AudioCore.Instance.Engine, asset);

            mSounds[asset].PlayCue(cueName);
        }
开发者ID:derekvanvliet,项目名称:loveandhate,代码行数:7,代码来源:Sound.cs


示例16: SoundEngine

 private SoundEngine()
 {
     return;
     _engine = new AudioEngine("Content\\Sounds\\Sounds.xgs");
     _wavebank = new WaveBank(_engine, "Content\\Sounds\\Wave Bank.xwb");
     _soundbank = new SoundBank(_engine, "Content\\Sounds\\Sound Bank.xsb");
 }
开发者ID:bsmr,项目名称:openc1,代码行数:7,代码来源:SoundEngine.cs


示例17: AudioEngineManager

 private AudioEngineManager()
 {
     //create and use appropriate XACT objects
     audioEngine = new AudioEngine("Content\\Audio\\datx02.xgs");
     soundBank = new SoundBank(audioEngine, "Content\\Audio\\SoundEffects.xsb");
     waveBank = new WaveBank(audioEngine, "Content\\Audio\\SoundEffectWaves.xwb");
 }
开发者ID:MintL,项目名称:datx02-rally,代码行数:7,代码来源:AudioEngineManager.cs


示例18: Initialize

 public static void Initialize()
 {
     audioEngine = new AudioEngine("Content/Sounds.xgs");
     soundBank = new SoundBank(audioEngine, "Content/Sound Bank.xsb");
     waveBank = new WaveBank(audioEngine, "Content/Wave Bank.xwb");
     soundsPlaying = new List<Cue>();
 }
开发者ID:hkeeble,项目名称:HKFramework,代码行数:7,代码来源:Audio.cs


示例19: MoteurAudio

 public MoteurAudio()
 {
     engine = new AudioEngine(@"Content\Sons\Ambiance sonore.xgs");
     waveBank = new WaveBank(engine, @"Content\Sons\Wave Bank.xwb");
     soundBank = new SoundBank(engine, @"Content\Sons\Sound Bank.xsb");
     musiques = new Song[2];
 }
开发者ID:Ayro64,项目名称:yellokiller,代码行数:7,代码来源:MoteurAudio.cs


示例20: GameOverScreen

 public GameOverScreen(Texture2D buttonTex, SpriteFont font, Color color, Rectangle window, SoundBank soundBack)
     : base(buttonTex, font, window, soundBack)
 {
     this.AddLabel("Game Over!! you've lost the battle!.But it's not too late,wanna try again?", new Vector2(100,window.Height/3f));
     this.AddButton("Try Again",color, new Vector2(window.Width/2f-buttonTex.Width,window.Height/2f+70));
     this.AddButton("Exit",color, new Vector2(window.Width / 2f+30f, window.Height / 2f + 70));
 }
开发者ID:urgamedev,项目名称:code-monogame,代码行数:7,代码来源:GameOverScreen.cs



注:本文中的Microsoft.Xna.Framework.Audio.SoundBank类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Audio.SoundEffect类代码示例发布时间:2022-05-26
下一篇:
C# Audio.Microphone类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap