Modified AudioService to check endianness; fixes Xbox 360 audio.

This commit is contained in:
Sean Fausett 2010-09-23 22:09:34 +12:00
parent c3b65587f3
commit 18fa25759d
2 changed files with 13 additions and 3 deletions

View File

@ -1,6 +1,7 @@
using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
@ -20,8 +21,9 @@ public GameBase(string name)
Content.RootDirectory = "Content";
GraphicsDeviceManager = new GraphicsDeviceManager(this);
#if WINDOWS_PHONE
GraphicsDeviceManager.IsFullScreen = true;
TargetElapsedTime = TimeSpan.FromTicks(333333); // 30 fps
#elif XBOX
Components.Add(new GamerServicesComponent(this));
#endif
GraphicsDeviceService = (IGraphicsDeviceService)Services.GetService(typeof(IGraphicsDeviceService));

View File

@ -14,8 +14,16 @@ protected AudioService(Machine machine) :
public void Output(int data) // machine thread
{
_buffer[_index + 0] = (byte)(data & 0xFF);
_buffer[_index + 1] = (byte)(data >> 8);
if (BitConverter.IsLittleEndian)
{
_buffer[_index + 0] = (byte)(data & 0xFF);
_buffer[_index + 1] = (byte)(data >> 8);
}
else
{
_buffer[_index + 0] = (byte)(data >> 8);
_buffer[_index + 1] = (byte)(data & 0xFF);
}
_index = (_index + 2) % SampleSize;
if (_index == 0)
{