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 83e70c36..af1f193d 100644 --- a/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_Linux.csproj +++ b/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_Linux.csproj @@ -36,6 +36,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 cc29aa64..0b2064cb 100644 --- a/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_PSVita.csproj +++ b/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_PSVita.csproj @@ -36,6 +36,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 0c973d6b..55c0f85a 100644 --- a/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_WindowsMetro.csproj +++ b/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_WindowsMetro.csproj @@ -19,7 +19,7 @@ true full false - bin\Debug\ + bin\Debug\ModernUI TRACE;DEBUG;WINDOWSMETRO; prompt 4 @@ -28,7 +28,7 @@ pdbonly true - bin\Release\ + bin\Release\ModernUI TRACE;WINDOWSMETRO; prompt 4 @@ -38,6 +38,7 @@ + diff --git a/ANX.Framework.ContentPipeline/ANX.Framework.ContentPipeline.Extensions_WindowsMetro.csproj b/ANX.Framework.ContentPipeline/ANX.Framework.ContentPipeline.Extensions_WindowsMetro.csproj index 914f2e32..14d01d18 100644 --- a/ANX.Framework.ContentPipeline/ANX.Framework.ContentPipeline.Extensions_WindowsMetro.csproj +++ b/ANX.Framework.ContentPipeline/ANX.Framework.ContentPipeline.Extensions_WindowsMetro.csproj @@ -17,7 +17,7 @@ true full false - ..\bin\Debug\ + ..\bin\Debug\ModernUI XNAEXT;DEBUG;TRACE;WINDOWSMETRO; prompt 4 @@ -26,7 +26,7 @@ pdbonly true - ..\bin\Release\ + ..\bin\Release\ModernUI XNAEXT;TRACE;WINDOWSMETRO; prompt 4 diff --git a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_Linux.csproj b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_Linux.csproj index 0dc61df7..6d5bde0f 100644 --- a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_Linux.csproj +++ b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_Linux.csproj @@ -62,6 +62,7 @@ + diff --git a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_PSVita.csproj b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_PSVita.csproj index 7b9a6ca3..78fda1c3 100644 --- a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_PSVita.csproj +++ b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_PSVita.csproj @@ -63,6 +63,7 @@ + diff --git a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_WindowsMetro.csproj b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_WindowsMetro.csproj index b1c019fd..35b23ef0 100644 --- a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_WindowsMetro.csproj +++ b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_WindowsMetro.csproj @@ -19,7 +19,7 @@ true full false - ..\bin\Debug\ + ..\bin\Debug\ModernUI TRACE;DEBUG;WINDOWSMETRO; prompt 4 @@ -28,7 +28,7 @@ pdbonly true - ..\bin\Release\ + ..\bin\Release\ModernUI TRACE;WINDOWSMETRO; prompt 4 @@ -64,6 +64,7 @@ + @@ -131,10 +132,6 @@ {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35} ANX.Framework - - {60D08399-244F-46A3-91F1-4CFD26D961A3} - ANX.InputDevices.Windows.XInput - {49066074-3B7B-4A55-B122-6BD33AB73558} ANX.InputSystem.Standard diff --git a/ANX.Framework.sln b/ANX.Framework.sln index c7304283..50486112 100644 --- a/ANX.Framework.sln +++ b/ANX.Framework.sln @@ -197,6 +197,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.InputDevices.Windows.Mo EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OnlineStatusGenerator", "Tools\OnlineStatusGenerator\OnlineStatusGenerator.csproj", "{6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OggUtils", "Support\OggUtils\OggUtils.csproj", "{ABECEC14-6BF4-4432-833C-69714EB4E8E6}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleNoContent", "Samples\SimpleNoContent\SimpleNoContent.csproj", "{AA3DF4D7-F072-47B5-B88C-20140B5F704A}" EndProject Global @@ -998,6 +1000,20 @@ Global {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|x64.ActiveCfg = Release|x86 {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|x86.ActiveCfg = Release|x86 {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|x86.Build.0 = Release|x86 + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|ARM.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|x64.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|x86.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|Any CPU.Build.0 = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|ARM.ActiveCfg = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|x64.ActiveCfg = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|x86.ActiveCfg = Release|Any CPU {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|Any CPU.Build.0 = Debug|Any CPU {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -1073,6 +1089,7 @@ Global {2B6D0EFF-7874-495F-9226-873ED9649C60} = {1436F7C9-29D3-4FEF-8914-10B45F13D142} {2CF3FE4D-586E-4B07-8BF0-1E84B670F0AD} = {1436F7C9-29D3-4FEF-8914-10B45F13D142} {1986B0ED-3D28-4FEE-82D0-BCC39C87C18C} = {3E29A6C6-9487-46A7-A161-D8DB84514933} + {ABECEC14-6BF4-4432-833C-69714EB4E8E6} = {3E29A6C6-9487-46A7-A161-D8DB84514933} EndGlobalSection GlobalSection(SubversionScc) = preSolution Svn-Managed = True diff --git a/ANX.Framework/ANX.Framework.csproj b/ANX.Framework/ANX.Framework.csproj index c33deda5..74a11c0b 100644 --- a/ANX.Framework/ANX.Framework.csproj +++ b/ANX.Framework/ANX.Framework.csproj @@ -98,6 +98,7 @@ + diff --git a/ANX.Framework/ANX.Framework_Linux.csproj b/ANX.Framework/ANX.Framework_Linux.csproj index d722cdfd..c107ea52 100644 --- a/ANX.Framework/ANX.Framework_Linux.csproj +++ b/ANX.Framework/ANX.Framework_Linux.csproj @@ -98,6 +98,7 @@ + @@ -445,7 +446,9 @@ + + diff --git a/ANX.Framework/ANX.Framework_PSVita.csproj b/ANX.Framework/ANX.Framework_PSVita.csproj index 95e7c57d..e03ef844 100644 --- a/ANX.Framework/ANX.Framework_PSVita.csproj +++ b/ANX.Framework/ANX.Framework_PSVita.csproj @@ -100,6 +100,7 @@ + @@ -447,7 +448,9 @@ + + diff --git a/ANX.Framework/ANX.Framework_WindowsMetro.csproj b/ANX.Framework/ANX.Framework_WindowsMetro.csproj index 895552f8..9aaf8807 100644 --- a/ANX.Framework/ANX.Framework_WindowsMetro.csproj +++ b/ANX.Framework/ANX.Framework_WindowsMetro.csproj @@ -101,6 +101,7 @@ + diff --git a/ANX.Framework/Content/ContentManager.cs b/ANX.Framework/Content/ContentManager.cs index b6dc7348..bfa9ed37 100644 --- a/ANX.Framework/Content/ContentManager.cs +++ b/ANX.Framework/Content/ContentManager.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using ANX.Framework.NonXNA; using ANX.Framework.NonXNA.PlatformSystem; // This file is part of the ANX.Framework created by the diff --git a/ANX.Framework/Content/ContentReader.cs b/ANX.Framework/Content/ContentReader.cs index ce64d37d..1b535369 100644 --- a/ANX.Framework/Content/ContentReader.cs +++ b/ANX.Framework/Content/ContentReader.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Reflection; using ANX.Framework.Graphics; using ANX.Framework.NonXNA.Reflection; @@ -463,5 +464,27 @@ namespace ANX.Framework.Content } return device; } + + internal string GetAbsolutePathToReference(string referenceName) + { + referenceName = GetPathToReference(referenceName); + referenceName = Path.Combine(ContentManager.RootDirectory, referenceName); + + Assembly assembly = Assembly.GetEntryAssembly(); + if (assembly == null) + assembly = Assembly.GetCallingAssembly(); + string titleLocationPath = Path.GetDirectoryName(assembly.Location); + referenceName = Path.Combine(titleLocationPath, referenceName); + return TitleContainer.GetCleanPath(referenceName); + } + + private string GetPathToReference(string referenceName) + { + int num = AssetName.LastIndexOfAny(new[] { '\\', '/', Path.DirectorySeparatorChar }); + string path = ""; + if (num != -1) + path = AssetName.Substring(0, num); + return Path.Combine(path, referenceName); + } } } diff --git a/ANX.Framework/Content/MediaTypeReaders/SongReader.cs b/ANX.Framework/Content/MediaTypeReaders/SongReader.cs new file mode 100644 index 00000000..094f6f95 --- /dev/null +++ b/ANX.Framework/Content/MediaTypeReaders/SongReader.cs @@ -0,0 +1,23 @@ +using ANX.Framework.Media; +using ANX.Framework.NonXNA.Development; + +// 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.Content +{ + [PercentageComplete(100)] + [Developer("AstrorEnales")] + [TestState(TestStateAttribute.TestState.Untested)] + internal class SongReader : ContentTypeReader + { + protected internal override Song Read(ContentReader input, Song existingInstance) + { + string text = input.ReadString(); + text = input.GetAbsolutePathToReference(text); + int duration = input.ReadObject(); + return new Song(input.AssetName, text, duration); + } + } +} diff --git a/ANX.Framework/Content/MediaTypeReaders/SoundEffectReader.cs b/ANX.Framework/Content/MediaTypeReaders/SoundEffectReader.cs index 928f456d..24053a86 100644 --- a/ANX.Framework/Content/MediaTypeReaders/SoundEffectReader.cs +++ b/ANX.Framework/Content/MediaTypeReaders/SoundEffectReader.cs @@ -2,9 +2,17 @@ using System.IO; using System.Runtime.InteropServices; using ANX.Framework.Audio; +using ANX.Framework.NonXNA.Development; + +// 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.Content { + [PercentageComplete(100)] + [Developer("AstrorEnales")] + [TestState(TestStateAttribute.TestState.InProgress)] internal class SoundEffectReader : ContentTypeReader { private struct WaveFormatEx diff --git a/ANX.Framework/Media/MediaLibrary.cs b/ANX.Framework/Media/MediaLibrary.cs index 6de353bc..d614414b 100644 --- a/ANX.Framework/Media/MediaLibrary.cs +++ b/ANX.Framework/Media/MediaLibrary.cs @@ -1,5 +1,6 @@ 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 @@ -8,6 +9,9 @@ using ANX.Framework.NonXNA.PlatformSystem; namespace ANX.Framework.Media { + [PercentageComplete(100)] + [Developer("AstrorEnales")] + [TestState(TestStateAttribute.TestState.Untested)] public sealed class MediaLibrary : IDisposable { private INativeMediaLibrary nativeLibrary; diff --git a/ANX.Framework/Media/MediaPlayer.cs b/ANX.Framework/Media/MediaPlayer.cs index faf4a937..b6e92fc8 100644 --- a/ANX.Framework/Media/MediaPlayer.cs +++ b/ANX.Framework/Media/MediaPlayer.cs @@ -8,8 +8,8 @@ using ANX.Framework.NonXNA.Development; namespace ANX.Framework.Media { [PercentageComplete(100)] - [TestState(TestStateAttribute.TestState.Untested)] [Developer("AstrorEnales")] + [TestState(TestStateAttribute.TestState.Untested)] public static class MediaPlayer { #region Events @@ -61,7 +61,8 @@ namespace ANX.Framework.Media return; currentState = value; - MediaStateChanged(null, EventArgs.Empty); + if (MediaStateChanged != null) + MediaStateChanged(null, EventArgs.Empty); } } @@ -157,6 +158,8 @@ namespace ANX.Framework.Media return; } + Queue.ActiveSong.NativeSong.Update(); + State = Queue.ActiveSong.State; if (Queue.ActiveSong.State != MediaState.Stopped) return; @@ -164,7 +167,8 @@ namespace ANX.Framework.Media if (Queue.MoveNext(isRepeating)) State = MediaState.Playing; - ActiveSongChanged(null, EventArgs.Empty); + if (ActiveSongChanged != null) + ActiveSongChanged(null, EventArgs.Empty); } #endregion diff --git a/ANX.Framework/Media/MediaQueue.cs b/ANX.Framework/Media/MediaQueue.cs index 28e23d50..31b166f6 100644 --- a/ANX.Framework/Media/MediaQueue.cs +++ b/ANX.Framework/Media/MediaQueue.cs @@ -144,7 +144,7 @@ namespace ANX.Framework.Media } #region MoveNext - internal bool MoveNext(bool stopIfEnded) + internal bool MoveNext(bool isRepeating) { if (Count <= 0) return false; @@ -156,7 +156,7 @@ namespace ANX.Framework.Media else { ActiveSongIndex = 0; - if (stopIfEnded) + if (isRepeating == false) return false; } diff --git a/ANX.Framework/Media/Song.cs b/ANX.Framework/Media/Song.cs index 99ca374c..534fb66b 100644 --- a/ANX.Framework/Media/Song.cs +++ b/ANX.Framework/Media/Song.cs @@ -89,12 +89,21 @@ namespace ANX.Framework.Media #region Constructor internal Song(string setName, Uri uri) - { - NativeSong = AddInSystemFactory.Instance.GetDefaultCreator().CreateSong(this, uri); + { + var creator = AddInSystemFactory.Instance.GetDefaultCreator(); + NativeSong = creator.CreateSong(this, uri); Name = setName; IsDisposed = false; } + internal Song(string setName, string filename, int duration) + { + var creator = AddInSystemFactory.Instance.GetDefaultCreator(); + NativeSong = creator.CreateSong(this, filename, duration); + Name = setName; + IsDisposed = false; + } + ~Song() { Dispose(); @@ -108,15 +117,15 @@ namespace ANX.Framework.Media public bool Equals(Song other) { - throw new NotImplementedException(); + return other != null && Name == other.Name; } public override bool Equals(object obj) { - if (obj is Song) - return Equals(obj as Song); + if (ReferenceEquals(this, obj) == false) + return Equals((Song)obj); - return base.Equals(obj); + return base.Equals(obj); } public void Dispose() @@ -167,13 +176,13 @@ namespace ANX.Framework.Media #region Operator overloading public static bool operator ==(Song first, Song second) - { - return first != null && first.Equals(second); + { + return object.Equals(first, second); } public static bool operator !=(Song first, Song second) - { - return first == null || first.Equals(second) == false; + { + return !(first == second); } #endregion } diff --git a/ANX.Framework/NonXNA/SoundSystem/ISoundSystemCreator.cs b/ANX.Framework/NonXNA/SoundSystem/ISoundSystemCreator.cs index df710dad..47ff7210 100644 --- a/ANX.Framework/NonXNA/SoundSystem/ISoundSystemCreator.cs +++ b/ANX.Framework/NonXNA/SoundSystem/ISoundSystemCreator.cs @@ -36,6 +36,7 @@ namespace ANX.Framework.NonXNA.SoundSystem int GetDefaultMicrophone(ReadOnlyCollection allMicrophones); ISong CreateSong(Song parentSong, Uri uri); + ISong CreateSong(Song parentSong, string filepath, int duration); IDynamicSoundEffectInstance CreateDynamicSoundEffectInstance(); } diff --git a/ANX.Framework_Linux.sln b/ANX.Framework_Linux.sln index c2034465..949ebd2e 100644 --- a/ANX.Framework_Linux.sln +++ b/ANX.Framework_Linux.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2010 +# Visual Studio 2012 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.Framework", "ANX.Framework\ANX.Framework_Linux.csproj", "{6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.Framework.TestCenter", "ANX.Framework.TestCenter\ANX.Framework.TestCenter_Linux.csproj", "{7344BBEB-A1C7-43A8-B68E-D42B81973DA9}" @@ -195,6 +195,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.RenderSystem.Windows.DX EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.InputDevices.Windows.ModernUI", "InputSystems\ANX.InputDevices.Windows.ModernUI\ANX.InputDevices.Windows.ModernUI_Linux.csproj", "{628AB80A-B1B9-4878-A810-7A58D4840F60}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OnlineStatusGenerator", "Tools\OnlineStatusGenerator\OnlineStatusGenerator.csproj", "{6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OggUtils", "Support\OggUtils\OggUtils_Linux.csproj", "{ABECEC14-6BF4-4432-833C-69714EB4E8E6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleNoContent", "Samples\SimpleNoContent\SimpleNoContent_Linux.csproj", "{AA3DF4D7-F072-47B5-B88C-20140B5F704A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -980,6 +986,48 @@ Global {628AB80A-B1B9-4878-A810-7A58D4840F60}.Release|x64.Build.0 = Release|x64 {628AB80A-B1B9-4878-A810-7A58D4840F60}.Release|x86.ActiveCfg = Release|x86 {628AB80A-B1B9-4878-A810-7A58D4840F60}.Release|x86.Build.0 = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|Any CPU.ActiveCfg = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|ARM.ActiveCfg = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|x64.ActiveCfg = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|x86.ActiveCfg = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|x86.Build.0 = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|Any CPU.ActiveCfg = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|ARM.ActiveCfg = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|Mixed Platforms.Build.0 = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|x64.ActiveCfg = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|x86.ActiveCfg = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|x86.Build.0 = Release|x86 + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|ARM.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|x64.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|x86.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|Any CPU.Build.0 = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|ARM.ActiveCfg = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|x64.ActiveCfg = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|x86.ActiveCfg = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|ARM.ActiveCfg = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|x64.ActiveCfg = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|x86.ActiveCfg = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|Any CPU.Build.0 = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|ARM.ActiveCfg = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|x64.ActiveCfg = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -995,6 +1043,7 @@ Global {938D5F88-B888-4B04-BEEE-EE701FBA51EF} = {B24A8593-562A-4A25-BB08-46C163F10F3F} {14B39F89-C9B0-407E-877A-B515C985E96E} = {B24A8593-562A-4A25-BB08-46C163F10F3F} {45DD7B40-C498-4DD2-A16B-FD6C4E6991B3} = {B24A8593-562A-4A25-BB08-46C163F10F3F} + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01} = {B24A8593-562A-4A25-BB08-46C163F10F3F} {B30DE9C2-0926-46B6-8351-9AF276C472D5} = {D421509A-9AE3-4D7E-881B-EAFED598B028} {FF0AB665-2796-4354-9630-76C2751DB3C2} = {D421509A-9AE3-4D7E-881B-EAFED598B028} {2B71A7C2-0D18-4E3D-AE5A-320641D1162A} = {D421509A-9AE3-4D7E-881B-EAFED598B028} @@ -1018,6 +1067,7 @@ Global {4A048A8C-C31D-4FC8-AAF3-C387B9E0309B} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {9259CC4E-AE6B-403C-8FAB-2408448C3935} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {D810F12D-6CE9-4755-AC6A-5DFEC7D1C782} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} + {AA3DF4D7-F072-47B5-B88C-20140B5F704A} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {DB88DDEB-7281-405D-8FCA-5681B6B2BD7A} = {7AD65E6B-2A48-437F-81D9-4CA9C9A85C64} {49066074-3B7B-4A55-B122-6BD33AB73558} = {7AD65E6B-2A48-437F-81D9-4CA9C9A85C64} {60D08399-244F-46A3-91F1-4CFD26D961A3} = {7AD65E6B-2A48-437F-81D9-4CA9C9A85C64} @@ -1039,6 +1089,7 @@ Global {2B6D0EFF-7874-495F-9226-873ED9649C60} = {1436F7C9-29D3-4FEF-8914-10B45F13D142} {2CF3FE4D-586E-4B07-8BF0-1E84B670F0AD} = {1436F7C9-29D3-4FEF-8914-10B45F13D142} {1986B0ED-3D28-4FEE-82D0-BCC39C87C18C} = {3E29A6C6-9487-46A7-A161-D8DB84514933} + {ABECEC14-6BF4-4432-833C-69714EB4E8E6} = {3E29A6C6-9487-46A7-A161-D8DB84514933} EndGlobalSection GlobalSection(SubversionScc) = preSolution Svn-Managed = True diff --git a/ANX.Framework_PSVita.sln b/ANX.Framework_PSVita.sln index e96ff06e..bc5b9e57 100644 --- a/ANX.Framework_PSVita.sln +++ b/ANX.Framework_PSVita.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2010 +# Visual Studio 2012 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.Framework", "ANX.Framework\ANX.Framework_PSVita.csproj", "{6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.Framework.TestCenter", "ANX.Framework.TestCenter\ANX.Framework.TestCenter_PSVita.csproj", "{7344BBEB-A1C7-43A8-B68E-D42B81973DA9}" @@ -195,6 +195,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.RenderSystem.Windows.DX EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.InputDevices.Windows.ModernUI", "InputSystems\ANX.InputDevices.Windows.ModernUI\ANX.InputDevices.Windows.ModernUI_PSVita.csproj", "{628AB80A-B1B9-4878-A810-7A58D4840F60}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OnlineStatusGenerator", "Tools\OnlineStatusGenerator\OnlineStatusGenerator.csproj", "{6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OggUtils", "Support\OggUtils\OggUtils_PSVita.csproj", "{ABECEC14-6BF4-4432-833C-69714EB4E8E6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleNoContent", "Samples\SimpleNoContent\SimpleNoContent_PSVita.csproj", "{AA3DF4D7-F072-47B5-B88C-20140B5F704A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -980,6 +986,48 @@ Global {628AB80A-B1B9-4878-A810-7A58D4840F60}.Release|x64.Build.0 = Release|x64 {628AB80A-B1B9-4878-A810-7A58D4840F60}.Release|x86.ActiveCfg = Release|x86 {628AB80A-B1B9-4878-A810-7A58D4840F60}.Release|x86.Build.0 = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|Any CPU.ActiveCfg = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|ARM.ActiveCfg = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|x64.ActiveCfg = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|x86.ActiveCfg = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|x86.Build.0 = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|Any CPU.ActiveCfg = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|ARM.ActiveCfg = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|Mixed Platforms.Build.0 = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|x64.ActiveCfg = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|x86.ActiveCfg = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|x86.Build.0 = Release|x86 + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|ARM.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|x64.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|x86.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|Any CPU.Build.0 = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|ARM.ActiveCfg = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|x64.ActiveCfg = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|x86.ActiveCfg = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|ARM.ActiveCfg = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|x64.ActiveCfg = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|x86.ActiveCfg = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|Any CPU.Build.0 = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|ARM.ActiveCfg = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|x64.ActiveCfg = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -995,6 +1043,7 @@ Global {938D5F88-B888-4B04-BEEE-EE701FBA51EF} = {B24A8593-562A-4A25-BB08-46C163F10F3F} {14B39F89-C9B0-407E-877A-B515C985E96E} = {B24A8593-562A-4A25-BB08-46C163F10F3F} {45DD7B40-C498-4DD2-A16B-FD6C4E6991B3} = {B24A8593-562A-4A25-BB08-46C163F10F3F} + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01} = {B24A8593-562A-4A25-BB08-46C163F10F3F} {B30DE9C2-0926-46B6-8351-9AF276C472D5} = {D421509A-9AE3-4D7E-881B-EAFED598B028} {FF0AB665-2796-4354-9630-76C2751DB3C2} = {D421509A-9AE3-4D7E-881B-EAFED598B028} {2B71A7C2-0D18-4E3D-AE5A-320641D1162A} = {D421509A-9AE3-4D7E-881B-EAFED598B028} @@ -1018,6 +1067,7 @@ Global {4A048A8C-C31D-4FC8-AAF3-C387B9E0309B} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {9259CC4E-AE6B-403C-8FAB-2408448C3935} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {D810F12D-6CE9-4755-AC6A-5DFEC7D1C782} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} + {AA3DF4D7-F072-47B5-B88C-20140B5F704A} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {DB88DDEB-7281-405D-8FCA-5681B6B2BD7A} = {7AD65E6B-2A48-437F-81D9-4CA9C9A85C64} {49066074-3B7B-4A55-B122-6BD33AB73558} = {7AD65E6B-2A48-437F-81D9-4CA9C9A85C64} {60D08399-244F-46A3-91F1-4CFD26D961A3} = {7AD65E6B-2A48-437F-81D9-4CA9C9A85C64} @@ -1039,6 +1089,7 @@ Global {2B6D0EFF-7874-495F-9226-873ED9649C60} = {1436F7C9-29D3-4FEF-8914-10B45F13D142} {2CF3FE4D-586E-4B07-8BF0-1E84B670F0AD} = {1436F7C9-29D3-4FEF-8914-10B45F13D142} {1986B0ED-3D28-4FEE-82D0-BCC39C87C18C} = {3E29A6C6-9487-46A7-A161-D8DB84514933} + {ABECEC14-6BF4-4432-833C-69714EB4E8E6} = {3E29A6C6-9487-46A7-A161-D8DB84514933} EndGlobalSection GlobalSection(SubversionScc) = preSolution Svn-Managed = True diff --git a/ANX.Framework_WindowsMetro.sln b/ANX.Framework_WindowsMetro.sln index d6f50888..de35c027 100644 --- a/ANX.Framework_WindowsMetro.sln +++ b/ANX.Framework_WindowsMetro.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2010 +# Visual Studio 2012 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.Framework", "ANX.Framework\ANX.Framework_WindowsMetro.csproj", "{6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.Framework.TestCenter", "ANX.Framework.TestCenter\ANX.Framework.TestCenter_WindowsMetro.csproj", "{7344BBEB-A1C7-43A8-B68E-D42B81973DA9}" @@ -195,6 +195,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.RenderSystem.Windows.DX EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ANX.InputDevices.Windows.ModernUI", "InputSystems\ANX.InputDevices.Windows.ModernUI\ANX.InputDevices.Windows.ModernUI_WindowsMetro.csproj", "{628AB80A-B1B9-4878-A810-7A58D4840F60}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OnlineStatusGenerator", "Tools\OnlineStatusGenerator\OnlineStatusGenerator.csproj", "{6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OggUtils", "Support\OggUtils\OggUtils_WindowsMetro.csproj", "{ABECEC14-6BF4-4432-833C-69714EB4E8E6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleNoContent", "Samples\SimpleNoContent\SimpleNoContent_WindowsMetro.csproj", "{AA3DF4D7-F072-47B5-B88C-20140B5F704A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -980,6 +986,48 @@ Global {628AB80A-B1B9-4878-A810-7A58D4840F60}.Release|x64.Build.0 = Release|x64 {628AB80A-B1B9-4878-A810-7A58D4840F60}.Release|x86.ActiveCfg = Release|x86 {628AB80A-B1B9-4878-A810-7A58D4840F60}.Release|x86.Build.0 = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|Any CPU.ActiveCfg = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|ARM.ActiveCfg = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|x64.ActiveCfg = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|x86.ActiveCfg = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Debug|x86.Build.0 = Debug|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|Any CPU.ActiveCfg = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|ARM.ActiveCfg = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|Mixed Platforms.Build.0 = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|x64.ActiveCfg = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|x86.ActiveCfg = Release|x86 + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01}.Release|x86.Build.0 = Release|x86 + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|ARM.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|x64.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Debug|x86.ActiveCfg = Debug|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|Any CPU.Build.0 = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|ARM.ActiveCfg = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|x64.ActiveCfg = Release|Any CPU + {ABECEC14-6BF4-4432-833C-69714EB4E8E6}.Release|x86.ActiveCfg = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|ARM.ActiveCfg = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|x64.ActiveCfg = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Debug|x86.ActiveCfg = Debug|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|Any CPU.Build.0 = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|ARM.ActiveCfg = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|x64.ActiveCfg = Release|Any CPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -995,6 +1043,7 @@ Global {938D5F88-B888-4B04-BEEE-EE701FBA51EF} = {B24A8593-562A-4A25-BB08-46C163F10F3F} {14B39F89-C9B0-407E-877A-B515C985E96E} = {B24A8593-562A-4A25-BB08-46C163F10F3F} {45DD7B40-C498-4DD2-A16B-FD6C4E6991B3} = {B24A8593-562A-4A25-BB08-46C163F10F3F} + {6119ADEE-7047-4E29-BEC2-00F8D6D0EA01} = {B24A8593-562A-4A25-BB08-46C163F10F3F} {B30DE9C2-0926-46B6-8351-9AF276C472D5} = {D421509A-9AE3-4D7E-881B-EAFED598B028} {FF0AB665-2796-4354-9630-76C2751DB3C2} = {D421509A-9AE3-4D7E-881B-EAFED598B028} {2B71A7C2-0D18-4E3D-AE5A-320641D1162A} = {D421509A-9AE3-4D7E-881B-EAFED598B028} @@ -1018,6 +1067,7 @@ Global {4A048A8C-C31D-4FC8-AAF3-C387B9E0309B} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {9259CC4E-AE6B-403C-8FAB-2408448C3935} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {D810F12D-6CE9-4755-AC6A-5DFEC7D1C782} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} + {AA3DF4D7-F072-47B5-B88C-20140B5F704A} = {9B0DD48B-3912-4F33-AF3F-691AF02B73F9} {DB88DDEB-7281-405D-8FCA-5681B6B2BD7A} = {7AD65E6B-2A48-437F-81D9-4CA9C9A85C64} {49066074-3B7B-4A55-B122-6BD33AB73558} = {7AD65E6B-2A48-437F-81D9-4CA9C9A85C64} {60D08399-244F-46A3-91F1-4CFD26D961A3} = {7AD65E6B-2A48-437F-81D9-4CA9C9A85C64} @@ -1039,6 +1089,7 @@ Global {2B6D0EFF-7874-495F-9226-873ED9649C60} = {1436F7C9-29D3-4FEF-8914-10B45F13D142} {2CF3FE4D-586E-4B07-8BF0-1E84B670F0AD} = {1436F7C9-29D3-4FEF-8914-10B45F13D142} {1986B0ED-3D28-4FEE-82D0-BCC39C87C18C} = {3E29A6C6-9487-46A7-A161-D8DB84514933} + {ABECEC14-6BF4-4432-833C-69714EB4E8E6} = {3E29A6C6-9487-46A7-A161-D8DB84514933} EndGlobalSection GlobalSection(SubversionScc) = preSolution Svn-Managed = True diff --git a/InputSystems/ANX.InputDevices.Windows.ModernUI/ANX.InputDevices.Windows.ModernUI_Linux.csproj b/InputSystems/ANX.InputDevices.Windows.ModernUI/ANX.InputDevices.Windows.ModernUI_Linux.csproj new file mode 100644 index 00000000..79438585 --- /dev/null +++ b/InputSystems/ANX.InputDevices.Windows.ModernUI/ANX.InputDevices.Windows.ModernUI_Linux.csproj @@ -0,0 +1,136 @@ + + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {628AB80A-B1B9-4878-A810-7A58D4840F60} + Library + Properties + ANX.InputDevices.Windows.ModernUI + ANX.InputDevices.Windows.ModernUI + de-DE + 512 + + + true + full + false + ..\..\bin\Debug\ + NETFX_CORE;TRACE;DEBUG;LINUX; + prompt + 4 + + + pdbonly + true + ..\..\bin\Release\ + NETFX_CORE;TRACE;LINUX; + prompt + 4 + + + true + bin\ARM\Debug\ + NETFX_CORE;TRACE;DEBUG;LINUX; + ;2008 + full + ARM + false + prompt + true + + + bin\ARM\Release\ + NETFX_CORE;TRACE;LINUX; + true + ;2008 + pdbonly + ARM + false + prompt + true + + + true + bin\x64\Debug\ + NETFX_CORE;TRACE;DEBUG;LINUX; + ;2008 + full + x64 + false + prompt + true + + + bin\x64\Release\ + NETFX_CORE;TRACE;LINUX; + true + ;2008 + pdbonly + x64 + false + prompt + true + + + true + bin\x86\Debug\ + NETFX_CORE;TRACE;DEBUG;LINUX; + ;2008 + full + x86 + false + prompt + true + + + bin\x86\Release\ + NETFX_CORE;TRACE;LINUX; + true + ;2008 + pdbonly + x86 + false + prompt + true + + + + + + + + + + + + + + + ..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.dll + + + ..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.XInput.dll + + + + + {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35} + ANX.Framework + + + + 11.0 + + + + \ No newline at end of file diff --git a/InputSystems/ANX.InputDevices.Windows.ModernUI/ANX.InputDevices.Windows.ModernUI_PSVita.csproj b/InputSystems/ANX.InputDevices.Windows.ModernUI/ANX.InputDevices.Windows.ModernUI_PSVita.csproj new file mode 100644 index 00000000..b0c83ea0 --- /dev/null +++ b/InputSystems/ANX.InputDevices.Windows.ModernUI/ANX.InputDevices.Windows.ModernUI_PSVita.csproj @@ -0,0 +1,138 @@ + + + + + Debug + AnyCPU + 10.0.0 + 2.0 + {628AB80A-B1B9-4878-A810-7A58D4840F60} + Library + Properties + ANX.InputDevices.Windows.ModernUI + ANX.InputDevices.Windows.ModernUI + de-DE + 512 + {69878862-DA7D-4DC6-B0A1-50D8FAB4242F};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + true + full + false + ..\..\bin\Debug\ + NETFX_CORE;TRACE;DEBUG;PSVITA; + prompt + 4 + + + pdbonly + true + ..\..\bin\Release\ + NETFX_CORE;TRACE;PSVITA; + prompt + 4 + + + true + bin\ARM\Debug\ + NETFX_CORE;TRACE;DEBUG;PSVITA; + ;2008 + full + ARM + false + prompt + true + + + bin\ARM\Release\ + NETFX_CORE;TRACE;PSVITA; + true + ;2008 + pdbonly + ARM + false + prompt + true + + + true + bin\x64\Debug\ + NETFX_CORE;TRACE;DEBUG;PSVITA; + ;2008 + full + x64 + false + prompt + true + + + bin\x64\Release\ + NETFX_CORE;TRACE;PSVITA; + true + ;2008 + pdbonly + x64 + false + prompt + true + + + true + bin\x86\Debug\ + NETFX_CORE;TRACE;DEBUG;PSVITA; + ;2008 + full + x86 + false + prompt + true + + + bin\x86\Release\ + NETFX_CORE;TRACE;PSVITA; + true + ;2008 + pdbonly + x86 + false + prompt + true + + + + + + + + + + + + + + + ..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.dll + + + ..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.XInput.dll + + + + + + {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35} + ANX.Framework + + + + 11.0 + + + + \ No newline at end of file diff --git a/RenderSystems/ANX.Framework.GL3/ANX.RenderSystem.GL3_PSVita.csproj b/RenderSystems/ANX.Framework.GL3/ANX.RenderSystem.GL3_PSVita.csproj new file mode 100644 index 00000000..4cbc9428 --- /dev/null +++ b/RenderSystems/ANX.Framework.GL3/ANX.RenderSystem.GL3_PSVita.csproj @@ -0,0 +1,90 @@ + + + + Debug + AnyCPU + 10.0.0 + 2.0 + {EB8258E0-6741-4DB9-B756-1EBDF67B1ED6} + Library + Properties + ANX.RenderSystem.GL3 + ANX.RenderSystem.GL3 + 512 + {69878862-DA7D-4DC6-B0A1-50D8FAB4242F};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + true + full + false + ..\..\bin\Debug\ + XNAEXT;DEBUG;TRACE;PSVITA; + prompt + 4 + x86 + Auto + true + + + pdbonly + true + ..\bin\Release\ + XNAEXT;TRACE;PSVITA; + prompt + 4 + x86 + true + + + + ..\..\lib\OpenTK\OpenTK.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {6899f0c9-70b9-4eb0-9dd3-e598d4be3e35} + ANX.Framework + + + + + + + + \ No newline at end of file diff --git a/Samples/AudioSample/AudioSample_Linux.csproj b/Samples/AudioSample/AudioSample_Linux.csproj index 821552ed..bba3775b 100644 --- a/Samples/AudioSample/AudioSample_Linux.csproj +++ b/Samples/AudioSample/AudioSample_Linux.csproj @@ -89,6 +89,10 @@ {068EB2E9-963C-4E1B-8831-E25011F11FFE} ANX.PlatformSystem.Windows + + {5BE49183-2F6F-4527-AC90-D816911FCF90} + ANX.RenderSystem.Windows.DX10 + {14EF49AB-6D3F-458D-9D5C-D120B86EDD7A} ANX.SoundSystem.OpenAL diff --git a/Samples/AudioSample/AudioSample_PSVita.csproj b/Samples/AudioSample/AudioSample_PSVita.csproj index ac738f55..af1083aa 100644 --- a/Samples/AudioSample/AudioSample_PSVita.csproj +++ b/Samples/AudioSample/AudioSample_PSVita.csproj @@ -92,6 +92,10 @@ {068EB2E9-963C-4E1B-8831-E25011F11FFE} ANX.PlatformSystem.Windows + + {5BE49183-2F6F-4527-AC90-D816911FCF90} + ANX.RenderSystem.Windows.DX10 + {14EF49AB-6D3F-458D-9D5C-D120B86EDD7A} ANX.SoundSystem.OpenAL diff --git a/Samples/AudioSample/Game1.cs b/Samples/AudioSample/Game1.cs index 2d35a5b8..959855c9 100644 --- a/Samples/AudioSample/Game1.cs +++ b/Samples/AudioSample/Game1.cs @@ -1,5 +1,9 @@ +using System.IO; using ANX.Framework; using ANX.Framework.Audio; +using ANX.Framework.Media; +using System; +using ANX.Framework.Input; // This file is part of the ANX.Framework created by the // "ANX.Framework developer group" and released under the Ms-PL license. @@ -11,9 +15,12 @@ namespace AudioSample { private GraphicsDeviceManager graphics; private SoundEffect sound; + private Song song; private float timer; private float duration; + private const bool UseMusicPlayback = false; + public Game1() { graphics = new GraphicsDeviceManager(this); @@ -23,6 +30,8 @@ namespace AudioSample protected override void LoadContent() { sound = Content.Load("Sounds\\testsound"); + string testmusicPath = Path.GetFullPath("../../../../../media/testmusic.ogg"); + song = Song.FromUri(testmusicPath, new Uri(testmusicPath)); timer = duration = (float)sound.Duration.TotalSeconds; } @@ -36,7 +45,21 @@ namespace AudioSample if (timer >= duration) { timer -= duration; - sound.Play(1f, 1f, 0f); + if (UseMusicPlayback) + MediaPlayer.Play(song); + else + sound.Play(1f, 1f, 0f); + } + + if (UseMusicPlayback) + { + Window.Title = "PlayTime = " + MediaPlayer.PlayPosition; + + if (Keyboard.GetState().IsKeyDown(Keys.A)) + MediaPlayer.Pause(); + + if (Keyboard.GetState().IsKeyDown(Keys.S)) + MediaPlayer.Resume(); } base.Update(gameTime); diff --git a/Samples/SimpleNoContent/Assets/Logo.png b/Samples/SimpleNoContent/Assets/Logo.png new file mode 100644 index 00000000..ab28e66b Binary files /dev/null and b/Samples/SimpleNoContent/Assets/Logo.png differ diff --git a/Samples/SimpleNoContent/Assets/SmallLogo.png b/Samples/SimpleNoContent/Assets/SmallLogo.png new file mode 100644 index 00000000..c4a32ab0 Binary files /dev/null and b/Samples/SimpleNoContent/Assets/SmallLogo.png differ diff --git a/Samples/SimpleNoContent/Assets/SplashScreen.png b/Samples/SimpleNoContent/Assets/SplashScreen.png new file mode 100644 index 00000000..8d204826 Binary files /dev/null and b/Samples/SimpleNoContent/Assets/SplashScreen.png differ diff --git a/Samples/SimpleNoContent/Assets/StoreLogo.png b/Samples/SimpleNoContent/Assets/StoreLogo.png new file mode 100644 index 00000000..55690e28 Binary files /dev/null and b/Samples/SimpleNoContent/Assets/StoreLogo.png differ diff --git a/Samples/SimpleNoContent/Manifest.appxmanifest b/Samples/SimpleNoContent/Manifest.appxmanifest new file mode 100644 index 00000000..e2b4fa18 --- /dev/null +++ b/Samples/SimpleNoContent/Manifest.appxmanifest @@ -0,0 +1,27 @@ + + + + + SimpleNoContent + ANX Developer Team + Assets\StoreLogo.png + + + 6.2.0 + 6.2.0 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Samples/SimpleNoContent/SimpleNoContent.csproj b/Samples/SimpleNoContent/SimpleNoContent.csproj index e7c77924..90408b8e 100644 --- a/Samples/SimpleNoContent/SimpleNoContent.csproj +++ b/Samples/SimpleNoContent/SimpleNoContent.csproj @@ -1,6 +1,5 @@  - Debug AnyCPU diff --git a/Samples/SimpleNoContent/SimpleNoContent_Linux.csproj b/Samples/SimpleNoContent/SimpleNoContent_Linux.csproj new file mode 100644 index 00000000..25cc5986 --- /dev/null +++ b/Samples/SimpleNoContent/SimpleNoContent_Linux.csproj @@ -0,0 +1,87 @@ + + + + Debug + AnyCPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A} + Exe + Properties + SimpleNoContent + SimpleNoContent + v4.0 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + TRACE;DEBUG;LINUX; + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE;LINUX; + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + {6899f0c9-70b9-4eb0-9dd3-e598d4be3e35} + ANX.Framework + + + {60d08399-244f-46a3-91f1-4cfd26d961a3} + ANX.InputDevices.Windows.XInput + + + {49066074-3b7b-4a55-b122-6bd33ab73558} + ANX.InputSystem.Standard + + + {068eb2e9-963c-4e1b-8831-e25011f11ffe} + ANX.PlatformSystem.Windows + + + {b30de9c2-0926-46b6-8351-9af276c472d5} + ANX.RenderSystem.Windows.DX11 + + + {6a582788-c4d2-410c-96cd-177f75712d65} + ANX.SoundSystem.Windows.XAudio + + + + + \ No newline at end of file diff --git a/Samples/SimpleNoContent/SimpleNoContent_PSVita.csproj b/Samples/SimpleNoContent/SimpleNoContent_PSVita.csproj new file mode 100644 index 00000000..80c0ee70 --- /dev/null +++ b/Samples/SimpleNoContent/SimpleNoContent_PSVita.csproj @@ -0,0 +1,90 @@ + + + + Debug + AnyCPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A} + Exe + Properties + SimpleNoContent + SimpleNoContent + 512 + {69878862-DA7D-4DC6-B0A1-50D8FAB4242F};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 10.0.0 + 2.0 + + + AnyCPU + true + full + false + bin\Debug\ + TRACE;DEBUG;PSVITA; + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE;PSVITA; + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + {6899f0c9-70b9-4eb0-9dd3-e598d4be3e35} + ANX.Framework + + + {60d08399-244f-46a3-91f1-4cfd26d961a3} + ANX.InputDevices.Windows.XInput + + + {49066074-3b7b-4a55-b122-6bd33ab73558} + ANX.InputSystem.Standard + + + {068eb2e9-963c-4e1b-8831-e25011f11ffe} + ANX.PlatformSystem.Windows + + + {b30de9c2-0926-46b6-8351-9af276c472d5} + ANX.RenderSystem.Windows.DX11 + + + {6a582788-c4d2-410c-96cd-177f75712d65} + ANX.SoundSystem.Windows.XAudio + + + + + \ No newline at end of file diff --git a/Samples/SimpleNoContent/SimpleNoContent_WindowsMetro.csproj b/Samples/SimpleNoContent/SimpleNoContent_WindowsMetro.csproj new file mode 100644 index 00000000..78a34946 --- /dev/null +++ b/Samples/SimpleNoContent/SimpleNoContent_WindowsMetro.csproj @@ -0,0 +1,91 @@ + + + + Debug + AnyCPU + {AA3DF4D7-F072-47B5-B88C-20140B5F704A} + AppContainerExe + Properties + SimpleNoContent + SimpleNoContent + 512 + {BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + en-US + Test_TemporaryKey.pfx + + + AnyCPU + true + full + false + bin\Debug\ModernUI + TRACE;DEBUG;WINDOWSMETRO; + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ModernUI + TRACE;WINDOWSMETRO; + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + {6899f0c9-70b9-4eb0-9dd3-e598d4be3e35} + ANX.Framework + + + {49066074-3b7b-4a55-b122-6bd33ab73558} + ANX.InputSystem.Standard + + + {6a582788-c4d2-410c-96cd-177f75712d65} + ANX.SoundSystem.Windows.XAudio + + + + + + + + Designer + + + + + + + + 11.0 + + + \ No newline at end of file diff --git a/Samples/WpfEditor/WpfEditor_Linux.csproj b/Samples/WpfEditor/WpfEditor_Linux.csproj index 522ffcfd..2afffd48 100644 --- a/Samples/WpfEditor/WpfEditor_Linux.csproj +++ b/Samples/WpfEditor/WpfEditor_Linux.csproj @@ -105,6 +105,10 @@ {49066074-3B7B-4A55-B122-6BD33AB73558} ANX.InputSystem.Standard + + {EB8258E0-6741-4DB9-B756-1EBDF67B1ED6} + ANX.RenderSystem.GL3 + {5BE49183-2F6F-4527-AC90-D816911FCF90} ANX.RenderSystem.Windows.DX10 diff --git a/Samples/WpfEditor/WpfEditor_PSVita.csproj b/Samples/WpfEditor/WpfEditor_PSVita.csproj index 61034276..e1654dae 100644 --- a/Samples/WpfEditor/WpfEditor_PSVita.csproj +++ b/Samples/WpfEditor/WpfEditor_PSVita.csproj @@ -106,6 +106,10 @@ {49066074-3B7B-4A55-B122-6BD33AB73558} ANX.InputSystem.Standard + + {EB8258E0-6741-4DB9-B756-1EBDF67B1ED6} + ANX.RenderSystem.GL3 + {5BE49183-2F6F-4527-AC90-D816911FCF90} ANX.RenderSystem.Windows.DX10 diff --git a/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL.csproj b/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL.csproj index 9a52c707..f51aab4a 100644 --- a/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL.csproj +++ b/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL.csproj @@ -42,6 +42,7 @@ + @@ -52,6 +53,10 @@ {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35} ANX.Framework + + {ABECEC14-6BF4-4432-833C-69714EB4E8E6} + OggUtils + {1986B0ED-3D28-4FEE-82D0-BCC39C87C18C} WaveUtils diff --git a/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL_Linux.csproj b/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL_Linux.csproj index 99308950..af188c1b 100644 --- a/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL_Linux.csproj +++ b/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL_Linux.csproj @@ -42,6 +42,7 @@ + @@ -52,6 +53,10 @@ {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35} ANX.Framework + + {ABECEC14-6BF4-4432-833C-69714EB4E8E6} + OggUtils + {1986B0ED-3D28-4FEE-82D0-BCC39C87C18C} WaveUtils diff --git a/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL_PSVita.csproj b/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL_PSVita.csproj index 3aac1509..1ad2c24c 100644 --- a/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL_PSVita.csproj +++ b/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL_PSVita.csproj @@ -43,6 +43,7 @@ + @@ -53,6 +54,10 @@ {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35} ANX.Framework + + {ABECEC14-6BF4-4432-833C-69714EB4E8E6} + OggUtils + {1986B0ED-3D28-4FEE-82D0-BCC39C87C18C} WaveUtils diff --git a/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL_WindowsMetro.csproj b/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL_WindowsMetro.csproj index 4068f21e..198fa608 100644 --- a/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL_WindowsMetro.csproj +++ b/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL_WindowsMetro.csproj @@ -44,6 +44,7 @@ + @@ -54,6 +55,10 @@ {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35} ANX.Framework + + {ABECEC14-6BF4-4432-833C-69714EB4E8E6} + OggUtils + {1986B0ED-3D28-4FEE-82D0-BCC39C87C18C} WaveUtils diff --git a/SoundSystems/ANX.SoundSystem.OpenAL/Creator.cs b/SoundSystems/ANX.SoundSystem.OpenAL/Creator.cs index 7fc76947..17dcb135 100644 --- a/SoundSystems/ANX.SoundSystem.OpenAL/Creator.cs +++ b/SoundSystems/ANX.SoundSystem.OpenAL/Creator.cs @@ -162,7 +162,13 @@ namespace ANX.SoundSystem.OpenAL public ISong CreateSong(Song parentSong, Uri uri) { PreventSystemChange(); - throw new NotImplementedException(); + return new OpenALSong(parentSong, uri); + } + + public ISong CreateSong(Song parentSong, string filepath, int duration) + { + PreventSystemChange(); + return new OpenALSong(parentSong, filepath, duration); } public IDynamicSoundEffectInstance CreateDynamicSoundEffectInstance() diff --git a/SoundSystems/ANX.SoundSystem.OpenAL/OpenALSong.cs b/SoundSystems/ANX.SoundSystem.OpenAL/OpenALSong.cs new file mode 100644 index 00000000..ae41779a --- /dev/null +++ b/SoundSystems/ANX.SoundSystem.OpenAL/OpenALSong.cs @@ -0,0 +1,179 @@ +using System; +using System.IO; +using ANX.Framework.Audio; +using ANX.Framework.Media; +using ANX.Framework.NonXNA.Development; +using ANX.Framework.NonXNA.SoundSystem; +using OggUtils; +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 +{ + [Developer("AstrorEnales")] + public class OpenALSong : ISong + { + private Song parent; + private FileStream oggFileStream; + private OggInputStream oggStream; + private int[] bufferHandles; + private int sourceHandle = InvalidHandle; + private const int InvalidHandle = -1; + private static readonly byte[] streamReadBuffer = new byte[4096 * 8]; + + public TimeSpan Duration { get; private set; } + public TimeSpan PlayPosition { get; private set; } + public MediaState State { get; private set; } + + public OpenALSong(Song setParent, Uri uri) + { + parent = setParent; + Init(uri.AbsolutePath); + // TODO: duration + } + + public OpenALSong(Song setParent, string filepath, int duration) + { + parent = setParent; + Init(filepath); + Duration = new TimeSpan(0, 0, 0, 0, duration); + } + + private void Init(string filepath) + { + PlayPosition = TimeSpan.Zero; + + State = MediaState.Stopped; + oggFileStream = File.Open(filepath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + oggStream = new OggInputStream(oggFileStream); + bufferHandles = AL.GenBuffers(2); + sourceHandle = AL.GenSource(); + } + + public void Play() + { + if (State == MediaState.Playing) + return; + + if (State == MediaState.Stopped) + { + Rewind(); + if (Stream(bufferHandles[0]) == false || Stream(bufferHandles[1]) == false) + return; + + AL.SourceQueueBuffers(sourceHandle, bufferHandles.Length, bufferHandles); + } + + AL.SourcePlay(sourceHandle); + State = MediaState.Playing; + } + + public void Stop() + { + if (State == MediaState.Stopped) + return; + + State = MediaState.Stopped; + AL.SourceStop(sourceHandle); + AL.SourceUnqueueBuffers(sourceHandle, bufferHandles.Length); + } + + public void Pause() + { + if (State == MediaState.Paused) + return; + + State = MediaState.Paused; + AL.SourcePause(sourceHandle); + } + + public void Resume() + { + Play(); + } + + public void Update() + { + if (sourceHandle == InvalidHandle || State == MediaState.Paused) + return; + + int processed; + AL.GetSource(sourceHandle, ALGetSourcei.BuffersProcessed, out processed); + while (processed-- != 0) + { + int buffer = AL.SourceUnqueueBuffer(sourceHandle); + if (Stream(buffer) == false) + { + Stop(); + return; + } + + AL.SourceQueueBuffer(sourceHandle, buffer); + } + + int state; + AL.GetSource(sourceHandle, ALGetSourcei.SourceState, out state); + switch ((ALSourceState)state) + { + case ALSourceState.Stopped: + case ALSourceState.Initial: + State = MediaState.Stopped; + break; + case ALSourceState.Playing: + State = MediaState.Playing; + break; + default: + State = MediaState.Paused; + break; + } + } + + internal void Rewind() + { + PlayPosition = TimeSpan.Zero; + oggFileStream.Position = 0; + oggStream = new OggInputStream(oggFileStream); + } + + internal bool Stream(int bufferHandle) + { + int size = oggStream.Read(streamReadBuffer); + bool dataAvailable = size > 0; + if (dataAvailable) + { + var channels = (AudioChannels)oggStream.Channels; + PlayPosition = PlayPosition.Add(SoundEffect.GetSampleDuration(size, oggStream.SampleRate, channels)); + ALFormat format = oggStream.Channels > 1 ? ALFormat.Stereo16 : ALFormat.Mono16; + AL.BufferData(bufferHandle, format, streamReadBuffer, size, oggStream.SampleRate); + } + + return dataAvailable; + } + + public void GetVisualizationData(VisualizationData data) + { + throw new NotImplementedException(); + } + + public void Dispose() + { + if (oggFileStream != null) + oggFileStream.Close(); + + oggFileStream = null; + oggStream = null; + + if (sourceHandle == InvalidHandle) + return; + + AL.SourceStop(sourceHandle); + AL.SourceUnqueueBuffers(sourceHandle, bufferHandles.Length); + AL.DeleteSource(sourceHandle); + sourceHandle = InvalidHandle; + AL.DeleteBuffers(bufferHandles); + } + } +} diff --git a/SoundSystems/ANX.SoundSystem.PsVita/Creator.cs b/SoundSystems/ANX.SoundSystem.PsVita/Creator.cs index cedac182..f97b51fc 100644 --- a/SoundSystems/ANX.SoundSystem.PsVita/Creator.cs +++ b/SoundSystems/ANX.SoundSystem.PsVita/Creator.cs @@ -172,6 +172,12 @@ namespace ANX.SoundSystem.PsVita throw new NotImplementedException(); } + public ISong CreateSong(Song parentSong, string filepath, int duration) + { + AddInSystemFactory.Instance.PreventSystemChange(AddInType.SoundSystem); + throw new NotImplementedException(); + } + public IDynamicSoundEffectInstance CreateDynamicSoundEffectInstance() { AddInSystemFactory.Instance.PreventSystemChange(AddInType.SoundSystem); diff --git a/SoundSystems/ANX.SoundSystem.Windows.XAudio/ANX.SoundSystem.Windows.XAudio.csproj b/SoundSystems/ANX.SoundSystem.Windows.XAudio/ANX.SoundSystem.Windows.XAudio.csproj index 8dafd82d..4b400d83 100644 --- a/SoundSystems/ANX.SoundSystem.Windows.XAudio/ANX.SoundSystem.Windows.XAudio.csproj +++ b/SoundSystems/ANX.SoundSystem.Windows.XAudio/ANX.SoundSystem.Windows.XAudio.csproj @@ -21,6 +21,7 @@ DEBUG;TRACE prompt 4 + true pdbonly @@ -29,6 +30,7 @@ TRACE prompt 4 + true @@ -42,6 +44,8 @@ + + @@ -52,6 +56,10 @@ {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35} ANX.Framework + + {ABECEC14-6BF4-4432-833C-69714EB4E8E6} + OggUtils + + \ No newline at end of file diff --git a/Support/OggUtils/OggUtils_Linux.csproj b/Support/OggUtils/OggUtils_Linux.csproj new file mode 100644 index 00000000..ef80d1da --- /dev/null +++ b/Support/OggUtils/OggUtils_Linux.csproj @@ -0,0 +1,88 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {ABECEC14-6BF4-4432-833C-69714EB4E8E6} + Library + Properties + OggUtils + OggUtils + v4.0 + 512 + + + true + full + false + bin\Debug\ + TRACE;DEBUG;LINUX; + prompt + 4 + x86 + true + + + pdbonly + true + bin\Release\ + TRACE;LINUX; + prompt + 4 + x86 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Support/OggUtils/OggUtils_PSVita.csproj b/Support/OggUtils/OggUtils_PSVita.csproj new file mode 100644 index 00000000..1e99088d --- /dev/null +++ b/Support/OggUtils/OggUtils_PSVita.csproj @@ -0,0 +1,89 @@ + + + + Debug + AnyCPU + 10.0.0 + 2.0 + {ABECEC14-6BF4-4432-833C-69714EB4E8E6} + Library + Properties + OggUtils + OggUtils + 512 + {69878862-DA7D-4DC6-B0A1-50D8FAB4242F};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + true + full + false + bin\Debug\ + TRACE;DEBUG;PSVITA; + prompt + 4 + x86 + true + + + pdbonly + true + bin\Release\ + TRACE;PSVITA; + prompt + 4 + x86 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Support/OggUtils/OggUtils_WindowsMetro.csproj b/Support/OggUtils/OggUtils_WindowsMetro.csproj new file mode 100644 index 00000000..f0ae0a1e --- /dev/null +++ b/Support/OggUtils/OggUtils_WindowsMetro.csproj @@ -0,0 +1,94 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {ABECEC14-6BF4-4432-833C-69714EB4E8E6} + Library + Properties + OggUtils + OggUtils + 512 + {BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + en-US + Test_TemporaryKey.pfx + + + true + full + false + bin\Debug\ModernUI + TRACE;DEBUG;WINDOWSMETRO; + prompt + 4 + x86 + true + + + pdbonly + true + bin\Release\ModernUI + TRACE;WINDOWSMETRO; + prompt + 4 + x86 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 11.0 + + + \ No newline at end of file diff --git a/Support/OggUtils/Properties/AssemblyInfo.cs b/Support/OggUtils/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..b74f61ef --- /dev/null +++ b/Support/OggUtils/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die mit einer Assembly verknüpft sind. +[assembly: AssemblyTitle("OggUtils")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("ANX.Framework Team")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("Copyright © ANX.Framework Team 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar +// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von +// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("774a9cc9-2e64-4bae-9038-c857edfe3e08")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern +// übernehmen, indem Sie "*" eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("0.7.0.*")] +[assembly: AssemblyFileVersion("0.7.0.*")] diff --git a/Support/OggUtils/csogg/Buffer.cs b/Support/OggUtils/csogg/Buffer.cs new file mode 100644 index 00000000..41a04087 --- /dev/null +++ b/Support/OggUtils/csogg/Buffer.cs @@ -0,0 +1,302 @@ +/* csogg + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +using System; + +namespace csogg +{ + /// + /// Summary description for csBuffer. + /// + public class csBuffer + { + private static int BUFFER_INCREMENT = 256; + + private static uint[] mask={ + 0x00000000,0x00000001,0x00000003,0x00000007,0x0000000f, + 0x0000001f,0x0000003f,0x0000007f,0x000000ff,0x000001ff, + 0x000003ff,0x000007ff,0x00000fff,0x00001fff,0x00003fff, + 0x00007fff,0x0000ffff,0x0001ffff,0x0003ffff,0x0007ffff, + 0x000fffff,0x001fffff,0x003fffff,0x007fffff,0x00ffffff, + 0x01ffffff,0x03ffffff,0x07ffffff,0x0fffffff,0x1fffffff, + 0x3fffffff,0x7fffffff,0xffffffff + }; + int ptr = 0; + byte[] buffer = null; + int endbit = 0; + int endbyte = 0; + int storage = 0; + + public void writeinit() + { + buffer = new byte[BUFFER_INCREMENT]; + ptr = 0; + buffer[0] = (byte)'\0'; + storage = BUFFER_INCREMENT; + } + + public void write(byte[] s) + { + for(int i = 0; i < s.Length; i++) + { + if(s[i] == 0) break; + write(s[i], 8); + } + } + + public void read (byte[] s, int bytes) + { + int i = 0; + while(bytes--!=0) + { + s[i++]=(byte)(read(8)); + } + } + + void reset() + { + ptr = 0; + buffer[0] = (byte)'\0'; + endbit = endbyte = 0; + } + + public void writeclear() + { + buffer = null; + } + + public void readinit(byte[] buf, int start, int bytes) + { + ptr = start; + buffer = buf; + endbit = endbyte = 0; + storage = bytes; + } + + public void write(int vvalue, int bits) + { + if(endbyte + 4 >= storage) + { + byte[] foo = new byte[storage + BUFFER_INCREMENT]; + Array.Copy(buffer, 0, foo, 0, storage); + buffer = foo; + storage += BUFFER_INCREMENT; + } + + vvalue = (int)((uint)vvalue & mask[bits]); + bits += endbit; + buffer[ptr] |= (byte)(vvalue << endbit); + + if(bits >= 8) + { + buffer[ptr+1] = (byte)((uint)vvalue >> (8-endbit)); + if(bits >= 16) + { + buffer[ptr+2] = (byte)((uint)vvalue >> (16-endbit)); + if (bits >= 24) + { + buffer[ptr+3] = (byte)((uint)vvalue >> (24-endbit)); + if(bits >= 32) + { + if(endbit > 0) + buffer[ptr+4] = (byte)((uint)vvalue >> (32-endbit)); + else + buffer[ptr+4]=0; + } + } + } + } + + endbyte += bits / 8; + ptr += bits/8; + endbit = bits & 7; + } + + public int look(int bits) + { + int ret; + uint m = mask[bits]; + + bits += endbit; + + if(endbyte + 4 >= storage) + { + if(endbyte+(bits-1)/8 >= storage) + return (-1); + } + + ret = ((buffer[ptr]) & 0xff) >> endbit; + + if(bits > 8) + { + ret |= ((buffer[ptr+1]) & 0xff) << (8 - endbit); + if(bits > 16) + { + ret |= ((buffer[ptr+2])&0xff) << (16-endbit); + if(bits > 24) + { + ret |= ((buffer[ptr+3])&0xff) << (24-endbit); + if((bits > 32) && (endbit != 0)) + { + ret |= ((buffer[ptr+4])&0xff) << (32-endbit); + } + } + } + } + ret = (int)(m & ret); + return (ret); + } + + public int look1() + { + if(endbyte >= storage) + return(-1); + return((buffer[ptr] >> endbit) & 1); + } + + public void adv(int bits) + { + bits += endbit; + ptr += bits / 8; + endbyte += bits / 8; + endbit = bits & 7; + } + + public void adv1() + { + ++endbit; + if(endbit > 7) + { + endbit = 0; + ptr++; + endbyte++; + } + } + + public int read(int bits) + { + int ret; + uint m=mask[bits]; + + bits += endbit; + + if(endbyte+4 >= storage) + { + ret = -1; + if(endbyte + (bits-1)/8 >= storage) + { + ptr += bits/8; + endbyte += bits/8; + endbit = bits&7; + return(ret); + } + } + + ret = ((buffer[ptr]) & 0xff) >> endbit; + if(bits > 8) + { + ret|=((buffer[ptr+1])&0xff)<<(8-endbit); + if(bits > 16) + { + ret|=((buffer[ptr+2])&0xff)<<(16-endbit); + if(bits > 24) + { + ret|=((buffer[ptr+3])&0xff)<<(24-endbit); + + if((bits > 32) && (endbit != 0)) + { + ret|=((buffer[ptr+4])&0xff)<<(32-endbit); + } + } + } + } + + ret &= (int)m; + + ptr += bits/8; + endbyte += bits/8; + endbit = bits&7; + return(ret); + } + + public int read1() + { + int ret; + if(endbyte>=storage) + { + ret = -1; + endbit++; + if(endbit > 7) + { + endbit = 0; + ptr++; + endbyte++; + } + return(ret); + } + + ret=(buffer[ptr] >> endbit) & 1; + + endbit++; + if(endbit > 7) + { + endbit = 0; + ptr++; + endbyte++; + } + return(ret); + } + + public int bytes() + { + return(endbyte+(endbit+7)/8); + } + + public int bits() + { + return(endbyte*8+endbit); + } + + public static int ilog(int v) + { + int ret=0; + while(v > 0) + { + ret++; + v >>= 1; + } + return(ret); + } + + public byte[] buf() + { + return(buffer); + } + + public csBuffer() + { + // Really a noop? + } + } +} diff --git a/Support/OggUtils/csogg/Packet.cs b/Support/OggUtils/csogg/Packet.cs new file mode 100644 index 00000000..6b14d708 --- /dev/null +++ b/Support/OggUtils/csogg/Packet.cs @@ -0,0 +1,53 @@ +/* csogg + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +using System; + +namespace csogg +{ + /// + /// Summary description for Packet. + /// + public class Packet + { + public byte[] packet_base; + public int packet; + public int bytes; + public int b_o_s; + public int e_o_s; + + public long granulepos; + + public long packetno; // sequence number for decode; the framing + // knows where there's a hole in the data, + // but we need coupling so that the codec + // (which is in a seperate abstraction + // layer) also knows about the gap + + public Packet() + { + // No constructor + } + } +} diff --git a/Support/OggUtils/csogg/Page.cs b/Support/OggUtils/csogg/Page.cs new file mode 100644 index 00000000..524fe3b5 --- /dev/null +++ b/Support/OggUtils/csogg/Page.cs @@ -0,0 +1,140 @@ +/* csogg + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +using System; + +namespace csogg +{ + /// + /// Summary description for Page. + /// + public class Page + { + private static uint[] crc_lookup=new uint[256]; + + private static uint crc_entry(uint index) + { + uint r = index << 24; + for(int i=0; i<8; i++) + { + if((r& 0x80000000)!=0) + { + r=(r << 1)^0x04c11db7; /* The same as the ethernet generator + polynomial, although we use an + unreflected alg and an init/final + of 0, not 0xffffffff */ + } + else + { + r <<= 1; + } + } + return (r & 0xffffffff); + } + + public byte[] header_base; + public int header; + public int header_len; + public byte[] body_base; + public int body; + public int body_len; + + internal int version() + { + return header_base[header+4]&0xff; + } + internal int continued() + { + return (header_base[header+5]&0x01); + } + public int bos() + { + return (header_base[header+5]&0x02); + } + public int eos() + { + return (header_base[header+5]&0x04); + } + public long granulepos() + { + long foo = header_base[header+13]&0xff; + foo = (foo<<8) | (uint)(header_base[header+12]&0xff); + foo = (foo<<8) | (uint)(header_base[header+11]&0xff); + foo = (foo<<8) | (uint)(header_base[header+10]&0xff); + foo = (foo<<8) | (uint)(header_base[header+9]&0xff); + foo = (foo<<8) | (uint)(header_base[header+8]&0xff); + foo = (foo<<8) | (uint)(header_base[header+7]&0xff); + foo = (foo<<8) | (uint)(header_base[header+6]&0xff); + return(foo); + } + public int serialno() + { + return (header_base[header+14]&0xff)| + ((header_base[header+15]&0xff)<<8)| + ((header_base[header+16]&0xff)<<16)| + ((header_base[header+17]&0xff)<<24); + } + internal int pageno() + { + return (header_base[header+18]&0xff)| + ((header_base[header+19]&0xff)<<8)| + ((header_base[header+20]&0xff)<<16)| + ((header_base[header+21]&0xff)<<24); + } + + internal void checksum() + { + uint crc_reg=0; + uint a, b; + + for(int i=0;i> 24) & 0xff; + crc_reg = (crc_reg<<8)^crc_lookup[a^b]; + //crc_reg = (crc_reg<<8)^(uint)(crc_lookup[((crc_reg >> 24)&0xff)^(header_base[header+i]&0xff)]); + } + for(int i=0;i> 24) & 0xff; + crc_reg = (crc_reg<<8)^crc_lookup[a^b]; + + //crc_reg = (crc_reg<<8)^(uint)(crc_lookup[((crc_reg >> 24)&0xff)^(body_base[body+i]&0xff)]); + } + header_base[header+22]=(byte)crc_reg/*&0xff*/; + header_base[header+23]=(byte)(crc_reg>>8)/*&0xff*/; + header_base[header+24]=(byte)(crc_reg>>16)/*&0xff*/; + header_base[header+25]=(byte)(crc_reg>>24)/*&0xff*/; + } + + public Page() + { + for(uint i=0; i + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +using System; +using System.Text; + +namespace csogg +{ + /// + /// Summary description for StreamState. + /// + public class StreamState + { + byte[] body_data; /* bytes from packet bodies */ + int body_storage; /* storage elements allocated */ + int body_fill; /* elements stored; fill mark */ + private int body_returned; /* elements of fill returned */ + + + int[] lacing_vals; /* The values that will go to the segment table */ + long[] granule_vals; /* pcm_pos values for headers. Not compact + this way, but it is simple coupled to the + lacing fifo */ + int lacing_storage; + int lacing_fill; + int lacing_packet; + int lacing_returned; + + byte[] header=new byte[282]; /* working space for header encode */ + int header_fill; + + public int e_o_s; /* set when we have buffered the last packet in the + logical bitstream */ + int b_o_s; /* set after we've written the initial page + of a logical bitstream */ + int serialno; + int pageno; + long packetno; /* sequence number for decode; the framing + knows where there's a hole in the data, + but we need coupling so that the codec + (which is in a seperate abstraction + layer) also knows about the gap */ + long granulepos; + + StreamState(int serialno) : this() + { + init(serialno); + } + + public StreamState() + { + init(); + } + + void init() + { + body_storage=16*1024; + body_data=new byte[body_storage]; + lacing_storage=1024; + lacing_vals=new int[lacing_storage]; + granule_vals=new long[lacing_storage]; + } + public void init(int serialno) + { + if(body_data==null){ init(); } + else + { + for(int i=0; i255?255:lacing_fill); + int bytes=0; + int acc=0; + long granule_pos=granule_vals[0]; + + if(maxvals==0)return(0); + + /* construct a page */ + /* decide how many segments to include */ + + /* If this is the initial header case, the first page must only include + the initial header packet */ + if(b_o_s==0) + { /* 'initial header page' case */ + granule_pos=0; + for(vals=0;vals4096)break; + acc+=(lacing_vals[vals]&0x0ff); + granule_pos=granule_vals[vals]; + } + } + + /* construct the header in temp storage */ + + String oggs_str = "OggS"; + Encoding AE = Encoding.UTF8; + byte[] oggs_byt = AE.GetBytes(oggs_str); + Array.Copy(oggs_byt, 0, header, 0, oggs_byt.Length); + + /* stream structure version */ + header[4]=0x00; + + /* continued packet flag? */ + header[5]=0x00; + if((lacing_vals[0]&0x100)==0)header[5]|=0x01; + /* first page flag? */ + if(b_o_s==0) header[5]|=0x02; + /* last page flag? */ + if(e_o_s!=0 && lacing_fill==vals) header[5]|=0x04; + b_o_s=1; + + /* 64 bits of PCM position */ + for(i=6;i<14;i++) + { + header[i]=(byte)granule_pos; + granule_pos>>=8; + } + + /* 32 bits of stream serial number */ + { + int _serialno=serialno; + for(i=14;i<18;i++) + { + header[i]=(byte)_serialno; + _serialno>>=8; + } + } + + /* 32 bits of page counter (we have both counter and page header + because this val can roll over) */ + if(pageno==-1)pageno=0; /* because someone called + stream_reset; this would be a + strange thing to do in an + encode stream, but it has + plausible uses */ + { + int _pageno=pageno++; + for(i=18;i<22;i++) + { + header[i]=(byte)_pageno; + _pageno>>=8; + } + } + + /* zero for computation; filled in later */ + header[22]=0; + header[23]=0; + header[24]=0; + header[25]=0; + + /* segment table */ + header[26]=(byte)vals; + for(i=0;i 4096 || /* 'page nominal size' case */ + lacing_fill>=255 || /* 'segment table full' case */ + (lacing_fill!=0&&b_o_s==0)) + { /* 'initial header page' case */ + return flush(og); + } + return 0; + } + + public int eof() + { + return e_o_s; + } + + public int reset() + { + body_fill=0; + body_returned=0; + + lacing_fill=0; + lacing_packet=0; + lacing_returned=0; + + header_fill=0; + + e_o_s=0; + b_o_s=0; + pageno=-1; + packetno=0; + granulepos=0; + return(0); + } + } +} diff --git a/Support/OggUtils/csogg/SyncState.cs b/Support/OggUtils/csogg/SyncState.cs new file mode 100644 index 00000000..1e385982 --- /dev/null +++ b/Support/OggUtils/csogg/SyncState.cs @@ -0,0 +1,289 @@ +/* csogg + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +using System; + +namespace csogg +{ + /// + /// Summary description for SyncState. + /// + public class SyncState + { + public byte[] data; + int storage; + int fill; + int returned; + + int unsynced; + int headerbytes; + int bodybytes; + + public int clear() + { + data=null; + return(0); + } + + // !!!!!!!!!!!! + // byte[] buffer(int size){ + public int buffer(int size) + { + // first, clear out any space that has been previously returned + if(returned!=0) + { + fill-=returned; + if(fill>0) + { + Array.Copy(data, returned, data, 0, fill); + } + returned=0; + } + + if(size>storage-fill) + { + // We need to extend the internal buffer + int newsize=size+fill+4096; // an extra page to be nice + if(data!=null) + { + byte[] foo=new byte[newsize]; + Array.Copy(data, 0, foo, 0, data.Length); + data=foo; + } + else + { + data=new byte[newsize]; + } + storage=newsize; + } + + // expose a segment at least as large as requested at the fill mark + // return((char *)oy->data+oy->fill); + // return(data); + return(fill); + } + + public int wrote(int bytes) + { + if(fill+bytes>storage)return(-1); + fill+=bytes; + return(0); + } + + // sync the stream. This is meant to be useful for finding page + // boundaries. + // + // return values for this: + // -n) skipped n bytes + // 0) page not ready; more data (no bytes skipped) + // n) page synced at current location; page length n bytes + private Page pageseek_p=new Page(); + private byte[] chksum=new byte[4]; + public int pageseek(Page og) + { + int page=returned; + int next; + int bytes=fill-returned; + + if(headerbytes==0) + { + int _headerbytes,i; + if(bytes<27)return(0); // not enough for a header + + /* verify capture pattern */ + //!!!!!!!!!!! + if(data[page]!='O' || + data[page+1]!='g' || + data[page+2]!='g' || + data[page+3]!='S') + { + headerbytes=0; + bodybytes=0; + + // search for possible capture + next=0; + for(int ii=0; iibytes)return(0); + + // The whole test page is buffered. Verify the checksum + lock(chksum) + { + // Grab the checksum bytes, set the header field to zero + + Array.Copy(data, page+22, chksum, 0, 4); + data[page+22]=0; + data[page+23]=0; + data[page+24]=0; + data[page+25]=0; + + // set up a temp page struct and recompute the checksum + Page log=pageseek_p; + log.header_base=data; + log.header=page; + log.header_len=headerbytes; + + log.body_base=data; + log.body=page+headerbytes; + log.body_len=bodybytes; + log.checksum(); + + // Compare + if(chksum[0]!=data[page+22] || + chksum[1]!=data[page+23] || + chksum[2]!=data[page+24] || + chksum[3]!=data[page+25]) + { + // D'oh. Mismatch! Corrupt page (or miscapture and not a page at all) + // replace the computed checksum with the one actually read in + Array.Copy(chksum, 0, data, page+22, 4); + // Bad checksum. Lose sync */ + + headerbytes=0; + bodybytes=0; + // search for possible capture + next=0; + for(int ii=0; ii0) + { + // have a page + return(1); + } + if(ret==0) + { + // need more data + return(0); + } + + // head did not start a synced page... skipped some bytes + if(unsynced==0) + { + unsynced=1; + return(-1); + } + // loop. keep looking + } + } + + // clear things to an initial state. Good to call, eg, before seeking + public int reset() + { + fill=0; + returned=0; + unsynced=0; + headerbytes=0; + bodybytes=0; + return(0); + } + public void init(){} + + public SyncState() + { + // No constructor needed + } + } +} diff --git a/Support/OggUtils/csvorbis/AllocChain.cs b/Support/OggUtils/csvorbis/AllocChain.cs new file mode 100644 index 00000000..d074453f --- /dev/null +++ b/Support/OggUtils/csvorbis/AllocChain.cs @@ -0,0 +1,36 @@ +/* csvorbis + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* So, again, why is this here? Kill it soon */ + +using System; + +namespace csvorbis +{ + class AllocChain + { + //Object ptr; + //AllocChain next; + }; +} \ No newline at end of file diff --git a/Support/OggUtils/csvorbis/Block.cs b/Support/OggUtils/csvorbis/Block.cs new file mode 100644 index 00000000..7185f223 --- /dev/null +++ b/Support/OggUtils/csvorbis/Block.cs @@ -0,0 +1,205 @@ +/* csvorbis + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; +using csogg; + +namespace csvorbis +{ + public class Block + { + ///necessary stream state for linking to the framing abstraction + internal float[][] pcm=new float[0][]; // this is a pointer into local storage + internal csBuffer opb=new csBuffer(); + + internal int lW; + internal int W; + internal int nW; + internal int pcmend; + internal int mode; + + internal int eofflag; + internal long granulepos; + internal long sequence; + internal DspState vd; // For read-only access of configuration + + // local storage to avoid remallocing; it's up to the mapping to + // structure it + //byte[] localstore; + //int localtop; + //int localalloc; + //int totaluse; + //AllocChain reap; + + // bitmetrics for the frame + internal int glue_bits; + internal int time_bits; + internal int floor_bits; + internal int res_bits; + + public Block(DspState vd) + { + this.vd=vd; + // localalloc=0; + // localstore=null; + if(vd.analysisp!=0) + { + opb.writeinit(); + } + } + + public void init(DspState vd) + { + this.vd=vd; + } + + // int alloc(int bytes){ + // bytes=(bytes+(8-1))&(~(8-1)); + // if(bytes+localtop>localalloc){ + // if(localstore!=null){ + // AllocChain link=new AllocChain(); + // totaluse+=localtop; + // link.next=reap; + // link.ptr=localstore; + // reap=link; + // } + // // highly conservative + // localalloc=bytes; + // localstore=new byte[localalloc]; + // localtop=0; + // } + // { + // int foo=localtop; + // //void *ret=(void *)(((char *)vb->localstore)+vb->localtop); + // localtop+=bytes; + // return foo; + // } + // } + + // reap the chain, pull the ripcord + // void ripcord(){ + // // reap the chain + // while(reap!=null){ + // AllocChain next=reap.next; + // //free(reap->ptr); + // reap.ptr=null; + // //memset(reap,0,sizeof(struct alloc_chain)); + // //free(reap); + // reap=next; + // } + // // consolidate storage + // if(totaluse!=0){ + // //vb->localstore=realloc(vb->localstore,vb->totaluse+vb->localalloc); + // byte[] foo=new byte[totaluse+localalloc]; + // Array.Copy(localstore, 0, foo, 0, localstore.length); + // localstore=foo; + // localalloc+=totaluse; + // totaluse=0; + // } + // // pull the ripcord + // localtop=0; + // reap=null; + // } + + public int clear() + { + if(vd!=null) + { + if(vd.analysisp!=0) + { + opb.writeclear(); + } + } + //ripcord(); + //if(localstore!=null) + // localstore=null; + //memset(vb,0,sizeof(vorbis_block)); + return(0); + } + + public int synthesis(Packet op) + { + Info vi=vd.vi; + + // first things first. Make sure decode is ready + // ripcord(); + opb.readinit(op.packet_base, op.packet, op.bytes); + + // Check the packet type + if(opb.read(1)!=0) + { + // Oops. This is not an audio data packet + return(-1); + } + + // read our mode and pre/post windowsize + int _mode=opb.read(vd.modebits); + if(_mode==-1)return(-1); + + mode=_mode; + W=vi.mode_param[mode].blockflag; + if(W!=0) + { + lW=opb.read(1); + nW=opb.read(1); + if(nW==-1) return(-1); + } + else + { + lW=0; + nW=0; + } + + // more setup + granulepos=op.granulepos; + sequence=op.packetno-3; // first block is third packet + eofflag=op.e_o_s; + + // alloc pcm passback storage + pcmend=vi.blocksizes[W]; + //pcm=alloc(vi.channels); + if(pcm.Length + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; +using System.Runtime.CompilerServices; +using csogg; + +namespace csvorbis +{ + class CodeBook + { + internal int dim; // codebook dimensions (elements per vector) + internal int entries; // codebook entries + internal StaticCodeBook c=new StaticCodeBook(); + + internal float[] valuelist; // list of dim*entries actual entry values + internal int[] codelist; // list of bitstream codewords for each entry + internal DecodeAux decode_tree; + + // returns the number of bits + internal int encode(int a, csBuffer b) + { + b.write(codelist[a], c.lengthlist[a]); + return(c.lengthlist[a]); + } + + // One the encode side, our vector writers are each designed for a + // specific purpose, and the encoder is not flexible without modification: + // + // The LSP vector coder uses a single stage nearest-match with no + // interleave, so no step and no error return. This is specced by floor0 + // and doesn't change. + // + // Residue0 encoding interleaves, uses multiple stages, and each stage + // peels of a specific amount of resolution from a lattice (thus we want + // to match by threshhold, not nearest match). Residue doesn't *have* to + // be encoded that way, but to change it, one will need to add more + // infrastructure on the encode side (decode side is specced and simpler) + + // floor0 LSP (single stage, non interleaved, nearest match) + // returns entry number and *modifies a* to the quantization value + internal int errorv(float[] a) + { + int bestt=best(a,1); + for(int k=0;k8) + { + for(i=0;i + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; + +namespace csvorbis +{ + class Drft + { + int n; + float[] trigcache; + int[] splitcache; + + internal void backward(float[] data) + { + if(n==1)return; + drftb1(n,data,trigcache,trigcache,n,splitcache); + } + + internal void init(int n) + { + this.n=n; + trigcache=new float[3*n]; + splitcache=new int[32]; + fdrffti(n, trigcache, splitcache); + } + + internal void clear() + { + if(trigcache!=null)trigcache=null; + if(splitcache!=null)splitcache=null; + } + + static int[] ntryh = { 4,2,3,5 }; + static float tpi = 6.28318530717958647692528676655900577f; + static float hsqt2 = .70710678118654752440084436210485f; + static float taui = .86602540378443864676372317075293618f; + static float taur = -.5f; + static float sqrt2 = 1.4142135623730950488016887242097f; + + static void drfti1(int n, float[] wa, int index, int[] ifac) + { + float arg,argh,argld,fi; + int ntry=0,i,j=-1; + int k1, l1, l2, ib; + int ld, ii, ip, iis, nq, nr; + int ido, ipm, nfm1; + int nl=n; + int nf=0; + + + L101: j++; + if (j < 4) + ntry=ntryh[j]; + else + ntry+=2; + + L104: nq=nl/ntry; + nr=nl-ntry*nq; + if(nr!=0) goto L101; + + nf++; + ifac[nf+1]=ntry; + nl=nq; + if(ntry!=2) goto L107; + if(nf==1) goto L107; + + for(i=1;i>1; + ipp2=ip; + idp2=ido; + nbd=(ido-1)>>1; + t0=l1*ido; + t10=ip*ido; + + if(ido==1) goto L119; + for(ik=0;ikl1) + { + for(j=1;j>1); + ipp2=ip; + ipph=(int)((uint)(ip+1)>>1); + if(idol1) goto L139; + + iis= -ido-1; + t1=0; + for(j=1;j + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; +using csogg; +using csvorbis; + +namespace csvorbis +{ + public class DspState + { + static float M_PI=3.1415926539f; + static int VI_TRANSFORMB=1; + static int VI_WINDOWB=1; + + internal int analysisp; + internal Info vi; + internal int modebits; + + float[][] pcm; + //float[][] pcmret; + int pcm_storage; + int pcm_current; + int pcm_returned; + + float[] multipliers; + int envelope_storage; + int envelope_current; + + int eofflag; + + int lW; + int W; + int nW; + int centerW; + + long granulepos; + public long sequence; + + long glue_bits; + long time_bits; + long floor_bits; + long res_bits; + + // local lookup storage + //!! Envelope ve=new Envelope(); // envelope + //float **window[2][2][2]; // block, leadin, leadout, type + internal float[][][][][] wnd; // block, leadin, leadout, type + //vorbis_look_transform **transform[2]; // block, type + internal Object[][] transform; + internal CodeBook[] fullbooks; + // backend lookups are tied to the mode, not the backend or naked mapping + internal Object[] mode; + + // local storage, only used on the encoding side. This way the + // application does not need to worry about freeing some packets' + // memory and not others'; packet storage is always tracked. + // Cleared next call to a _dsp_ function + byte[] header; + byte[] header1; + byte[] header2; + + public DspState() + { + transform=new Object[2][]; + wnd=new float[2][][][][]; + wnd[0]=new float[2][][][]; + wnd[0][0]=new float[2][][]; + wnd[0][1]=new float[2][][]; + wnd[0][0][0]=new float[2][]; + wnd[0][0][1]=new float[2][]; + wnd[0][1][0]=new float[2][]; + wnd[0][1][1]=new float[2][]; + wnd[1]=new float[2][][][]; + wnd[1][0]=new float[2][][]; + wnd[1][1]=new float[2][][]; + wnd[1][0][0]=new float[2][]; + wnd[1][0][1]=new float[2][]; + wnd[1][1][0]=new float[2][]; + wnd[1][1][1]=new float[2][]; + } + + private static int ilog2(int v) + { + int ret=0; + while(v>1) + { + ret++; + v = (int)((uint)v >> 1); + } + return(ret); + } + + internal static float[] window(int type, int wnd, int left, int right) + { + float[] ret=new float[wnd]; + switch(type) + { + case 0: + // The 'vorbis window' (window 0) is sin(sin(x)*sin(x)*2pi) + { + int leftbegin=wnd/4-left/2; + int rightbegin=wnd-wnd/4-right/2; + + for(int i=0;ivi.blocksizes[1]/2 && pcm_returned>8192) + { + // don't shift too much; we need to have a minimum PCM buffer of + // 1/2 long block + + int shiftPCM=centerW-vi.blocksizes[1]/2; + shiftPCM=(pcm_returnedpcm_storage) + { + // expand the storage + pcm_storage=endW+vi.blocksizes[1]; + for(int i=0;igranulepos. + // + // This is not foolproof! It will be confused if we begin + // decoding at the last page after a seek or hole. In that case, + // we don't have a starting point to judge where the last frame + // is. For this reason, vorbisfile will always try to make sure + // it reads the last two marked pages in proper sequence + + if(granulepos==-1) + { + granulepos=vb.granulepos; + } + else + { + granulepos+=(_centerW-centerW); + if(vb.granulepos!=-1 && granulepos!=vb.granulepos) + { + if(granulepos>vb.granulepos && vb.eofflag!=0) + { + // partial last frame. Strip the padding off + _centerW = _centerW - (int)(granulepos-vb.granulepos); + }// else{ Shouldn't happen *unless* the bitstream is out of + // spec. Either way, believe the bitstream } + granulepos=vb.granulepos; + } + } + + // Update, cleanup + + centerW=_centerW; + pcm_current=endW; + if(vb.eofflag!=0)eofflag=1; + } + return(0); + } + + // pcm==NULL indicates we just want the pending samples, no more + public int synthesis_pcmout(float[][][] _pcm, int[] index) + { + if(pcm_returnedcenterW)return(-1); + pcm_returned+=bytes; + return(0); + } + + public void clear() + { + } + } +} \ No newline at end of file diff --git a/Support/OggUtils/csvorbis/EncodeAuxNearestMatch.cs b/Support/OggUtils/csvorbis/EncodeAuxNearestMatch.cs new file mode 100644 index 00000000..8e513a3f --- /dev/null +++ b/Support/OggUtils/csvorbis/EncodeAuxNearestMatch.cs @@ -0,0 +1,40 @@ +/* csvorbis + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; + +namespace csvorbis +{ + class EncodeAuxNearestMatch + { + internal int[] ptr0; + internal int[] ptr1; + + internal int[] p; // decision points (each is an entry) + internal int[] q; // decision points (each is an entry) + internal int aux; // number of tree entries + internal int alloc; + } +} diff --git a/Support/OggUtils/csvorbis/EncodeAuxThreshMatch.cs b/Support/OggUtils/csvorbis/EncodeAuxThreshMatch.cs new file mode 100644 index 00000000..933e5519 --- /dev/null +++ b/Support/OggUtils/csvorbis/EncodeAuxThreshMatch.cs @@ -0,0 +1,37 @@ +/* csvorbis + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; + +namespace csvorbis +{ + class EncodeAuxThreshMatch + { + internal float[] quantthresh; + internal int[] quantmap; + internal int quantvals; + internal int threshvals; + } +} \ No newline at end of file diff --git a/Support/OggUtils/csvorbis/Floor0.cs b/Support/OggUtils/csvorbis/Floor0.cs new file mode 100644 index 00000000..d49bcc0d --- /dev/null +++ b/Support/OggUtils/csvorbis/Floor0.cs @@ -0,0 +1,405 @@ +/* csvorbis + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; +using csogg; + +namespace csvorbis +{ + class Floor0 : FuncFloor + { + + override public void pack(Object i, csBuffer opb) + { + InfoFloor0 info=(InfoFloor0)i; + opb.write(info.order,8); + opb.write(info.rate,16); + opb.write(info.barkmap,16); + opb.write(info.ampbits,6); + opb.write(info.ampdB,8); + opb.write(info.numbooks-1,4); + for(int j=0;j=vi.books) + { + //free_info(info); + return(null); + } + } + return(info); + // err_out: + // free_info(info); + // return(NULL); + } + override public Object look(DspState vd, InfoMode mi, Object i) + { + float scale; + + Info vi=vd.vi; + InfoFloor0 info=(InfoFloor0)i; + LookFloor0 look=new LookFloor0(); + look.m=info.order; + look.n=vi.blocksizes[mi.blockflag]/2; + look.ln=info.barkmap; + look.vi=info; + look.lpclook.init(look.ln,look.m); + + // we choose a scaling constant so that: + // floor(bark(rate/2-1)*C)=mapped-1 + // floor(bark(rate/2)*C)=mapped + scale = look.ln / (float)toBARK((float)(info.rate/2.0)); + + // the mapping from a linear scale to a smaller bark scale is + // straightforward. We do *not* make sure that the linear mapping + // does not skip bark-scale bins; the decoder simply skips them and + // the encoder may do what it wishes in filling them. They're + // necessary in some mapping combinations to keep the scale spacing + // accurate + look.linearmap=new int[look.n]; + + for(int j=0; j=look.ln) val=look.ln; // guard against the approximation + look.linearmap[j]=val; + } + return look; + } + + static double toBARK(float f) + { + double a,b,c; + a = 13.1 * Math.Atan(0.00074 * f); + b = 2.24 * Math.Atan(f * f * 1.85e-8); + c = 1.0e-4 * f; + + return (a + b + c); + } + + private object state(object i) + { + EchstateFloor0 state=new EchstateFloor0(); + InfoFloor0 info=(InfoFloor0)i; + + // a safe size if usually too big (dim==1) + state.codewords=new int[info.order]; + state.curve=new float[info.barkmap]; + state.frameno=-1; + return(state); + } + override public void free_info(Object i){} + override public void free_look(Object i){} + override public void free_state(Object vs){} + override public int forward(Block vb, Object i, float[] fin, float[] fout, Object vs){return 0;} + + float[] lsp=null; + int inverse(Block vb, Object i, float[] fout) + { + //System.err.println("Floor0.inverse "+i.getClass()+"]"); + LookFloor0 look=(LookFloor0)i; + InfoFloor0 info=look.vi; + int ampraw=vb.opb.read(info.ampbits); + if(ampraw>0) + { // also handles the -1 out of data case + int maxval=(1<m); + for(int j=0; jn); + for(int k=0; kn); + return(0); + } + + override public Object inverse1(Block vb, Object i, Object memo) + { + //System.err.println("Floor0.inverse "+i.getClass()+"]"); + LookFloor0 look=(LookFloor0)i; + InfoFloor0 info=look.vi; + float[] lsp=null; + if(memo is float[]) + { + lsp=(float[])memo; + } + + int ampraw=vb.opb.read(info.ampbits); + if(ampraw>0) + { // also handles the -1 out of data case + int maxval=(1<n); + for(int j=0; j> 1); + } + return(ret); + } + + static void lsp_to_lpc(float[] lsp, float[] lpc, int m) + { + int i,j,m2=m/2; + float[] O=new float[m2]; + float[] E=new float[m2]; + float A; + float[] Ae=new float[m2+1]; + float[] Ao=new float[m2+1]; + float B; + float[] Be=new float[m2]; + float[] Bo=new float[m2]; + float temp; + + // even/odd roots setup + for(i=0;im+1 must be less than l->ln, but guard in case we get a bad stream + float[] lcurve=new float[Math.Max(l.ln*2,l.m*2+2)]; + + if(amp==0) + { + //memset(curve,0,sizeof(float)*l->n); + for(int j=0; j + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; +using csogg; + +namespace csvorbis +{ + class Floor1 : FuncFloor + { + static int floor1_rangedb=140; + static int VIF_POSIT=63; + + override public void pack(Object i, csBuffer opb) + { + InfoFloor1 info=(InfoFloor1)i; + + int count=0; + int rangebits; + int maxposit=info.postlist[1]; + int maxclass=-1; + + /* save out partitions */ + opb.write(info.partitions,5); /* only 0 to 31 legal */ + for(int j=0;j=vi.books) + { + //goto err_out; + info.free(); + return(null); + } + for(int k=0;k<(1<=vi.books) + { + //goto err_out; + info.free(); + return(null); + } + } + } + + /* read the post list */ + info.mult=opb.read(2)+1; /* only 1,2,3,4 legal now */ + rangebits=opb.read(4); + + for(int j=0,k=0;j=(1<info.postlist[sortpointer[k]]) + { + foo=sortpointer[k]; + sortpointer[k]=sortpointer[j]; + sortpointer[j]=foo; + } + } + } + + /* points from sort order back to range number */ + for(int j=0;j<_n;j++) + { + look.forward_index[j]=sortpointer[j]; + } + /* points from range order to sorted position */ + for(int j=0;j<_n;j++) + { + look.reverse_index[look.forward_index[j]]=j; + } + /* we actually need the post values too */ + for(int j=0;j<_n;j++) + { + look.sorted_index[j]=info.postlist[look.forward_index[j]]; + } + + + /* quantize values to multiplier spec */ + switch(info.mult) + { + case 1: /* 1024 -> 256 */ + look.quant_q=256; + break; + case 2: /* 1024 -> 128 */ + look.quant_q=128; + break; + case 3: /* 1024 -> 86 */ + look.quant_q=86; + break; + case 4: /* 1024 -> 64 */ + look.quant_q=64; + break; + default: + look.quant_q=-1; + break; + } + + /* discover our neighbors for decode where we don't use fit flags + (that would push the neighbors outward) */ + for(int j=0;j<_n-2;j++) + { + int lo=0; + int hi=1; + int lx=0; + int hx=look.n; + int currentx=info.postlist[j+2]; + for(int k=0;klx && xcurrentx) + { + hi=k; + hx=x; + } + } + look.loneighbor[j]=lo; + look.hineighbor[j]=hi; + } + + return look; + } + + override public void free_info(Object i){} + override public void free_look(Object i){} + override public void free_state(Object vs){} + + override public int forward(Block vb, Object i, float[] fin, float[] fout, Object vs){return 0;} + + override public Object inverse1(Block vb, Object ii, Object memo) + { + LookFloor1 look=(LookFloor1)ii; + InfoFloor1 info=look.vi; + CodeBook[] books=vb.vd.fullbooks; + + /* unpack wrapped/predicted values from stream */ + if(vb.opb.read(1)==1) + { + int[] fit_value=null; + if(memo is int[]) + { + fit_value=(int[])memo; + } + if(fit_value==null || fit_value.Length> csubbits); + if(book>=0) + { + if((fit_value[j+k]=books[book].decode(vb.opb))==-1) + { + return(null); + } + } + else + { + fit_value[j+k]=0; + } + } + j+=cdim; + } + + /* unwrap positive values and reconsitute via linear interpolation */ + for(int i=2;i=room) + { + if(hiroom>loroom) + { + val = val-loroom; + } + else + { + val = -1-(val-hiroom); + } + } + else + { + if((val&1)!=0) + { + val= (int)(-((uint)(val+1) >> 1)); + } + else + { + val>>=1; + } + } + + fit_value[i]=val+predicted; + fit_value[look.loneighbor[i-2]]&=0x7fff; + fit_value[look.hineighbor[i-2]]&=0x7fff; + } + else + { + fit_value[i]=predicted|0x8000; + } + } + return(fit_value); + } + + // eop: + // return(NULL); + return(null); + } + + private static int render_point(int x0,int x1,int y0,int y1,int x) + { + y0&=0x7fff; /* mask off flag */ + y1&=0x7fff; + + { + int dy=y1-y0; + int adx=x1-x0; + int ady=Math.Abs(dy); + int err=ady*(x-x0); + + int off=(int)(err/adx); + if(dy<0)return(y0-off); + return(y0+off); + } + } + + override public int inverse2(Block vb, Object i, Object memo, float[] fout) + { + LookFloor1 look=(LookFloor1)i; + InfoFloor1 info=look.vi; + int n=vb.vd.vi.blocksizes[vb.mode]/2; + + if(memo!=null) + { + /* render the lines */ + int[] fit_value=(int[] )memo; + int hx=0; + int lx=0; + int ly=fit_value[0]*info.mult; + for(int j=1;j=adx) + { + err-=adx; + y+=sy; + } + else + { + y+=bbase; + } + d[x]*=FLOOR_fromdB_LOOKUP[y]; + } + } + + static int ilog(int v) + { + int ret=0; + while(v!=0) + { + ret++; + v = (int)((uint)v >> 1); + } + return(ret); + } + + private static int ilog2(int v) + { + int ret=0; + while(v>1) + { + ret++; + v = (int)((uint)v >> 1); + } + return(ret); + } + } + + class InfoFloor1 + { + const int VIF_POSIT=63; + const int VIF_CLASS=16; + const int VIF_PARTS=31; + + internal int partitions; /* 0 to 31 */ + internal int[] partitionclass=new int[VIF_PARTS]; /* 0 to 15 */ + + internal int[] class_dim=new int[VIF_CLASS]; /* 1 to 8 */ + internal int[] class_subs=new int[VIF_CLASS]; /* 0,1,2,3 (bits: 1< + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; +using csogg; + +namespace csvorbis +{ + abstract class FuncFloor + { + public static FuncFloor[] floor_P={new Floor0(),new Floor1()}; + + public abstract void pack(Object i, csBuffer opb); + public abstract Object unpack(Info vi, csBuffer opb); + public abstract Object look(DspState vd, InfoMode mi, Object i); + public abstract void free_info(Object i); + public abstract void free_look(Object i); + public abstract void free_state(Object vs); + public abstract int forward(Block vb, Object i, float[] fin, float[] fout, Object vs); + public abstract Object inverse1(Block vb, Object i, Object memo); + public abstract int inverse2(Block vb, Object i, Object memo, float[] fout); + } +} diff --git a/Support/OggUtils/csvorbis/FuncMapping.cs b/Support/OggUtils/csvorbis/FuncMapping.cs new file mode 100644 index 00000000..78ac0474 --- /dev/null +++ b/Support/OggUtils/csvorbis/FuncMapping.cs @@ -0,0 +1,42 @@ +/* csvorbis + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; +using csogg; + +namespace csvorbis +{ + abstract class FuncMapping + { + public static FuncMapping[] mapping_P={new Mapping0()}; + + public abstract void pack(Info info , Object imap, csBuffer buffer); + public abstract Object unpack(Info info , csBuffer buffer); + public abstract Object look(DspState vd, InfoMode vm, Object m); + public abstract void free_info(Object imap); + public abstract void free_look(Object imap); + public abstract int inverse(Block vd, Object lm); + } +} \ No newline at end of file diff --git a/Support/OggUtils/csvorbis/FuncResidue.cs b/Support/OggUtils/csvorbis/FuncResidue.cs new file mode 100644 index 00000000..c3313145 --- /dev/null +++ b/Support/OggUtils/csvorbis/FuncResidue.cs @@ -0,0 +1,46 @@ +/* csvorbis + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; +using csogg; + +namespace csvorbis +{ + abstract class FuncResidue + { + public static FuncResidue[] residue_P={new Residue0(), + new Residue1(), + new Residue2()}; + + public abstract void pack(Object vr, csBuffer opb); + public abstract Object unpack(Info vi, csBuffer opb); + public abstract Object look(DspState vd, InfoMode vm, Object vr); + public abstract void free_info(Object i); + public abstract void free_look(Object i); + public abstract int forward(Block vb,Object vl, float[][] fin, int ch); + + public abstract int inverse(Block vb, Object vl, float[][] fin, int[] nonzero,int ch); + } +} \ No newline at end of file diff --git a/Support/OggUtils/csvorbis/FuncTime.cs b/Support/OggUtils/csvorbis/FuncTime.cs new file mode 100644 index 00000000..11b2c424 --- /dev/null +++ b/Support/OggUtils/csvorbis/FuncTime.cs @@ -0,0 +1,43 @@ +/* csvorbis + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; +using csogg; + +namespace csvorbis +{ + abstract class FuncTime + { + public static FuncTime[] time_P={new Time0()}; + + public abstract void pack(Object i, csBuffer opb); + public abstract Object unpack(Info vi , csBuffer opb); + public abstract Object look(DspState vd, InfoMode vm, Object i); + public abstract void free_info(Object i); + public abstract void free_look(Object i); + public abstract int forward(Block vb, Object i); + public abstract int inverse(Block vb, Object i, float[] fin, float[] fout); + } +} \ No newline at end of file diff --git a/Support/OggUtils/csvorbis/Info.cs b/Support/OggUtils/csvorbis/Info.cs new file mode 100644 index 00000000..cc1d3c47 --- /dev/null +++ b/Support/OggUtils/csvorbis/Info.cs @@ -0,0 +1,574 @@ +/* csvorbis +* Copyright (C) 2000 ymnk, JCraft,Inc. +* +* Written by: 2000 ymnk +* Ported to C# from JOrbis by: Mark Crichton +* +* Thanks go to the JOrbis team, for licencing the code under the +* LGPL, making my job a lot easier. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU Library General Public License +* as published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. + +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Library General Public License for more details. +* +* You should have received a copy of the GNU Library General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +using System; +using System.Text; +using csogg; + +namespace csvorbis +{ + public class Info + { + private static int OV_EBADPACKET=-136; + private static int OV_ENOTAUDIO=-135; + private static string _vorbis="vorbis"; + private static int VI_TIMEB=1; + private static int VI_FLOORB=2; + private static int VI_RESB=3; + private static int VI_MAPB=1; + private static int VI_WINDOWB=1; + + public int version; + public int channels; + public int rate; + + // The below bitrate declarations are *hints*. + // Combinations of the three values carry the following implications: + // + // all three set to the same value: + // implies a fixed rate bitstream + // only nominal set: + // implies a VBR stream that averages the nominal bitrate. No hard + // upper/lower limit + // upper and or lower set: + // implies a VBR bitstream that obeys the bitrate limits. nominal + // may also be set to give a nominal rate. + // none set: + // the coder does not care to speculate. + + internal int bitrate_upper; + internal int bitrate_nominal; + internal int bitrate_lower; + + // Vorbis supports only short and long blocks, but allows the + // encoder to choose the sizes + + internal int[] blocksizes=new int[2]; + + // modes are the primary means of supporting on-the-fly different + // blocksizes, different channel mappings (LR or mid-side), + // different residue backends, etc. Each mode consists of a + // blocksize flag and a mapping (along with the mapping setup + + internal int modes; + internal int maps; + internal int times; + internal int floors; + internal int residues; + internal int books; + internal int psys; // encode only + + internal InfoMode[] mode_param=null; + + internal int[] map_type=null; + internal Object[] map_param=null; + + internal int[] time_type=null; + internal Object[] time_param=null; + + internal int[] floor_type=null; + internal Object[] floor_param=null; + + internal int[] residue_type=null; + internal Object[] residue_param=null; + + internal StaticCodeBook[] book_param=null; + + internal PsyInfo[] psy_param=new PsyInfo[64]; // encode only + + // for block long/sort tuning; encode only + //internal int envelopesa; + //internal float preecho_thresh; + //internal float preecho_clamp; + + // used by synthesis, which has a full, alloced vi + public void init() + { + rate=0; + //memset(vi,0,sizeof(vorbis_info)); + } + + public void clear() + { + for(int i=0;ibook_param)free(vi->book_param); + book_param=null; + + for(int i=0;ipsy_param)free(vi->psy_param); + //memset(vi,0,sizeof(vorbis_info)); + } + + // Header packing/unpacking + int unpack_info(csBuffer opb) + { + version=opb.read(32); + if(version!=0)return(-1); + + channels=opb.read(8); + rate=opb.read(32); + + bitrate_upper=opb.read(32); + bitrate_nominal=opb.read(32); + bitrate_lower=opb.read(32); + + blocksizes[0]=1<=VI_TIMEB) + { + //goto err_out; + clear(); + return(-1); + } + time_param[i]=FuncTime.time_P[time_type[i]].unpack(this, opb); + if(time_param[i]==null) + { + //goto err_out; + clear(); + return(-1); + } + } + + // floor backend settings + floors=opb.read(6)+1; + if(floor_type==null || floor_type.Length!=floors) + floor_type=new int[floors]; + if(floor_param==null || floor_param.Length!=floors) + floor_param=new Object[floors]; + + for(int i=0;i=VI_FLOORB) + { + //goto err_out; + clear(); + return(-1); + } + + floor_param[i]=FuncFloor.floor_P[floor_type[i]].unpack(this,opb); + if(floor_param[i]==null) + { + //goto err_out; + clear(); + return(-1); + } + } + + // residue backend settings + residues=opb.read(6)+1; + + if(residue_type==null || residue_type.Length!=residues) + residue_type=new int[residues]; + + if(residue_param==null || residue_param.Length!=residues) + residue_param=new Object[residues]; + + for(int i=0;i=VI_RESB) + { + // goto err_out; + clear(); + return(-1); + } + residue_param[i]=FuncResidue.residue_P[residue_type[i]].unpack(this,opb); + if(residue_param[i]==null) + { + // goto err_out; + clear(); + return(-1); + } + } + + // map backend settings + maps=opb.read(6)+1; + if(map_type==null || map_type.Length!=maps) map_type=new int[maps]; + if(map_param==null || map_param.Length!=maps) map_param=new Object[maps]; + for(int i=0;i=VI_MAPB) + { + // goto err_out; + clear(); + return(-1); + } + map_param[i]=FuncMapping.mapping_P[map_type[i]].unpack(this,opb); + if(map_param[i]==null) + { + // goto err_out; + clear(); + return(-1); + } + } + + // mode settings + modes=opb.read(6)+1; + if(mode_param==null || mode_param.Length!=modes) + mode_param=new InfoMode[modes]; + for(int i=0;i=VI_WINDOWB)|| + (mode_param[i].transformtype>=VI_WINDOWB)|| + (mode_param[i].mapping>=maps)) + { + // goto err_out; + clear(); + return(-1); + } + } + + if(opb.read(1)!=1) + { + //goto err_out; // top level EOP check + clear(); + return(-1); + } + + return(0); + // err_out: + // vorbis_info_clear(vi); + // return(-1); + } + + // The Vorbis header is in three packets; the initial small packet in + // the first page that identifies basic parameters, a second packet + // with bitstream comments and a third packet that holds the + // codebook. + + public int synthesis_headerin(Comment vc, Packet op) + { + csBuffer opb=new csBuffer(); + + if(op!=null) + { + opb.readinit(op.packet_base, op.packet, op.bytes); + + // Which of the three types of header is this? + // Also verify header-ness, vorbis + { + byte[] buffer=new byte[6]; + int packtype=opb.read(8); + //memset(buffer,0,6); + opb.read(buffer,6); + if(buffer[0]!='v' || buffer[1]!='o' || buffer[2]!='r' || + buffer[3]!='b' || buffer[4]!='i' || buffer[5]!='s') + { + // not a vorbis header + return(-1); + } + switch(packtype) + { + case 0x01: // least significant *bit* is read first + if(op.b_o_s==0) + { + // Not the initial packet + return(-1); + } + if(rate!=0) + { + // previously initialized info header + return(-1); + } + return(unpack_info(opb)); + case 0x03: // least significant *bit* is read first + if(rate==0) + { + // um... we didn't get the initial header + return(-1); + } + return(vc.unpack(opb)); + case 0x05: // least significant *bit* is read first + if(rate==0 || vc.vendor==null) + { + // um... we didn;t get the initial header or comments yet + return(-1); + } + return(unpack_books(opb)); + default: + // Not a valid vorbis header type + //return(-1); + break; + } + } + } + return(-1); + } + + // pack side + int pack_info(csBuffer opb) + { + Encoding AE = Encoding.UTF8; + byte[] _vorbis_byt = AE.GetBytes(_vorbis); + + // preamble + opb.write(0x01,8); + opb.write(_vorbis_byt); + + // basic information about the stream + opb.write(0x00,32); + opb.write(channels,8); + opb.write(rate,32); + + opb.write(bitrate_upper,32); + opb.write(bitrate_nominal,32); + opb.write(bitrate_lower,32); + + opb.write(ilog2(blocksizes[0]),4); + opb.write(ilog2(blocksizes[1]),4); + opb.write(1,1); + return(0); + } + + int pack_books(csBuffer opb) + { + Encoding AE = Encoding.UTF8; + byte[] _vorbis_byt = AE.GetBytes(_vorbis); + + opb.write(0x05,8); + opb.write(_vorbis_byt); + + // books + opb.write(books-1,8); + for(int i=0;icodec_setup; + csBuffer opb=new csBuffer(); + // synchronized(opb_blocksize){ + int mode; + + opb.readinit(op.packet_base, op.packet, op.bytes); + + /* Check the packet type */ + if(opb.read(1)!=0) + { + /* Oops. This is not an audio data packet */ + return(OV_ENOTAUDIO); + } + { + int modebits=0; + int v=modes; + while(v>1) + { + modebits++; + v = (int)((uint)v >> 1); + } + + /* read our mode and pre/post windowsize */ + mode=opb.read(modebits); + } + if(mode==-1)return(OV_EBADPACKET); + return(blocksizes[mode_param[mode].blockflag]); + // } + } + + private static int ilog2(int v) + { + int ret=0; + while(v>1) + { + ret++; + v = (int)((uint)v >> 1); + } + return(ret); + } + + public String toString() + { + return "version:"+ version.ToString() + + ", channels:"+ channels.ToString() + + ", rate:"+ rate.ToString() + + ", bitrate:"+ bitrate_upper.ToString() +","+ + bitrate_nominal.ToString() +","+ + bitrate_lower.ToString(); + } + } +} diff --git a/Support/OggUtils/csvorbis/InfoMode.cs b/Support/OggUtils/csvorbis/InfoMode.cs new file mode 100644 index 00000000..4450b2e7 --- /dev/null +++ b/Support/OggUtils/csvorbis/InfoMode.cs @@ -0,0 +1,38 @@ +/* csvorbis + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; +using csogg; + +namespace csvorbis +{ + class InfoMode + { + internal int blockflag; + internal int windowtype; + internal int transformtype; + internal int mapping; + } +} \ No newline at end of file diff --git a/Support/OggUtils/csvorbis/Lookup.cs b/Support/OggUtils/csvorbis/Lookup.cs new file mode 100644 index 00000000..2a6f5f16 --- /dev/null +++ b/Support/OggUtils/csvorbis/Lookup.cs @@ -0,0 +1,161 @@ +/* csvorbis + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; +using csogg; + +namespace csvorbis +{ + class Lookup + { + static int COS_LOOKUP_SZ=128; + static float[] COS_LOOKUP={ + +1.0000000000000f,+0.9996988186962f,+0.9987954562052f,+0.9972904566787f, + +0.9951847266722f,+0.9924795345987f,+0.9891765099648f,+0.9852776423889f, + +0.9807852804032f,+0.9757021300385f,+0.9700312531945f,+0.9637760657954f, + +0.9569403357322f,+0.9495281805930f,+0.9415440651830f,+0.9329927988347f, + +0.9238795325113f,+0.9142097557035f,+0.9039892931234f,+0.8932243011955f, + +0.8819212643484f,+0.8700869911087f,+0.8577286100003f,+0.8448535652497f, + +0.8314696123025f,+0.8175848131516f,+0.8032075314806f,+0.7883464276266f, + +0.7730104533627f,+0.7572088465065f,+0.7409511253550f,+0.7242470829515f, + +0.7071067811865f,+0.6895405447371f,+0.6715589548470f,+0.6531728429538f, + +0.6343932841636f,+0.6152315905806f,+0.5956993044924f,+0.5758081914178f, + +0.5555702330196f,+0.5349976198871f,+0.5141027441932f,+0.4928981922298f, + +0.4713967368260f,+0.4496113296546f,+0.4275550934303f,+0.4052413140050f, + +0.3826834323651f,+0.3598950365350f,+0.3368898533922f,+0.3136817403989f, + +0.2902846772545f,+0.2667127574749f,+0.2429801799033f,+0.2191012401569f, + +0.1950903220161f,+0.1709618887603f,+0.1467304744554f,+0.1224106751992f, + +0.0980171403296f,+0.0735645635997f,+0.0490676743274f,+0.0245412285229f, + +0.0000000000000f,-0.0245412285229f,-0.0490676743274f,-0.0735645635997f, + -0.0980171403296f,-0.1224106751992f,-0.1467304744554f,-0.1709618887603f, + -0.1950903220161f,-0.2191012401569f,-0.2429801799033f,-0.2667127574749f, + -0.2902846772545f,-0.3136817403989f,-0.3368898533922f,-0.3598950365350f, + -0.3826834323651f,-0.4052413140050f,-0.4275550934303f,-0.4496113296546f, + -0.4713967368260f,-0.4928981922298f,-0.5141027441932f,-0.5349976198871f, + -0.5555702330196f,-0.5758081914178f,-0.5956993044924f,-0.6152315905806f, + -0.6343932841636f,-0.6531728429538f,-0.6715589548470f,-0.6895405447371f, + -0.7071067811865f,-0.7242470829515f,-0.7409511253550f,-0.7572088465065f, + -0.7730104533627f,-0.7883464276266f,-0.8032075314806f,-0.8175848131516f, + -0.8314696123025f,-0.8448535652497f,-0.8577286100003f,-0.8700869911087f, + -0.8819212643484f,-0.8932243011955f,-0.9039892931234f,-0.9142097557035f, + -0.9238795325113f,-0.9329927988347f,-0.9415440651830f,-0.9495281805930f, + -0.9569403357322f,-0.9637760657954f,-0.9700312531945f,-0.9757021300385f, + -0.9807852804032f,-0.9852776423889f,-0.9891765099648f,-0.9924795345987f, + -0.9951847266722f,-0.9972904566787f,-0.9987954562052f,-0.9996988186962f, + -1.0000000000000f, + }; + /* interpolated lookup based cos function, domain 0 to PI only */ + internal static float coslook(float a) + { + double d=a*(.31830989*(float)COS_LOOKUP_SZ); + int i=(int)d; + return COS_LOOKUP[i]+ ((float)(d-i))*(COS_LOOKUP[i+1]-COS_LOOKUP[i]); + } + + static int INVSQ_LOOKUP_SZ=32; + static float[] INVSQ_LOOKUP={ + 1.414213562373f,1.392621247646f,1.371988681140f,1.352246807566f, + 1.333333333333f,1.315191898443f,1.297771369046f,1.281025230441f, + 1.264911064067f,1.249390095109f,1.234426799697f,1.219988562661f, + 1.206045378311f,1.192569588000f,1.179535649239f,1.166919931983f, + 1.154700538379f,1.142857142857f,1.131370849898f,1.120224067222f, + 1.109400392450f,1.098884511590f,1.088662107904f,1.078719779941f, + 1.069044967650f,1.059625885652f,1.050451462878f,1.041511287847f, + 1.032795558989f,1.024295039463f,1.016001016002f,1.007905261358f, + 1.000000000000f, + }; + /* interpolated 1./sqrt(p) where .5 <= p < 1. */ + internal static float invsqlook(float a) + { + // System.out.println(a); + double d=a*(2.0f*(float)INVSQ_LOOKUP_SZ)-(float)INVSQ_LOOKUP_SZ; + int i=(int)d; + return INVSQ_LOOKUP[i]+ ((float)(d-i))*(INVSQ_LOOKUP[i+1]-INVSQ_LOOKUP[i]); + } + + static int INVSQ2EXP_LOOKUP_MIN=-32; + //static int INVSQ2EXP_LOOKUP_MAX=32; + static float[] INVSQ2EXP_LOOKUP={ + 65536.0f, 46340.95001f, 32768.0f, 23170.47501f, + 16384.0f, 11585.2375f, 8192.0f, 5792.618751f, + 4096.0f, 2896.309376f, 2048.0f, 1448.154688f, + 1024.0f, 724.0773439f, 512.0f, 362.038672f, + 256.0f, 181.019336f, 128.0f, 90.50966799f, + 64.0f, 45.254834f, 32.0f, 22.627417f, + 16.0f, 11.3137085f, 8.0f, 5.656854249f, + 4.0f, 2.828427125f, 2.0f, 1.414213562f, + 1.0f, 0.7071067812f, 0.5f, 0.3535533906f, + 0.25f, 0.1767766953f, 0.125f, 0.08838834765f, + 0.0625f, 0.04419417382f, 0.03125f, 0.02209708691f, + 0.015625f, 0.01104854346f, 0.0078125f, 0.005524271728f, + 0.00390625f, 0.002762135864f, 0.001953125f, 0.001381067932f, + 0.0009765625f, 0.000690533966f, 0.00048828125f, 0.000345266983f, + 0.000244140625f,0.0001726334915f,0.0001220703125f,8.631674575e-05f, + 6.103515625e-05f,4.315837288e-05f,3.051757812e-05f,2.157918644e-05f, + 1.525878906e-05f, + }; + /* interpolated 1./sqrt(p) where .5 <= p < 1. */ + internal static float invsq2explook(int a) + { + return INVSQ2EXP_LOOKUP[a-INVSQ2EXP_LOOKUP_MIN]; + } + + const int FROMdB_LOOKUP_SZ=35; + const int FROMdB2_LOOKUP_SZ=32; + const int FROMdB_SHIFT=5; + const int FROMdB2_SHIFT=3; + const int FROMdB2_MASK=31; + static float[] FROMdB_LOOKUP = { + 1.0f, 0.6309573445f, 0.3981071706f, 0.2511886432f, + 0.1584893192f, 0.1f, 0.06309573445f, 0.03981071706f, + 0.02511886432f, 0.01584893192f, 0.01f, 0.006309573445f, + 0.003981071706f, 0.002511886432f, 0.001584893192f, 0.001f, + 0.0006309573445f,0.0003981071706f,0.0002511886432f,0.0001584893192f, + 0.0001f,6.309573445e-05f,3.981071706e-05f,2.511886432e-05f, + 1.584893192e-05f, 1e-05f,6.309573445e-06f,3.981071706e-06f, + 2.511886432e-06f,1.584893192e-06f, 1e-06f,6.309573445e-07f, + 3.981071706e-07f,2.511886432e-07f,1.584893192e-07f, + }; + static float[] FROMdB2_LOOKUP = { + 0.9928302478f, 0.9786445908f, 0.9646616199f, 0.9508784391f, + 0.9372921937f, 0.92390007f, 0.9106992942f, 0.8976871324f, + 0.8848608897f, 0.8722179097f, 0.8597555737f, 0.8474713009f, + 0.835362547f, 0.8234268041f, 0.8116616003f, 0.8000644989f, + 0.7886330981f, 0.7773650302f, 0.7662579617f, 0.755309592f, + 0.7445176537f, 0.7338799116f, 0.7233941627f, 0.7130582353f, + 0.7028699885f, 0.6928273125f, 0.6829281272f, 0.6731703824f, + 0.6635520573f, 0.6540711597f, 0.6447257262f, 0.6355138211f, + }; + /* interpolated lookup based fromdB function, domain -140dB to 0dB only */ + internal static float fromdBlook(float a) + { + int i=(int)(a*((float)(-(1<=(FROMdB_LOOKUP_SZ<>FROMdB_SHIFT]*FROMdB2_LOOKUP[i&FROMdB2_MASK]); + } + + } +} diff --git a/Support/OggUtils/csvorbis/Lpc.cs b/Support/OggUtils/csvorbis/Lpc.cs new file mode 100644 index 00000000..2cd9b4cf --- /dev/null +++ b/Support/OggUtils/csvorbis/Lpc.cs @@ -0,0 +1,200 @@ +/* csvorbis + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; +using csogg; + +namespace csvorbis +{ + class Lpc + { + Drft fft=new Drft(); + + int ln; + int m; + + // Autocorrelation LPC coeff generation algorithm invented by + // N. Levinson in 1947, modified by J. Durbin in 1959. + + // Input : n elements of time doamin data + // Output: m lpc coefficients, excitation energy + + static float lpc_from_data(float[] data, float[] lpc,int n,int m) + { + float[] aut=new float[m+1]; + float error; + int i,j; + + // autocorrelation, p+1 lag coefficients + + j=m+1; + while(j--!=0) + { + float d=0.0F; + for(i=j;iln*2); + for(int i=0; i + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; +using System.Runtime.InteropServices; +using csogg; + +namespace csvorbis +{ + /* + function: LSP (also called LSF) conversion routines + + The LSP generation code is taken (with minimal modification) from + "On the Computation of the LSP Frequencies" by Joseph Rothweiler + , available at: + + http://www2.xtdl.com/~rothwlr/lsfpaper/lsfpage.html + ********************************************************************/ + + class Lsp + { + + [StructLayout(LayoutKind.Explicit, Size=32, CharSet=CharSet.Ansi)] + struct FloatHack + { + [FieldOffset(0)] public float fh_float; + [FieldOffset(0)] public int fh_int; + } + static float M_PI=(float)(3.1415926539); + + internal static void lsp_to_curve(float[] curve, + int[] map, int n, int ln, + float[] lsp, int m, + float amp, float ampoffset) + { + int i; + float wdel=M_PI/ln; + for(i=0;i> 1); + + for(int j=0;j=0x7f800000||(ix==0)) + { + // 0,inf,nan + } + else + { + if(ix<0x00800000) + { // subnormal + q*=3.3554432000e+07F; // 0x4c000000 + fh.fh_float = q; + hx=fh.fh_int; + ix=0x7fffffff&hx; + qexp=-25; + } + qexp += (int)(((uint)ix >> 23)-126); + hx=(int)((hx&0x807fffff)|0x3f000000); + fh.fh_int = hx; + q=fh.fh_float; + } + + q=Lookup.fromdBlook(amp* + Lookup.invsqlook(q)* + Lookup.invsq2explook(qexp+m)-ampoffset); + + do{curve[i]*=q; i++;} + // do{curve[i++]=q;} + while(i + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +using System; +using csogg; + +namespace csvorbis +{ + class Mapping0 : FuncMapping + { + //static int seq=0; + override public void free_info(Object imap){} + override public void free_look(Object imap){} + + override public Object look(DspState vd, InfoMode vm, Object m) + { + Info vi=vd.vi; + LookMapping0 looks=new LookMapping0(); + InfoMapping0 info=looks.map=(InfoMapping0)m; + looks.mode=vm; + + looks.time_look=new Object[info.submaps]; + looks.floor_look=new Object[info.submaps]; + looks.residue_look=new Object[info.submaps]; + + looks.time_func=new FuncTime[info.submaps]; + looks.floor_func=new FuncFloor[info.submaps]; + looks.residue_func=new FuncResidue[info.submaps]; + + for(int i=0;i1) + { + opb.write(1,1); + opb.write(info.submaps-1,4); + } + else + { + opb.write(0,1); + } + + if(info.coupling_steps>0) + { + opb.write(1,1); + opb.write(info.coupling_steps-1,8); + for(int i=0;i1) + { + for(int i=0;i=vi.channels || + testA>=vi.channels) + { + //goto err_out; + info.free(); + return(null); + } + } + } + + if(opb.read(2)>0) + { /* 2,3:reserved */ + //goto err_out; + info.free(); + return(null); + } + + if(info.submaps>1) + { + for(int i=0;i=info.submaps) + { + //goto err_out; + info.free(); + return(null); + } + } + } + + for(int i=0;i=vi.times) + { + //goto err_out; + info.free(); + return(null); + } + info.floorsubmap[i]=opb.read(8); + if(info.floorsubmap[i]>=vi.floors) + { + //goto err_out; + info.free(); + return(null); + } + info.residuesubmap[i]=opb.read(8); + if(info.residuesubmap[i]>=vi.residues) + { + //goto err_out; + info.free(); + return(null); + } + } + return info; + //err_out: + //free_info(info); + //return(NULL); + } + + + float[][] pcmbundle=null; + int[] zerobundle=null; + int[] nonzero=null; + Object[] floormemo=null; + + override public int inverse(Block vb, Object l) + { + lock(this) + { + //System.err.println("Mapping0.inverse"); + DspState vd=vb.vd; + Info vi=vd.vi; + LookMapping0 look=(LookMapping0)l; + InfoMapping0 info=look.map; + InfoMode mode=look.mode; + int n=vb.pcmend=vi.blocksizes[vb.W]; + + float[] window=vd.wnd[vb.W][vb.lW][vb.nW][mode.windowtype]; + // float[][] pcmbundle=new float[vi.channels][]; + // int[] nonzero=new int[vi.channels]; + if(pcmbundle==null || pcmbundle.Length=0;i--) + { + float[] pcmM=vb.pcm[info.coupling_mag[i]]; + float[] pcmA=vb.pcm[info.coupling_ang[i]]; + + for(int j=0;j0) + { + if(ang>0) + { + pcmM[j]=mag; + pcmA[j]=mag-ang; + } + else + { + pcmA[j]=mag; + pcmM[j]=mag+ang; + } + } + else + { + if(ang>0) + { + pcmM[j]=mag; + pcmA[j]=mag+ang; + } + else + { + pcmA[j]=mag; + pcmM[j]=mag-ang; + } + } + } + } + + // /* compute and apply spectral envelope */ + + for(int i=0;i1) + { + ret++; + v = (int)((uint)v >> 1); + } + return(ret); + } + } + + class InfoMapping0 + { + internal int submaps; // <= 16 + internal int[] chmuxlist=new int[256]; // up to 256 channels in a Vorbis stream + + internal int[] timesubmap=new int[16]; // [mux] + internal int[] floorsubmap=new int[16]; // [mux] submap to floors + internal int[] residuesubmap=new int[16];// [mux] submap to residue + internal int[] psysubmap=new int[16]; // [mux]; encode only + + internal int coupling_steps; + internal int[] coupling_mag=new int[256]; + internal int[] coupling_ang=new int[256]; + + internal void free() + { + chmuxlist=null; + timesubmap=null; + floorsubmap=null; + residuesubmap=null; + psysubmap=null; + + coupling_mag=null; + coupling_ang=null; + } + } + + class LookMapping0 + { + internal InfoMode mode; + internal InfoMapping0 map; + internal Object[] time_look; + internal Object[] floor_look; + //Object[] floor_state; + internal Object[] residue_look; + //PsyLook[] psy_look; + + internal FuncTime[] time_func; + internal FuncFloor[] floor_func; + internal FuncResidue[] residue_func; + + internal int ch; + //float[][] decay; + //int lastframe; // if a different mode is called, we need to + // invalidate decay and floor state + } +} \ No newline at end of file diff --git a/Support/OggUtils/csvorbis/Mdct.cs b/Support/OggUtils/csvorbis/Mdct.cs new file mode 100644 index 00000000..cacce9cc --- /dev/null +++ b/Support/OggUtils/csvorbis/Mdct.cs @@ -0,0 +1,274 @@ +/* csvorbis + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; +using System.Runtime.CompilerServices; +using csogg; + +namespace csvorbis +{ + class Mdct + { + + //static private float cPI3_8=0.38268343236508977175f; + //static private float cPI2_8=0.70710678118654752441f; + //static private float cPI1_8=0.92387953251128675613f; + + int n; + int log2n; + + float[] trig; + int[] bitrev; + + float scale; + + internal void init(int n) + { + bitrev=new int[n/4]; + trig=new float[n+n/4]; + + int n2=(int)((uint)n >> 1); + log2n=(int)Math.Round(Math.Log(n)/Math.Log(2)); + this.n=n; + + + int AE=0; + int AO=1; + int BE=AE+n/2; + int BO=BE+1; + int CE=BE+n/2; + int CO=CE+1; + // trig lookups... + for(int i=0;i> j) != 0; j++) + if(((((uint)msb>>j))&i) != 0) + acc |= 1 << j; + bitrev[i*2]=((~acc)&mask); + // bitrev[i*2]=((~acc)&mask)-1; + bitrev[i*2+1]=acc; + } + } + scale=4.0f/n; + } + + internal void clear() + { + } + + internal void forward(float[] fin, float[] fout) + { + } + + float[] _x=new float[1024]; + float[] _w=new float[1024]; + + + [MethodImpl(MethodImplOptions.Synchronized)] + internal void backward(float[] fin, float[] fout) + { + if(_x.Length < n/2){_x=new float[n/2];} + if(_w.Length < n/2){_w=new float[n/2];} + float[] x=_x; + float[] w=_w; + int n2=(int)((uint)n >> 1); + int n4=(int)((uint)n >> 2); + int n8=(int)((uint)n >> 3); + + // rotate + step 1 + { + int inO=1; + int xO=0; + int A=n2; + + int i; + for(i=0;i> (i+2)); + int k1=1 << (i+3); + int wbase=n2-2; + + A=0; + float[] temp; + + for(int r=0; r<((uint)k0>>2); r++) + { + int w1=wbase; + w2=w1-(k0>>1); + float AEv= trig[A],wA; + float AOv= trig[A+1],wB; + wbase-=2; + + k0++; + for(int s=0;s<(2< +* Ported to C# from JOrbis by: Mark Crichton +* +* Thanks go to the JOrbis team, for licencing the code under the +* LGPL, making my job a lot easier. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU Library General Public License +* as published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. + +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Library General Public License for more details. +* +* You should have received a copy of the GNU Library General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + + +using System; +using csogg; + +namespace csvorbis +{ + // psychoacoustic setup + class PsyInfo + { + //int athp; + //int decayp; + //int smoothp; + //int noisefitp; + //int noisefit_subblock; + //float noisefit_threshdB; + + //float ath_att; + + //int tonemaskp; + float[] toneatt_125Hz=new float[5]; + float[] toneatt_250Hz=new float[5]; + float[] toneatt_500Hz=new float[5]; + float[] toneatt_1000Hz=new float[5]; + float[] toneatt_2000Hz=new float[5]; + float[] toneatt_4000Hz=new float[5]; + float[] toneatt_8000Hz=new float[5]; + + //int peakattp; + float[] peakatt_125Hz=new float[5]; + float[] peakatt_250Hz=new float[5]; + float[] peakatt_500Hz=new float[5]; + float[] peakatt_1000Hz=new float[5]; + float[] peakatt_2000Hz=new float[5]; + float[] peakatt_4000Hz=new float[5]; + float[] peakatt_8000Hz=new float[5]; + + //int noisemaskp; + float[] noiseatt_125Hz=new float[5]; + float[] noiseatt_250Hz=new float[5]; + float[] noiseatt_500Hz=new float[5]; + float[] noiseatt_1000Hz=new float[5]; + float[] noiseatt_2000Hz=new float[5]; + float[] noiseatt_4000Hz=new float[5]; + float[] noiseatt_8000Hz=new float[5]; + + //float max_curve_dB; + + //float attack_coeff; + //float decay_coeff; + + internal void free(){} + } +} \ No newline at end of file diff --git a/Support/OggUtils/csvorbis/PsyLook.cs b/Support/OggUtils/csvorbis/PsyLook.cs new file mode 100644 index 00000000..9e1aa69f --- /dev/null +++ b/Support/OggUtils/csvorbis/PsyLook.cs @@ -0,0 +1,46 @@ +/* csvorbis + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +using System; +using csogg; + +namespace csvorbis +{ + class PsyLook + { + //int n; + //PsyInfo vi; + + //float[][][] tonecurves; + //float[][] peakatt; + //float[][][] noisecurves; + + //float[] ath; + //int[] octave; + + void init(PsyInfo vi, int n, int rate) + { + } + } +} \ No newline at end of file diff --git a/Support/OggUtils/csvorbis/Residue0.cs b/Support/OggUtils/csvorbis/Residue0.cs new file mode 100644 index 00000000..203197e4 --- /dev/null +++ b/Support/OggUtils/csvorbis/Residue0.cs @@ -0,0 +1,415 @@ +/* csvorbis + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +using System; +using System.Runtime.CompilerServices; +using csogg; + +namespace csvorbis +{ + class Residue0 : FuncResidue + { + override public void pack(Object vr, csBuffer opb) + { + InfoResidue0 info=(InfoResidue0)vr; + int acc=0; + opb.write(info.begin,24); + opb.write(info.end,24); + + opb.write(info.grouping-1,24); /* residue vectors to group and + code with a partitioned book */ + opb.write(info.partitions-1,6); /* possible partition choices */ + opb.write(info.groupbook,8); /* group huffman book */ + + /* secondstages is a bitmask; as encoding progresses pass by pass, a + bitmask of one indicates this partition class has bits to write + this pass */ + for(int j=0;j3) + { + /* yes, this is a minor hack due to not thinking ahead */ + opb.write(info.secondstages[j],3); + opb.write(1,1); + opb.write(info.secondstages[j] >> 3,5); + } + else + { + opb.write(info.secondstages[j],4); /* trailing zero */ + } + acc+=icount(info.secondstages[j]); + } + for(int j=0;j=vi.books) + { + free_info(info); + return(null); + } + + for(int j=0;j=vi.books) + { + free_info(info); + return(null); + } + } + return(info); + // errout: + // free_info(info); + // return(NULL); + } + + override public Object look(DspState vd, InfoMode vm, Object vr) + { + InfoResidue0 info=(InfoResidue0)vr; + LookResidue0 look=new LookResidue0(); + int acc=0; + int dim; + int maxstage=0; + look.info=info; + look.map=vm.mapping; + + look.parts=info.partitions; + look.fullbooks=vd.fullbooks; + look.phrasebook=vd.fullbooks[info.groupbook]; + + dim=look.phrasebook.dim; + + look.partbooks=new int[look.parts][]; + + for(int j=0;jmaxstage)maxstage=stages; + look.partbooks[j]=new int[stages]; + for(int k=0; k> 1); + } + return(ret); + } + internal static int icount(int v) + { + int ret=0; + while(v!=0) + { + ret+=(v&1); + v = (int)((uint)v >> 1); + } + return(ret); + } + } + + class LookResidue0 + { + internal InfoResidue0 info; + internal int map; + + internal int parts; + internal int stages; + internal CodeBook[] fullbooks; + internal CodeBook phrasebook; + internal int[][] partbooks; + // CodeBook[][] partbooks; + + internal int partvals; + internal int[][] decodemap; + + //internal int postbits; + //internal int phrasebits; + // int[][] frames; + //internal int frames; + } + + class InfoResidue0 + { + // block-partitioned VQ coded straight residue + internal int begin; + internal int end; + + // first stage (lossless partitioning) + internal int grouping; // group n vectors per partition + internal int partitions; // possible codebooks for a partition + internal int groupbook; // huffbook for partitioning + internal int[] secondstages=new int[64]; // expanded out to pointers in lookup + internal int[] booklist=new int[256]; // list of second stage books + + // encode-only heuristic settings + internal float[] entmax=new float[64]; // book entropy threshholds + internal float[] ampmax=new float[64]; // book amp threshholds + internal int[] subgrp=new int[64]; // book heuristic subgroup size + internal int[] blimit=new int[64]; // subgroup position limits + } +} \ No newline at end of file diff --git a/Support/OggUtils/csvorbis/Residue1.cs b/Support/OggUtils/csvorbis/Residue1.cs new file mode 100644 index 00000000..f469e6be --- /dev/null +++ b/Support/OggUtils/csvorbis/Residue1.cs @@ -0,0 +1,59 @@ +/* csvorbis + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; +using csogg; + +namespace csvorbis +{ + class Residue1 : Residue0 + { + new int forward(Block vb,Object vl, float[][] fin, int ch) + { + return 0; + } + + override public int inverse(Block vb, Object vl, float[][] fin, int[] nonzero, int ch) + { + //System.err.println("Residue0.inverse"); + int used=0; + for(int i=0; i + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; +using csogg; + +namespace csvorbis +{ + class Residue2 : Residue0 + { + override public int forward(Block vb,Object vl, float[][] fin, int ch) + { + return 0; + } + + override public int inverse(Block vb, Object vl, float[][] fin, int[] nonzero, int ch) + { + //System.err.println("Residue0.inverse"); + int i=0; + for(i=0;i + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; +using csogg; + +namespace csvorbis +{ + class StaticCodeBook + { + internal int dim; // codebook dimensions (elements per vector) + internal int entries; // codebook entries + internal int[] lengthlist; // codeword lengths in bits + + // mapping + internal int maptype; // 0=none + // 1=implicitly populated values from map column + // 2=listed arbitrary values + + // The below does a linear, single monotonic sequence mapping. + internal int q_min; // packed 32 bit float; quant value 0 maps to minval + internal int q_delta; // packed 32 bit float; val 1 - val 0 == delta + internal int q_quant; // bits: 0 < quant <= 16 + internal int q_sequencep; // bitflag + + // additional information for log (dB) mapping; the linear mapping + // is assumed to actually be values in dB. encodebias is used to + // assign an error weight to 0 dB. We have two additional flags: + // zeroflag indicates if entry zero is to represent -Inf dB; negflag + // indicates if we're to represent negative linear values in a + // mirror of the positive mapping. + + internal int[] quantlist; // map == 1: (int)(entries/dim) element column map + // map == 2: list of dim*entries quantized entry vals + + // encode helpers + internal EncodeAuxNearestMatch nearest_tree; + internal EncodeAuxThreshMatch thresh_tree; + + internal StaticCodeBook(){} + internal StaticCodeBook(int dim, int entries, int[] lengthlist, + int maptype, int q_min, int q_delta, + int q_quant, int q_sequencep, int[] quantlist, + //EncodeAuxNearestmatch nearest_tree, + Object nearest_tree, + // EncodeAuxThreshmatch thresh_tree, + Object thresh_tree + ) : this() + { + this.dim=dim; this.entries=entries; this.lengthlist=lengthlist; + this.maptype=maptype; this.q_min=q_min; this.q_delta=q_delta; + this.q_quant=q_quant; this.q_sequencep=q_sequencep; + this.quantlist=quantlist; + } + + internal int pack(csBuffer opb) + { + int i; + bool ordered=false; + + opb.write(0x564342,24); + opb.write(dim, 16); + opb.write(entries, 24); + + // pack the codewords. There are two packings; length ordered and + // length random. Decide between the two now. + + for(i=1;i_last) + { + for(int j=_last;j<_this;j++) + { + opb.write(i-count,ilog(entries-count)); + count=i; + } + } + } + opb.write(i-count,ilog(entries-count)); + } + else + { + // length random. Again, we don't code the codeword itself, just + // the length. This time, though, we have to encode each length + opb.write(0,1); // unordered + + // algortihmic mapping has use for 'unused entries', which we tag + // here. The algorithmic mapping happens as usual, but the unused + // entry has no codeword. + for(i=0;ientries/c->dim) quantized values for + // building a full value list algorithmically (square lattice) + quantvals=maptype1_quantvals(); + break; + case 2: + // every value (c->entries*c->dim total) specified explicitly + quantvals=entries*dim; + break; + } + + // quantized values + for(i=0;ibim <= b->entries + // treat the above as an initial guess + while(true) + { + int acc=1; + int acc1=1; + for(int i=0;ientries){ return(vals); } + else + { + if(acc>entries){ vals--; } + else{ vals++; } + } + } + } + + internal void clear() + { + // if(quantlist!=null)free(b->quantlist); + // if(lengthlist!=null)free(b->lengthlist); + // if(nearest_tree!=null){ + // free(b->nearest_tree->ptr0); + // free(b->nearest_tree->ptr1); + // free(b->nearest_tree->p); + // free(b->nearest_tree->q); + // memset(b->nearest_tree,0,sizeof(encode_aux_nearestmatch)); + // free(b->nearest_tree); + // } + // if(thresh_tree!=null){ + // free(b->thresh_tree->quantthresh); + // free(b->thresh_tree->quantmap); + // memset(b->thresh_tree,0,sizeof(encode_aux_threshmatch)); + // free(b->thresh_tree); + // } + // memset(b,0,sizeof(static_codebook)); + } + + // unpack the quantized list of values for encode/decode + // we need to deal with two map types: in map type 1, the values are + // generated algorithmically (each column of the vector counts through + // the values in the quant vector). in map type 2, all the values came + // in in an explicit list. Both value lists must be unpacked + internal float[] unquantize() + { + + if(maptype==1 || maptype==2) + { + int quantvals; + float mindel=float32_unpack(q_min); + float delta=float32_unpack(q_delta); + float[] r=new float[entries*dim]; + + //System.err.println("q_min="+q_min+", mindel="+mindel); + + // maptype 1 and 2 both use a quantized value vector, but + // different sizes + switch(maptype) + { + case 1: + // most of the time, entries%dimensions == 0, but we need to be + // well defined. We define that the possible vales at each + // scalar is values == entries/dim. If entries%dim != 0, we'll + // have 'too few' values (values*dim "+val+" | ");} + val=Math.Abs(val)*delta+mindel+last; + if(q_sequencep!=0)last=val; + r[j*dim+k]=val; + //if((j*dim+k)==0){System.err.println(" $ r[0] -> "+r[0]+" | ");} + } + } + //System.err.println("\nr[0]="+r[0]); + break; + default: + break; + } + return(r); + } + return(null); + } + + internal static int ilog(int v) + { + int ret=0; + while(v!=0) + { + ret++; + v = (int)((uint)v >> 1); + } + return(ret); + } + + // 32 bit float (not IEEE; nonnormalized mantissa + + // biased exponent) : neeeeeee eeemmmmm mmmmmmmm mmmmmmmm + // Why not IEEE? It's just not that important here. + + //static int VQ_FEXP=10; + static int VQ_FMAN=21; + static int VQ_FEXP_BIAS=768; // bias toward values smaller than 1. + + // doesn't currently guard under/overflow + internal static long float32_pack(float val) + { + uint sign=0; + int exp; + int mant; + if(val<0) + { + sign = 0x80000000; + val = -val; + } + exp=(int)Math.Floor(Math.Log(val)/Math.Log(2)); + mant=(int)Math.Round(Math.Pow(val,(VQ_FMAN-1)-exp)); + exp=(exp+VQ_FEXP_BIAS)<> VQ_FMAN; + //System.err.println("mant="+mant+", sign="+sign+", exp="+exp); + //if(sign!=0.0)mant= -mant; + if((val&0x80000000)!=0)mant= -mant; + //System.err.println("mant="+mant); + return(ldexp(mant,((int)exp)-(VQ_FMAN-1)-VQ_FEXP_BIAS)); + } + + internal static float ldexp(float foo, int e) + { + return (float)(foo*Math.Pow(2, e)); + } + } +} diff --git a/Support/OggUtils/csvorbis/Time0.cs b/Support/OggUtils/csvorbis/Time0.cs new file mode 100644 index 00000000..c17efdab --- /dev/null +++ b/Support/OggUtils/csvorbis/Time0.cs @@ -0,0 +1,41 @@ +/* csvorbis + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; +using csogg; + +namespace csvorbis +{ + class Time0 : FuncTime + { + override public void pack(Object i, csBuffer opb){} + override public Object unpack(Info vi , csBuffer opb){return "";} + override public Object look(DspState vd, InfoMode mi, Object i){return "";} + override public void free_info(Object i){} + override public void free_look(Object i){} + override public int forward(Block vb, Object i){return 0;} + override public int inverse(Block vb, Object i, float[] fin, float[] fout){return 0;} + } +} diff --git a/Support/OggUtils/csvorbis/VorbisFile.cs b/Support/OggUtils/csvorbis/VorbisFile.cs new file mode 100644 index 00000000..92e40033 --- /dev/null +++ b/Support/OggUtils/csvorbis/VorbisFile.cs @@ -0,0 +1,1434 @@ +/* csvorbis + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +using System; +using System.IO; +using csogg; + +namespace csvorbis +{ + public class VorbisFile + { + static int CHUNKSIZE=8500; + static int SEEK_SET=0; + static int SEEK_CUR=1; + static int SEEK_END=2; + + static int OV_FALSE=-1; + static int OV_EOF=-2; + static int OV_HOLE=-3; + + static int OV_EREAD=-128; + static int OV_EFAULT=-129; + static int OV_EIMPL=-130; + static int OV_EINVAL=-131; + static int OV_ENOTVORBIS=-132; + static int OV_EBADHEADER=-133; + static int OV_EVERSION=-134; + static int OV_ENOTAUDIO=-135; + static int OV_EBADPACKET=-136; + static int OV_EBADLINK=-137; + static int OV_ENOSEEK=-138; + + FileStream datasource; + bool skable=false; + long offset; + long end; + + SyncState oy=new SyncState(); + + int links; + long[] offsets; + long[] dataoffsets; + int[] serialnos; + long[] pcmlengths; + Info[] vi; + Comment[] vc; + + // Decoding working state local storage + long pcm_offset; + bool decode_ready=false; + int current_serialno; + int current_link; + + float bittrack; + float samptrack; + + StreamState os; + DspState vd; + Block vb; + + + private VorbisFile() + { + os=new StreamState(); // take physical pages, weld into a logical + // stream of packets + vd=new DspState(); // central working state for + // the packet->PCM decoder + vb=new Block(vd); // local working space for packet->PCM decode + } + + public VorbisFile(String file) : this() + { + FileStream inst=null; + + try{ inst=new FileStream(file, FileMode.Open, FileAccess.Read);} + catch(Exception e) + { + throw new csorbisException("VorbisFile: "+e.Message); + } + int ret=open(inst, null, 0); + if(ret==-1) + { + throw new csorbisException("VorbisFile: open return -1"); + } + } + + public VorbisFile(FileStream inst, byte[] initial, int ibytes) : this() + { + int ret=open(inst, initial, ibytes); + } + + private int get_data() + { + int index=oy.buffer(CHUNKSIZE); + byte[] buffer=oy.data; + // int bytes=callbacks.read_func(buffer, index, 1, CHUNKSIZE, datasource); + int bytes=0; + try + { + bytes=datasource.Read(buffer, index, CHUNKSIZE); + } + catch(Exception e) + { + Console.Error.WriteLine(e.Message); + return OV_EREAD; + } + oy.wrote(bytes); + if(bytes==-1) + { + bytes=0; + } + return bytes; + } + + private void seek_helper(long offst) + { + //callbacks.seek_func(datasource, offst, SEEK_SET); + fseek(datasource, offst, SEEK_SET); + this.offset=offst; + oy.reset(); + } + + private int get_next_page(Page page, long boundary) + { + if(boundary>0) boundary+=offset; + while(true) + { + int more; + if(boundary>0 && offset>=boundary)return OV_FALSE; + more=oy.pageseek(page); + if(more<0){offset-=more;} + else + { + if(more==0) + { + if(boundary==0)return OV_FALSE; + // if(get_data()<=0)return -1; + int ret=get_data(); + if(ret==0) return OV_EOF; + if(ret<0) return OV_EREAD; + } + else + { + int ret=(int)offset; //!!! + offset+=more; + return ret; + } + } + } + } + + private int get_prev_page(Page page) + { + long begin=offset; //!!! + int ret; + int offst=-1; + while(offst==-1) + { + begin-=CHUNKSIZE; + if(begin<0) + begin=0; + seek_helper(begin); + while(offset=0)next=ret; + } + else + { + searched=ret+page.header_len+page.body_len; + } + } + seek_helper(next); + ret=get_next_page(page, -1); + if(ret==OV_EREAD) return OV_EREAD; + + if(searched>=end || ret==-1) + { + links=m+1; + offsets=new long[m+2]; + offsets[m+1]=searched; + } + else + { + ret=bisect_forward_serialno(next, offset, end, page.serialno(), m+1); + if(ret==OV_EREAD)return OV_EREAD; + } + offsets[m]=begin; + return 0; + } + + // uses the local ogg_stream storage in vf; this is important for + // non-streaming input sources + int fetch_headers(Info vi, Comment vc, int[] serialno, Page og_ptr) + { + //System.err.println("fetch_headers"); + Page og=new Page(); + Packet op=new Packet(); + int ret; + + if(og_ptr==null) + { + ret=get_next_page(og, CHUNKSIZE); + if(ret==OV_EREAD)return OV_EREAD; + if(ret<0) return OV_ENOTVORBIS; + og_ptr=og; + } + + if(serialno!=null)serialno[0]=og_ptr.serialno(); + + os.init(og_ptr.serialno()); + + // extract the initial header from the first page and verify that the + // Ogg bitstream is in fact Vorbis data + + vi.init(); + vc.init(); + + int i=0; + while(i<3) + { + os.pagein(og_ptr); + while(i<3) + { + int result=os.packetout(op); + if(result==0)break; + if(result==-1) + { + Console.Error.WriteLine("Corrupt header in logical bitstream."); + //goto bail_header; + vi.clear(); + vc.clear(); + os.clear(); + return -1; + } + if(vi.synthesis_headerin(vc, op)!=0) + { + Console.Error.WriteLine("Illegal header in logical bitstream."); + //goto bail_header; + vi.clear(); + vc.clear(); + os.clear(); + return -1; + } + i++; + } + if(i<3) + if(get_next_page(og_ptr, 1)<0) + { + Console.Error.WriteLine("Missing header in logical bitstream."); + //goto bail_header; + vi.clear(); + vc.clear(); + os.clear(); + return -1; + } + } + return 0; + } + + // last step of the OggVorbis_File initialization; get all the + // vorbis_info structs and PCM positions. Only called by the seekable + // initialization (local stream storage is hacked slightly; pay + // attention to how that's done) + void prefetch_all_headers(Info first_i,Comment first_c, int dataoffset) + { + Page og=new Page(); + int ret; + + vi=new Info[links]; + vc=new Comment[links]; + dataoffsets=new long[links]; + pcmlengths=new long[links]; + serialnos=new int[links]; + + for(int i=0;ivi+i,first_i,sizeof(vorbis_info)); + vc[i]=first_c; + //memcpy(vf->vc+i,first_c,sizeof(vorbis_comment)); + dataoffsets[i]=dataoffset; + } + else + { + // seek to the location of the initial header + seek_helper(offsets[i]); //!!! + if(fetch_headers(vi[i], vc[i], null, null)==-1) + { + Console.Error.WriteLine("Error opening logical bitstream #"+(i+1)+"\n"); + dataoffsets[i]=-1; + } + else + { + dataoffsets[i]=offset; + os.clear(); + } + } + + // get the serial number and PCM length of this link. To do this, + // get the last page of the stream + long end=offsets[i+1]; //!!! + seek_helper(end); + + while(true) + { + ret=get_prev_page(og); + if(ret==-1) + { + // this should not be possible + Console.Error.WriteLine("Could not find last page of logical "+ + "bitstream #"+(i)+"\n"); + vi[i].clear(); + vc[i].clear(); + break; + } + if(og.granulepos()!=-1) + { + serialnos[i]=og.serialno(); + pcmlengths[i]=og.granulepos(); + break; + } + } + } + } + + int make_decode_ready() + { +#if NET_2_1 + if(decode_ready) throw new Exception ("make_decode_ready: 1"); +#else + if(decode_ready)Environment.Exit(1); +#endif + vd.synthesis_init(vi[0]); + vb.init(vd); + decode_ready=true; + return(0); + } + + int open_seekable() + { + Info initial_i=new Info(); + Comment initial_c=new Comment(); + int serialno; + long end; + int ret; + int dataoffset; + Page og=new Page(); + // is this even vorbis...? + int[] foo=new int[1]; + ret=fetch_headers(initial_i, initial_c, foo, null); + serialno=foo[0]; + dataoffset=(int)offset; //!! + os.clear(); + if(ret==-1)return(-1); + // we can seek, so set out learning all about this file + skable=true; + //(callbacks.seek_func)(datasource, 0, SEEK_END); + fseek(datasource, 0, SEEK_END); + //offset=end=(callbacks.tell_func)(datasource); + offset=ftell(datasource); + end=offset; + // We get the offset for the last page of the physical bitstream. + // Most OggVorbis files will contain a single logical bitstream + end=get_prev_page(og); + // moer than one logical bitstream? + if(og.serialno()!=serialno) + { + // Chained bitstream. Bisect-search each logical bitstream + // section. Do so based on serial number only + if(bisect_forward_serialno(0,0,end+1,serialno,0)<0) + { + clear(); + return OV_EREAD; + } + } + else + { + // Only one logical bitstream + if(bisect_forward_serialno(0,end,end+1,serialno,0)<0) + { + clear(); + return OV_EREAD; + } + } + prefetch_all_headers(initial_i, initial_c, dataoffset); + return(raw_seek(0)); + } + + int open_nonseekable() + { + //System.err.println("open_nonseekable"); + // we cannot seek. Set up a 'single' (current) logical bitstream entry + links=1; + vi=new Info[links]; vi[0]=new Info(); // ?? + vc=new Comment[links]; vc[0]=new Comment(); // ?? bug? + + // Try to fetch the headers, maintaining all the storage + int[]foo=new int[1]; + if(fetch_headers(vi[0], vc[0], foo, null)==-1)return(-1); + current_serialno=foo[0]; + make_decode_ready(); + return 0; + } + + // clear out the current logical bitstream decoder + void decode_clear() + { + os.clear(); + vd.clear(); + vb.clear(); + decode_ready=false; + bittrack=0.0f; + samptrack=0.0f; + } + + // fetch and process a packet. Handles the case where we're at a + // bitstream boundary and dumps the decoding machine. If the decoding + // machine is unloaded, it loads it. It also keeps pcm_offset up to + // date (seek and read both use this. seek uses a special hack with + // readp). + // + // return: -1) hole in the data (lost packet) + // 0) need more date (only if readp==0)/eof + // 1) got a packet + + int process_packet(int readp) + { + Page og=new Page(); + + // handle one packet. Try to fetch it from current stream state + // extract packets from page + while(true) + { + // process a packet if we can. If the machine isn't loaded, + // neither is a page + if(decode_ready) + { + Packet op=new Packet(); + int result=os.packetout(op); + long granulepos; + // if(result==-1)return(-1); // hole in the data. For now, swallow + // and go. We'll need to add a real + // error code in a bit. + if(result>0) + { + // got a packet. process it + granulepos=op.granulepos; + if(vb.synthesis(op)==0) + { // lazy check for lazy + // header handling. The + // header packets aren't + // audio, so if/when we + // submit them, + // vorbis_synthesis will + // reject them + // suck in the synthesis data and track bitrate + { + int oldsamples=vd.synthesis_pcmout(null, null); + vd.synthesis_blockin(vb); + samptrack+=vd.synthesis_pcmout(null, null)-oldsamples; + bittrack+=op.bytes*8; + } + + // update the pcm offset. + if(granulepos!=-1 && op.e_o_s==0) + { + int link=(skable?current_link:0); + int samples; + // this packet has a pcm_offset on it (the last packet + // completed on a page carries the offset) After processing + // (above), we know the pcm position of the *last* sample + // ready to be returned. Find the offset of the *first* + // + // As an aside, this trick is inaccurate if we begin + // reading anew right at the last page; the end-of-stream + // granulepos declares the last frame in the stream, and the + // last packet of the last page may be a partial frame. + // So, we need a previous granulepos from an in-sequence page + // to have a reference point. Thus the !op.e_o_s clause above + + samples=vd.synthesis_pcmout(null, null); + granulepos-=samples; + for(int i=0;icallbacks.close_func)(vf->datasource); + //memset(vf,0,sizeof(OggVorbis_File)); + return(0); + } + + static int fseek(FileStream fis, + //int64_t off, + long off, + int whence) + { + if(fis.CanSeek == true) + { + try + { + if(whence==SEEK_SET) + { + fis.Seek(off, 0); + } + else if(whence==SEEK_END) + { + fis.Seek(fis.Length - off, 0); + } + else + { + Console.Error.WriteLine("seek: "+whence+" is not supported"); + } + } + catch(Exception e) + { + Console.Error.WriteLine(e.Message); + } + return 0; + } + try + { + if(whence==0){ fis.Seek(0, 0); } + fis.Seek(off, 0); + } + catch(Exception e) + { + Console.Error.WriteLine(e.Message); + return -1; + } + return 0; + } + + static long ftell(FileStream fis) + { + try + { + if(fis.CanSeek == true) + { + return (fis.Position); + } + } + catch(Exception e) + { + Console.Error.WriteLine(e.Message); + } + return 0; + } + + // inspects the OggVorbis file and finds/documents all the logical + // bitstreams contained in it. Tries to be tolerant of logical + // bitstream sections that are truncated/woogie. + // + // return: -1) error + // 0) OK + + int open(FileStream iis, byte[] initial, int ibytes) + { + return open_callbacks(iis, initial, ibytes); + } + + int open_callbacks(FileStream iis, byte[] initial, int ibytes) + { + int ret; + datasource=iis; + //callbacks = _callbacks; + // init the framing state + oy.init(); + + // perhaps some data was previously read into a buffer for testing + // against other stream types. Allow initialization from this + // previously read data (as we may be reading from a non-seekable + // stream) + if(initial!=null) + { + int index=oy.buffer(ibytes); + Array.Copy(initial, 0, oy.data, index, ibytes); + oy.wrote(ibytes); + } + // can we seek? Stevens suggests the seek test was portable + if(iis.CanSeek == true){ ret=open_seekable(); } + else{ ret=open_nonseekable(); } + if(ret!=0) + { + datasource=null; + clear(); + } + return(ret); + } + + // How many logical bitstreams in this physical bitstream? + public int streams() + { + return links; + } + + // Is the FILE * associated with vf seekable? + public bool seekable() + { + return skable; + } + + // returns the bitrate for a given logical bitstream or the entire + // physical bitstream. If the file is open for random access, it will + // find the *actual* average bitrate. If the file is streaming, it + // returns the nominal bitrate (if set) else the average of the + // upper/lower bounds (if set) else -1 (unset). + // + // If you want the actual bitrate field settings, get them from the + // vorbis_info structs + + public int bitrate(int i) + { + if(i>=links)return(-1); + if(!skable && i!=0)return(bitrate(0)); + if(i<0) + { + long bits=0; + for(int j=0;j0) + { + return vi[i].bitrate_nominal; + } + else + { + if(vi[i].bitrate_upper>0) + { + if(vi[i].bitrate_lower>0) + { + return (vi[i].bitrate_upper+vi[i].bitrate_lower)/2; + } + else + { + return vi[i].bitrate_upper; + } + } + return(-1); + } + } + } + } + + // returns the actual bitrate since last call. returns -1 if no + // additional data to offer since last call (or at beginning of stream) + public int bitrate_instant() + { + int _link=(skable?current_link:0); + if(samptrack==0)return(-1); + int ret=(int)(bittrack/samptrack*vi[_link].rate+.5); + bittrack=0.0f; + samptrack=0.0f; + return(ret); + } + + public int serialnumber(int i) + { + if(i>=links)return(-1); + if(!skable && i>=0)return(serialnumber(-1)); + if(i<0) + { + return(current_serialno); + } + else + { + return(serialnos[i]); + } + } + + // returns: total raw (compressed) length of content if i==-1 + // raw (compressed) length of that logical bitstream for i==0 to n + // -1 if the stream is not seekable (we can't know the length) + + public long raw_total(int i) + { + if(!skable || i>=links)return(-1); + if(i<0) + { + long acc=0; // bug? + for(int j=0;j=links)return(-1); + if(i<0) + { + long acc=0; + for(int j=0;j=links)return(-1); + if(i<0) + { + float acc=0; + for(int j=0;joffsets[links]) + { + //goto seek_error; + pcm_offset=-1; + decode_clear(); + return -1; + } + + // clear out decoding machine state + pcm_offset=-1; + decode_clear(); + + // seek + seek_helper(pos); + + // we need to make sure the pcm_offset is set. We use the + // _fetch_packet helper to process one packet with readp set, then + // call it until it returns '0' with readp not set (the last packet + // from a page has the 'granulepos' field set, and that's how the + // helper updates the offset + + switch(process_packet(1)) + { + case 0: + // oh, eof. There are no packets remaining. Set the pcm offset to + // the end of file + pcm_offset=pcm_total(-1); + return(0); + case -1: + // error! missing data or invalid bitstream structure + //goto seek_error; + pcm_offset=-1; + decode_clear(); + return -1; + default: + // all OK + break; + } + while(true) + { + switch(process_packet(0)) + { + case 0: + // the offset is set. If it's a bogus bitstream with no offset + // information, it's not but that's not our fault. We still run + // gracefully, we're just missing the offset + return(0); + case -1: + // error! missing data or invalid bitstream structure + //goto seek_error; + pcm_offset=-1; + decode_clear(); + return -1; + default: + // continue processing packets + break; + } + } + + // seek_error: + // dump the machine so we're in a known state + //pcm_offset=-1; + //decode_clear(); + return -1; + } + + // seek to a sample offset relative to the decompressed pcm stream + // returns zero on success, nonzero on failure + + public int pcm_seek(long pos) + { + int link=-1; + long total=pcm_total(-1); + + if(!skable)return(-1); // don't dump machine if we can't seek + if(pos<0 || pos>total) + { + //goto seek_error; + pcm_offset=-1; + decode_clear(); + return -1; + } + + // which bitstream section does this pcm offset occur in? + for(link=links-1;link>=0;link--) + { + total-=pcmlengths[link]; + if(pos>=total)break; + } + + // search within the logical bitstream for the page with the highest + // pcm_pos preceeding (or equal to) pos. There is a danger here; + // missing pages or incorrect frame number information in the + // bitstream could make our task impossible. Account for that (it + // would be an error condition) + { + long target=pos-total; + long end=offsets[link+1]; + long begin=offsets[link]; + int best=(int)begin; + + Page og=new Page(); + while(begin=pos) + { + //goto seek_error; + pcm_offset=-1; + decode_clear(); + return -1; + } + if(pos>pcm_total(-1)) + { + //goto seek_error; + pcm_offset=-1; + decode_clear(); + return -1; + } + + // discard samples until we reach the desired position. Crossing a + // logical bitstream boundary with abandon is OK. + while(pcm_offsettarget)samples=target; + vd.synthesis_read(samples); + pcm_offset+=samples; + + if(samplestime_tot) + { + //goto seek_error; + pcm_offset=-1; + decode_clear(); + return -1; + } + + // which bitstream section does this time offset occur in? + for(link=links-1;link>=0;link--) + { + pcm_tot-=pcmlengths[link]; + time_tot-=time_total(link); + if(seconds>=time_tot)break; + } + + // enough information to convert time offset to pcm offset + { + long target=(long)(pcm_tot+(seconds-time_tot)*vi[link].rate); + return(pcm_seek(target)); + } + } + + // tell the current stream offset cursor. Note that seek followed by + // tell will likely not give the set offset due to caching + public long raw_tell() + { + return(offset); + } + + // return PCM offset (sample) of next PCM sample to be read + public long pcm_tell() + { + return(pcm_offset); + } + + // return time offset (seconds) of next PCM sample to be read + public float time_tell() + { + // translate time to PCM position and call pcm_seek + + int link=-1; + long pcm_tot=0; + float time_tot=0.0f; + + if(skable) + { + pcm_tot=pcm_total(-1); + time_tot=time_total(-1); + + // which bitstream section does this time offset occur in? + for(link=links-1;link>=0;link--) + { + pcm_tot-=pcmlengths[link]; + time_tot-=time_total(link); + if(pcm_offset>=pcm_tot)break; + } + } + + return((float)time_tot+(float)(pcm_offset-pcm_tot)/vi[link].rate); + } + + // link: -1) return the vorbis_info struct for the bitstream section + // currently being decoded + // 0-n) to request information for a specific bitstream section + // + // In the case of a non-seekable bitstream, any call returns the + // current bitstream. NULL in the case that the machine is not + // initialized + + public Info getInfo(int link) + { + if(skable) + { + if(link<0) + { + if(decode_ready) + { + return vi[current_link]; + } + else + { + return null; + } + } + else + { + if(link>=links) + { + return null; + } + else + { + return vi[link]; + } + } + } + else + { + if(decode_ready) + { + return vi[0]; + } + else + { + return null; + } + } + } + + public Comment getComment(int link) + { + if(skable) + { + if(link<0) + { + if(decode_ready){ return vc[current_link]; } + else{ return null; } + } + else + { + if(link>=links){ return null;} + else{ return vc[link]; } + } + } + else + { + if(decode_ready){ return vc[0]; } + else{ return null; } + } + } + + int host_is_big_endian() + { + return 0; + //the above isn't really right... + } + + // up to this point, everything could more or less hide the multiple + // logical bitstream nature of chaining from the toplevel application + // if the toplevel application didn't particularly care. However, at + // the point that we actually read audio back, the multiple-section + // nature must surface: Multiple bitstream sections do not necessarily + // have to have the same number of channels or sampling rate. + // + // read returns the sequential logical bitstream number currently + // being decoded along with the PCM data in order that the toplevel + // application can take action on channel/sample rate changes. This + // number will be incremented even for streamed (non-seekable) streams + // (for seekable streams, it represents the actual logical bitstream + // index within the physical bitstream. Note that the accessor + // functions above are aware of this dichotomy). + // + // input values: buffer) a buffer to hold packed PCM data for return + // length) the byte length requested to be placed into buffer + // bigendianp) should the data be packed LSB first (0) or + // MSB first (1) + // word) word size for output. currently 1 (byte) or + // 2 (16 bit short) + // + // return values: -1) error/hole in data + // 0) EOF + // n) number of bytes of PCM actually returned. The + // below works on a packet-by-packet basis, so the + // return length is not related to the 'length' passed + // in, just guaranteed to fit. + // + // *section) set to the logical bitstream number + + public int read(byte[] buffer,int length, + int bigendianp, int word, int sgned, int[] bitstream) + { + int host_endian = host_is_big_endian(); + int index=0; + + while(true) + { + if(decode_ready) + { + float[][] pcm; + float[][][] _pcm=new float[1][][]; + int[] _index=new int[getInfo(-1).channels]; + int samples=vd.synthesis_pcmout(_pcm, _index); + pcm=_pcm[0]; + if(samples!=0) + { + // yay! proceed to pack data into the byte buffer + int channels=getInfo(-1).channels; + int bytespersample=word * channels; + if(samples>length/bytespersample)samples=length/bytespersample; + + // a tight loop to pack each size + { + int val; + if(word==1) + { + int off=(sgned!=0?0:128); + for(int j=0;j127)val=127; + else if(val<-128)val=-128; + buffer[index++]=(byte)(val+off); + } + } + } + else + { + int off=(sgned!=0?0:32768); + + if(host_endian==bigendianp) + { + if(sgned!=0) + { + for(int i=0;i32767)val=32767; + else if(val<-32768)val=-32768; + buffer[dest]=(byte)(val); + buffer[dest+1]=(byte)((uint)val >> 8); + dest+=bytespersample; + } + } + } + else + { + for(int i=0;i32767)val=32767; + else if(val<-32768)val=-32768; + buffer[dest]=(byte)((uint)(val+off) >> 8); + buffer[dest+1]=(byte)(val+off); + dest+=channels*2; + } + } + } + } + else if(bigendianp!=0) + { + for(int j=0;j32767)val=32767; + else if(val<-32768)val=-32768; + val+=off; + buffer[index++]=(byte)((uint)val >> 8); + buffer[index++]=(byte)val; + } + } + } + else + { + //int val; + for(int j=0;j32767)val=32767; + else if(val<-32768)val=-32768; + val+=off; + buffer[index++]=(byte)val; + buffer[index++]=(byte)((uint)val >> 8); + } + } + } + } + } + + vd.synthesis_read(samples); + pcm_offset+=samples; + if(bitstream!=null)bitstream[0]=current_link; + return(samples*bytespersample); + } + } + + // suck in another packet + switch(process_packet(1)) + { + case 0: + return(0); + case -1: + return -1; + default: + break; + } + } + return -1; + } + + public Info[] getInfo(){return vi;} + public Comment[] getComment(){return vc;} + } +} diff --git a/Support/OggUtils/csvorbis/csorbisException.cs b/Support/OggUtils/csvorbis/csorbisException.cs new file mode 100644 index 00000000..0e039f08 --- /dev/null +++ b/Support/OggUtils/csvorbis/csorbisException.cs @@ -0,0 +1,36 @@ +/* csvorbis + * Copyright (C) 2000 ymnk, JCraft,Inc. + * + * Written by: 2000 ymnk + * Ported to C# from JOrbis by: Mark Crichton + * + * Thanks go to the JOrbis team, for licencing the code under the + * LGPL, making my job a lot easier. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +using System; + +namespace csvorbis +{ + public class csorbisException : Exception + { + public csorbisException () + :base(){} + public csorbisException (String s) + :base("csorbis: "+s){} + } +} diff --git a/Support/WaveUtils/WaveUtils_WindowsMetro.csproj b/Support/WaveUtils/WaveUtils_WindowsMetro.csproj index c4f2339d..f3dba06d 100644 --- a/Support/WaveUtils/WaveUtils_WindowsMetro.csproj +++ b/Support/WaveUtils/WaveUtils_WindowsMetro.csproj @@ -19,7 +19,7 @@ true full false - ..\..\bin\Debug\ + ..\..\bin\Debug\ModernUI TRACE;DEBUG;WINDOWSMETRO; prompt 4 @@ -28,7 +28,7 @@ pdbonly true - ..\..\bin\Release\ + ..\..\bin\Release\ModernUI TRACE;WINDOWSMETRO; prompt 4 diff --git a/Tools/ProjectConverter/Platforms/MetroConverter.cs b/Tools/ProjectConverter/Platforms/MetroConverter.cs index 83b7b8da..e1adfe25 100644 --- a/Tools/ProjectConverter/Platforms/MetroConverter.cs +++ b/Tools/ProjectConverter/Platforms/MetroConverter.cs @@ -17,15 +17,12 @@ namespace ProjectConverter.Platforms private bool isCurrentProjectExecutable; - public override string Postfix - { - get - { - return "WindowsMetro"; - } - } + public override string Postfix + { + get { return "WindowsMetro"; } + } - #region ConvertImport + #region ConvertImport protected override void ConvertImport(XElement element, XAttribute projectAttribute) { if (projectAttribute != null) diff --git a/lib/GetLibraries.cmd b/lib/GetLibraries.cmd new file mode 100644 index 00000000..df78869a --- /dev/null +++ b/lib/GetLibraries.cmd @@ -0,0 +1,5 @@ +@echo off + +"./NuGet/NuGet.exe" install packages.config + +pause \ No newline at end of file diff --git a/lib/packages.config b/lib/packages.config new file mode 100644 index 00000000..2aa76aaa --- /dev/null +++ b/lib/packages.config @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/media/Test_TemporaryKey.pfx b/media/Test_TemporaryKey.pfx new file mode 100644 index 00000000..a7af833c Binary files /dev/null and b/media/Test_TemporaryKey.pfx differ diff --git a/media/testmusic.ogg b/media/testmusic.ogg new file mode 100644 index 00000000..b9a5c53f Binary files /dev/null and b/media/testmusic.ogg differ