- Working on implementing the WindowsMediaLibrary via the WMPLib
- Implemented nearly all classes in the Media namespace side by side with the Windows implementation - Started adding unit tests to compare the ANX and XNA MediaLibrary behaviour - Merged the ConvertEquals for PackedVectors to a single method that does the job equally good
This commit is contained in:
parent
b5d8b48376
commit
9f4369c05d
@ -10,27 +10,26 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ANX.Framework.Content.Pipeline</RootNamespace>
|
||||
<AssemblyName>ANX.Framework.Content.Pipeline</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<Optimize>False</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;LINUX;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;LINUX;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
@ -186,7 +185,9 @@
|
||||
<Compile Include="Tasks\BuildContent.cs" />
|
||||
<Compile Include="Tasks\BuildItem.cs" />
|
||||
<Compile Include="Tasks\ContentProject.cs" />
|
||||
<Compile Include="Tasks\ImporterConverter.cs" />
|
||||
<Compile Include="Tasks\ImporterManager.cs" />
|
||||
<Compile Include="Tasks\ProcessorConverter.cs" />
|
||||
<Compile Include="Tasks\ProcessorManager.cs" />
|
||||
<Compile Include="VideoContent.cs" />
|
||||
<Compile Include="Serialization\XmlReaderExtensions.cs" />
|
||||
|
@ -14,23 +14,23 @@
|
||||
<ProjectTypeGuids>{69878862-DA7D-4DC6-B0A1-50D8FAB4242F};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<Optimize>False</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;PSVITA;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;PSVITA;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
@ -187,7 +187,9 @@
|
||||
<Compile Include="Tasks\BuildContent.cs" />
|
||||
<Compile Include="Tasks\BuildItem.cs" />
|
||||
<Compile Include="Tasks\ContentProject.cs" />
|
||||
<Compile Include="Tasks\ImporterConverter.cs" />
|
||||
<Compile Include="Tasks\ImporterManager.cs" />
|
||||
<Compile Include="Tasks\ProcessorConverter.cs" />
|
||||
<Compile Include="Tasks\ProcessorManager.cs" />
|
||||
<Compile Include="VideoContent.cs" />
|
||||
<Compile Include="Serialization\XmlReaderExtensions.cs" />
|
||||
|
@ -16,23 +16,23 @@
|
||||
<PackageCertificateKeyFile>Test_TemporaryKey.pfx</PackageCertificateKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<Optimize>False</Optimize>
|
||||
<OutputPath>bin\Debug\ModernUI</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;WINDOWSMETRO;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\Release\ModernUI</OutputPath>
|
||||
<DefineConstants>TRACE;WINDOWSMETRO;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
@ -188,7 +188,9 @@
|
||||
<Compile Include="Tasks\BuildContent.cs" />
|
||||
<Compile Include="Tasks\BuildItem.cs" />
|
||||
<Compile Include="Tasks\ContentProject.cs" />
|
||||
<Compile Include="Tasks\ImporterConverter.cs" />
|
||||
<Compile Include="Tasks\ImporterManager.cs" />
|
||||
<Compile Include="Tasks\ProcessorConverter.cs" />
|
||||
<Compile Include="Tasks\ProcessorManager.cs" />
|
||||
<Compile Include="VideoContent.cs" />
|
||||
<Compile Include="Serialization\XmlReaderExtensions.cs" />
|
||||
|
@ -74,6 +74,7 @@
|
||||
<Compile Include="Strukturen\Input\KeyboardStateTest.cs" />
|
||||
<Compile Include="Strukturen\Input\MouseStateTest.cs" />
|
||||
<Compile Include="Strukturen\Input\MouseTest.cs" />
|
||||
<Compile Include="Strukturen\Media\MediaLibraryTests.cs" />
|
||||
<Compile Include="Strukturen\Storage\StorageContainerTest.cs" />
|
||||
<Compile Include="Strukturen\Storage\StorageDeviceTest.cs" />
|
||||
<Compile Include="Strukturen\BoundingBoxTest.cs" />
|
||||
@ -118,7 +119,6 @@
|
||||
<Folder Include="Strukturen\Design\GamerServices\" />
|
||||
<Folder Include="Strukturen\Input\MotionSensing\" />
|
||||
<Folder Include="Strukturen\Input\Touch\" />
|
||||
<Folder Include="Strukturen\Media\" />
|
||||
<Folder Include="Strukturen\Net\" />
|
||||
<Folder Include="Strukturen\NonXNA\InputSystem\" />
|
||||
<Folder Include="Strukturen\NonXNA\RenderSystem\" />
|
||||
@ -142,6 +142,10 @@
|
||||
<Project>{068EB2E9-963C-4E1B-8831-E25011F11FFE}</Project>
|
||||
<Name>ANX.PlatformSystem.Windows</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SoundSystems\ANX.SoundSystem.Windows.XAudio\ANX.SoundSystem.Windows.XAudio.csproj">
|
||||
<Project>{6A582788-C4D2-410C-96CD-177F75712D65}</Project>
|
||||
<Name>ANX.SoundSystem.Windows.XAudio</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@ -74,6 +74,7 @@
|
||||
<Compile Include="Strukturen\Input\KeyboardStateTest.cs" />
|
||||
<Compile Include="Strukturen\Input\MouseStateTest.cs" />
|
||||
<Compile Include="Strukturen\Input\MouseTest.cs" />
|
||||
<Compile Include="Strukturen\Media\MediaLibraryTests.cs" />
|
||||
<Compile Include="Strukturen\Storage\StorageContainerTest.cs" />
|
||||
<Compile Include="Strukturen\Storage\StorageDeviceTest.cs" />
|
||||
<Compile Include="Strukturen\BoundingBoxTest.cs" />
|
||||
@ -118,7 +119,6 @@
|
||||
<Folder Include="Strukturen\Design\GamerServices\" />
|
||||
<Folder Include="Strukturen\Input\MotionSensing\" />
|
||||
<Folder Include="Strukturen\Input\Touch\" />
|
||||
<Folder Include="Strukturen\Media\" />
|
||||
<Folder Include="Strukturen\Net\" />
|
||||
<Folder Include="Strukturen\NonXNA\InputSystem\" />
|
||||
<Folder Include="Strukturen\NonXNA\RenderSystem\" />
|
||||
@ -142,6 +142,10 @@
|
||||
<Project>{068EB2E9-963C-4E1B-8831-E25011F11FFE}</Project>
|
||||
<Name>ANX.PlatformSystem.Windows</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SoundSystems\ANX.SoundSystem.Windows.XAudio\ANX.SoundSystem.Windows.XAudio_Linux.csproj">
|
||||
<Project>{6A582788-C4D2-410C-96CD-177F75712D65}</Project>
|
||||
<Name>ANX.SoundSystem.Windows.XAudio</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@ -75,6 +75,7 @@
|
||||
<Compile Include="Strukturen\Input\KeyboardStateTest.cs" />
|
||||
<Compile Include="Strukturen\Input\MouseStateTest.cs" />
|
||||
<Compile Include="Strukturen\Input\MouseTest.cs" />
|
||||
<Compile Include="Strukturen\Media\MediaLibraryTests.cs" />
|
||||
<Compile Include="Strukturen\Storage\StorageContainerTest.cs" />
|
||||
<Compile Include="Strukturen\Storage\StorageDeviceTest.cs" />
|
||||
<Compile Include="Strukturen\BoundingBoxTest.cs" />
|
||||
@ -119,7 +120,6 @@
|
||||
<Folder Include="Strukturen\Design\GamerServices\" />
|
||||
<Folder Include="Strukturen\Input\MotionSensing\" />
|
||||
<Folder Include="Strukturen\Input\Touch\" />
|
||||
<Folder Include="Strukturen\Media\" />
|
||||
<Folder Include="Strukturen\Net\" />
|
||||
<Folder Include="Strukturen\NonXNA\InputSystem\" />
|
||||
<Folder Include="Strukturen\NonXNA\RenderSystem\" />
|
||||
@ -143,6 +143,10 @@
|
||||
<Project>{068EB2E9-963C-4E1B-8831-E25011F11FFE}</Project>
|
||||
<Name>ANX.PlatformSystem.Windows</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SoundSystems\ANX.SoundSystem.Windows.XAudio\ANX.SoundSystem.Windows.XAudio_PSVita.csproj">
|
||||
<Project>{6A582788-C4D2-410C-96CD-177F75712D65}</Project>
|
||||
<Name>ANX.SoundSystem.Windows.XAudio</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Sce\Sce.Psm.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@ -76,6 +76,7 @@
|
||||
<Compile Include="Strukturen\Input\KeyboardStateTest.cs" />
|
||||
<Compile Include="Strukturen\Input\MouseStateTest.cs" />
|
||||
<Compile Include="Strukturen\Input\MouseTest.cs" />
|
||||
<Compile Include="Strukturen\Media\MediaLibraryTests.cs" />
|
||||
<Compile Include="Strukturen\Storage\StorageContainerTest.cs" />
|
||||
<Compile Include="Strukturen\Storage\StorageDeviceTest.cs" />
|
||||
<Compile Include="Strukturen\BoundingBoxTest.cs" />
|
||||
@ -120,7 +121,6 @@
|
||||
<Folder Include="Strukturen\Design\GamerServices\" />
|
||||
<Folder Include="Strukturen\Input\MotionSensing\" />
|
||||
<Folder Include="Strukturen\Input\Touch\" />
|
||||
<Folder Include="Strukturen\Media\" />
|
||||
<Folder Include="Strukturen\Net\" />
|
||||
<Folder Include="Strukturen\NonXNA\InputSystem\" />
|
||||
<Folder Include="Strukturen\NonXNA\RenderSystem\" />
|
||||
@ -136,6 +136,10 @@
|
||||
<Project>{49066074-3B7B-4A55-B122-6BD33AB73558}</Project>
|
||||
<Name>ANX.InputSystem.Standard</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SoundSystems\ANX.SoundSystem.Windows.XAudio\ANX.SoundSystem.Windows.XAudio_WindowsMetro.csproj">
|
||||
<Project>{6A582788-C4D2-410C-96CD-177F75712D65}</Project>
|
||||
<Name>ANX.SoundSystem.Windows.XAudio</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@ -1,8 +1,5 @@
|
||||
#region Using Statements
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
|
||||
#endregion // Using Statements
|
||||
@ -45,57 +42,6 @@ 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;
|
||||
|
||||
using XNABgra5551 = Microsoft.Xna.Framework.Graphics.PackedVector.Bgra5551;
|
||||
using ANXBgra5551 = ANX.Framework.Graphics.PackedVector.Bgra5551;
|
||||
|
||||
using XNABgra4444 = Microsoft.Xna.Framework.Graphics.PackedVector.Bgra4444;
|
||||
using ANXBgra4444 = ANX.Framework.Graphics.PackedVector.Bgra4444;
|
||||
|
||||
using XNAByte4 = Microsoft.Xna.Framework.Graphics.PackedVector.Byte4;
|
||||
using ANXByte4 = ANX.Framework.Graphics.PackedVector.Byte4;
|
||||
|
||||
using XNAHalfSingle = Microsoft.Xna.Framework.Graphics.PackedVector.HalfSingle;
|
||||
using ANXHalfSingle = ANX.Framework.Graphics.PackedVector.HalfSingle;
|
||||
|
||||
using XNAHalfVector2 = Microsoft.Xna.Framework.Graphics.PackedVector.HalfVector2;
|
||||
using ANXHalfVector2 = ANX.Framework.Graphics.PackedVector.HalfVector2;
|
||||
|
||||
using XNAHalfVector4 = Microsoft.Xna.Framework.Graphics.PackedVector.HalfVector4;
|
||||
using ANXHalfVector4 = ANX.Framework.Graphics.PackedVector.HalfVector4;
|
||||
|
||||
using XNARg32 = Microsoft.Xna.Framework.Graphics.PackedVector.Rg32;
|
||||
using ANXRg32 = ANX.Framework.Graphics.PackedVector.Rg32;
|
||||
|
||||
using XNARgba1010102 = Microsoft.Xna.Framework.Graphics.PackedVector.Rgba1010102;
|
||||
using ANXRgba1010102 = ANX.Framework.Graphics.PackedVector.Rgba1010102;
|
||||
|
||||
using XNARgba64 = Microsoft.Xna.Framework.Graphics.PackedVector.Rgba64;
|
||||
using ANXRgba64 = ANX.Framework.Graphics.PackedVector.Rgba64;
|
||||
|
||||
using XNANormalizedByte2 = Microsoft.Xna.Framework.Graphics.PackedVector.NormalizedByte2;
|
||||
using ANXNormalizedByte2 = ANX.Framework.Graphics.PackedVector.NormalizedByte2;
|
||||
|
||||
using XNANormalizedByte4 = Microsoft.Xna.Framework.Graphics.PackedVector.NormalizedByte4;
|
||||
using ANXNormalizedByte4 = ANX.Framework.Graphics.PackedVector.NormalizedByte4;
|
||||
|
||||
using XNANormalizedShort2 = Microsoft.Xna.Framework.Graphics.PackedVector.NormalizedShort2;
|
||||
using ANXNormalizedShort2 = ANX.Framework.Graphics.PackedVector.NormalizedShort2;
|
||||
|
||||
using XNANormalizedShort4 = Microsoft.Xna.Framework.Graphics.PackedVector.NormalizedShort4;
|
||||
using ANXNormalizedShort4 = ANX.Framework.Graphics.PackedVector.NormalizedShort4;
|
||||
|
||||
using XNAShort2 = Microsoft.Xna.Framework.Graphics.PackedVector.Short2;
|
||||
using ANXShort2 = ANX.Framework.Graphics.PackedVector.Short2;
|
||||
|
||||
using XNAShort4 = Microsoft.Xna.Framework.Graphics.PackedVector.Short4;
|
||||
using ANXShort4 = ANX.Framework.Graphics.PackedVector.Short4;
|
||||
|
||||
using XNAMatrix = Microsoft.Xna.Framework.Matrix;
|
||||
using ANXMatrix = ANX.Framework.Matrix;
|
||||
|
||||
@ -345,208 +291,13 @@ namespace ANX.Framework.TestCenter
|
||||
}
|
||||
}
|
||||
|
||||
public static void ConvertEquals(XNABgr565 lhs, ANXBgr565 rhs, String test)
|
||||
public static void ConvertEqualsPackedVector<T>(Microsoft.Xna.Framework.Graphics.PackedVector.IPackedVector<T> lhs,
|
||||
ANX.Framework.Graphics.PackedVector.IPackedVector<T> rhs, string test)
|
||||
{
|
||||
if (lhs.PackedValue == rhs.PackedValue)
|
||||
{
|
||||
if (lhs.PackedValue.Equals(rhs.PackedValue))
|
||||
Assert.Pass(test + " passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail(String.Format("{0} failed: Bgr565 XNA: ({1}) Bgr565 ANX: ({2})", test, lhs, rhs));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ConvertEquals(XNABgra5551 lhs, ANXBgra5551 rhs, String test)
|
||||
{
|
||||
if (lhs.PackedValue == rhs.PackedValue)
|
||||
{
|
||||
Assert.Pass(test + " passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail(String.Format("{0} failed: Bgra5551 XNA: ({1}) Bgra5551 ANX: ({2})", test, lhs, rhs));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ConvertEquals(XNABgra4444 lhs, ANXBgra4444 rhs, String test)
|
||||
{
|
||||
if (lhs.PackedValue == rhs.PackedValue)
|
||||
{
|
||||
Assert.Pass(test + " passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail(String.Format("{0} failed: Bgra4444 XNA: ({1}) Bgra4444 ANX: ({2})", test, lhs, rhs));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ConvertEquals(XNAByte4 lhs, ANXByte4 rhs, String test)
|
||||
{
|
||||
if (lhs.PackedValue == rhs.PackedValue)
|
||||
{
|
||||
Assert.Pass(test + " passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail(String.Format("{0} failed: Byte4 XNA: ({1}) Byte4 ANX: ({2})", test, lhs, rhs));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ConvertEquals(XNAHalfSingle lhs, ANXHalfSingle rhs, String test)
|
||||
{
|
||||
if (lhs.PackedValue == rhs.PackedValue)
|
||||
{
|
||||
Assert.Pass(test + " passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail(String.Format("{0} failed: HalfSingle XNA: ({1}) HalfSingle ANX: ({2})", test, lhs, rhs));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ConvertEquals(XNAHalfVector2 lhs, ANXHalfVector2 rhs, String test)
|
||||
{
|
||||
if (lhs.PackedValue == rhs.PackedValue)
|
||||
{
|
||||
Assert.Pass(test + " passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail(String.Format("{0} failed: HalfVector2 XNA: ({1}) HalfVector2 ANX: ({2})", test, lhs, rhs));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ConvertEquals(XNAHalfVector4 lhs, ANXHalfVector4 rhs, String test)
|
||||
{
|
||||
if (lhs.PackedValue == rhs.PackedValue)
|
||||
{
|
||||
Assert.Pass(test + " passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail(String.Format("{0} failed: HalfVector4 XNA: ({1}) HalfVector4 ANX: ({2})", test, lhs, rhs));
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
Assert.Pass(test + " passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail(String.Format("{0} failed: Rg32 XNA: ({1}) Rg32 ANX: ({2})", test, lhs, rhs));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ConvertEquals(XNARgba1010102 lhs, ANXRgba1010102 rhs, String test)
|
||||
{
|
||||
if (lhs.PackedValue == rhs.PackedValue)
|
||||
{
|
||||
Assert.Pass(test + " passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail(String.Format("{0} failed: Rgba1010102 XNA: ({1}) Rgba1010102 ANX: ({2})", test, lhs, rhs));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ConvertEquals(XNARgba64 lhs, ANXRgba64 rhs, String test)
|
||||
{
|
||||
if (lhs.PackedValue == rhs.PackedValue)
|
||||
{
|
||||
Assert.Pass(test + " passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail(String.Format("{0} failed: Rgba64 XNA: ({1}) Rgba64 ANX: ({2})", test, lhs, rhs));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ConvertEquals(XNANormalizedByte2 lhs, ANXNormalizedByte2 rhs, String test)
|
||||
{
|
||||
if (lhs.PackedValue == rhs.PackedValue)
|
||||
{
|
||||
Assert.Pass(test + " passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail(String.Format("{0} failed: NormalizedByte2 XNA: ({1}) NormalizedByte2 ANX: ({2})", test, lhs, rhs));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ConvertEquals(XNANormalizedByte4 lhs, ANXNormalizedByte4 rhs, String test)
|
||||
{
|
||||
if (lhs.PackedValue == rhs.PackedValue)
|
||||
{
|
||||
Assert.Pass(test + " passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail(String.Format("{0} failed: NormalizedByte4 XNA: ({1}) NormalizedByte4 ANX: ({2})", test, lhs, rhs));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ConvertEquals(XNANormalizedShort2 lhs, ANXNormalizedShort2 rhs, String test)
|
||||
{
|
||||
if (lhs.PackedValue == rhs.PackedValue)
|
||||
{
|
||||
Assert.Pass(test + " passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail(String.Format("{0} failed: NormalizedShort2 XNA: ({1}) NormalizedShort2 ANX: ({2})", test, lhs, rhs));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ConvertEquals(XNANormalizedShort4 lhs, ANXNormalizedShort4 rhs, String test)
|
||||
{
|
||||
if (lhs.PackedValue == rhs.PackedValue)
|
||||
{
|
||||
Assert.Pass(test + " passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail(String.Format("{0} failed: NormalizedShort4 XNA: ({1}) NormalizedShort4 ANX: ({2})", test, lhs, rhs));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ConvertEquals(XNAShort2 lhs, ANXShort2 rhs, String test)
|
||||
{
|
||||
if (lhs.PackedValue == rhs.PackedValue)
|
||||
{
|
||||
Assert.Pass(test + " passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail(String.Format("{0} failed: Short2 XNA: ({1}) Short2 ANX: ({2})", test, lhs, rhs));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ConvertEquals(XNAShort4 lhs, ANXShort4 rhs, String test)
|
||||
{
|
||||
if (lhs.PackedValue == rhs.PackedValue)
|
||||
{
|
||||
Assert.Pass(test + " passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail(String.Format("{0} failed: Short4 XNA: ({1}) Short4 ANX: ({2})", test, lhs, rhs));
|
||||
}
|
||||
Assert.Fail("{0} failed: {1} XNA: ({2}) {1} ANX: ({3})", test, lhs.GetType().Name, lhs, rhs);
|
||||
}
|
||||
|
||||
public static void ConvertEquals(byte a, byte b, String test)
|
||||
@ -987,9 +738,5 @@ namespace ANX.Framework.TestCenter
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNAAlpha8 xnaVal = new XNAAlpha8(alpha);
|
||||
ANXAlpha8 anxVal = new ANXAlpha8(alpha);
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("floats")]
|
||||
|
@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNABgr565 xnaVal = new XNABgr565(r, g, b);
|
||||
ANXBgr565 anxVal = new ANXBgr565(r, g, b);
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("threefloats")]
|
||||
@ -52,7 +52,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNABgr565 xnaVal = new XNABgr565(new XNAVector3(r, g, b));
|
||||
ANXBgr565 anxVal = new ANXBgr565(new ANXVector3(r, g, b));
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("threefloats")]
|
||||
|
@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNABgra4444 xnaVal = new XNABgra4444(r, g, b, a);
|
||||
ANXBgra4444 anxVal = new ANXBgra4444(r, g, b, a);
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("fourfloats")]
|
||||
@ -52,7 +52,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNABgra4444 xnaVal = new XNABgra4444(new XNAVector4(r, g, b, a));
|
||||
ANXBgra4444 anxVal = new ANXBgra4444(new ANXVector4(r, g, b, a));
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("fourfloats")]
|
||||
|
@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNABgra5551 xnaVal = new XNABgra5551(r, g, b, a);
|
||||
ANXBgra5551 anxVal = new ANXBgra5551(r, g, b, a);
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("fourfloats")]
|
||||
@ -52,7 +52,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNABgra5551 xnaVal = new XNABgra5551(new XNAVector4(r, g, b, a));
|
||||
ANXBgra5551 anxVal = new ANXBgra5551(new ANXVector4(r, g, b, a));
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("fourfloats")]
|
||||
|
@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNAByte4 xnaVal = new XNAByte4(r, g, b, a);
|
||||
ANXByte4 anxVal = new ANXByte4(r, g, b, a);
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("fourfloats")]
|
||||
@ -52,7 +52,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNAByte4 xnaVal = new XNAByte4(new XNAVector4(r, g, b, a));
|
||||
ANXByte4 anxVal = new ANXByte4(new ANXVector4(r, g, b, a));
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("fourfloats")]
|
||||
|
@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNAHalfSingle xnaVal = new XNAHalfSingle(single);
|
||||
ANXHalfSingle anxVal = new ANXHalfSingle(single);
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("floats")]
|
||||
|
@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNAHalfVector2 xnaVal = new XNAHalfVector2(x, y);
|
||||
ANXHalfVector2 anxVal = new ANXHalfVector2(x, y);
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("twofloats")]
|
||||
@ -51,7 +51,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNAHalfVector2 xnaVal = new XNAHalfVector2(new XNAVector2(x, y));
|
||||
ANXHalfVector2 anxVal = new ANXHalfVector2(new ANXVector2(x, y));
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("twofloats")]
|
||||
|
@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNAHalfVector4 xnaVal = new XNAHalfVector4(x, y, z, w);
|
||||
ANXHalfVector4 anxVal = new ANXHalfVector4(x, y, z, w);
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("fourfloats")]
|
||||
@ -51,7 +51,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNAHalfVector4 xnaVal = new XNAHalfVector4(new XNAVector4(x, y, z, w));
|
||||
ANXHalfVector4 anxVal = new ANXHalfVector4(new ANXVector4(x, y, z, w));
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("fourfloats")]
|
||||
|
@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNANormalizedByte2 xnaVal = new XNANormalizedByte2(x, y);
|
||||
ANXNormalizedByte2 anxVal = new ANXNormalizedByte2(x, y);
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("twofloats")]
|
||||
@ -51,7 +51,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNANormalizedByte2 xnaVal = new XNANormalizedByte2(new XNAVector2(x, y));
|
||||
ANXNormalizedByte2 anxVal = new ANXNormalizedByte2(new ANXVector2(x, y));
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("twofloats")]
|
||||
|
@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNANormalizedByte4 xnaVal = new XNANormalizedByte4(x, y, z, w);
|
||||
ANXNormalizedByte4 anxVal = new ANXNormalizedByte4(x, y, z, w);
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("fourfloats")]
|
||||
@ -51,7 +51,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNANormalizedByte4 xnaVal = new XNANormalizedByte4(new XNAVector4(x, y, z, w));
|
||||
ANXNormalizedByte4 anxVal = new ANXNormalizedByte4(new ANXVector4(x, y, z, w));
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("fourfloats")]
|
||||
|
@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNANormalizedShort2 xnaVal = new XNANormalizedShort2(x, y);
|
||||
ANXNormalizedShort2 anxVal = new ANXNormalizedShort2(x, y);
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("twofloats")]
|
||||
@ -51,7 +51,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNANormalizedShort2 xnaVal = new XNANormalizedShort2(new XNAVector2(x, y));
|
||||
ANXNormalizedShort2 anxVal = new ANXNormalizedShort2(new ANXVector2(x, y));
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("twofloats")]
|
||||
|
@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNANormalizedShort4 xnaVal = new XNANormalizedShort4(x, y, z, w);
|
||||
ANXNormalizedShort4 anxVal = new ANXNormalizedShort4(x, y, z, w);
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("fourfloats")]
|
||||
@ -51,7 +51,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNANormalizedShort4 xnaVal = new XNANormalizedShort4(new XNAVector4(x, y, z, w));
|
||||
ANXNormalizedShort4 anxVal = new ANXNormalizedShort4(new ANXVector4(x, y, z, w));
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("fourfloats")]
|
||||
|
@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNARg32 xnaVal = new XNARg32(x, y);
|
||||
ANXRg32 anxVal = new ANXRg32(x, y);
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("twofloats")]
|
||||
@ -52,7 +52,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNARg32 xnaVal = new XNARg32(new XNAVector2(x, y));
|
||||
ANXRg32 anxVal = new ANXRg32(new ANXVector2(x, y));
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("twofloats")]
|
||||
|
@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNARgba1010102 xnaVal = new XNARgba1010102(x, y, z, w);
|
||||
ANXRgba1010102 anxVal = new ANXRgba1010102(x, y, z, w);
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("fourfloats")]
|
||||
@ -52,7 +52,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNARgba1010102 xnaVal = new XNARgba1010102(new XNAVector4(x, y, z, w));
|
||||
ANXRgba1010102 anxVal = new ANXRgba1010102(new ANXVector4(x, y, z, w));
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("fourfloats")]
|
||||
|
@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNARgba64 xnaVal = new XNARgba64(x, y, z, w);
|
||||
ANXRgba64 anxVal = new ANXRgba64(x, y, z, w);
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("fourfloats")]
|
||||
@ -52,7 +52,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNARgba64 xnaVal = new XNARgba64(new XNAVector4(x, y, z, w));
|
||||
ANXRgba64 anxVal = new ANXRgba64(new ANXVector4(x, y, z, w));
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("fourfloats")]
|
||||
|
@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNAShort2 xnaVal = new XNAShort2(x, y);
|
||||
ANXShort2 anxVal = new ANXShort2(x, y);
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("twofloats")]
|
||||
@ -51,7 +51,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNAShort2 xnaVal = new XNAShort2(new XNAVector2(x, y));
|
||||
ANXShort2 anxVal = new ANXShort2(new ANXVector2(x, y));
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("twofloats")]
|
||||
|
@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNAShort4 xnaVal = new XNAShort4(x, y, z, w);
|
||||
ANXShort4 anxVal = new ANXShort4(x, y, z, w);
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("fourfloats")]
|
||||
@ -51,7 +51,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
|
||||
XNAShort4 xnaVal = new XNAShort4(new XNAVector4(x, y, z, w));
|
||||
ANXShort4 anxVal = new ANXShort4(new ANXVector4(x, y, z, w));
|
||||
|
||||
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2");
|
||||
AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
|
||||
}
|
||||
|
||||
[Test, TestCaseSource("fourfloats")]
|
||||
|
@ -0,0 +1,98 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using ANXMediaLibrary = ANX.Framework.Media.MediaLibrary;
|
||||
using XNAMediaLibrary = Microsoft.Xna.Framework.Media.MediaLibrary;
|
||||
|
||||
namespace ANX.Framework.TestCenter.Strukturen.Media
|
||||
{
|
||||
public static class MediaLibraryTests
|
||||
{
|
||||
[Test]
|
||||
public static void TestGetSongs()
|
||||
{
|
||||
var anxLibrary = new ANXMediaLibrary();
|
||||
var xnaLibrary = new XNAMediaLibrary();
|
||||
var anxCollection = anxLibrary.Songs;
|
||||
var xnaCollection = xnaLibrary.Songs;
|
||||
Assert.AreEqual(xnaCollection.Count, anxCollection.Count);
|
||||
for(int index = 0; index < xnaCollection.Count; index++)
|
||||
{
|
||||
Assert.AreEqual(xnaCollection[index].Name, anxCollection[index].Name);
|
||||
Assert.AreEqual(xnaCollection[index].Rating, anxCollection[index].Rating);
|
||||
Assert.AreEqual(xnaCollection[index].IsRated, anxCollection[index].IsRated);
|
||||
Assert.AreEqual(xnaCollection[index].TrackNumber, anxCollection[index].TrackNumber);
|
||||
Assert.AreEqual(xnaCollection[index].PlayCount, anxCollection[index].PlayCount);
|
||||
Assert.AreEqual(xnaCollection[index].IsProtected, anxCollection[index].IsProtected);
|
||||
Assert.True(AreNearlyEqual(xnaCollection[index].Duration, anxCollection[index].Duration));
|
||||
|
||||
Assert.AreEqual(xnaCollection[index].Artist.Name, anxCollection[index].Artist.Name);
|
||||
Assert.AreEqual(xnaCollection[index].Album.Name, anxCollection[index].Album.Name);
|
||||
Assert.AreEqual(xnaCollection[index].Album.Artist.Name, anxCollection[index].Album.Artist.Name);
|
||||
Assert.AreEqual(xnaCollection[index].Genre.Name, anxCollection[index].Genre.Name);
|
||||
}
|
||||
}
|
||||
|
||||
private static bool AreNearlyEqual(TimeSpan first, TimeSpan second)
|
||||
{
|
||||
long ticks1 = first.Ticks;
|
||||
long ticks2 = second.Ticks;
|
||||
return ticks1 - 10000 <= ticks2 && ticks1 + 10000 >= ticks2;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void TestGetAlbums()
|
||||
{
|
||||
var anxLibrary = new ANXMediaLibrary();
|
||||
var xnaLibrary = new XNAMediaLibrary();
|
||||
var anxCollection = anxLibrary.Albums;
|
||||
var xnaCollection = xnaLibrary.Albums;
|
||||
Assert.AreEqual(xnaCollection.Count, anxCollection.Count);
|
||||
for (int index = 0; index < xnaCollection.Count; index++)
|
||||
{
|
||||
Assert.AreEqual(xnaCollection[index].Name, anxCollection[index].Name);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void TestGetPictures()
|
||||
{
|
||||
var anxLibrary = new ANXMediaLibrary();
|
||||
var xnaLibrary = new XNAMediaLibrary();
|
||||
var anxCollection = anxLibrary.Pictures;
|
||||
var xnaCollection = xnaLibrary.Pictures;
|
||||
Assert.AreEqual(xnaCollection.Count, anxCollection.Count);
|
||||
for (int index = 0; index < xnaCollection.Count; index++)
|
||||
{
|
||||
Assert.AreEqual(xnaCollection[index].Name, anxCollection[index].Name);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void TestGetArtists()
|
||||
{
|
||||
var anxLibrary = new ANXMediaLibrary();
|
||||
var xnaLibrary = new XNAMediaLibrary();
|
||||
var anxCollection = anxLibrary.Artists;
|
||||
var xnaCollection = xnaLibrary.Artists;
|
||||
Assert.AreEqual(xnaCollection.Count, anxCollection.Count);
|
||||
for (int index = 0; index < xnaCollection.Count; index++)
|
||||
{
|
||||
Assert.AreEqual(xnaCollection[index].Name, anxCollection[index].Name);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void TestGetGenres()
|
||||
{
|
||||
var anxLibrary = new ANXMediaLibrary();
|
||||
var xnaLibrary = new XNAMediaLibrary();
|
||||
var anxCollection = anxLibrary.Genres;
|
||||
var xnaCollection = xnaLibrary.Genres;
|
||||
Assert.AreEqual(xnaCollection.Count, anxCollection.Count);
|
||||
for (int index = 0; index < xnaCollection.Count; index++)
|
||||
{
|
||||
Assert.AreEqual(xnaCollection[index].Name, anxCollection[index].Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
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.
|
||||
@ -7,130 +8,70 @@ using System.IO;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
public sealed class Album : IEquatable<Album>, IDisposable
|
||||
{
|
||||
public bool IsDisposed
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
[PercentageComplete(70)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
public sealed class Album : IEquatable<Album>, IDisposable
|
||||
{
|
||||
internal string Id { get; private set; }
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public bool IsDisposed { get; private set; }
|
||||
public string Name { get; internal set; }
|
||||
public TimeSpan Duration { get; internal set; }
|
||||
public bool HasArt { get; internal set; }
|
||||
public Artist Artist { get; internal set; }
|
||||
public SongCollection Songs { get; internal set; }
|
||||
public Genre Genre { get; internal set; }
|
||||
|
||||
public TimeSpan Duration
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
internal Album(string setId)
|
||||
{
|
||||
Id = setId;
|
||||
IsDisposed = false;
|
||||
}
|
||||
|
||||
public bool HasArt
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public Stream GetAlbumArt()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Artist Artist
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public Stream GetThumbnail()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public SongCollection Songs
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
IsDisposed = true;
|
||||
}
|
||||
|
||||
public Genre Genre
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public bool Equals(Album other)
|
||||
{
|
||||
return Id == other.Id;
|
||||
}
|
||||
|
||||
#region Constructor
|
||||
private Album()
|
||||
{
|
||||
IsDisposed = false;
|
||||
}
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is Album ? Equals(obj as Album) : base.Equals(obj);
|
||||
}
|
||||
|
||||
~Album()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
#endregion
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
public Stream GetAlbumArt()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Name.GetHashCode();
|
||||
}
|
||||
|
||||
public Stream GetThumbnail()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public static bool operator ==(Album first, Album second)
|
||||
{
|
||||
return first.Equals(second);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (IsDisposed == false)
|
||||
{
|
||||
IsDisposed = true;
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public bool Equals(Album other)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is Album)
|
||||
return Equals(obj as Album);
|
||||
|
||||
return base.Equals(obj);
|
||||
}
|
||||
|
||||
#region ToString
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetHashCode
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Name.GetHashCode();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Operator overloading
|
||||
public static bool operator ==(Album first, Album second)
|
||||
{
|
||||
return first.Equals(second);
|
||||
}
|
||||
|
||||
public static bool operator !=(Album first, Album second)
|
||||
{
|
||||
return first.Equals(second) == false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
public static bool operator !=(Album first, Album second)
|
||||
{
|
||||
return first.Equals(second) == false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
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.
|
||||
@ -8,35 +9,28 @@ using System.Collections.Generic;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public sealed class AlbumCollection : IEnumerable<Album>, IEnumerable, IDisposable
|
||||
{
|
||||
private List<Album> albums;
|
||||
private readonly List<Album> albums;
|
||||
|
||||
public bool IsDisposed
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public bool IsDisposed { get; private set; }
|
||||
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return albums.Count;
|
||||
}
|
||||
}
|
||||
public int Count
|
||||
{
|
||||
get { return albums.Count; }
|
||||
}
|
||||
|
||||
public Album this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return albums[index];
|
||||
}
|
||||
}
|
||||
public Album this[int index]
|
||||
{
|
||||
get { return albums[index]; }
|
||||
}
|
||||
|
||||
internal AlbumCollection()
|
||||
internal AlbumCollection(IEnumerable<Album> setAlbums)
|
||||
{
|
||||
albums = new List<Album>();
|
||||
albums = new List<Album>(setAlbums);
|
||||
IsDisposed = false;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
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.
|
||||
@ -6,96 +7,55 @@ using System;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
public sealed class Artist : IEquatable<Artist>, IDisposable
|
||||
{
|
||||
public bool IsDisposed
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public sealed class Artist : IEquatable<Artist>, IDisposable
|
||||
{
|
||||
public bool IsDisposed { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
public SongCollection Songs { get; internal set; }
|
||||
public AlbumCollection Albums { get; internal set; }
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
internal Artist(string setName)
|
||||
{
|
||||
Name = setName;
|
||||
IsDisposed = false;
|
||||
}
|
||||
|
||||
public SongCollection Songs
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public bool Equals(Artist other)
|
||||
{
|
||||
return Name == other.Name;
|
||||
}
|
||||
|
||||
public AlbumCollection Albums
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is Artist ? Equals(obj as Artist) : base.Equals(obj);
|
||||
}
|
||||
|
||||
#region Constructor
|
||||
private Artist()
|
||||
{
|
||||
IsDisposed = false;
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
IsDisposed = true;
|
||||
}
|
||||
|
||||
~Artist()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
#endregion
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
public bool Equals(Artist other)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Name.GetHashCode();
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is Artist)
|
||||
return Equals(obj as Artist);
|
||||
public static bool operator ==(Artist first, Artist second)
|
||||
{
|
||||
return first.Equals(second);
|
||||
}
|
||||
|
||||
return base.Equals(obj);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (IsDisposed == false)
|
||||
{
|
||||
IsDisposed = true;
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
#region ToString
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetHashCode
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Name.GetHashCode();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Operator overloading
|
||||
public static bool operator ==(Artist first, Artist second)
|
||||
{
|
||||
return first.Equals(second);
|
||||
}
|
||||
|
||||
public static bool operator !=(Artist first, Artist second)
|
||||
{
|
||||
return first.Equals(second) == false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
public static bool operator !=(Artist first, Artist second)
|
||||
{
|
||||
return first.Equals(second) == false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
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.
|
||||
@ -8,6 +9,9 @@ using System.Collections.Generic;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public sealed class ArtistCollection : IEnumerable<Artist>, IEnumerable, IDisposable
|
||||
{
|
||||
private readonly List<Artist> artists;
|
||||
@ -24,9 +28,9 @@ namespace ANX.Framework.Media
|
||||
get { return artists[index]; }
|
||||
}
|
||||
|
||||
internal ArtistCollection()
|
||||
internal ArtistCollection(IEnumerable<Artist> setArtists)
|
||||
{
|
||||
artists = new List<Artist>();
|
||||
artists = new List<Artist>(setArtists);
|
||||
IsDisposed = false;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
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.
|
||||
@ -6,96 +7,55 @@ using System;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
public sealed class Genre : IEquatable<Genre>, IDisposable
|
||||
{
|
||||
public bool IsDisposed
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public sealed class Genre : IEquatable<Genre>, IDisposable
|
||||
{
|
||||
public bool IsDisposed { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
public SongCollection Songs { get; internal set; }
|
||||
public AlbumCollection Albums { get; internal set; }
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
internal Genre(string setName)
|
||||
{
|
||||
Name = setName;
|
||||
IsDisposed = false;
|
||||
}
|
||||
|
||||
public SongCollection Songs
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public bool Equals(Genre other)
|
||||
{
|
||||
return Name == other.Name;
|
||||
}
|
||||
|
||||
public AlbumCollection Albums
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
#region Constructor
|
||||
private Genre()
|
||||
{
|
||||
IsDisposed = false;
|
||||
}
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is Genre ? Equals(obj as Genre) : base.Equals(obj);
|
||||
}
|
||||
|
||||
~Genre()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
#endregion
|
||||
public void Dispose()
|
||||
{
|
||||
IsDisposed = true;
|
||||
}
|
||||
|
||||
public bool Equals(Genre other)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is Genre)
|
||||
return Equals(obj as Genre);
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Name.GetHashCode();
|
||||
}
|
||||
|
||||
return base.Equals(obj);
|
||||
}
|
||||
public static bool operator ==(Genre first, Genre second)
|
||||
{
|
||||
return first.Equals(second);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (IsDisposed == false)
|
||||
{
|
||||
IsDisposed = true;
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
#region ToString
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetHashCode
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Name.GetHashCode();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Operator overloading
|
||||
public static bool operator ==(Genre first, Genre second)
|
||||
{
|
||||
return first.Equals(second);
|
||||
}
|
||||
|
||||
public static bool operator !=(Genre first, Genre second)
|
||||
{
|
||||
return first.Equals(second) == false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
public static bool operator !=(Genre first, Genre second)
|
||||
{
|
||||
return first.Equals(second) == false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
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.
|
||||
@ -8,6 +9,9 @@ using System.Collections.Generic;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public sealed class GenreCollection : IEnumerable<Genre>, IEnumerable, IDisposable
|
||||
{
|
||||
private readonly List<Genre> genres;
|
||||
@ -24,9 +28,9 @@ namespace ANX.Framework.Media
|
||||
get { return genres[index]; }
|
||||
}
|
||||
|
||||
internal GenreCollection()
|
||||
internal GenreCollection(IEnumerable<Genre> setGenres)
|
||||
{
|
||||
genres = new List<Genre>();
|
||||
genres = new List<Genre>(setGenres);
|
||||
IsDisposed = false;
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,8 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
public sealed class MediaQueue
|
||||
{
|
||||
private readonly List<Song> queue;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
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.
|
||||
@ -6,6 +7,9 @@ using System;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
[Flags]
|
||||
public enum MediaSourceType
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
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.
|
||||
@ -6,6 +7,9 @@ using System;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
[Flags]
|
||||
public enum MediaState
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
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.
|
||||
@ -7,122 +8,69 @@ using System.IO;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
public sealed class Picture : IEquatable<Picture>, IDisposable
|
||||
{
|
||||
public bool IsDisposed
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
[PercentageComplete(70)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
public sealed class Picture : IEquatable<Picture>, IDisposable
|
||||
{
|
||||
internal string Id { get; private set; }
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public bool IsDisposed { get; private set; }
|
||||
public string Name { get; internal set; }
|
||||
public PictureAlbum Album { get; internal set; }
|
||||
public int Width { get; internal set; }
|
||||
public int Height { get; internal set; }
|
||||
public DateTime Date { get; internal set; }
|
||||
|
||||
public PictureAlbum Album
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
internal Picture(string setId)
|
||||
{
|
||||
Id = setId;
|
||||
IsDisposed = false;
|
||||
}
|
||||
|
||||
public int Width
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public Stream GetImage()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public int Height
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public Stream GetThumbnail()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public DateTime Date
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public bool Equals(Picture other)
|
||||
{
|
||||
return Id == other.Id;
|
||||
}
|
||||
|
||||
#region Constructor
|
||||
private Picture()
|
||||
{
|
||||
IsDisposed = false;
|
||||
}
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is Picture ? Equals(obj as Picture) : base.Equals(obj);
|
||||
}
|
||||
|
||||
~Picture()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
#endregion
|
||||
public void Dispose()
|
||||
{
|
||||
IsDisposed = true;
|
||||
}
|
||||
|
||||
public Stream GetImage()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
public Stream GetThumbnail()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Name.GetHashCode();
|
||||
}
|
||||
|
||||
public bool Equals(Picture other)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public static bool operator ==(Picture first, Picture second)
|
||||
{
|
||||
return first.Equals(second);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is Picture)
|
||||
return Equals(obj as Picture);
|
||||
|
||||
return base.Equals(obj);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (IsDisposed == false)
|
||||
{
|
||||
IsDisposed = true;
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
#region ToString
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetHashCode
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Name.GetHashCode();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Operator overloading
|
||||
public static bool operator ==(Picture first, Picture second)
|
||||
{
|
||||
return first.Equals(second);
|
||||
}
|
||||
|
||||
public static bool operator !=(Picture first, Picture second)
|
||||
{
|
||||
return first.Equals(second) == false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
public static bool operator !=(Picture first, Picture second)
|
||||
{
|
||||
return first.Equals(second) == false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
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.
|
||||
@ -6,104 +7,58 @@ using System;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
public sealed class PictureAlbum : IEquatable<PictureAlbum>, IDisposable
|
||||
{
|
||||
public bool IsDisposed
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
[PercentageComplete(50)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
public sealed class PictureAlbum : IEquatable<PictureAlbum>, IDisposable
|
||||
{
|
||||
internal string Id { get; private set; }
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public bool IsDisposed { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
public PictureAlbumCollection Albums { get; private set; }
|
||||
public PictureCollection Pictures { get; private set; }
|
||||
public PictureAlbum Parent { get; private set; }
|
||||
|
||||
public PictureAlbumCollection Albums
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
internal PictureAlbum(string setId)
|
||||
{
|
||||
Id = setId;
|
||||
IsDisposed = false;
|
||||
}
|
||||
|
||||
public PictureCollection Pictures
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public bool Equals(PictureAlbum other)
|
||||
{
|
||||
return Id == other.Id;
|
||||
}
|
||||
|
||||
public PictureAlbum Parent
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is PictureAlbum ? Equals(obj as PictureAlbum) : base.Equals(obj);
|
||||
}
|
||||
|
||||
#region Constructor
|
||||
private PictureAlbum()
|
||||
{
|
||||
IsDisposed = false;
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
IsDisposed = true;
|
||||
}
|
||||
|
||||
~PictureAlbum()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
#endregion
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
public bool Equals(PictureAlbum other)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Name.GetHashCode();
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is PictureAlbum)
|
||||
return Equals(obj as PictureAlbum);
|
||||
public static bool operator ==(PictureAlbum first, PictureAlbum second)
|
||||
{
|
||||
return first.Equals(second);
|
||||
}
|
||||
|
||||
return base.Equals(obj);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (IsDisposed == false)
|
||||
{
|
||||
IsDisposed = true;
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
#region ToString
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetHashCode
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Name.GetHashCode();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Operator overloading
|
||||
public static bool operator ==(PictureAlbum first, PictureAlbum second)
|
||||
{
|
||||
return first.Equals(second);
|
||||
}
|
||||
|
||||
public static bool operator !=(PictureAlbum first, PictureAlbum second)
|
||||
{
|
||||
return first.Equals(second) == false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
public static bool operator !=(PictureAlbum first, PictureAlbum second)
|
||||
{
|
||||
return first.Equals(second) == false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
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.
|
||||
@ -8,33 +9,26 @@ using System.Collections.Generic;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public sealed class PictureAlbumCollection : IEnumerable<PictureAlbum>, IEnumerable, IDisposable
|
||||
{
|
||||
private List<PictureAlbum> pictureAlbums;
|
||||
private readonly List<PictureAlbum> pictureAlbums;
|
||||
|
||||
public bool IsDisposed
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public bool IsDisposed { get; private set; }
|
||||
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return pictureAlbums.Count;
|
||||
}
|
||||
}
|
||||
public int Count
|
||||
{
|
||||
get { return pictureAlbums.Count; }
|
||||
}
|
||||
|
||||
public PictureAlbum this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return pictureAlbums[index];
|
||||
}
|
||||
}
|
||||
public PictureAlbum this[int index]
|
||||
{
|
||||
get { return pictureAlbums[index]; }
|
||||
}
|
||||
|
||||
internal PictureAlbumCollection()
|
||||
internal PictureAlbumCollection()
|
||||
{
|
||||
pictureAlbums = new List<PictureAlbum>();
|
||||
IsDisposed = false;
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
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.
|
||||
@ -8,35 +9,28 @@ using System.Collections.Generic;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public sealed class PictureCollection : IEnumerable<Picture>, IEnumerable, IDisposable
|
||||
{
|
||||
private List<Picture> pictures;
|
||||
private readonly List<Picture> pictures;
|
||||
|
||||
public bool IsDisposed
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public bool IsDisposed { get; private set; }
|
||||
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return pictures.Count;
|
||||
}
|
||||
}
|
||||
public int Count
|
||||
{
|
||||
get { return pictures.Count; }
|
||||
}
|
||||
|
||||
public Picture this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return pictures[index];
|
||||
}
|
||||
}
|
||||
public Picture this[int index]
|
||||
{
|
||||
get { return pictures[index]; }
|
||||
}
|
||||
|
||||
internal PictureCollection()
|
||||
internal PictureCollection(IEnumerable<Picture> setPictures)
|
||||
{
|
||||
pictures = new List<Picture>();
|
||||
pictures = new List<Picture>(setPictures);
|
||||
IsDisposed = false;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
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.
|
||||
@ -6,87 +7,49 @@ using System;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
public sealed class Playlist : IEquatable<Playlist>, IDisposable
|
||||
{
|
||||
public bool IsDisposed
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
{
|
||||
internal string Id { get; private set; }
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public bool IsDisposed { get; private set; }
|
||||
public string Name { get; internal set; }
|
||||
public SongCollection Songs { get; internal set; }
|
||||
public TimeSpan Duration { get; internal set; }
|
||||
|
||||
public SongCollection Songs
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public TimeSpan Duration
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
#region Constructor
|
||||
private Playlist()
|
||||
internal Playlist(string setId)
|
||||
{
|
||||
Id = setId;
|
||||
IsDisposed = false;
|
||||
}
|
||||
|
||||
~Playlist()
|
||||
public bool Equals(Playlist other)
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
#endregion
|
||||
|
||||
public bool Equals(Playlist other)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return Id == other.Id;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is Playlist)
|
||||
return Equals(obj as Playlist);
|
||||
|
||||
return base.Equals(obj);
|
||||
{
|
||||
return obj is Playlist ? Equals(obj as Playlist) : base.Equals(obj);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (IsDisposed == false)
|
||||
{
|
||||
IsDisposed = true;
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
IsDisposed = true;
|
||||
}
|
||||
|
||||
#region ToString
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetHashCode
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Name.GetHashCode();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Operator overloading
|
||||
public static bool operator ==(Playlist first, Playlist second)
|
||||
{
|
||||
return first.Equals(second);
|
||||
@ -96,6 +59,5 @@ namespace ANX.Framework.Media
|
||||
{
|
||||
return first.Equals(second) == false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
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.
|
||||
@ -8,34 +9,26 @@ using System.Collections.Generic;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
public sealed class PlaylistCollection
|
||||
: IEnumerable<Playlist>, IEnumerable, IDisposable
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public sealed class PlaylistCollection : IEnumerable<Playlist>, IEnumerable, IDisposable
|
||||
{
|
||||
private List<Playlist> playlists;
|
||||
private readonly List<Playlist> playlists;
|
||||
|
||||
public bool IsDisposed
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public bool IsDisposed { get; private set; }
|
||||
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return playlists.Count;
|
||||
}
|
||||
}
|
||||
public int Count
|
||||
{
|
||||
get { return playlists.Count; }
|
||||
}
|
||||
|
||||
public Playlist this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return playlists[index];
|
||||
}
|
||||
}
|
||||
public Playlist this[int index]
|
||||
{
|
||||
get { return playlists[index]; }
|
||||
}
|
||||
|
||||
internal PlaylistCollection()
|
||||
internal PlaylistCollection()
|
||||
{
|
||||
playlists = new List<Playlist>();
|
||||
IsDisposed = false;
|
||||
|
@ -9,116 +9,109 @@ using ANX.Framework.NonXNA.Development;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
[PercentageComplete(50)]
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
public sealed class Song : IEquatable<Song>, IDisposable
|
||||
{
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public sealed class Song : IEquatable<Song>, IDisposable
|
||||
{
|
||||
internal string Id { get; private set; }
|
||||
internal ISong NativeSong { get; private set; }
|
||||
internal MediaState State { get { return NativeSong.State; } }
|
||||
internal MediaState State
|
||||
{
|
||||
get { return NativeSong.State; }
|
||||
}
|
||||
|
||||
#region Public
|
||||
public bool IsDisposed { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
|
||||
public bool IsRated
|
||||
{
|
||||
get { return Rating > 0; }
|
||||
}
|
||||
|
||||
public string Name { get; private set; }
|
||||
public int Rating { get; internal set; }
|
||||
public int TrackNumber { get; internal set; }
|
||||
public int PlayCount { get; internal set; }
|
||||
public bool IsProtected { get; internal set; }
|
||||
public Artist Artist { get; internal set; }
|
||||
public Album Album { get; internal set; }
|
||||
public Genre Genre { get; internal set; }
|
||||
|
||||
public bool IsRated
|
||||
{
|
||||
get { return Rating > 0; }
|
||||
}
|
||||
|
||||
public TimeSpan Duration
|
||||
{
|
||||
get { return NativeSong.Duration; }
|
||||
}
|
||||
|
||||
public int Rating
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public int PlayCount
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public int TrackNumber
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public bool IsProtected
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
get { return NativeSong.Duration; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
internal Song(string setName)
|
||||
#region Constructor
|
||||
internal Song(string setName, string setId, string filename, int duration)
|
||||
{
|
||||
// TODO
|
||||
var creator = AddInSystemFactory.Instance.GetDefaultCreator<ISoundSystemCreator>();
|
||||
//NativeSong = creator.CreateSong(this, uri);
|
||||
NativeSong = creator.CreateSong(this, filename, duration);
|
||||
Id = setId;
|
||||
Name = setName;
|
||||
IsDisposed = false;
|
||||
}
|
||||
|
||||
internal Song(string setName, Uri uri)
|
||||
internal Song(string setName, Uri uri)
|
||||
{
|
||||
var creator = AddInSystemFactory.Instance.GetDefaultCreator<ISoundSystemCreator>();
|
||||
NativeSong = creator.CreateSong(this, uri);
|
||||
Name = setName;
|
||||
IsDisposed = false;
|
||||
}
|
||||
Id = "-1";
|
||||
Name = setName;
|
||||
IsDisposed = false;
|
||||
}
|
||||
|
||||
internal Song(string setName, string filename, int duration)
|
||||
{
|
||||
var creator = AddInSystemFactory.Instance.GetDefaultCreator<ISoundSystemCreator>();
|
||||
NativeSong = creator.CreateSong(this, filename, duration);
|
||||
Id = "-1";
|
||||
Name = setName;
|
||||
IsDisposed = false;
|
||||
}
|
||||
|
||||
~Song()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
#endregion
|
||||
~Song()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static Song FromUri(string name, Uri uri)
|
||||
{
|
||||
return new Song(name, uri);
|
||||
}
|
||||
public static Song FromUri(string name, Uri uri)
|
||||
{
|
||||
return new Song(name, uri);
|
||||
}
|
||||
|
||||
#region Equals
|
||||
public bool Equals(Song other)
|
||||
{
|
||||
return other != null && Name == other.Name;
|
||||
}
|
||||
{
|
||||
if (other == null || Id != other.Id)
|
||||
return false;
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(this, obj) == false)
|
||||
return Id != "-1" || ReferenceEquals(this, other);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is Song && ReferenceEquals(this, obj) == false)
|
||||
return Equals((Song)obj);
|
||||
|
||||
return base.Equals(obj);
|
||||
}
|
||||
return base.Equals(obj);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Dispose
|
||||
public void Dispose()
|
||||
{
|
||||
if (IsDisposed)
|
||||
return;
|
||||
{
|
||||
if (IsDisposed)
|
||||
return;
|
||||
|
||||
IsDisposed = true;
|
||||
IsDisposed = true;
|
||||
|
||||
if(NativeSong != null)
|
||||
if (NativeSong != null)
|
||||
NativeSong.Dispose();
|
||||
NativeSong = null;
|
||||
}
|
||||
NativeSong = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
internal void Play()
|
||||
@ -141,30 +134,30 @@ namespace ANX.Framework.Media
|
||||
NativeSong.Resume();
|
||||
}
|
||||
|
||||
#region ToString
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
#endregion
|
||||
#region ToString
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetHashCode
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Name.GetHashCode();
|
||||
}
|
||||
#endregion
|
||||
#region GetHashCode
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Name.GetHashCode();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Operator overloading
|
||||
public static bool operator ==(Song first, Song second)
|
||||
#region Operator overloading
|
||||
public static bool operator ==(Song first, Song second)
|
||||
{
|
||||
return object.Equals(first, second);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool operator !=(Song first, Song second)
|
||||
public static bool operator !=(Song first, Song second)
|
||||
{
|
||||
return !(first == second);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
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.
|
||||
@ -8,6 +9,9 @@ using System.Collections.Generic;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public sealed class SongCollection : IEnumerable<Song>, IEnumerable, IDisposable
|
||||
{
|
||||
private readonly List<Song> songs;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
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.
|
||||
@ -6,6 +7,9 @@ using System;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
[PercentageComplete(10)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
public sealed class Video
|
||||
{
|
||||
internal TimeSpan PlayPosition
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using ANX.Framework.Graphics;
|
||||
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.
|
||||
@ -7,6 +8,9 @@ using ANX.Framework.Graphics;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
[PercentageComplete(50)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
public sealed class VideoPlayer : IDisposable
|
||||
{
|
||||
private float volume;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
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.
|
||||
@ -6,6 +7,9 @@ using System;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
[Flags]
|
||||
public enum VideoSoundtrackType
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Collections.ObjectModel;
|
||||
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.
|
||||
@ -6,6 +7,9 @@ using System.Collections.ObjectModel;
|
||||
|
||||
namespace ANX.Framework.Media
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
public class VisualizationData
|
||||
{
|
||||
internal readonly float[] FrequencyData;
|
||||
|
@ -41,6 +41,7 @@
|
||||
<Compile Include="SupportedPlatformsImpl.cs" />
|
||||
<Compile Include="WindowsContentManager.cs" />
|
||||
<Compile Include="WindowsGameTimer.cs" />
|
||||
<Compile Include="WindowsMediaLibrary.cs" />
|
||||
<Compile Include="WindowsStorageContainer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="WindowsGameHost.cs" />
|
||||
@ -55,6 +56,17 @@
|
||||
<Name>ANX.Framework</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="WMPLib">
|
||||
<Guid>{6BF52A50-394A-11D3-B153-00C04F79FAA6}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
@ -42,6 +42,7 @@
|
||||
<Compile Include="SupportedPlatformsImpl.cs" />
|
||||
<Compile Include="WindowsContentManager.cs" />
|
||||
<Compile Include="WindowsGameTimer.cs" />
|
||||
<Compile Include="WindowsMediaLibrary.cs" />
|
||||
<Compile Include="WindowsStorageContainer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="WindowsGameHost.cs" />
|
||||
@ -56,6 +57,17 @@
|
||||
<Name>ANX.Framework</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="WMPLib">
|
||||
<Guid>{6BF52A50-394A-11D3-B153-00C04F79FAA6}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Sce\Sce.Psm.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
@ -43,6 +43,7 @@
|
||||
<Compile Include="SupportedPlatformsImpl.cs" />
|
||||
<Compile Include="WindowsContentManager.cs" />
|
||||
<Compile Include="WindowsGameTimer.cs" />
|
||||
<Compile Include="WindowsMediaLibrary.cs" />
|
||||
<Compile Include="WindowsStorageContainer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="WindowsGameHost.cs" />
|
||||
@ -57,6 +58,17 @@
|
||||
<Name>ANX.Framework</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="WMPLib">
|
||||
<Guid>{6BF52A50-394A-11D3-B153-00C04F79FAA6}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
@ -1,20 +1,260 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using ANX.Framework.Media;
|
||||
using ANX.Framework.NonXNA.PlatformSystem;
|
||||
using WMPLib;
|
||||
|
||||
namespace ANX.PlatformSystem.Windows
|
||||
{
|
||||
class WindowsMediaLibrary : INativeMediaLibrary
|
||||
/// <summary>
|
||||
/// List of media item attributes: http://msdn.microsoft.com/en-us/library/dd562379%28v=vs.85%29.aspx
|
||||
/// </summary>
|
||||
public class WindowsMediaLibrary : INativeMediaLibrary
|
||||
{
|
||||
private enum MediaType
|
||||
{
|
||||
Audio,
|
||||
Other,
|
||||
Photo,
|
||||
Playlist,
|
||||
Radio,
|
||||
Video
|
||||
}
|
||||
|
||||
private PictureCollection pictureCollection;
|
||||
private PictureAlbum rootPictureAlbum;
|
||||
private PictureCollection savedPictures;
|
||||
private SongCollection songs;
|
||||
private ArtistCollection artists;
|
||||
private GenreCollection genres;
|
||||
private PlaylistCollection playlists;
|
||||
private AlbumCollection albums;
|
||||
private WindowsMediaPlayer nativePlayer;
|
||||
|
||||
public WindowsMediaLibrary()
|
||||
{
|
||||
nativePlayer = new WindowsMediaPlayer();
|
||||
CollectAllData();
|
||||
}
|
||||
|
||||
#region CollectAllData
|
||||
private void CollectAllData()
|
||||
{
|
||||
var allArtists = new List<Artist>();
|
||||
var allSongs = new List<Song>();
|
||||
var allAlbums = new List<Album>();
|
||||
var allPictures = new List<Picture>();
|
||||
var allGenres = new List<Genre>();
|
||||
var allPictureAlbums = new List<PictureAlbum>();
|
||||
|
||||
var list = nativePlayer.mediaCollection.getAll();
|
||||
for (int index = 0; index < list.count; index++)
|
||||
{
|
||||
var media = list.Item[index];
|
||||
string id = media.getItemInfo("TrackingID");
|
||||
if (GetType(media) == MediaType.Audio)
|
||||
{
|
||||
string artistName = media.getItemInfo("Author");
|
||||
var newArtist = GetArtist(artistName, allArtists);
|
||||
|
||||
string albumId = media.getItemInfo("AlbumID");
|
||||
string albumName = media.getItemInfo("WM/AlbumTitle");
|
||||
string albumArtistName = albumName.Length > 0 ? albumId.Replace(albumName, "") : artistName;
|
||||
if (albumArtistName.Length == 0)
|
||||
albumArtistName = artistName;
|
||||
var newAlbum = GetAlbum(albumId, allAlbums);
|
||||
newAlbum.Name = albumName;
|
||||
newAlbum.Artist = GetArtist(albumArtistName, allArtists);
|
||||
|
||||
string genreName = media.getItemInfo("WM/Genre");
|
||||
Genre newGenre = GetGenre(genreName, allGenres);
|
||||
|
||||
int duration = GetMediaDuration(media, "Duration");
|
||||
string name = media.getItemInfo("Title");
|
||||
var newSong = new Song(name, id, media.sourceURL, duration)
|
||||
{
|
||||
Artist = newArtist,
|
||||
Album = newAlbum,
|
||||
Genre = newGenre,
|
||||
Rating = GetMediaIntValue(media, "UserRating", 0),
|
||||
TrackNumber = GetMediaIntValue(media, "WM/TrackNumber", 0),
|
||||
PlayCount = GetMediaIntValue(media, "UserPlayCount", 0),
|
||||
IsProtected = GetMediaBoolValue(media, "Is_Protected", false),
|
||||
};
|
||||
allSongs.Add(newSong);
|
||||
}
|
||||
else if (GetType(media) == MediaType.Photo)
|
||||
{
|
||||
string name = media.getItemInfo("Title");
|
||||
var newPicture = new Picture(id)
|
||||
{
|
||||
Name = name,
|
||||
};
|
||||
allPictures.Add(newPicture);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Artist artist in allArtists)
|
||||
{
|
||||
var allSongsFromArtist = allSongs.Where(song => song.Artist == artist).ToArray();
|
||||
artist.Songs = new SongCollection(allSongsFromArtist);
|
||||
var allAlbumsFromArtist = allAlbums.Where(album => album.Artist == artist).ToArray();
|
||||
artist.Albums = new AlbumCollection(allAlbumsFromArtist);
|
||||
}
|
||||
|
||||
foreach (Album album in allAlbums)
|
||||
{
|
||||
var allSongsFromAlbum = allSongs.Where(song => song.Album == album).ToArray();
|
||||
album.Songs = new SongCollection(allSongsFromAlbum);
|
||||
}
|
||||
|
||||
foreach (Genre genre in allGenres)
|
||||
{
|
||||
var allSongsInGenre = allSongs.Where(song => song.Genre == genre).ToArray();
|
||||
genre.Songs = new SongCollection(allSongsInGenre);
|
||||
// TODO: albums
|
||||
}
|
||||
|
||||
songs = new SongCollection(allSongs);
|
||||
pictureCollection = new PictureCollection(allPictures);
|
||||
artists = new ArtistCollection(allArtists);
|
||||
albums = new AlbumCollection(allAlbums);
|
||||
genres = new GenreCollection(allGenres);
|
||||
// TODO
|
||||
rootPictureAlbum = null;
|
||||
playlists = new PlaylistCollection();
|
||||
savedPictures = new PictureCollection(new Picture[0]);
|
||||
}
|
||||
#endregion
|
||||
|
||||
private Artist GetArtist(string name, List<Artist> allArtists)
|
||||
{
|
||||
foreach (Artist artist in allArtists)
|
||||
if (artist.Name == name)
|
||||
return artist;
|
||||
|
||||
var newArtist = new Artist(name);
|
||||
allArtists.Add(newArtist);
|
||||
return newArtist;
|
||||
}
|
||||
|
||||
private Genre GetGenre(string name, List<Genre> allGenres)
|
||||
{
|
||||
foreach (Genre genre in allGenres)
|
||||
if (genre.Name == name)
|
||||
return genre;
|
||||
|
||||
var newGenre = new Genre(name);
|
||||
allGenres.Add(newGenre);
|
||||
return newGenre;
|
||||
}
|
||||
|
||||
private Album GetAlbum(string id, List<Album> allAlbums)
|
||||
{
|
||||
foreach (Album album in allAlbums)
|
||||
if (album.Name == id)
|
||||
return album;
|
||||
|
||||
var newAlbum = new Album(id);
|
||||
allAlbums.Add(newAlbum);
|
||||
return newAlbum;
|
||||
}
|
||||
|
||||
#region GetMethods
|
||||
public PictureCollection GetPictures()
|
||||
{
|
||||
return pictureCollection;
|
||||
}
|
||||
|
||||
public PictureAlbum GetRootPictureAlbum()
|
||||
{
|
||||
return rootPictureAlbum;
|
||||
}
|
||||
|
||||
public PictureCollection GetSavedPictures()
|
||||
{
|
||||
return savedPictures;
|
||||
}
|
||||
|
||||
public SongCollection GetSongs()
|
||||
{
|
||||
return songs;
|
||||
}
|
||||
|
||||
public ArtistCollection GetArtists()
|
||||
{
|
||||
return artists;
|
||||
}
|
||||
|
||||
public AlbumCollection GetAlbums()
|
||||
{
|
||||
return albums;
|
||||
}
|
||||
|
||||
public PlaylistCollection GetPlaylists()
|
||||
{
|
||||
return playlists;
|
||||
}
|
||||
|
||||
public GenreCollection GetGenres()
|
||||
{
|
||||
return genres;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetMediaBoolValue
|
||||
private bool GetMediaBoolValue(IWMPMedia media, string name, bool defaultValue)
|
||||
{
|
||||
string value = media.getItemInfo(name);
|
||||
bool result;
|
||||
return bool.TryParse(value, out result) == false ? defaultValue : result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetMediaDuration
|
||||
private int GetMediaDuration(IWMPMedia media, string name)
|
||||
{
|
||||
string value = media.getItemInfo(name).Replace(',', '.');
|
||||
float seconds;
|
||||
if (float.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out seconds) == false)
|
||||
return 0;
|
||||
return (int)(seconds * 1000f);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetMediaIntValue
|
||||
private int GetMediaIntValue(IWMPMedia media, string name, int defaultValue)
|
||||
{
|
||||
string value = media.getItemInfo(name);
|
||||
int result;
|
||||
return int.TryParse(value, out result) == false ? defaultValue : result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetType
|
||||
private static MediaType GetType(IWMPMedia media)
|
||||
{
|
||||
switch (media.getItemInfo("MediaType"))
|
||||
{
|
||||
case "audio":
|
||||
return MediaType.Audio;
|
||||
default:
|
||||
return MediaType.Other;
|
||||
case "photo":
|
||||
return MediaType.Photo;
|
||||
case "playlist":
|
||||
return MediaType.Playlist;
|
||||
case "radio":
|
||||
return MediaType.Radio;
|
||||
case "video":
|
||||
return MediaType.Video;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public Picture SavePicture(string file, Stream data)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@ -30,60 +270,24 @@ namespace ANX.PlatformSystem.Windows
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public PictureCollection GetPictures()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public PictureAlbum GetRootPictureAlbum()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public PictureCollection GetSavedPictures()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public SongCollection GetSongs()
|
||||
{
|
||||
var collection = nativePlayer.mediaCollection;
|
||||
var list = collection.getAll();
|
||||
var songs = new Song[list.count];
|
||||
// TODO: sort out songs!
|
||||
for (int index = 0; index < songs.Length; index++)
|
||||
{
|
||||
var newSong = new Song(list.Item[index].name);
|
||||
songs[index] = newSong;
|
||||
}
|
||||
return new SongCollection(songs);
|
||||
}
|
||||
|
||||
public ArtistCollection GetArtists()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public AlbumCollection GetAlbums()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public PlaylistCollection GetPlaylists()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public GenreCollection GetGenres()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#region Dispose
|
||||
public void Dispose()
|
||||
{
|
||||
pictureCollection = null;
|
||||
rootPictureAlbum = null;
|
||||
savedPictures = null;
|
||||
songs = null;
|
||||
artists = null;
|
||||
genres = null;
|
||||
playlists = null;
|
||||
albums = null;
|
||||
|
||||
if (nativePlayer != null)
|
||||
{
|
||||
nativePlayer.close();
|
||||
nativePlayer = null;
|
||||
nativePlayer = null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -169,13 +169,13 @@ namespace ANX.SoundSystem.OpenAL
|
||||
public ISong CreateSong(Song parentSong, Uri uri)
|
||||
{
|
||||
PreventSystemChange();
|
||||
return new OpenALSong(parentSong, uri);
|
||||
return new OpenALSong(uri);
|
||||
}
|
||||
|
||||
public ISong CreateSong(Song parentSong, string filepath, int duration)
|
||||
{
|
||||
PreventSystemChange();
|
||||
return new OpenALSong(parentSong, filepath, duration);
|
||||
return new OpenALSong(filepath, duration);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -16,35 +16,37 @@ namespace ANX.SoundSystem.OpenAL
|
||||
[Developer("AstrorEnales")]
|
||||
public class OpenALSong : ISong
|
||||
{
|
||||
private Song parent;
|
||||
private FileStream oggFileStream;
|
||||
private OggInputStream oggStream;
|
||||
private int[] bufferHandles;
|
||||
private int sourceHandle = InvalidHandle;
|
||||
private const int InvalidHandle = -1;
|
||||
private static readonly byte[] streamReadBuffer = new byte[4096 * 8];
|
||||
private static readonly byte[] StreamReadBuffer = new byte[4096 * 8];
|
||||
private string filepath;
|
||||
private bool isInitialized;
|
||||
|
||||
public TimeSpan Duration { get; private set; }
|
||||
public TimeSpan PlayPosition { get; private set; }
|
||||
public MediaState State { get; private set; }
|
||||
|
||||
public OpenALSong(Song setParent, Uri uri)
|
||||
public OpenALSong(Uri uri)
|
||||
{
|
||||
string path = uri.AbsolutePath.Replace("%20", "");
|
||||
parent = setParent;
|
||||
Init(path);
|
||||
filepath = uri.AbsolutePath.Replace("%20", "");
|
||||
// TODO: duration
|
||||
}
|
||||
|
||||
public OpenALSong(Song setParent, string filepath, int duration)
|
||||
public OpenALSong(string filepath, int duration)
|
||||
{
|
||||
parent = setParent;
|
||||
Init(filepath);
|
||||
this.filepath = filepath;
|
||||
Duration = new TimeSpan(0, 0, 0, 0, duration);
|
||||
}
|
||||
|
||||
private void Init(string filepath)
|
||||
private void Init()
|
||||
{
|
||||
if (Path.GetExtension(filepath).ToLower() != ".ogg")
|
||||
throw new NotImplementedException("Currently only ogg playback is implemented!");
|
||||
|
||||
isInitialized = true;
|
||||
PlayPosition = TimeSpan.Zero;
|
||||
|
||||
State = MediaState.Stopped;
|
||||
@ -56,6 +58,9 @@ namespace ANX.SoundSystem.OpenAL
|
||||
|
||||
public void Play()
|
||||
{
|
||||
if (isInitialized == false)
|
||||
Init();
|
||||
|
||||
if (State == MediaState.Playing)
|
||||
return;
|
||||
|
||||
@ -141,14 +146,14 @@ namespace ANX.SoundSystem.OpenAL
|
||||
|
||||
internal bool Stream(int bufferHandle)
|
||||
{
|
||||
int size = oggStream.Read(streamReadBuffer);
|
||||
int size = oggStream.Read(StreamReadBuffer);
|
||||
bool dataAvailable = size > 0;
|
||||
if (dataAvailable)
|
||||
{
|
||||
var channels = (AudioChannels)oggStream.Channels;
|
||||
PlayPosition = PlayPosition.Add(SoundEffect.GetSampleDuration(size, oggStream.SampleRate, channels));
|
||||
ALFormat format = oggStream.Channels > 1 ? ALFormat.Stereo16 : ALFormat.Mono16;
|
||||
AL.BufferData(bufferHandle, format, streamReadBuffer, size, oggStream.SampleRate);
|
||||
AL.BufferData(bufferHandle, format, StreamReadBuffer, size, oggStream.SampleRate);
|
||||
}
|
||||
|
||||
return dataAvailable;
|
||||
|
@ -22,6 +22,9 @@ namespace ANX.SoundSystem.Windows.XAudio
|
||||
private SourceVoice source;
|
||||
private readonly AudioBuffer[] buffers = new AudioBuffer[2];
|
||||
private int nextBufferIndex;
|
||||
private XAudio2 device;
|
||||
private string filepath;
|
||||
private bool isInitialized;
|
||||
|
||||
public TimeSpan Duration { get; private set; }
|
||||
public TimeSpan PlayPosition { get; private set; }
|
||||
@ -29,19 +32,24 @@ namespace ANX.SoundSystem.Windows.XAudio
|
||||
|
||||
public XAudioSong(XAudio2 device, Uri uri)
|
||||
{
|
||||
string path = uri.AbsolutePath.Replace("%20", "");
|
||||
Init(device, path);
|
||||
filepath = uri.AbsolutePath.Replace("%20", "");
|
||||
this.device = device;
|
||||
// TODO: duration
|
||||
}
|
||||
|
||||
public XAudioSong(XAudio2 device, string filepath, int duration)
|
||||
{
|
||||
Init(device, filepath);
|
||||
this.filepath = filepath;
|
||||
this.device = device;
|
||||
Duration = new TimeSpan(0, 0, 0, 0, duration);
|
||||
}
|
||||
|
||||
private void Init(XAudio2 device, string filepath)
|
||||
private void Init()
|
||||
{
|
||||
if (Path.GetExtension(filepath).ToLower() != ".ogg")
|
||||
throw new NotImplementedException("Currently only ogg playback is implemented!");
|
||||
|
||||
isInitialized = true;
|
||||
PlayPosition = TimeSpan.Zero;
|
||||
State = MediaState.Stopped;
|
||||
|
||||
@ -63,6 +71,9 @@ namespace ANX.SoundSystem.Windows.XAudio
|
||||
|
||||
public void Play()
|
||||
{
|
||||
if (isInitialized == false)
|
||||
Init();
|
||||
|
||||
if (State == MediaState.Playing)
|
||||
return;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user