Updated some Developer Attributes and added a test class for PackedVector/Alpha8.
Analyzed the Shuffle behaviour of the MediaPlayer in Xna and implemented it correctly in ANX.
This commit is contained in:
parent
7e23391940
commit
488545cef3
@ -62,6 +62,7 @@
|
||||
<Compile Include="ReflectionLearningTests.cs" />
|
||||
<Compile Include="Strukturen\CurveKeyCollectionTest.cs" />
|
||||
<Compile Include="Strukturen\CurveKeyTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\PackedVector\Alpha8Test.cs" />
|
||||
<Compile Include="Strukturen\Input\GamePadButtonsTest.cs" />
|
||||
<Compile Include="Strukturen\Input\GamePadDPadTest.cs" />
|
||||
<Compile Include="Strukturen\Design\TypeConverterTest.cs" />
|
||||
|
@ -45,6 +45,9 @@ using ANXPlane = ANX.Framework.Plane;
|
||||
using XNARect = Microsoft.Xna.Framework.Rectangle;
|
||||
using ANXRect = ANX.Framework.Rectangle;
|
||||
|
||||
using XNAAlpha8 = Microsoft.Xna.Framework.Graphics.PackedVector.Alpha8;
|
||||
using ANXAlpha8 = ANX.Framework.Graphics.PackedVector.Alpha8;
|
||||
|
||||
using XNABgr565 = Microsoft.Xna.Framework.Graphics.PackedVector.Bgr565;
|
||||
using ANXBgr565 = ANX.Framework.Graphics.PackedVector.Bgr565;
|
||||
|
||||
@ -426,6 +429,18 @@ namespace ANX.Framework.TestCenter
|
||||
}
|
||||
}
|
||||
|
||||
public static void ConvertEquals(XNAAlpha8 lhs, ANXAlpha8 rhs, String test)
|
||||
{
|
||||
if (lhs.PackedValue == rhs.PackedValue)
|
||||
{
|
||||
Assert.Pass(test + " passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail(String.Format("{0} failed: Rg32 XNA: ({1}) Rg32 ANX: ({2})", test, lhs, rhs));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ConvertEquals(XNARg32 lhs, ANXRg32 rhs, String test)
|
||||
{
|
||||
if (lhs.PackedValue == rhs.PackedValue)
|
||||
|
@ -0,0 +1,46 @@
|
||||
using NUnit.Framework;
|
||||
using XNAAlpha8 = Microsoft.Xna.Framework.Graphics.PackedVector.Alpha8;
|
||||
using ANXAlpha8 = ANX.Framework.Graphics.PackedVector.Alpha8;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
// For details see: http://anxframework.codeplex.com/license
|
||||
|
||||
namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
{
|
||||
[TestFixture]
|
||||
class Alpha8Test
|
||||
{
|
||||
#region Testdata
|
||||
|
||||
static object[] floats =
|
||||
{
|
||||
new object[] {DataFactory.RandomValue },
|
||||
new object[] {DataFactory.RandomValue },
|
||||
new object[] {DataFactory.RandomValue },
|
||||
new object[] {DataFactory.RandomValue },
|
||||
new object[] {DataFactory.RandomValue }
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
[Test, TestCaseSource("floats")]
|
||||
public void contructor(float alpha)
|
||||
{
|
||||
XNAAlpha8 xnaVal = new XNAAlpha8(alpha);
|
||||
ANXAlpha8 anxVal = new ANXAlpha8(alpha);
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("floats")]
|
||||
public void ToAlpha(float alpha)
|
||||
{
|
||||
XNAAlpha8 xnaVal = new XNAAlpha8(alpha);
|
||||
ANXAlpha8 anxVal = new ANXAlpha8(alpha);
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal.ToAlpha(), anxVal.ToAlpha(), "ToAlpha");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,7 +1,4 @@
|
||||
#region Using Statements
|
||||
|
||||
|
||||
#endregion // Using Statements
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
@ -9,6 +6,8 @@
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum ContainmentType
|
||||
{
|
||||
Disjoint = 0,
|
||||
|
@ -1,9 +1,13 @@
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
// For details see: http://anxframework.codeplex.com/license
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum CurveContinuity
|
||||
{
|
||||
Smooth = 0,
|
||||
|
@ -1,7 +1,4 @@
|
||||
#region Using Statements
|
||||
|
||||
|
||||
#endregion // Using Statements
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
@ -9,6 +6,8 @@
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum CurveLoopType
|
||||
{
|
||||
Constant = 0,
|
||||
|
@ -1,7 +1,4 @@
|
||||
#region Using Statements
|
||||
|
||||
|
||||
#endregion // Using Statements
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
@ -9,6 +6,8 @@
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum CurveTangent
|
||||
{
|
||||
Flat,
|
||||
|
@ -1,5 +1,6 @@
|
||||
#region Using Statements
|
||||
using System;
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
@ -10,6 +11,8 @@ using System;
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[Flags]
|
||||
[PercentageComplete(100)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum DisplayOrientation
|
||||
{
|
||||
Default = 0,
|
||||
|
@ -12,8 +12,8 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics.PackedVector
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct Alpha8 : IPackedVector<byte>, IEquatable<Alpha8>, IPackedVector
|
||||
{
|
||||
private byte packedValue;
|
||||
|
@ -11,8 +11,8 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics.PackedVector
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct Bgr565 : IPackedVector<UInt16>, IEquatable<Bgr565>, IPackedVector
|
||||
{
|
||||
private UInt16 packedValue;
|
||||
|
@ -11,8 +11,8 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics.PackedVector
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct Bgra4444 : IPackedVector<UInt16>, IEquatable<Bgra4444>, IPackedVector
|
||||
{
|
||||
private UInt16 packedValue;
|
||||
|
@ -11,8 +11,8 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics.PackedVector
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct Bgra5551 : IPackedVector<UInt16>, IEquatable<Bgra5551>, IPackedVector
|
||||
{
|
||||
private UInt16 packedValue;
|
||||
|
@ -11,8 +11,8 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics.PackedVector
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct Byte4 : IPackedVector<uint>, IEquatable<Byte4>, IPackedVector
|
||||
{
|
||||
private uint packedValue;
|
||||
|
@ -11,8 +11,8 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics.PackedVector
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct HalfSingle : IPackedVector<UInt16>, IEquatable<HalfSingle>, IPackedVector
|
||||
{
|
||||
UInt16 packedValue;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#region Using Statements
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
@ -10,6 +11,9 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace ANX.Framework.Graphics.PackedVector
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
internal class HalfTypeHelper
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
|
@ -11,8 +11,8 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics.PackedVector
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct HalfVector2 : IPackedVector<uint>, IEquatable<HalfVector2>, IPackedVector
|
||||
{
|
||||
private uint packedValue;
|
||||
|
@ -11,8 +11,8 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics.PackedVector
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct HalfVector4 : IPackedVector<ulong>, IEquatable<HalfVector4>, IPackedVector
|
||||
{
|
||||
private ulong packedValue;
|
||||
|
@ -5,9 +5,9 @@
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics.PackedVector
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public interface IPackedVector
|
||||
{
|
||||
void PackFromVector4(Vector4 vector);
|
||||
@ -15,9 +15,9 @@ namespace ANX.Framework.Graphics.PackedVector
|
||||
Vector4 ToVector4();
|
||||
}
|
||||
|
||||
[PercentageComplete(100)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public interface IPackedVector<TPacked> : IPackedVector
|
||||
{
|
||||
TPacked PackedValue
|
||||
|
@ -11,8 +11,8 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics.PackedVector
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct NormalizedByte2 : IPackedVector<ushort>, IEquatable<NormalizedByte2>, IPackedVector
|
||||
{
|
||||
private ushort packedValue;
|
||||
|
@ -11,8 +11,8 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics.PackedVector
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct NormalizedByte4 : IPackedVector<uint>, IEquatable<NormalizedByte4>, IPackedVector
|
||||
{
|
||||
private uint packedValue;
|
||||
|
@ -11,8 +11,8 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics.PackedVector
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct NormalizedShort2 : IPackedVector<uint>, IEquatable<NormalizedShort2>, IPackedVector
|
||||
{
|
||||
private uint packedValue;
|
||||
|
@ -11,8 +11,8 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics.PackedVector
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct NormalizedShort4 : IPackedVector<ulong>, IEquatable<NormalizedShort4>, IPackedVector
|
||||
{
|
||||
private ulong packedValue;
|
||||
|
@ -11,8 +11,8 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics.PackedVector
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct Rg32 : IPackedVector<uint>, IEquatable<Rg32>, IPackedVector
|
||||
{
|
||||
private uint packedValue;
|
||||
|
@ -11,8 +11,8 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics.PackedVector
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct Rgba1010102 : IPackedVector<uint>, IEquatable<Rgba1010102>, IPackedVector
|
||||
{
|
||||
private uint packedValue;
|
||||
|
@ -11,8 +11,8 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics.PackedVector
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct Rgba64 : IPackedVector<ulong>, IEquatable<Rgba64>, IPackedVector
|
||||
{
|
||||
private ulong packedValue;
|
||||
|
@ -11,8 +11,8 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics.PackedVector
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct Short2 : IPackedVector<uint>, IEquatable<Short2>, IPackedVector
|
||||
{
|
||||
private uint packedValue;
|
||||
|
@ -11,8 +11,8 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics.PackedVector
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct Short4 : IPackedVector<ulong>, IEquatable<Short4>, IPackedVector
|
||||
{
|
||||
private ulong packedValue;
|
||||
|
@ -17,6 +17,7 @@ namespace ANX.Framework.Media
|
||||
public static event EventHandler<EventArgs> MediaStateChanged;
|
||||
#endregion
|
||||
|
||||
private static bool isShuffled;
|
||||
private static bool isRepeating;
|
||||
private static float volume;
|
||||
private static MediaState currentState;
|
||||
@ -26,7 +27,15 @@ namespace ANX.Framework.Media
|
||||
}
|
||||
|
||||
#region Public
|
||||
public static bool IsShuffled { get; set; }
|
||||
public static bool IsShuffled
|
||||
{
|
||||
get { return isShuffled; }
|
||||
set
|
||||
{
|
||||
isShuffled = value;
|
||||
Queue.UpdateOrder();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsRepeating
|
||||
{
|
||||
@ -79,7 +88,7 @@ namespace ANX.Framework.Media
|
||||
isRepeating = false;
|
||||
IsMuted = false;
|
||||
IsVisualizationEnabled = false;
|
||||
IsShuffled = false;
|
||||
isShuffled = false;
|
||||
Queue = new MediaQueue();
|
||||
FrameworkDispatcher.OnUpdate += Tick;
|
||||
}
|
||||
|
@ -13,7 +13,9 @@ namespace ANX.Framework.Media
|
||||
[Developer("AstrorEnales")]
|
||||
public sealed class MediaQueue
|
||||
{
|
||||
private readonly List<Song> queue;
|
||||
private readonly List<Song> queue;
|
||||
private readonly List<Song> shuffledQueue;
|
||||
private int activeSongIndex;
|
||||
|
||||
#region Public
|
||||
public int Count
|
||||
@ -21,16 +23,28 @@ namespace ANX.Framework.Media
|
||||
get { return queue.Count; }
|
||||
}
|
||||
|
||||
public int ActiveSongIndex { get; set; }
|
||||
public int ActiveSongIndex
|
||||
{
|
||||
get { return activeSongIndex; }
|
||||
set
|
||||
{
|
||||
if (Count <= 0)
|
||||
return;
|
||||
|
||||
public Song ActiveSong
|
||||
ActiveSong.Stop();
|
||||
activeSongIndex = Math.Min(value, queue.Count);
|
||||
ActiveSong.Play();
|
||||
}
|
||||
}
|
||||
|
||||
public Song ActiveSong
|
||||
{
|
||||
get { return queue.Count <= 0 ? null : queue[ActiveSongIndex]; }
|
||||
get { return shuffledQueue.Count <= 0 ? null : shuffledQueue[ActiveSongIndex]; }
|
||||
}
|
||||
|
||||
public Song this[int index]
|
||||
{
|
||||
get { return queue[index]; }
|
||||
get { return shuffledQueue[index]; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -38,11 +52,13 @@ namespace ANX.Framework.Media
|
||||
internal MediaQueue()
|
||||
{
|
||||
queue = new List<Song>();
|
||||
shuffledQueue = new List<Song>();
|
||||
}
|
||||
|
||||
~MediaQueue()
|
||||
{
|
||||
queue.Clear();
|
||||
shuffledQueue.Clear();
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -54,6 +70,7 @@ namespace ANX.Framework.Media
|
||||
|
||||
Clear();
|
||||
queue.Add(song);
|
||||
shuffledQueue.Add(song);
|
||||
ActiveSong.Play();
|
||||
}
|
||||
|
||||
@ -64,9 +81,7 @@ namespace ANX.Framework.Media
|
||||
|
||||
Clear();
|
||||
queue.AddRange(songCollection);
|
||||
// TODO: check if the shuffle is calculated after each finished song or like this!
|
||||
if (MediaPlayer.IsShuffled)
|
||||
Shuffle();
|
||||
UpdateOrder();
|
||||
ActiveSong.Play();
|
||||
}
|
||||
|
||||
@ -78,18 +93,34 @@ namespace ANX.Framework.Media
|
||||
Clear();
|
||||
ActiveSongIndex = index;
|
||||
queue.AddRange(songCollection);
|
||||
// TODO: check if the shuffle is calculated after each finished song or like this!
|
||||
if (MediaPlayer.IsShuffled)
|
||||
Shuffle();
|
||||
UpdateOrder();
|
||||
ActiveSong.Play();
|
||||
}
|
||||
#endregion
|
||||
|
||||
internal void UpdateOrder()
|
||||
{
|
||||
if (Count <= 0)
|
||||
return;
|
||||
|
||||
Song currentPlayingSong = ActiveSong;
|
||||
if (MediaPlayer.IsShuffled)
|
||||
Shuffle();
|
||||
else
|
||||
{
|
||||
shuffledQueue.Clear();
|
||||
shuffledQueue.AddRange(queue.ToArray());
|
||||
}
|
||||
|
||||
activeSongIndex = shuffledQueue.IndexOf(currentPlayingSong);
|
||||
}
|
||||
|
||||
private void Clear()
|
||||
{
|
||||
Stop();
|
||||
ActiveSongIndex = 0;
|
||||
queue.Clear();
|
||||
shuffledQueue.Clear();
|
||||
}
|
||||
|
||||
internal void Stop()
|
||||
@ -106,9 +137,9 @@ namespace ANX.Framework.Media
|
||||
{
|
||||
int k = rand.Next(n);
|
||||
n--;
|
||||
Song value = queue[k];
|
||||
queue[k] = queue[n];
|
||||
queue[n] = value;
|
||||
Song value = shuffledQueue[k];
|
||||
shuffledQueue[k] = shuffledQueue[n];
|
||||
shuffledQueue[n] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ANX.Framework.NonXNA;
|
||||
using ANX.Framework.NonXNA.PlatformSystem;
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
@ -9,42 +8,28 @@ using ANX.Framework.NonXNA.PlatformSystem;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
public sealed class MediaSource
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
public sealed class MediaSource
|
||||
{
|
||||
#region Public
|
||||
public string Name
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string Name { get; private set; }
|
||||
public MediaSourceType MediaSourceType { get; private set; }
|
||||
|
||||
public MediaSourceType MediaSourceType
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
internal MediaSource(string setName, MediaSourceType setType)
|
||||
{
|
||||
Name = setName;
|
||||
MediaSourceType = setType;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
public static IList<MediaSource> GetAvailableMediaSources()
|
||||
{
|
||||
return PlatformSystem.Instance.GetAvailableMediaSources();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ToString
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,13 @@
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
// For details see: http://anxframework.codeplex.com/license
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum PlaneIntersectionType
|
||||
{
|
||||
Front = 0,
|
||||
|
@ -1,9 +1,13 @@
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
// For details see: http://anxframework.codeplex.com/license
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum PlayerIndex
|
||||
{
|
||||
One = 0,
|
||||
|
@ -9,45 +9,26 @@ using ANX.Framework.NonXNA.Development;
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("AstrorEnales")]
|
||||
public static class TitleContainer
|
||||
{
|
||||
private static INativeTitleContainer nativeImplementation;
|
||||
[PercentageComplete(100)]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("AstrorEnales")]
|
||||
public static class TitleContainer
|
||||
{
|
||||
private static readonly INativeTitleContainer nativeImplementation;
|
||||
|
||||
static TitleContainer()
|
||||
{
|
||||
try
|
||||
{
|
||||
nativeImplementation = PlatformSystem.Instance.CreateTitleContainer();
|
||||
}
|
||||
catch (PlatformSystemInstanceException ex)
|
||||
{
|
||||
//TODO: error handling
|
||||
}
|
||||
}
|
||||
|
||||
public static Stream OpenStream(string name)
|
||||
{
|
||||
if (nativeImplementation == null)
|
||||
{
|
||||
//TODO: error handling
|
||||
return null;
|
||||
}
|
||||
static TitleContainer()
|
||||
{
|
||||
nativeImplementation = PlatformSystem.Instance.CreateTitleContainer();
|
||||
}
|
||||
|
||||
return nativeImplementation.OpenStream(name);
|
||||
}
|
||||
public static Stream OpenStream(string name)
|
||||
{
|
||||
return nativeImplementation.OpenStream(name);
|
||||
}
|
||||
|
||||
internal static string GetCleanPath(string path)
|
||||
{
|
||||
if (nativeImplementation == null)
|
||||
{
|
||||
//TODO: error handling
|
||||
return null;
|
||||
}
|
||||
|
||||
return nativeImplementation.GetCleanPath(path);
|
||||
}
|
||||
}
|
||||
internal static string GetCleanPath(string path)
|
||||
{
|
||||
return nativeImplementation.GetCleanPath(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,12 +70,15 @@ namespace ANX.PlatformSystem.Windows
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetAvailableMediaSources (TODO)
|
||||
public IList<MediaSource> GetAvailableMediaSources()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
#region GetAvailableMediaSources
|
||||
public IList<MediaSource> GetAvailableMediaSources()
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
new MediaSource("Local Windows Media Player Library", MediaSourceType.LocalDevice)
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region OpenReadFilestream
|
||||
public Stream OpenReadFilestream(string filepath)
|
||||
|
Loading…
x
Reference in New Issue
Block a user