diff --git a/ANX.Framework/Content/MediaTypeReaders/SoundEffectReader.cs b/ANX.Framework/Content/MediaTypeReaders/SoundEffectReader.cs index 24053a86..eef79876 100644 --- a/ANX.Framework/Content/MediaTypeReaders/SoundEffectReader.cs +++ b/ANX.Framework/Content/MediaTypeReaders/SoundEffectReader.cs @@ -1,5 +1,4 @@ using System; -using System.IO; using System.Runtime.InteropServices; using ANX.Framework.Audio; using ANX.Framework.NonXNA.Development; @@ -40,33 +39,12 @@ namespace ANX.Framework.Content int dataCount = input.ReadInt32(); byte[] data = input.ReadBytes(dataCount); - int loopStart = input.ReadInt32(); int loopLength = input.ReadInt32(); - int duration = input.ReadInt32(); - byte[] soundData; - using (var mStream = new MemoryStream(20 + header.Length + 8 + data.Length)) - { - var writer = new BinaryWriter(mStream); - writer.Write("RIFF".ToCharArray()); - writer.Write(20 + header.Length + data.Length); - writer.Write("WAVE".ToCharArray()); - - writer.Write("fmt ".ToCharArray()); - writer.Write(header.Length); - writer.Write(header); - - writer.Write("data".ToCharArray()); - writer.Write(data.Length); - writer.Write(data); - - soundData = mStream.ToArray(); - } - - return new SoundEffect(soundData, 0, soundData.Length, headerStruct.nSamplesPerSec, - (AudioChannels)headerStruct.nChannels, loopStart, loopLength); + return new SoundEffect(data, 0, data.Length, headerStruct.nSamplesPerSec, (AudioChannels)headerStruct.nChannels, + loopStart, loopLength); } } } diff --git a/ANX.Framework/Media/Song.cs b/ANX.Framework/Media/Song.cs index 534fb66b..fbe0bb26 100644 --- a/ANX.Framework/Media/Song.cs +++ b/ANX.Framework/Media/Song.cs @@ -25,69 +25,46 @@ namespace ANX.Framework.Media get { return Rating > 0; } } - public Artist Artist - { - get - { - throw new NotImplementedException(); - } - } + public Artist Artist { get; internal set; } + public Album Album { get; internal set; } + public Genre Genre { get; internal set; } - public Album Album - { - get - { - throw new NotImplementedException(); - } - } - - public Genre Genre - { - get - { - throw new NotImplementedException(); - } - } - - public TimeSpan Duration + public TimeSpan Duration { get { return NativeSong.Duration; } } - public int Rating - { - get - { - throw new NotImplementedException(); - } - } + public int Rating + { + get { throw new NotImplementedException(); } + } - public int PlayCount - { - get - { - throw new NotImplementedException(); - } - } + public int PlayCount + { + get { throw new NotImplementedException(); } + } - public int TrackNumber - { - get - { - throw new NotImplementedException(); - } - } + public int TrackNumber + { + get { throw new NotImplementedException(); } + } - public bool IsProtected - { - get - { - throw new NotImplementedException(); - } + public bool IsProtected + { + get { throw new NotImplementedException(); } } #endregion #region Constructor + internal Song(string setName) + { + // TODO + var creator = AddInSystemFactory.Instance.GetDefaultCreator(); + //NativeSong = creator.CreateSong(this, uri); + Name = setName; + IsDisposed = false; + } + internal Song(string setName, Uri uri) { var creator = AddInSystemFactory.Instance.GetDefaultCreator(); @@ -115,7 +92,8 @@ namespace ANX.Framework.Media return new Song(name, uri); } - public bool Equals(Song other) + #region Equals + public bool Equals(Song other) { return other != null && Name == other.Name; } @@ -127,8 +105,10 @@ namespace ANX.Framework.Media return base.Equals(obj); } + #endregion - public void Dispose() + #region Dispose + public void Dispose() { if (IsDisposed) return; @@ -139,6 +119,7 @@ namespace ANX.Framework.Media NativeSong.Dispose(); NativeSong = null; } + #endregion internal void Play() { diff --git a/ANX.Framework/Media/SongCollection.cs b/ANX.Framework/Media/SongCollection.cs index 0a6f2726..749a413c 100644 --- a/ANX.Framework/Media/SongCollection.cs +++ b/ANX.Framework/Media/SongCollection.cs @@ -8,36 +8,25 @@ using System.Collections.Generic; namespace ANX.Framework.Media { - public sealed class SongCollection - : IEnumerable, IEnumerable, IDisposable + public sealed class SongCollection : IEnumerable, IEnumerable, IDisposable { - private List songs; + private readonly List songs; - public bool IsDisposed - { - get; - private set; - } + public bool IsDisposed { get; private set; } - public int Count - { - get - { - return songs.Count; - } - } + public int Count + { + get { return songs.Count; } + } - public Song this[int index] - { - get - { - return songs[index]; - } - } + public Song this[int index] + { + get { return songs[index]; } + } - internal SongCollection() + internal SongCollection(IEnumerable allSongs) { - songs = new List(); + songs = new List(allSongs); IsDisposed = false; } diff --git a/PlatformSystems/ANX.PlatformSystem.Windows/ANX.PlatformSystem.Windows.csproj b/PlatformSystems/ANX.PlatformSystem.Windows/ANX.PlatformSystem.Windows.csproj index 8d331989..fe53a283 100644 --- a/PlatformSystems/ANX.PlatformSystem.Windows/ANX.PlatformSystem.Windows.csproj +++ b/PlatformSystems/ANX.PlatformSystem.Windows/ANX.PlatformSystem.Windows.csproj @@ -41,6 +41,7 @@ + @@ -55,6 +56,17 @@ ANX.Framework + + + {6BF52A50-394A-11D3-B153-00C04F79FAA6} + 1 + 0 + 0 + tlbimp + False + True + +