mirror of
https://github.com/digital-jellyfish/Virtu.git
synced 2025-02-21 01:29:02 +00:00
Worked around lack of audio on XNA+XBox360 blocking machine thread.
Bumped version to 0.8.1 for next release. --HG-- extra : convert_revision : svn%3Affd33b8c-2492-42e0-bdc5-587b920b7d6d/trunk%4044502
This commit is contained in:
parent
7b713e6aaa
commit
5f8c4ce9d8
@ -11,9 +11,9 @@ using Jellyfish.Library;
|
|||||||
[assembly: AssemblyCopyright("Copyright © 2009-2010 Digital Jellyfish Design Ltd")]
|
[assembly: AssemblyCopyright("Copyright © 2009-2010 Digital Jellyfish Design Ltd")]
|
||||||
[assembly: AssemblyComment("Developed by Sean Fausett")]
|
[assembly: AssemblyComment("Developed by Sean Fausett")]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("0.1.0.0")]
|
[assembly: AssemblyVersion("0.1.1.0")]
|
||||||
[assembly: AssemblyFileVersion("0.1.0.0")]
|
[assembly: AssemblyFileVersion("0.1.1.0")]
|
||||||
[assembly: AssemblyInformationalVersion("0.1.0.0")]
|
[assembly: AssemblyInformationalVersion("0.1.1.0")]
|
||||||
|
|
||||||
[assembly: CLSCompliant(false)]
|
[assembly: CLSCompliant(false)]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
@ -11,9 +11,9 @@ using Jellyfish.Library;
|
|||||||
[assembly: AssemblyCopyright("Copyright © 2009-2010 Digital Jellyfish Design Ltd")]
|
[assembly: AssemblyCopyright("Copyright © 2009-2010 Digital Jellyfish Design Ltd")]
|
||||||
[assembly: AssemblyComment("Developed by Sean Fausett")]
|
[assembly: AssemblyComment("Developed by Sean Fausett")]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("0.1.0.0")]
|
[assembly: AssemblyVersion("0.1.1.0")]
|
||||||
[assembly: AssemblyFileVersion("0.1.0.0")]
|
[assembly: AssemblyFileVersion("0.1.1.0")]
|
||||||
[assembly: AssemblyInformationalVersion("0.1.0.0")]
|
[assembly: AssemblyInformationalVersion("0.1.1.0")]
|
||||||
|
|
||||||
[assembly: CLSCompliant(false)]
|
[assembly: CLSCompliant(false)]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
@ -17,11 +17,11 @@ using Jellyfish.Library;
|
|||||||
[assembly: AssemblyCopyright("Copyright © 2009-2010 Digital Jellyfish Design Ltd")]
|
[assembly: AssemblyCopyright("Copyright © 2009-2010 Digital Jellyfish Design Ltd")]
|
||||||
[assembly: AssemblyComment("Developed by Sean Fausett")]
|
[assembly: AssemblyComment("Developed by Sean Fausett")]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("0.1.0.0")]
|
[assembly: AssemblyVersion("0.1.1.0")]
|
||||||
#if WINDOWS
|
#if WINDOWS
|
||||||
[assembly: AssemblyFileVersion("0.1.0.0")]
|
[assembly: AssemblyFileVersion("0.1.1.0")]
|
||||||
#endif
|
#endif
|
||||||
[assembly: AssemblyInformationalVersion("0.1.0.0")]
|
[assembly: AssemblyInformationalVersion("0.1.1.0")]
|
||||||
|
|
||||||
[assembly: CLSCompliant(false)]
|
[assembly: CLSCompliant(false)]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
@ -48,38 +48,6 @@
|
|||||||
<Namespaces>
|
<Namespaces>
|
||||||
<Namespace Name="Jellyfish.Virtu">
|
<Namespace Name="Jellyfish.Virtu">
|
||||||
<Types>
|
<Types>
|
||||||
<Type Name="DiskDsk">
|
|
||||||
<Members>
|
|
||||||
<Member Name="#Read3Nibbles(System.Byte,System.Byte,System.Byte,System.Int32)">
|
|
||||||
<Messages>
|
|
||||||
<Message Id="nibble" TypeName="RemoveUnusedLocals" Category="Microsoft.Performance" CheckId="CA1804" Created="2009-12-11 09:07:49Z">
|
|
||||||
<Issue>
|
|
||||||
<Item>'DiskDsk.Read3Nibbles(byte, byte, byte, int)'</Item>
|
|
||||||
<Item>'nibble'</Item>
|
|
||||||
<Item>'byte'</Item>
|
|
||||||
</Issue>
|
|
||||||
</Message>
|
|
||||||
</Messages>
|
|
||||||
</Member>
|
|
||||||
<Member Name="#WriteTrack(System.Int32,System.Int32,System.Byte[])">
|
|
||||||
<Messages>
|
|
||||||
<Message TypeName="DoNotRaiseReservedExceptionTypes" Category="Microsoft.Usage" CheckId="CA2201" Created="2009-12-11 09:07:49Z">
|
|
||||||
<Issue Name="TooGeneric">
|
|
||||||
<Item>'DiskDsk.WriteTrack(int, int, byte[])'</Item>
|
|
||||||
<Item>'Exception'</Item>
|
|
||||||
</Issue>
|
|
||||||
</Message>
|
|
||||||
<Message Id="readVolume" TypeName="RemoveUnusedLocals" Category="Microsoft.Performance" CheckId="CA1804" Created="2009-12-11 09:07:49Z">
|
|
||||||
<Issue>
|
|
||||||
<Item>'DiskDsk.WriteTrack(int, int, byte[])'</Item>
|
|
||||||
<Item>'readVolume'</Item>
|
|
||||||
<Item>'int'</Item>
|
|
||||||
</Issue>
|
|
||||||
</Message>
|
|
||||||
</Messages>
|
|
||||||
</Member>
|
|
||||||
</Members>
|
|
||||||
</Type>
|
|
||||||
<Type Name="MainWindow">
|
<Type Name="MainWindow">
|
||||||
<Members>
|
<Members>
|
||||||
<Member Name="#System.Windows.Markup.IComponentConnector.Connect(System.Int32,System.Object)">
|
<Member Name="#System.Windows.Markup.IComponentConnector.Connect(System.Int32,System.Object)">
|
||||||
@ -102,61 +70,11 @@
|
|||||||
</Module>
|
</Module>
|
||||||
</Modules>
|
</Modules>
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="$(ProjectDir)/Xna/bin/Jellyfish.Virtu.exe">
|
|
||||||
<Modules>
|
|
||||||
<Module Name="jellyfish.virtu.exe">
|
|
||||||
<Namespaces>
|
|
||||||
<Namespace Name="Jellyfish.Virtu">
|
|
||||||
<Types>
|
|
||||||
<Type Name="DiskDsk">
|
|
||||||
<Members>
|
|
||||||
<Member Name="#Read3Nibbles(System.Byte,System.Byte,System.Byte,System.Int32)">
|
|
||||||
<Messages>
|
|
||||||
<Message Id="nibble" TypeName="RemoveUnusedLocals" Category="Microsoft.Performance" CheckId="CA1804" Created="2009-12-11 09:07:49Z">
|
|
||||||
<Issue>
|
|
||||||
<Item>'DiskDsk.Read3Nibbles(byte, byte, byte, int)'</Item>
|
|
||||||
<Item>'nibble'</Item>
|
|
||||||
<Item>'byte'</Item>
|
|
||||||
</Issue>
|
|
||||||
</Message>
|
|
||||||
</Messages>
|
|
||||||
</Member>
|
|
||||||
<Member Name="#WriteTrack(System.Int32,System.Int32,System.Byte[])">
|
|
||||||
<Messages>
|
|
||||||
<Message TypeName="DoNotRaiseReservedExceptionTypes" Category="Microsoft.Usage" CheckId="CA2201" Created="2009-12-11 09:07:49Z">
|
|
||||||
<Issue Name="TooGeneric">
|
|
||||||
<Item>'DiskDsk.WriteTrack(int, int, byte[])'</Item>
|
|
||||||
<Item>'Exception'</Item>
|
|
||||||
</Issue>
|
|
||||||
</Message>
|
|
||||||
<Message Id="readVolume" TypeName="RemoveUnusedLocals" Category="Microsoft.Performance" CheckId="CA1804" Created="2009-12-11 09:07:49Z">
|
|
||||||
<Issue>
|
|
||||||
<Item>'DiskDsk.WriteTrack(int, int, byte[])'</Item>
|
|
||||||
<Item>'readVolume'</Item>
|
|
||||||
<Item>'int'</Item>
|
|
||||||
</Issue>
|
|
||||||
</Message>
|
|
||||||
</Messages>
|
|
||||||
</Member>
|
|
||||||
</Members>
|
|
||||||
</Type>
|
|
||||||
</Types>
|
|
||||||
</Namespace>
|
|
||||||
</Namespaces>
|
|
||||||
</Module>
|
|
||||||
</Modules>
|
|
||||||
</Target>
|
|
||||||
</Targets>
|
</Targets>
|
||||||
<Rules>
|
<Rules>
|
||||||
<Rule TypeName="DoNotCastUnnecessarily" Category="Microsoft.Performance" CheckId="CA1800">
|
<Rule TypeName="DoNotCastUnnecessarily" Category="Microsoft.Performance" CheckId="CA1800">
|
||||||
<Resolution Name="Parameter">{0}, a parameter, is cast to type {1} multiple times in method {2}. Cache the result of the 'as' operator or direct cast in order to eliminate the redundant {3} instruction.</Resolution>
|
<Resolution Name="Parameter">{0}, a parameter, is cast to type {1} multiple times in method {2}. Cache the result of the 'as' operator or direct cast in order to eliminate the redundant {3} instruction.</Resolution>
|
||||||
</Rule>
|
</Rule>
|
||||||
<Rule TypeName="DoNotRaiseReservedExceptionTypes" Category="Microsoft.Usage" CheckId="CA2201">
|
|
||||||
<Resolution Name="TooGeneric">{0} creates an exception of type {1}, an exception type that is not sufficiently specific and should never be raised by user code. If this exception instance might be thrown, use a different exception type.</Resolution>
|
|
||||||
</Rule>
|
|
||||||
<Rule TypeName="RemoveUnusedLocals" Category="Microsoft.Performance" CheckId="CA1804">
|
|
||||||
<Resolution Name="Default">{0} declares a variable, {1}, of type {2}, which is never used or is only assigned to. Use this variable or remove it.</Resolution>
|
|
||||||
</Rule>
|
|
||||||
</Rules>
|
</Rules>
|
||||||
</FxCopReport>
|
</FxCopReport>
|
||||||
</FxCopProject>
|
</FxCopProject>
|
||||||
|
@ -304,6 +304,7 @@ namespace Jellyfish.Virtu.Settings
|
|||||||
public VideoSettings Video { get; set; }
|
public VideoSettings Video { get; set; }
|
||||||
|
|
||||||
public const string FileName = "Settings.xml";
|
public const string FileName = "Settings.xml";
|
||||||
|
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
|
||||||
public static readonly XNamespace Namespace = "http://schemas.jellyfish.co.nz/virtu/settings";
|
public static readonly XNamespace Namespace = "http://schemas.jellyfish.co.nz/virtu/settings";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,16 +37,14 @@ namespace Jellyfish.Virtu.Services
|
|||||||
|
|
||||||
protected void Update(int bufferSize, Action<byte[], int> updateBuffer) // audio thread
|
protected void Update(int bufferSize, Action<byte[], int> updateBuffer) // audio thread
|
||||||
{
|
{
|
||||||
if (updateBuffer == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("updateBuffer");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Machine.State == MachineState.Running)
|
if (Machine.State == MachineState.Running)
|
||||||
{
|
{
|
||||||
_readEvent.WaitOne();
|
_readEvent.WaitOne();
|
||||||
}
|
}
|
||||||
|
if (updateBuffer != null)
|
||||||
|
{
|
||||||
updateBuffer(_buffer, bufferSize);
|
updateBuffer(_buffer, bufferSize);
|
||||||
|
}
|
||||||
_writeEvent.Set();
|
_writeEvent.Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,9 +11,9 @@ using Jellyfish.Library;
|
|||||||
[assembly: AssemblyCopyright("Copyright © 1995-2010 Digital Jellyfish Design Ltd")]
|
[assembly: AssemblyCopyright("Copyright © 1995-2010 Digital Jellyfish Design Ltd")]
|
||||||
[assembly: AssemblyComment("Developed by Sean Fausett & Nick Westgate")]
|
[assembly: AssemblyComment("Developed by Sean Fausett & Nick Westgate")]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("0.8.0.0")]
|
[assembly: AssemblyVersion("0.8.1.0")]
|
||||||
[assembly: AssemblyFileVersion("0.8.0.0")]
|
[assembly: AssemblyFileVersion("0.8.1.0")]
|
||||||
[assembly: AssemblyInformationalVersion("0.8.0.0")]
|
[assembly: AssemblyInformationalVersion("0.8.1.0")]
|
||||||
|
|
||||||
[assembly: CLSCompliant(false)]
|
[assembly: CLSCompliant(false)]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
@ -12,9 +12,9 @@ using Jellyfish.Library;
|
|||||||
[assembly: AssemblyCopyright("Copyright © 1995-2010 Digital Jellyfish Design Ltd")]
|
[assembly: AssemblyCopyright("Copyright © 1995-2010 Digital Jellyfish Design Ltd")]
|
||||||
[assembly: AssemblyComment("Developed by Sean Fausett & Nick Westgate")]
|
[assembly: AssemblyComment("Developed by Sean Fausett & Nick Westgate")]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("0.8.0.0")]
|
[assembly: AssemblyVersion("0.8.1.0")]
|
||||||
[assembly: AssemblyFileVersion("0.8.0.0")]
|
[assembly: AssemblyFileVersion("0.8.1.0")]
|
||||||
[assembly: AssemblyInformationalVersion("0.8.0.0")]
|
[assembly: AssemblyInformationalVersion("0.8.1.0")]
|
||||||
|
|
||||||
[assembly: CLSCompliant(false)]
|
[assembly: CLSCompliant(false)]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
@ -15,11 +15,7 @@ namespace Jellyfish.Virtu
|
|||||||
_storageService = new XnaStorageService(_machine, this);
|
_storageService = new XnaStorageService(_machine, this);
|
||||||
_keyboardService = new XnaKeyboardService(_machine);
|
_keyboardService = new XnaKeyboardService(_machine);
|
||||||
_gamePortService = new XnaGamePortService(_machine);
|
_gamePortService = new XnaGamePortService(_machine);
|
||||||
#if XBOX
|
|
||||||
_audioService = new AudioService(_machine); // not connected
|
|
||||||
#else
|
|
||||||
_audioService = new XnaAudioService(_machine, this);
|
_audioService = new XnaAudioService(_machine, this);
|
||||||
#endif
|
|
||||||
_videoService = new XnaVideoService(_machine, this);
|
_videoService = new XnaVideoService(_machine, this);
|
||||||
|
|
||||||
_machine.Services.AddService(typeof(StorageService), _storageService);
|
_machine.Services.AddService(typeof(StorageService), _storageService);
|
||||||
|
@ -15,11 +15,11 @@ using Jellyfish.Library;
|
|||||||
[assembly: AssemblyCopyright("Copyright © 1995-2010 Digital Jellyfish Design Ltd")]
|
[assembly: AssemblyCopyright("Copyright © 1995-2010 Digital Jellyfish Design Ltd")]
|
||||||
[assembly: AssemblyComment("Developed by Sean Fausett & Nick Westgate")]
|
[assembly: AssemblyComment("Developed by Sean Fausett & Nick Westgate")]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("0.8.0.0")]
|
[assembly: AssemblyVersion("0.8.1.0")]
|
||||||
#if WINDOWS
|
#if WINDOWS
|
||||||
[assembly: AssemblyFileVersion("0.8.0.0")]
|
[assembly: AssemblyFileVersion("0.8.1.0")]
|
||||||
#endif
|
#endif
|
||||||
[assembly: AssemblyInformationalVersion("0.8.0.0")]
|
[assembly: AssemblyInformationalVersion("0.8.1.0")]
|
||||||
|
|
||||||
[assembly: CLSCompliant(false)]
|
[assembly: CLSCompliant(false)]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Threading;
|
||||||
using Jellyfish.Library;
|
using Jellyfish.Library;
|
||||||
|
|
||||||
namespace Jellyfish.Virtu.Services
|
namespace Jellyfish.Virtu.Services
|
||||||
{
|
{
|
||||||
#if WINDOWS
|
|
||||||
public sealed class XnaAudioService : AudioService
|
public sealed class XnaAudioService : AudioService
|
||||||
{
|
{
|
||||||
|
[SuppressMessage("Microsoft.Mobility", "CA1601:DoNotUseTimersThatPreventPowerStateChanges")]
|
||||||
public XnaAudioService(Machine machine, GameBase game) :
|
public XnaAudioService(Machine machine, GameBase game) :
|
||||||
base(machine)
|
base(machine)
|
||||||
{
|
{
|
||||||
@ -17,26 +19,45 @@ namespace Jellyfish.Virtu.Services
|
|||||||
|
|
||||||
_game = game;
|
_game = game;
|
||||||
|
|
||||||
|
#if WINDOWS
|
||||||
_directSound.Start(_game.Window.Handle);
|
_directSound.Start(_game.Window.Handle);
|
||||||
_directSound.Update += OnDirectSoundUpdate;
|
_directSound.Update += OnDirectSoundUpdate;
|
||||||
_game.Exiting += (sender, e) => _directSound.Stop();
|
_game.Exiting += (sender, e) => _directSound.Stop();
|
||||||
|
#else
|
||||||
|
_timer = new Timer(OnTimerUpdate, null, 0, SampleLatency);
|
||||||
|
_game.Exiting += (sender, e) => _timer.Change(Timeout.Infinite, Timeout.Infinite);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
|
#if WINDOWS
|
||||||
_directSound.Dispose();
|
_directSound.Dispose();
|
||||||
|
#else
|
||||||
|
_timer.Dispose();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WINDOWS
|
||||||
private void OnDirectSoundUpdate(object sender, DirectSoundUpdateEventArgs e) // audio thread
|
private void OnDirectSoundUpdate(object sender, DirectSoundUpdateEventArgs e) // audio thread
|
||||||
{
|
{
|
||||||
Update(e.BufferSize, (source, count) => Marshal.Copy(source, 0, e.Buffer, count));
|
Update(e.BufferSize, (source, count) => Marshal.Copy(source, 0, e.Buffer, count));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
private GameBase _game;
|
private void OnTimerUpdate(object state) // audio thread
|
||||||
private DirectSound _directSound = new DirectSound(SampleRate, SampleChannels, SampleBits, SampleSize);
|
{
|
||||||
|
Update(0, null);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
private GameBase _game;
|
||||||
|
#if WINDOWS
|
||||||
|
private DirectSound _directSound = new DirectSound(SampleRate, SampleChannels, SampleBits, SampleSize);
|
||||||
|
#else
|
||||||
|
private Timer _timer;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user