SND\AstrorEnales_cp 0d25ca7589 - Added OggUtils Support project by making use of the csogg and csvorbis projects
- Implemented native Song playback in OpenAL and XAudio2
- Some tweaks in the MediaPlayer and MediaQueue
- Added a testmusic.ogg file to the media folder
2015-03-15 01:11:27 +01:00

115 lines
2.6 KiB
C#

using System;
using System.IO;
using ANX.Framework.NonXNA.Development;
using ANX.Framework.NonXNA.PlatformSystem;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.Framework.Media
{
[PercentageComplete(100)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.Untested)]
public sealed class MediaLibrary : IDisposable
{
private INativeMediaLibrary nativeLibrary;
#region Public
public bool IsDisposed { get; private set; }
public MediaSource MediaSource { get; private set; }
public PictureCollection Pictures
{
get { return nativeLibrary.GetPictures(); }
}
public PictureAlbum RootPictureAlbum
{
get { return nativeLibrary.GetRootPictureAlbum(); }
}
public PictureCollection SavedPictures
{
get { return nativeLibrary.GetSavedPictures(); }
}
public SongCollection Songs
{
get { return nativeLibrary.GetSongs(); }
}
public ArtistCollection Artists
{
get { return nativeLibrary.GetArtists(); }
}
public AlbumCollection Albums
{
get { return nativeLibrary.GetAlbums(); }
}
public PlaylistCollection Playlists
{
get { return nativeLibrary.GetPlaylists(); }
}
public GenreCollection Genres
{
get { return nativeLibrary.GetGenres(); }
}
#endregion
#region Constructor
public MediaLibrary()
{
nativeLibrary = PlatformSystem.Instance.CreateMediaLibrary();
MediaSource = MediaSource.GetAvailableMediaSources()[0];
}
public MediaLibrary(MediaSource setSource)
{
nativeLibrary = PlatformSystem.Instance.CreateMediaLibrary();
MediaSource = setSource;
}
~MediaLibrary()
{
Dispose();
}
#endregion
#region Dispose
public void Dispose()
{
if (IsDisposed)
return;
IsDisposed = true;
nativeLibrary.Dispose();
nativeLibrary = null;
}
#endregion
#region SavePicture
public Picture SavePicture(string file, byte[] data)
{
return nativeLibrary.SavePicture(file, data);
}
public Picture SavePicture(string file, Stream data)
{
return nativeLibrary.SavePicture(file, data);
}
#endregion
#region GetPictureFromToken
public Picture GetPictureFromToken(string file)
{
return nativeLibrary.GetPictureFromToken(file);
}
#endregion
}
}