本文整理汇总了C#中Microsoft.Xna.Framework.Audio.AudioEngine类的典型用法代码示例。如果您正苦于以下问题:C# AudioEngine类的具体用法?C# AudioEngine怎么用?C# AudioEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AudioEngine类属于Microsoft.Xna.Framework.Audio命名空间,在下文中一共展示了AudioEngine类的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: 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
示例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: AudioManager
public AudioManager(AudioEngine e, WaveBank wb, SoundBank sb)
{
Engine = e;
WaveBank = wb;
SoundBank = sb;
singleton = this;
}
开发者ID:poz2k4444,项目名称:TDA3Engine,代码行数:7,代码来源:AudioManager.cs
示例5: 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
示例6: WaveBank
public WaveBank(
AudioEngine audioEngine,
string streamingWaveBankFilename,
int offset,
short packetsize
)
{
/* Note that offset and packetsize go unused,
* because we're frauds and aren't actually streaming.
* -flibit
*/
if (audioEngine == null)
{
throw new ArgumentNullException("audioEngine");
}
if (String.IsNullOrEmpty(streamingWaveBankFilename))
{
throw new ArgumentNullException("streamingWaveBankFilename");
}
INTERNAL_waveBankReader = new BinaryReader(
TitleContainer.OpenStream(streamingWaveBankFilename)
);
LoadWaveBank(audioEngine, INTERNAL_waveBankReader, true);
}
开发者ID:khbecker,项目名称:FNA,代码行数:26,代码来源:WaveBank.cs
示例7: 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
示例8: 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
示例9: SoundBank
public SoundBank(AudioEngine audioEngine, string filename)
{
audioengine = audioEngine;
// Check for windows-style directory separator character
filename = filename.Replace('\\',Path.DirectorySeparatorChar);
BinaryReader soundbankreader = new BinaryReader(new FileStream(filename, FileMode.Open));
//byte[] identifier = soundbankreader.ReadBytes(4);
soundbankreader.BaseStream.Seek(30, SeekOrigin.Begin);
int cuelength = soundbankreader.ReadInt32();
soundbankreader.BaseStream.Seek(42, SeekOrigin.Begin);
int cueoffset = soundbankreader.ReadInt32();
soundbankreader.BaseStream.Seek(74, SeekOrigin.Begin);
name = System.Text.Encoding.UTF8.GetString(soundbankreader.ReadBytes(64)).Replace("\0","");
targetname = System.Text.Encoding.UTF8.GetString(soundbankreader.ReadBytes(64)).Replace("\0", "");
soundbankreader.BaseStream.Seek(cueoffset, SeekOrigin.Begin);
cues = System.Text.Encoding.UTF8.GetString(soundbankreader.ReadBytes(cuelength)).Split('\0');
}
开发者ID:JoelCarter,项目名称:MonoGame,代码行数:25,代码来源:SoundBank.cs
示例10: 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
示例11: 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
示例12: 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
示例13: 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
示例14: 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
示例15: 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
示例16: 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
示例17: 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
示例18: SoundManager
public SoundManager()
{
audioEngine = new AudioEngine(@"Content/Sounds/GameSounds.xgs");
waveBank = new WaveBank(audioEngine, @"Content/Sounds/Wave Bank.xwb");
soundBank = new SoundBank(audioEngine, @"Content/Sounds/Sound Bank.xsb");
Songs = new Dictionary<string, SoundEffectInstance>();
}
开发者ID:sgdc,项目名称:sgdc-old,代码行数:8,代码来源:SoundManager.cs
示例19: AudioManager
/// <summary>
/// Constructs the manager for audio playback of all cues.
/// </summary>
/// <param name="game">The game that this component will be attached to.</param>
/// <param name="settingsFile">The filename of the XACT settings file.</param>
/// <param name="waveBankFile">The filename of the XACT wavebank file.</param>
/// <param name="soundBankFile">The filename of the XACT soundbank file.</param>
public AudioManager(Game game, string settingsFile, string waveBankFile,
string soundBankFile)
: base(game)
{
engine = new AudioEngine(settingsFile);
waves = new WaveBank(engine, waveBankFile);
sounds = new SoundBank(engine, soundBankFile);
}
开发者ID:jpipeperez,项目名称:Software-Portfolio,代码行数:15,代码来源:AudioManager.cs
示例20: Audio
public Audio(Game game)
: base(game)
{
// Load all the audio data
audioEngine = new AudioEngine(@"Content\Audio\FinalProject.xgs");
waveBank = new WaveBank(audioEngine, @"Content\Audio\Wave Bank.xwb");
soundBank = new SoundBank(audioEngine, @"Content\Audio\Sound Bank.xsb");
}
开发者ID:bobby-vandiver,项目名称:cs485-xna-final,代码行数:8,代码来源:Audio.cs
注:本文中的Microsoft.Xna.Framework.Audio.AudioEngine类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论