using System; using System.Collections.ObjectModel; using System.IO; using ANX.Framework.Audio; using ANX.Framework.NonXNA; using ANX.Framework.NonXNA.SoundSystem; using OpenTK.Audio.OpenAL; // 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.SoundSystem.OpenAL { public class Creator : ISoundSystemCreator { #region Public public string Name { get { return "Sound.OpenAL"; } } public int Priority { get { return 100; } } public bool IsSupported { get { PlatformName os = OSInformation.GetName(); return OSInformation.IsWindows || os == PlatformName.Linux || os == PlatformName.MacOSX; } } public float DistanceScale { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } public float DopplerScale { get { return AL.Get(ALGetFloat.DopplerFactor); } set { AL.DopplerFactor(value); } } public float MasterVolume { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } public float SpeedOfSound { get { return AL.Get(ALGetFloat.SpeedOfSound); } set { AL.SpeedOfSound(value); } } #endregion #region CreateSoundEffectInstance public ISoundEffectInstance CreateSoundEffectInstance(ISoundEffect nativeSoundEffect) { PreventSystemChange(); return new OpenALSoundEffectInstance(nativeSoundEffect as OpenALSoundEffect); } #endregion #region CreateSoundEffect public ISoundEffect CreateSoundEffect(SoundEffect parent, Stream stream) { PreventSystemChange(); return new OpenALSoundEffect(parent, stream); } #endregion #region CreateSoundEffect (TODO) public ISoundEffect CreateSoundEffect(SoundEffect parent, byte[] buffer, int offset, int count, int sampleRate, AudioChannels channels, int loopStart, int loopLength) { PreventSystemChange(); throw new NotImplementedException(); } #endregion #region CreateAudioListener public IAudioListener CreateAudioListener() { PreventSystemChange(); return new OpenALAudioListener(); } #endregion #region CreateAudioEmitter (TODO) public IAudioEmitter CreateAudioEmitter() { PreventSystemChange(); throw new NotImplementedException(); } #endregion #region CreateMicrophone public IMicrophone CreateMicrophone(Microphone managedMicrophone) { PreventSystemChange(); throw new NotImplementedException(); } #endregion #region GetAllMicrophones public ReadOnlyCollection GetAllMicrophones() { PreventSystemChange(); throw new NotImplementedException(); } #endregion #region GetDefaultMicrophone public int GetDefaultMicrophone(ReadOnlyCollection allMicrophones) { PreventSystemChange(); throw new NotImplementedException(); } #endregion private void PreventSystemChange() { AddInSystemFactory.Instance.PreventSystemChange(AddInType.SoundSystem); } } }