Glatzemann 933ef7cae6 - extended ContentPipeline ProcessorManager with method to select a default processor for a importer or imported type
- extended ContentImporter to provide OutputType of imported content
- provided a list of available ContentProcessors in current context

PlatformSystems are no longer AddIns. This doesn't mean, that you can't load them dynamically. The handling is just different. There's only a single PlatformSystem available for each platform ANX runs on. This one is auto loaded. If it doesn't exist the game doesn't run. The reason for this is, that we will move the AddIn system from ANX.Framework to the specialized PlatformSystem. This is necessary because we want ANX.Framework to become platform independent. The AddIn system is different for some platforms (Android, iOS, Windows 8 Metro) and needs to be specialized. On the other hand we are able to simplify the AddIn system when moving it to the PlatformSystem because we don't need a big AddIn system supporting all platforms with much conditional compiling.

THIS COMMIT DOES BREAK SOME FUNCTIONALITY. METRO DOESN'T WORK ANYMORE, AS IT IS NOT TESTED. DON'T USE THIS COMMIT IF YOU ARE NO ANX.FRAMEWORK DEVELOPER. We will catch up soon with a tested and working version.
2015-03-15 01:10:54 +01:00

133 lines
3.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using ANX.Framework.Audio.XactParser;
using ANX.Framework.NonXNA;
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.Audio
{
[PercentageComplete(50)]
public class AudioEngine : IDisposable
{
#region Constants
public const int ContentVersion = 0x27;
#endregion
#region Private
private XactGeneralSettings generalSettings;
#endregion
#region Events
public event EventHandler<EventArgs> Disposing;
#endregion
#region Public
public bool IsDisposed
{
get;
private set;
}
public ReadOnlyCollection<RendererDetail> RendererDetails
{
get;
private set;
}
#endregion
#region Constructor (TODO)
public AudioEngine(string settingsFile)
{
// TODO: get renderer details
RendererDetails = new ReadOnlyCollection<RendererDetail>(new List<RendererDetail>());
Stream loadingStream = PlatformSystem.Instance.OpenReadFilestream(settingsFile);
generalSettings = new XactGeneralSettings(loadingStream);
loadingStream.Dispose();
}
public AudioEngine(string settingsFile, TimeSpan lookAheadTime, string rendererId)
{
// TODO: get renderer details
RendererDetails = new ReadOnlyCollection<RendererDetail>(new List<RendererDetail>());
// TODO: lookAheadTime and rendererId
Stream loadingStream = PlatformSystem.Instance.OpenReadFilestream(settingsFile);
generalSettings = new XactGeneralSettings(loadingStream);
loadingStream.Dispose();
}
~AudioEngine()
{
Dispose();
}
#endregion
#region GetCategory
public AudioCategory GetCategory(string name)
{
for (int index = 0; index < generalSettings.Categories.Length; index++)
if (generalSettings.Categories[index].Name == name)
return generalSettings.Categories[index];
return new AudioCategory(name);
}
#endregion
#region GetGlobalVariable
public float GetGlobalVariable(string name)
{
foreach (var variable in generalSettings.Variables)
if (variable.Name == name)
return variable.StartingValue;
return 0f;
}
#endregion
#region SetGlobalVariable
public void SetGlobalVariable(string name, float value)
{
foreach (var variable in generalSettings.Variables)
if (variable.Name == name)
variable.StartingValue = MathHelper.Clamp(value, variable.MinValue, variable.MaxValue);
}
#endregion
#region Update (TODO)
public void Update()
{
throw new NotImplementedException();
}
#endregion
#region Dispose
protected virtual void Dispose(bool disposing)
{
if (IsDisposed == false)
{
if (Disposing != null)
Disposing(this, EventArgs.Empty);
IsDisposed = true;
generalSettings = null;
}
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
#endregion
}
}