diff --git a/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_Linux.csproj b/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_Linux.csproj index 897a6cd2..6ba9bfcf 100644 --- a/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_Linux.csproj +++ b/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_Linux.csproj @@ -109,6 +109,8 @@ + + @@ -139,6 +141,7 @@ + diff --git a/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_PSVita.csproj b/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_PSVita.csproj index 317d83ce..481a8b68 100644 --- a/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_PSVita.csproj +++ b/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_PSVita.csproj @@ -109,6 +109,8 @@ + + @@ -139,6 +141,7 @@ + diff --git a/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_WindowsMetro.csproj b/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_WindowsMetro.csproj index c28edd93..3151a49f 100644 --- a/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_WindowsMetro.csproj +++ b/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_WindowsMetro.csproj @@ -111,6 +111,8 @@ + + @@ -141,6 +143,7 @@ + diff --git a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_Linux.csproj b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_Linux.csproj index 2fa1678e..7cc25394 100644 --- a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_Linux.csproj +++ b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_Linux.csproj @@ -59,9 +59,8 @@ - - False - E:\Entwicklung\NUnit\bin\net-2.0\framework\nunit.framework.dll + + ..\lib\NUnit-2.6.1\bin\nunit.framework.dll diff --git a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_PSVita.csproj b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_PSVita.csproj index ec88a57d..9c5f2312 100644 --- a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_PSVita.csproj +++ b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_PSVita.csproj @@ -59,9 +59,8 @@ - - False - E:\Entwicklung\NUnit\bin\net-2.0\framework\nunit.framework.dll + + ..\lib\NUnit-2.6.1\bin\nunit.framework.dll diff --git a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_WindowsMetro.csproj b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_WindowsMetro.csproj index 1b2847bd..57ba82b7 100644 --- a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_WindowsMetro.csproj +++ b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_WindowsMetro.csproj @@ -61,9 +61,8 @@ - - False - E:\Entwicklung\NUnit\bin\net-2.0\framework\nunit.framework.dll + + ..\lib\NUnit-2.6.1\bin\nunit.framework.dll diff --git a/ANX.Framework/ANX.Framework.csproj b/ANX.Framework/ANX.Framework.csproj index a818b4ad..b78c5115 100644 --- a/ANX.Framework/ANX.Framework.csproj +++ b/ANX.Framework/ANX.Framework.csproj @@ -432,6 +432,7 @@ + diff --git a/ANX.Framework/ANX.Framework_Linux.csproj b/ANX.Framework/ANX.Framework_Linux.csproj index f228f00e..a1d6199d 100644 --- a/ANX.Framework/ANX.Framework_Linux.csproj +++ b/ANX.Framework/ANX.Framework_Linux.csproj @@ -432,6 +432,7 @@ + diff --git a/ANX.Framework/ANX.Framework_PSVita.csproj b/ANX.Framework/ANX.Framework_PSVita.csproj index 400f9ee9..e413ec72 100644 --- a/ANX.Framework/ANX.Framework_PSVita.csproj +++ b/ANX.Framework/ANX.Framework_PSVita.csproj @@ -433,6 +433,7 @@ + diff --git a/ANX.Framework/ANX.Framework_WindowsMetro.csproj b/ANX.Framework/ANX.Framework_WindowsMetro.csproj index e4787cb7..f154a5ee 100644 --- a/ANX.Framework/ANX.Framework_WindowsMetro.csproj +++ b/ANX.Framework/ANX.Framework_WindowsMetro.csproj @@ -435,6 +435,7 @@ + diff --git a/ANX.Framework/Audio/AudioEmitter.cs b/ANX.Framework/Audio/AudioEmitter.cs index 67796bc4..494e8252 100644 --- a/ANX.Framework/Audio/AudioEmitter.cs +++ b/ANX.Framework/Audio/AudioEmitter.cs @@ -78,14 +78,8 @@ namespace ANX.Framework.Audio #region Constructor public AudioEmitter() { - nativeEmitter = GetCreator().CreateAudioEmitter(); - } - #endregion - - #region GetCreator - private static ISoundSystemCreator GetCreator() - { - return AddInSystemFactory.Instance.GetDefaultCreator(); + var creator = AddInSystemFactory.Instance.GetDefaultCreator(); + nativeEmitter = creator.CreateAudioEmitter(); } #endregion } diff --git a/ANX.Framework/Audio/AudioListener.cs b/ANX.Framework/Audio/AudioListener.cs index 4ecafcbb..deef2a1c 100644 --- a/ANX.Framework/Audio/AudioListener.cs +++ b/ANX.Framework/Audio/AudioListener.cs @@ -66,14 +66,8 @@ namespace ANX.Framework.Audio #region Constructor public AudioListener() { - nativeListener = GetCreator().CreateAudioListener(); - } - #endregion - - #region GetCreator - private static ISoundSystemCreator GetCreator() - { - return AddInSystemFactory.Instance.GetDefaultCreator(); + var creator = AddInSystemFactory.Instance.GetDefaultCreator(); + nativeListener = creator.CreateAudioListener(); } #endregion } diff --git a/ANX.Framework/Audio/Microphone.cs b/ANX.Framework/Audio/Microphone.cs index 83d00c7c..f6a6ada6 100644 --- a/ANX.Framework/Audio/Microphone.cs +++ b/ANX.Framework/Audio/Microphone.cs @@ -1,5 +1,7 @@ using System; using System.Collections.ObjectModel; +using ANX.Framework.NonXNA.SoundSystem; +using ANX.Framework.NonXNA; // This file is part of the ANX.Framework created by the // "ANX.Framework developer group" and released under the Ms-PL license. @@ -9,32 +11,45 @@ namespace ANX.Framework.Audio { public sealed class Microphone { + #region Private + private static int defaultMicrophone; + private static ReadOnlyCollection allMicrophones; + + private IMicrophone nativeMicrophone; + #endregion + #region Events public event EventHandler BufferReady; #endregion #region Public - public readonly string Name; - public static ReadOnlyCollection All { get { - throw new NotImplementedException(); + return allMicrophones; } } - public TimeSpan BufferDuration - { - get; - set; - } - public static Microphone Default { get { - throw new NotImplementedException(); + return allMicrophones[defaultMicrophone]; + } + } + + public readonly string Name; + + public TimeSpan BufferDuration + { + get + { + return nativeMicrophone.BufferDuration; + } + set + { + nativeMicrophone.BufferDuration = value; } } @@ -42,7 +57,7 @@ namespace ANX.Framework.Audio { get { - throw new NotImplementedException(); + return nativeMicrophone.IsHeadset; } } @@ -50,7 +65,7 @@ namespace ANX.Framework.Audio { get { - throw new NotImplementedException(); + return nativeMicrophone.SampleRate; } } @@ -58,57 +73,75 @@ namespace ANX.Framework.Audio { get { - throw new NotImplementedException(); + return nativeMicrophone.State; } } #endregion #region Constructor + static Microphone() + { + var creator = AddInSystemFactory.Instance.GetDefaultCreator(); + allMicrophones = creator.GetAllMicrophones(); + defaultMicrophone = creator.GetDefaultMicrophone(allMicrophones); + } + + internal Microphone(string setName) + { + Name = setName; + var creator = AddInSystemFactory.Instance.GetDefaultCreator(); + nativeMicrophone = creator.CreateMicrophone(this); + } + ~Microphone() { - throw new NotImplementedException(); + if (nativeMicrophone != null) + { + nativeMicrophone.Dispose(); + nativeMicrophone = null; + } } #endregion #region Stop public void Stop() { - throw new NotImplementedException(); + nativeMicrophone.Stop(); } #endregion #region Start public void Start() { - throw new NotImplementedException(); + nativeMicrophone.Start(); } #endregion #region GetSampleSizeInBytes public int GetSampleSizeInBytes(TimeSpan duration) { - throw new NotImplementedException(); + return nativeMicrophone.GetSampleSizeInBytes(ref duration); } #endregion #region GetSampleDuration public TimeSpan GetSampleDuration(int sizeInBytes) { - throw new NotImplementedException(); + return nativeMicrophone.GetSampleDuration(sizeInBytes); } #endregion #region GetData public int GetData(byte[] buffer) { - throw new NotImplementedException(); + return nativeMicrophone.GetData(buffer); } #endregion #region GetData public int GetData(byte[] buffer, int offset, int count) { - throw new NotImplementedException(); + return nativeMicrophone.GetData(buffer, offset, count); } #endregion } diff --git a/ANX.Framework/NonXNA/SoundSystem/IMicrophone.cs b/ANX.Framework/NonXNA/SoundSystem/IMicrophone.cs new file mode 100644 index 00000000..b76ad764 --- /dev/null +++ b/ANX.Framework/NonXNA/SoundSystem/IMicrophone.cs @@ -0,0 +1,26 @@ +using System; +using ANX.Framework.Audio; + +// 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.NonXNA.SoundSystem +{ + public interface IMicrophone : IDisposable + { + MicrophoneState State { get; } + int SampleRate { get; } + bool IsHeadset { get; } + TimeSpan BufferDuration { get; set; } + + void Stop(); + void Start(); + + int GetSampleSizeInBytes(ref TimeSpan duration); + TimeSpan GetSampleDuration(int sizeInBytes); + + int GetData(byte[] buffer); + int GetData(byte[] buffer, int offset, int count); + } +} diff --git a/ANX.Framework/NonXNA/SoundSystem/ISoundSystemCreator.cs b/ANX.Framework/NonXNA/SoundSystem/ISoundSystemCreator.cs index 7a228968..dd1494cc 100644 --- a/ANX.Framework/NonXNA/SoundSystem/ISoundSystemCreator.cs +++ b/ANX.Framework/NonXNA/SoundSystem/ISoundSystemCreator.cs @@ -1,6 +1,7 @@ using System.IO; using ANX.Framework.Audio; using ANX.Framework.NonXNA.SoundSystem; +using System.Collections.ObjectModel; // This file is part of the ANX.Framework created by the // "ANX.Framework developer group" and released under the Ms-PL license. @@ -45,5 +46,11 @@ namespace ANX.Framework.NonXNA int loopLength); ISoundEffectInstance CreateSoundEffectInstance(ISoundEffect nativeSoundEffect); + + IMicrophone CreateMicrophone(Microphone managedMicrophone); + + ReadOnlyCollection GetAllMicrophones(); + + int GetDefaultMicrophone(ReadOnlyCollection allMicrophones); } } diff --git a/ANX.Framework/PlayerIndex.cs b/ANX.Framework/PlayerIndex.cs index 886b88d0..11a68de7 100644 --- a/ANX.Framework/PlayerIndex.cs +++ b/ANX.Framework/PlayerIndex.cs @@ -6,9 +6,9 @@ namespace ANX.Framework { public enum PlayerIndex { - One, - Two, - Three, - Four, + One = 0, + Two = 1, + Three = 2, + Four = 3, } } diff --git a/ANX.Framework_Linux.sln b/ANX.Framework_Linux.sln index 7d9bc7f2..81408570 100644 --- a/ANX.Framework_Linux.sln +++ b/ANX.Framework_Linux.sln @@ -31,8 +31,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SoundSystems", "SoundSystem EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.SoundSystem.Windows.XAudio", "SoundSystems\ANX.SoundSystem.Windows.XAudio\ANX.SoundSystem.Windows.XAudio_Linux.csproj", "{6A582788-C4D2-410C-96CD-177F75712D65}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xinput", "Samples\Xinput\Xinput_Linux.csproj", "{45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsGame", "Samples\WindowsGame\WindowsGame_Linux.csproj", "{A08575E0-7B21-4822-9D4C-6B9EEB7EFFF7}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectConverter", "Tools\ProjectConverter\ProjectConverter.csproj", "{B5209A04-B2F8-4033-A5E7-545BE771214C}" @@ -283,17 +281,6 @@ Global {6A582788-C4D2-410C-96CD-177F75712D65}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {6A582788-C4D2-410C-96CD-177F75712D65}.Release|Mixed Platforms.Build.0 = Release|Any CPU {6A582788-C4D2-410C-96CD-177F75712D65}.Release|x86.ActiveCfg = Release|Any CPU - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Debug|Any CPU.ActiveCfg = Debug|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Debug|Any CPU.Build.0 = Debug|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Debug|x86.ActiveCfg = Debug|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Debug|x86.Build.0 = Debug|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Release|Any CPU.ActiveCfg = Release|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Release|Mixed Platforms.Build.0 = Release|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Release|x86.ActiveCfg = Release|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Release|x86.Build.0 = Release|x86 {A08575E0-7B21-4822-9D4C-6B9EEB7EFFF7}.Debug|Any CPU.ActiveCfg = Debug|x86 {A08575E0-7B21-4822-9D4C-6B9EEB7EFFF7}.Debug|Any CPU.Build.0 = Debug|x86 {A08575E0-7B21-4822-9D4C-6B9EEB7EFFF7}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 @@ -715,7 +702,6 @@ Global {AAA20E99-A897-4C91-A23E-D02B8F08ACA5} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {BC79B021-10E4-4D01-945A-7048FFF53A22} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {FA6E229D-4504-47B1-8A23-2D3FCC13F778} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {A08575E0-7B21-4822-9D4C-6B9EEB7EFFF7} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {A42413A9-5189-40CB-AACA-D50F24865431} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {05233BB1-444F-43F6-A3DF-B82AA924E094} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} diff --git a/ANX.Framework_PSVita.sln b/ANX.Framework_PSVita.sln index aec59ffa..4fbbc1d2 100644 --- a/ANX.Framework_PSVita.sln +++ b/ANX.Framework_PSVita.sln @@ -31,8 +31,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SoundSystems", "SoundSystem EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.SoundSystem.Windows.XAudio", "SoundSystems\ANX.SoundSystem.Windows.XAudio\ANX.SoundSystem.Windows.XAudio_PSVita.csproj", "{6A582788-C4D2-410C-96CD-177F75712D65}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xinput", "Samples\Xinput\Xinput_PSVita.csproj", "{45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsGame", "Samples\WindowsGame\WindowsGame_PSVita.csproj", "{A08575E0-7B21-4822-9D4C-6B9EEB7EFFF7}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectConverter", "Tools\ProjectConverter\ProjectConverter.csproj", "{B5209A04-B2F8-4033-A5E7-545BE771214C}" @@ -283,17 +281,6 @@ Global {6A582788-C4D2-410C-96CD-177F75712D65}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {6A582788-C4D2-410C-96CD-177F75712D65}.Release|Mixed Platforms.Build.0 = Release|Any CPU {6A582788-C4D2-410C-96CD-177F75712D65}.Release|x86.ActiveCfg = Release|Any CPU - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Debug|Any CPU.ActiveCfg = Debug|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Debug|Any CPU.Build.0 = Debug|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Debug|x86.ActiveCfg = Debug|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Debug|x86.Build.0 = Debug|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Release|Any CPU.ActiveCfg = Release|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Release|Mixed Platforms.Build.0 = Release|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Release|x86.ActiveCfg = Release|x86 - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F}.Release|x86.Build.0 = Release|x86 {A08575E0-7B21-4822-9D4C-6B9EEB7EFFF7}.Debug|Any CPU.ActiveCfg = Debug|x86 {A08575E0-7B21-4822-9D4C-6B9EEB7EFFF7}.Debug|Any CPU.Build.0 = Debug|x86 {A08575E0-7B21-4822-9D4C-6B9EEB7EFFF7}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 @@ -715,7 +702,6 @@ Global {AAA20E99-A897-4C91-A23E-D02B8F08ACA5} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {BC79B021-10E4-4D01-945A-7048FFF53A22} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {FA6E229D-4504-47B1-8A23-2D3FCC13F778} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} - {45D6F4DE-5BB6-4E86-8C44-F9CA307AE43F} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {A08575E0-7B21-4822-9D4C-6B9EEB7EFFF7} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {A42413A9-5189-40CB-AACA-D50F24865431} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {05233BB1-444F-43F6-A3DF-B82AA924E094} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} diff --git a/SoundSystems/ANX.SoundSystem.OpenAL/Creator.cs b/SoundSystems/ANX.SoundSystem.OpenAL/Creator.cs index a83dcb09..fc8d6696 100644 --- a/SoundSystems/ANX.SoundSystem.OpenAL/Creator.cs +++ b/SoundSystems/ANX.SoundSystem.OpenAL/Creator.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.ObjectModel; using System.IO; using ANX.Framework.Audio; using ANX.Framework.NonXNA; @@ -152,5 +153,26 @@ namespace ANX.SoundSystem.OpenAL throw new NotImplementedException(); } #endregion + + #region CreateMicrophone + public IMicrophone CreateMicrophone(Microphone managedMicrophone) + { + throw new NotImplementedException(); + } + #endregion + + #region GetAllMicrophones + public ReadOnlyCollection GetAllMicrophones() + { + throw new NotImplementedException(); + } + #endregion + + #region GetDefaultMicrophone + public int GetDefaultMicrophone(ReadOnlyCollection allMicrophones) + { + throw new NotImplementedException(); + } + #endregion } } diff --git a/SoundSystems/ANX.SoundSystem.Windows.XAudio/Creator.cs b/SoundSystems/ANX.SoundSystem.Windows.XAudio/Creator.cs index ebbf87ce..28a33251 100644 --- a/SoundSystems/ANX.SoundSystem.Windows.XAudio/Creator.cs +++ b/SoundSystems/ANX.SoundSystem.Windows.XAudio/Creator.cs @@ -122,5 +122,25 @@ namespace ANX.SoundSystem.Windows.XAudio } #endregion + + #region ISoundSystemCreator Member + + + public IMicrophone CreateMicrophone(Microphone managedMicrophone) + { + throw new NotImplementedException(); + } + + public System.Collections.ObjectModel.ReadOnlyCollection GetAllMicrophones() + { + throw new NotImplementedException(); + } + + public int GetDefaultMicrophone(System.Collections.ObjectModel.ReadOnlyCollection allMicrophones) + { + throw new NotImplementedException(); + } + + #endregion } }