/ContentSystem/Multimedia/MusicData.cs
C# | 94 lines | 45 code | 8 blank | 41 comment | 0 complexity | 77de1572d1f8b791517047ede7316603 MD5 | raw file
Possible License(s): Apache-2.0
- namespace Delta.ContentSystem.Multimedia
- {
- /// <summary>
- /// Abstract base music class for the Delta.Multimedia.Music class. Needs to
- /// be implemented in the platform multimedia module (similar to Graphic
- /// classes). Unlike many other data classes this does not contain the data
- /// yet as it is highly dependant on the native implementation. For example
- /// in XNA we actually do not load a wav file, we just keep a native
- /// Sound object, while for OpenTK we load the wav data and set it to a
- /// stream before releasing it again.
- /// </summary>
- public class MusicData : Content
- {
- #region Get (Static)
- /// <summary>
- /// Get and load content based on the content name. This method makes sure
- /// we do not load the same content twice (the constructor is protected).
- /// </summary>
- /// <param name="contentName">Content name we want to load, this is
- /// passed onto the Content System, which will do the actual loading with
- /// help of the Load method in this class.</param>
- /// <returns>The loaded Content object, always unique for the same
- /// name, this helps comparing data.</returns>
- public static MusicData Get(string contentName)
- {
- return Get<MusicData>(contentName, ContentType.Music);
- }
- #endregion
-
- #region TimeLength (Public)
- /// <summary>
- /// The length in seconds this music data plays.
- /// </summary>
- public float TimeLength
- {
- get
- {
- return data.TimeLength;
- }
- }
- #endregion
-
- #region Protected
-
- #region MemorySize (Protected)
- /// <summary>
- /// Change the memory size from the file size to just a small buffer
- /// that is used by each native implementation.
- /// </summary>
- protected override int MemorySize
- {
- get
- {
- return 4096;
- }
- }
- #endregion
-
- #endregion
-
- #region Constructors
- /// <summary>
- /// Create music data
- /// </summary>
- /// <param name="contentName">Name of the content.</param>
- protected MusicData(string contentName)
- : base(contentName, ContentType.Music)
- {
- }
- #endregion
-
- #region Methods (Private)
-
- #region Load
- /// <summary>
- /// Load music content data, does nothing. Only properties are assigned.
- /// No loading happens here (it all happens in Sound), we can obviously
- /// clone all SoundDatas with the same name as they are not loaded here.
- /// Note: If a class is interested in the content reload functionality,
- /// it can just attach itself to the ContentChanged event.
- /// </summary>
- /// <param name="alreadyLoadedNativeData">If we already have native data
- /// loaded, clone it from this instance. Only used if not null. Please
- /// note that this is only used for other objects that had the same
- /// RawFileId and are already loaded and returned true for this method.
- /// </param>
- protected override void Load(Content alreadyLoadedNativeData)
- {
- }
- #endregion
-
- #endregion
- }
- }