agate-svn-commit Mailing List for AgateLib (Page 15)
Status: Alpha
Brought to you by:
kanato
You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
(86) |
May
(77) |
Jun
|
Jul
(1) |
Aug
(31) |
Sep
(12) |
Oct
(31) |
Nov
(53) |
Dec
(39) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(53) |
Feb
(14) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
(7) |
Dec
(13) |
2011 |
Jan
(17) |
Feb
(5) |
Mar
(1) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
(21) |
Dec
|
2012 |
Jan
(6) |
Feb
(14) |
Mar
(5) |
Apr
(4) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(8) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
(1) |
Oct
(5) |
Nov
(9) |
Dec
(5) |
2014 |
Jan
(3) |
Feb
(2) |
Mar
(4) |
Apr
(3) |
May
|
Jun
(5) |
Jul
(33) |
Aug
(69) |
Sep
(35) |
Oct
(4) |
Nov
(1) |
Dec
|
From: <ka...@us...> - 2010-01-24 22:16:59
|
Revision: 1187 http://agate.svn.sourceforge.net/agate/?rev=1187&view=rev Author: kanato Date: 2010-01-24 22:16:52 +0000 (Sun, 24 Jan 2010) Log Message: ----------- Implement serialization of streams in XleSerializer. Modified Paths: -------------- trunk/AgateLib/AgateLib.csproj trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs Added Paths: ----------- trunk/AgateLib/Serialization/Xle/CompressionType.cs Modified: trunk/AgateLib/AgateLib.csproj =================================================================== --- trunk/AgateLib/AgateLib.csproj 2010-01-11 23:12:48 UTC (rev 1186) +++ trunk/AgateLib/AgateLib.csproj 2010-01-24 22:16:52 UTC (rev 1187) @@ -1,7 +1,7 @@ <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <PropertyGroup> <ProjectType>Local</ProjectType> - <ProductVersion>9.0.30729</ProductVersion> + <ProductVersion>9.0.21022</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{9490B719-829E-43A7-A5FE-8001F8A81759}</ProjectGuid> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> @@ -197,6 +197,7 @@ <Compile Include="DisplayLib\ImplementationBase\FrameBufferImpl.cs" /> <Compile Include="Platform.cs" /> <Compile Include="PlatformType.cs" /> + <Compile Include="Serialization\Xle\CompressionType.cs" /> <Compile Include="Settings\SettingsGroup.cs" /> <Compile Include="Timing.cs"> <SubType>Code</SubType> Added: trunk/AgateLib/Serialization/Xle/CompressionType.cs =================================================================== --- trunk/AgateLib/Serialization/Xle/CompressionType.cs (rev 0) +++ trunk/AgateLib/Serialization/Xle/CompressionType.cs 2010-01-24 22:16:52 UTC (rev 1187) @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace AgateLib.Serialization.Xle +{ + public enum CompressionType + { + None, + Deflate, + GZip, + } +} Modified: trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs =================================================================== --- trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs 2010-01-11 23:12:48 UTC (rev 1186) +++ trunk/AgateLib/Serialization/Xle/XleSerializationInfo.cs 2010-01-24 22:16:52 UTC (rev 1187) @@ -18,6 +18,8 @@ // using System; using System.Collections.Generic; +using System.IO; +using System.IO.Compression; using System.Text; using System.Xml; using System.Runtime.InteropServices; @@ -342,13 +344,53 @@ } /// <summary> + /// Writes a binary stream to the XML data as an element. + /// Compresses the stream using GZip compression. + /// </summary> + /// <param name="name">The name of the XML element used.</param> + /// <param name="value">The stream of data to write.</param> + public void Write(string name, Stream value) + { + Write(name, value, CompressionType.GZip); + } + /// <summary> + /// Writes a binary stream to the XML data as an element. + /// </summary> + /// <param name="name">The name of the XML element used.</param> + /// <param name="value">The stream of data to write.</param> + /// <param name="compression">The compression algorithm to use.</param> + public void Write(string name, Stream value, CompressionType compression) + { + WriteImpl(name, value, compression); + } + + private void WriteImpl(string name, Stream value, CompressionType compression) + { + MemoryStream ms = new MemoryStream(); + Stream compressed = TranslateStream(ms, compression, CompressionMode.Compress); + + byte[] uncompressedData = ReadFromStream(value); + compressed.Write(uncompressedData, 0, uncompressedData.Length); + + byte[] buffer = ms.GetBuffer(); + + string newValue = Convert.ToBase64String( + buffer, Base64FormattingOptions.InsertLineBreaks); + + XmlElement el = WriteAsElement(name, newValue); + AddAttribute(el, "stream", "true"); + AddAttribute(el, "compression", compression.ToString()); + AddAttribute(el, "encoding", "Base64"); + } + + /// <summary> /// Writes a byte[] array to the XML data as an element. /// </summary> /// <param name="name">The name of the XML element used.</param> /// <param name="value">The array data to write.</param> public void Write(string name, byte[] value) { - string newValue = Convert.ToBase64String(value, Base64FormattingOptions.None); + string newValue = Convert.ToBase64String(value, Base64FormattingOptions.InsertLineBreaks); XmlElement el = WriteAsElement(name, newValue); AddAttribute(el, "array", "true"); @@ -403,12 +445,17 @@ XmlElement item = doc.CreateElement("Item"); CurrentNode.AppendChild(item); - if (value[i].GetType() != listType) - AddAttribute(item, "type", value[i].GetType().ToString()); + if (value[i] == null) + AddAttribute(item, "type", "null"); + else + { + if (value[i].GetType() != listType) + AddAttribute(item, "type", value[i].GetType().ToString()); - nodes.Push(item); - Serialize(value[i]); - nodes.Pop(); + nodes.Push(item); + Serialize(value[i]); + nodes.Pop(); + } } nodes.Pop(); @@ -742,7 +789,48 @@ { return ReadStringImpl(name, false, string.Empty); } + /// <summary> + /// Reads binary data stored as a stream. + /// </summary> + /// <param name="name"></param> + /// <returns></returns> + public Stream ReadStream(string name) + { + XmlElement element = (XmlElement)CurrentNode[name]; + if (element == null) + throw new XleSerializationException("Field " + name + " was not found."); + + if (element.Attributes["stream"] == null || element.Attributes["stream"].Value != "true") + throw new XleSerializationException("Field " + name + " is not a stream."); + if (element.Attributes["encoding"] == null) + throw new XleSerializationException("Field " + name + " does not have encoding information."); + + string encoding = element.Attributes["encoding"].Value; + byte[] bytes; + + if (encoding == "Base64") + { + bytes = Convert.FromBase64String(element.InnerText); + } + else + throw new XleSerializationException("Unrecognized encoding " + encoding); + + CompressionType compression = CompressionType.None; + + if (element.Attributes["compression"] != null) + { + compression = (CompressionType) + Enum.Parse(typeof(CompressionType), element.Attributes["compression"].Value, true); + } + + MemoryStream ms = new MemoryStream(bytes); + ms.Position = 0; + Stream uncompressed = TranslateStream(ms, compression, CompressionMode.Decompress); + + return uncompressed; + } + private string ReadStringImpl(string name, bool haveDefault, string defaultValue) { string attribute = CurrentNode.GetAttribute(name); @@ -1006,7 +1094,7 @@ { list.Add(item.InnerText); } - else + else { nodes.Push(item); @@ -1078,8 +1166,52 @@ #endregion + #region --- Dealing with streams --- + /// <summary> + /// Reads data from a stream until the end is reached. The + /// data is returned as a byte array. An IOException is + /// thrown if any of the underlying IO calls fail. + /// </summary> + /// <param name="stream">The stream to read data from</param> + static byte[] ReadFromStream(Stream stream) + { + // Code is from + // http://www.yoda.arachsys.com/csharp/readbinary.html + byte[] buffer = new byte[32768]; + using (MemoryStream ms = new MemoryStream()) + { + while (true) + { + int read = stream.Read(buffer, 0, buffer.Length); + if (read <= 0) + return ms.ToArray(); + ms.Write(buffer, 0, read); + } + } + } + + + private Stream TranslateStream(Stream value, CompressionType compression, CompressionMode mode) + { + switch (compression) + { + case CompressionType.None: + return value; + case CompressionType.Deflate: + return new DeflateStream(value, mode, true); + case CompressionType.GZip: + return new GZipStream(value, mode, true); + + default: + throw new ArgumentException("Did not understand compression type.", "compression"); + } + } + + #endregion + + internal object BeginDeserialize() { XmlElement root = (XmlElement)doc.ChildNodes[0]; @@ -1113,6 +1245,9 @@ // load the type if it is not the default type. string typename = CurrentNode.Attributes["type"].Value; + if (typename == "null") + return null; + type = Binder.GetType(typename); if (type == null) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-01-11 23:12:57
|
Revision: 1186 http://agate.svn.sourceforge.net/agate/?rev=1186&view=rev Author: kanato Date: 2010-01-11 23:12:48 +0000 (Mon, 11 Jan 2010) Log Message: ----------- * GL_Display.cs: Disable GL3 code, since it doesn't work yet. * GL3/Shaders/ShaderSources.resx: Correct case-sensitive reference to resources file. Modified Paths: -------------- trunk/Drivers/AgateOTK/GL3/Shaders/ShaderSources.resx trunk/Drivers/AgateOTK/GL_Display.cs trunk/Drivers/AgateOTK/ShaderFactory.cs Modified: trunk/Drivers/AgateOTK/GL3/Shaders/ShaderSources.resx =================================================================== --- trunk/Drivers/AgateOTK/GL3/Shaders/ShaderSources.resx 2010-01-08 18:38:02 UTC (rev 1185) +++ trunk/Drivers/AgateOTK/GL3/Shaders/ShaderSources.resx 2010-01-11 23:12:48 UTC (rev 1186) @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <root> <!-- Microsoft ResX Schema @@ -119,9 +119,9 @@ </resheader> <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <data name="Basic2D_pixel" type="System.Resources.ResXFileRef, System.Windows.Forms"> - <value>..\..\resources\basic2d_pixel.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value> + <value>..\..\Resources\Basic2D_pixel.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value> </data> <data name="Basic2D_vert" type="System.Resources.ResXFileRef, System.Windows.Forms"> - <value>..\..\resources\basic2d_vert.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value> + <value>..\..\Resources\Basic2D_vert.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value> </data> </root> \ No newline at end of file Modified: trunk/Drivers/AgateOTK/GL_Display.cs =================================================================== --- trunk/Drivers/AgateOTK/GL_Display.cs 2010-01-08 18:38:02 UTC (rev 1185) +++ trunk/Drivers/AgateOTK/GL_Display.cs 2010-01-11 23:12:48 UTC (rev 1186) @@ -282,8 +282,13 @@ mGLVersion = DetectOpenGLVersion(); if (mGLVersion >= 3m) - mGL3 = true; + { + //mGL3 = true; + mGL3 = false; + mGLVersion = 2.1m; + } + LoadExtensions(); mSupportsFramebufferExt = SupportsExtension("GL_EXT_FRAMEBUFFER_OBJECT"); Modified: trunk/Drivers/AgateOTK/ShaderFactory.cs =================================================================== --- trunk/Drivers/AgateOTK/ShaderFactory.cs 2010-01-08 18:38:02 UTC (rev 1185) +++ trunk/Drivers/AgateOTK/ShaderFactory.cs 2010-01-11 23:12:48 UTC (rev 1186) @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -20,8 +20,8 @@ internal static void Initialize(bool gl3supported) { - //if (gl3supported) - // inst = new GL3.Shaders.ShaderFactory3(); + if (gl3supported) + inst = new GL3.Shaders.ShaderFactory3(); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-01-08 18:38:09
|
Revision: 1185 http://agate.svn.sourceforge.net/agate/?rev=1185&view=rev Author: kanato Date: 2010-01-08 18:38:02 +0000 (Fri, 08 Jan 2010) Log Message: ----------- Fix minor GL3 issues. Remove XAudio2_StreamingSoundBuffer debug output. Modified Paths: -------------- trunk/Drivers/AgateOTK/GL3/DrawBuffer.cs trunk/Drivers/AgateOTK/GL3/Shaders/GL3_Basic2DShader.cs trunk/Drivers/AgateOTK/GL_Display.cs trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs Modified: trunk/Drivers/AgateOTK/GL3/DrawBuffer.cs =================================================================== --- trunk/Drivers/AgateOTK/GL3/DrawBuffer.cs 2010-01-08 18:36:43 UTC (rev 1184) +++ trunk/Drivers/AgateOTK/GL3/DrawBuffer.cs 2010-01-08 18:38:02 UTC (rev 1185) @@ -32,8 +32,9 @@ namespace AgateOTK.GL3 { /// <summary> - /// Not GL3 compatible. Need replacements for - /// EnableClientState,TexCoordPointer, etc. + /// Not GL3 compatible. Need replacement for + /// Quad drawing, since quads are deprecated. + /// Thus, we need an index buffer. /// </summary> public class DrawBuffer : GLDrawBuffer { @@ -92,6 +93,7 @@ PointF[] cachePts = new PointF[4]; int mBufferID; + int mVaoID; public DrawBuffer() { @@ -99,6 +101,8 @@ Debug.Print("GL3 DrawBuffer: Draw buffer ID: {0}", mBufferID); SetBufferSize(1000); + + GL.GenVertexArrays(1, out mVaoID); } private void SetBufferSize(int size) @@ -111,7 +115,7 @@ private void BufferData() { - int bufferSize = mIndex * Marshal.SizeOf(typeof(PositionTextureColorNormal)); + int bufferSize = mIndex * Marshal.SizeOf(typeof(PositionTextureColor)); GL.BindBuffer(BufferTarget.ArrayBuffer, mBufferID); @@ -239,6 +243,8 @@ if (mIndex == 0) return; + GL.BindVertexArray(mVaoID); + BufferData(); SetGLInterpolation(); @@ -253,17 +259,6 @@ GL.BindTexture(TextureTarget.Texture2D, mCurrentTexture); shader.SetTexture(0); - //int size = Marshal.SizeOf(typeof(PositionTextureColorNormal)); - //int tex = PositionTextureColorNormal.VertexLayout.ElementByteIndex(VertexElement.Texture); - //int color = PositionTextureColorNormal.VertexLayout.ElementByteIndex(VertexElement.DiffuseColor); - //int pos = PositionTextureColorNormal.VertexLayout.ElementByteIndex(VertexElement.Position); - //int norm = PositionTextureColorNormal.VertexLayout.ElementByteIndex(VertexElement.Normal); - - //GL.TexCoordPointer(2, TexCoordPointerType.Float, size, (IntPtr) tex); - //GL.ColorPointer(4, ColorPointerType.UnsignedByte, size, (IntPtr) color); - //GL.VertexPointer(2, VertexPointerType.Float, size, (IntPtr) pos); - //GL.NormalPointer(NormalPointerType.Float, size, (IntPtr)norm); - GL.DrawArrays(BeginMode.Quads, 0, mIndex); mIndex = 0; Modified: trunk/Drivers/AgateOTK/GL3/Shaders/GL3_Basic2DShader.cs =================================================================== --- trunk/Drivers/AgateOTK/GL3/Shaders/GL3_Basic2DShader.cs 2010-01-08 18:36:43 UTC (rev 1184) +++ trunk/Drivers/AgateOTK/GL3/Shaders/GL3_Basic2DShader.cs 2010-01-08 18:38:02 UTC (rev 1185) @@ -102,10 +102,11 @@ int count = CountOf(desc.DataType); VertexAttribPointerType type = AttribTypeOf(desc.DataType); + GL.EnableVertexAttribArray(pos); + GL.VertexAttribPointer(pos, count, type, false, layout.VertexSize, layout.ElementByteIndex(desc.ElementType)); - GL.EnableVertexAttribArray(pos); } } Modified: trunk/Drivers/AgateOTK/GL_Display.cs =================================================================== --- trunk/Drivers/AgateOTK/GL_Display.cs 2010-01-08 18:36:43 UTC (rev 1184) +++ trunk/Drivers/AgateOTK/GL_Display.cs 2010-01-08 18:38:02 UTC (rev 1185) @@ -281,6 +281,9 @@ mSupportsShaders = false; mGLVersion = DetectOpenGLVersion(); + if (mGLVersion >= 3m) + mGL3 = true; + LoadExtensions(); mSupportsFramebufferExt = SupportsExtension("GL_EXT_FRAMEBUFFER_OBJECT"); @@ -290,7 +293,6 @@ { mNonPowerOf2Textures = true; mSupportsShaders = true; - mGL3 = true; } if (mGLVersion >= 2m) { Modified: trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs =================================================================== --- trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs 2010-01-08 18:36:43 UTC (rev 1184) +++ trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs 2010-01-08 18:38:02 UTC (rev 1185) @@ -41,7 +41,7 @@ bool mPlaying; int mNextData; double mPan; - BinaryWriter w; + //BinaryWriter w; bool mIsDisposed; bool mReadingData; int thisBufferIndex; @@ -118,7 +118,7 @@ string tempFileName = string.Format("xaudio2_buffer{0}.pcm", count); count++; - w = new BinaryWriter(File.Open(tempFileName, FileMode.Create)); + //w = new BinaryWriter(File.Open(tempFileName, FileMode.Create)); Pan = 0; } @@ -140,7 +140,7 @@ Thread.Sleep(1); mVoice.Stop(); - w.BaseStream.Dispose(); + //w.BaseStream.Dispose(); try { @@ -242,7 +242,7 @@ bufferData.buffer.AudioData = bufferData.ms; bufferData.buffer.AudioBytes = count; - w.Write(bufferData.backing, 0, count); + //w.Write(bufferData.backing, 0, count); } private void SubmitData(BufferData bufferData) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-01-08 18:36:50
|
Revision: 1184 http://agate.svn.sourceforge.net/agate/?rev=1184&view=rev Author: kanato Date: 2010-01-08 18:36:43 +0000 (Fri, 08 Jan 2010) Log Message: ----------- Add x86 and x64 targets to AgateTools solution and projects. Fix output directories for tools. Force FontCreator to use AgateDrawing. Modified Paths: -------------- trunk/AgateTools.sln trunk/Tools/FontCreator/FontCreator.cs trunk/Tools/FontCreator/FontCreator.csproj trunk/Tools/FontCreator/FontCreatorProgram.cs trunk/Tools/NotebookLib/NotebookLib/NotebookLib.csproj trunk/Tools/PackedSpriteCreator/PackedSpriteCreator.csproj trunk/Tools/ResourceEditor/ResourceEditor.csproj Modified: trunk/AgateTools.sln =================================================================== --- trunk/AgateTools.sln 2010-01-08 18:35:23 UTC (rev 1183) +++ trunk/AgateTools.sln 2010-01-08 18:36:43 UTC (rev 1184) @@ -24,37 +24,97 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Debug|x64.ActiveCfg = Debug|x64 + {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Debug|x64.Build.0 = Debug|x64 + {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Debug|x86.ActiveCfg = Debug|x86 + {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Debug|x86.Build.0 = Debug|x86 {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Release|Any CPU.ActiveCfg = Release|Any CPU {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Release|Any CPU.Build.0 = Release|Any CPU + {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Release|x64.ActiveCfg = Release|x64 + {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Release|x64.Build.0 = Release|x64 + {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Release|x86.ActiveCfg = Release|x86 + {FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}.Release|x86.Build.0 = Release|x86 {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|x64.ActiveCfg = Debug|x64 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|x64.Build.0 = Debug|x64 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|x86.ActiveCfg = Debug|x86 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|x86.Build.0 = Debug|x86 {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|Any CPU.ActiveCfg = Release|Any CPU {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|Any CPU.Build.0 = Release|Any CPU + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|x64.ActiveCfg = Release|x64 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|x64.Build.0 = Release|x64 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|x86.ActiveCfg = Release|x86 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|x86.Build.0 = Release|x86 {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Debug|x64.ActiveCfg = Debug|x64 + {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Debug|x64.Build.0 = Debug|x64 + {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Debug|x86.ActiveCfg = Debug|x86 + {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Debug|x86.Build.0 = Debug|x86 {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Release|Any CPU.ActiveCfg = Release|Any CPU {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Release|Any CPU.Build.0 = Release|Any CPU + {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Release|x64.ActiveCfg = Release|x64 + {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Release|x64.Build.0 = Release|x64 + {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Release|x86.ActiveCfg = Release|x86 + {C653C244-F604-4BA4-8822-D04FA9ACEFA5}.Release|x86.Build.0 = Release|x86 {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|x64.ActiveCfg = Debug|x64 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|x64.Build.0 = Debug|x64 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|x86.ActiveCfg = Debug|x86 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|x86.Build.0 = Debug|x86 {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|Any CPU.ActiveCfg = Release|Any CPU {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|Any CPU.Build.0 = Release|Any CPU + {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|x64.ActiveCfg = Release|x64 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|x64.Build.0 = Release|x64 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|x86.ActiveCfg = Release|x86 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|x86.Build.0 = Release|x86 {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Debug|x64.ActiveCfg = Debug|x64 + {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Debug|x64.Build.0 = Debug|x64 + {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Debug|x86.ActiveCfg = Debug|x86 + {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Debug|x86.Build.0 = Debug|x86 {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Release|Any CPU.ActiveCfg = Release|Any CPU {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Release|Any CPU.Build.0 = Release|Any CPU + {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Release|x64.ActiveCfg = Release|x64 + {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Release|x64.Build.0 = Release|x64 + {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Release|x86.ActiveCfg = Release|x86 + {A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}.Release|x86.Build.0 = Release|x86 {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x64.ActiveCfg = Debug|x64 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x64.Build.0 = Debug|x64 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x86.ActiveCfg = Debug|x86 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x86.Build.0 = Debug|x86 {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Any CPU.ActiveCfg = Release|Any CPU {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Any CPU.Build.0 = Release|Any CPU + {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x64.ActiveCfg = Release|x64 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x64.Build.0 = Release|x64 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x86.ActiveCfg = Release|x86 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x86.Build.0 = Release|x86 {91F57346-B574-4D52-9EB0-AA191B552C94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {91F57346-B574-4D52-9EB0-AA191B552C94}.Debug|Any CPU.Build.0 = Debug|Any CPU + {91F57346-B574-4D52-9EB0-AA191B552C94}.Debug|x64.ActiveCfg = Debug|x64 + {91F57346-B574-4D52-9EB0-AA191B552C94}.Debug|x64.Build.0 = Debug|x64 + {91F57346-B574-4D52-9EB0-AA191B552C94}.Debug|x86.ActiveCfg = Debug|x86 + {91F57346-B574-4D52-9EB0-AA191B552C94}.Debug|x86.Build.0 = Debug|x86 {91F57346-B574-4D52-9EB0-AA191B552C94}.Release|Any CPU.ActiveCfg = Release|Any CPU {91F57346-B574-4D52-9EB0-AA191B552C94}.Release|Any CPU.Build.0 = Release|Any CPU + {91F57346-B574-4D52-9EB0-AA191B552C94}.Release|x64.ActiveCfg = Release|x64 + {91F57346-B574-4D52-9EB0-AA191B552C94}.Release|x64.Build.0 = Release|x64 + {91F57346-B574-4D52-9EB0-AA191B552C94}.Release|x86.ActiveCfg = Release|x86 + {91F57346-B574-4D52-9EB0-AA191B552C94}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: trunk/Tools/FontCreator/FontCreator.cs =================================================================== --- trunk/Tools/FontCreator/FontCreator.cs 2010-01-08 18:35:23 UTC (rev 1183) +++ trunk/Tools/FontCreator/FontCreator.cs 2010-01-08 18:36:43 UTC (rev 1184) @@ -5,8 +5,8 @@ using AgateLib; using AgateLib.DisplayLib; +using AgateLib.DisplayLib.ImplementationBase; using AgateLib.BitmapFont; -using AgateLib.ImplementationBase; using AgateLib.Geometry; using AgateLib.Resources; Modified: trunk/Tools/FontCreator/FontCreator.csproj =================================================================== --- trunk/Tools/FontCreator/FontCreator.csproj 2010-01-08 18:35:23 UTC (rev 1183) +++ trunk/Tools/FontCreator/FontCreator.csproj 2010-01-08 18:36:43 UTC (rev 1184) @@ -1,7 +1,7 @@ <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <PropertyGroup> <ProjectType>Local</ProjectType> - <ProductVersion>9.0.30729</ProductVersion> + <ProductVersion>9.0.21022</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{A18DEAA1-EB7F-4B4A-B93A-83A2CAD5954A}</ProjectGuid> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> @@ -37,7 +37,7 @@ <DebugSymbols>True</DebugSymbols> <FileAlignment>4096</FileAlignment> <Optimize>False</Optimize> - <OutputPath>..\..\Binaries\Debug\Tools\FontCreator\</OutputPath> + <OutputPath>..\..\Binaries\Debug\FontCreator\</OutputPath> <RegisterForComInterop>False</RegisterForComInterop> <RemoveIntegerChecks>False</RemoveIntegerChecks> <TreatWarningsAsErrors>False</TreatWarningsAsErrors> @@ -57,7 +57,7 @@ <DebugSymbols>False</DebugSymbols> <FileAlignment>4096</FileAlignment> <Optimize>True</Optimize> - <OutputPath>..\..\Binaries\Release\Tools\FontCreator\</OutputPath> + <OutputPath>..\..\Binaries\Debug\FontCreator\</OutputPath> <RegisterForComInterop>False</RegisterForComInterop> <RemoveIntegerChecks>False</RemoveIntegerChecks> <TreatWarningsAsErrors>False</TreatWarningsAsErrors> @@ -65,6 +65,38 @@ <NoWarn> </NoWarn> </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> + <DebugSymbols>true</DebugSymbols> + <OutputPath>..\..\Binaries\Debug\FontCreator\</OutputPath> + <DefineConstants>DEBUG;TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x64</PlatformTarget> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> + <OutputPath>..\..\Binaries\Debug\FontCreator\</OutputPath> + <DefineConstants>TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <Optimize>true</Optimize> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x64</PlatformTarget> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> + <DebugSymbols>true</DebugSymbols> + <OutputPath>..\..\Binaries\Debug\FontCreator\</OutputPath> + <DefineConstants>DEBUG;TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x86</PlatformTarget> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> + <OutputPath>..\..\Binaries\Debug\FontCreator\</OutputPath> + <DefineConstants>TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <Optimize>true</Optimize> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x86</PlatformTarget> + </PropertyGroup> <ItemGroup> <Reference Include="System"> <Name>System</Name> @@ -92,6 +124,10 @@ <Project>{9490B719-829E-43A7-A5FE-8001F8A81759}</Project> <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> </ProjectReference> + <ProjectReference Include="..\..\Drivers\AgateDrawing\AgateDrawing.csproj"> + <Project>{164A785D-924E-40FB-A517-D7E677F3B53A}</Project> + <Name>AgateDrawing</Name> + </ProjectReference> <ProjectReference Include="..\..\Drivers\AgateLib.WinForms\AgateLib.WinForms.csproj"> <Name>AgateLib.WinForms</Name> <Project>{BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}</Project> Modified: trunk/Tools/FontCreator/FontCreatorProgram.cs =================================================================== --- trunk/Tools/FontCreator/FontCreatorProgram.cs 2010-01-08 18:35:23 UTC (rev 1183) +++ trunk/Tools/FontCreator/FontCreatorProgram.cs 2010-01-08 18:36:43 UTC (rev 1184) @@ -22,7 +22,6 @@ Directory.CreateDirectory("./images"); - AgateFileProvider.Assemblies.AddPath("../../Drivers"); AgateFileProvider.Images.AddPath("./images"); using (AgateLib.AgateSetup setup = new AgateLib.AgateSetup(args)) Modified: trunk/Tools/NotebookLib/NotebookLib/NotebookLib.csproj =================================================================== --- trunk/Tools/NotebookLib/NotebookLib/NotebookLib.csproj 2010-01-08 18:35:23 UTC (rev 1183) +++ trunk/Tools/NotebookLib/NotebookLib/NotebookLib.csproj 2010-01-08 18:36:43 UTC (rev 1184) @@ -1,7 +1,7 @@ <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <PropertyGroup> <ProjectType>Local</ProjectType> - <ProductVersion>9.0.30729</ProductVersion> + <ProductVersion>9.0.21022</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{91F57346-B574-4D52-9EB0-AA191B552C94}</ProjectGuid> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> @@ -57,7 +57,7 @@ <DebugSymbols>False</DebugSymbols> <FileAlignment>4096</FileAlignment> <Optimize>True</Optimize> - <OutputPath>..\..\..\Binaries\Release\Libraries\</OutputPath> + <OutputPath>..\..\..\Binaries\Debug\Libraries\</OutputPath> <RegisterForComInterop>False</RegisterForComInterop> <RemoveIntegerChecks>False</RemoveIntegerChecks> <TreatWarningsAsErrors>False</TreatWarningsAsErrors> @@ -65,6 +65,38 @@ <NoWarn> </NoWarn> </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> + <DebugSymbols>true</DebugSymbols> + <OutputPath>..\..\..\Binaries\Debug\Libraries\</OutputPath> + <DefineConstants>DEBUG;TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x64</PlatformTarget> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> + <OutputPath>..\..\..\Binaries\Debug\Libraries\</OutputPath> + <DefineConstants>TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <Optimize>true</Optimize> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x64</PlatformTarget> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> + <DebugSymbols>true</DebugSymbols> + <OutputPath>..\..\..\Binaries\Debug\Libraries\</OutputPath> + <DefineConstants>DEBUG;TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x86</PlatformTarget> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> + <OutputPath>..\..\..\Binaries\Debug\Libraries\</OutputPath> + <DefineConstants>TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <Optimize>true</Optimize> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x86</PlatformTarget> + </PropertyGroup> <ItemGroup> <Reference Include="System"> <Name>System</Name> Modified: trunk/Tools/PackedSpriteCreator/PackedSpriteCreator.csproj =================================================================== --- trunk/Tools/PackedSpriteCreator/PackedSpriteCreator.csproj 2010-01-08 18:35:23 UTC (rev 1183) +++ trunk/Tools/PackedSpriteCreator/PackedSpriteCreator.csproj 2010-01-08 18:36:43 UTC (rev 1184) @@ -1,7 +1,7 @@ <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <PropertyGroup> <ProjectType>Local</ProjectType> - <ProductVersion>9.0.30729</ProductVersion> + <ProductVersion>9.0.21022</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{C653C244-F604-4BA4-8822-D04FA9ACEFA5}</ProjectGuid> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> @@ -37,7 +37,7 @@ <DebugSymbols>True</DebugSymbols> <FileAlignment>4096</FileAlignment> <Optimize>False</Optimize> - <OutputPath>..\..\Binaries\Debug\Tools\PackedSpriteCreator\</OutputPath> + <OutputPath>..\..\Binaries\Debug\PackedSpriteCreator\</OutputPath> <RegisterForComInterop>False</RegisterForComInterop> <RemoveIntegerChecks>False</RemoveIntegerChecks> <TreatWarningsAsErrors>False</TreatWarningsAsErrors> @@ -57,7 +57,7 @@ <DebugSymbols>False</DebugSymbols> <FileAlignment>4096</FileAlignment> <Optimize>True</Optimize> - <OutputPath>..\..\Binaries\Release\Tools\PackedSpriteCreator\</OutputPath> + <OutputPath>..\..\Binaries\Debug\PackedSpriteCreator\</OutputPath> <RegisterForComInterop>False</RegisterForComInterop> <RemoveIntegerChecks>False</RemoveIntegerChecks> <TreatWarningsAsErrors>False</TreatWarningsAsErrors> @@ -65,6 +65,38 @@ <NoWarn> </NoWarn> </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> + <DebugSymbols>true</DebugSymbols> + <OutputPath>..\..\Binaries\Debug\PackedSpriteCreator\</OutputPath> + <DefineConstants>DEBUG;TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x64</PlatformTarget> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> + <OutputPath>..\..\Binaries\Debug\PackedSpriteCreator\</OutputPath> + <DefineConstants>TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <Optimize>true</Optimize> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x64</PlatformTarget> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> + <DebugSymbols>true</DebugSymbols> + <OutputPath>..\..\Binaries\Debug\PackedSpriteCreator\</OutputPath> + <DefineConstants>DEBUG;TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x86</PlatformTarget> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> + <OutputPath>..\..\Binaries\Debug\PackedSpriteCreator\</OutputPath> + <DefineConstants>TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <Optimize>true</Optimize> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x86</PlatformTarget> + </PropertyGroup> <ItemGroup> <Reference Include="System"> <Name>System</Name> Modified: trunk/Tools/ResourceEditor/ResourceEditor.csproj =================================================================== --- trunk/Tools/ResourceEditor/ResourceEditor.csproj 2010-01-08 18:35:23 UTC (rev 1183) +++ trunk/Tools/ResourceEditor/ResourceEditor.csproj 2010-01-08 18:36:43 UTC (rev 1184) @@ -1,7 +1,7 @@ <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <PropertyGroup> <ProjectType>Local</ProjectType> - <ProductVersion>9.0.30729</ProductVersion> + <ProductVersion>9.0.21022</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{FAB0D7E5-E6AF-4B29-BFE1-6545D6C22621}</ProjectGuid> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> @@ -37,7 +37,7 @@ <DebugSymbols>True</DebugSymbols> <FileAlignment>4096</FileAlignment> <Optimize>False</Optimize> - <OutputPath>..\..\Binaries\Debug\Tools\ResourceEditor\</OutputPath> + <OutputPath>..\..\Binaries\Debug\ResourceEditor\</OutputPath> <RegisterForComInterop>False</RegisterForComInterop> <RemoveIntegerChecks>False</RemoveIntegerChecks> <TreatWarningsAsErrors>False</TreatWarningsAsErrors> @@ -57,7 +57,7 @@ <DebugSymbols>False</DebugSymbols> <FileAlignment>4096</FileAlignment> <Optimize>True</Optimize> - <OutputPath>..\..\Binaries\Release\Tools\ResourceEditor\</OutputPath> + <OutputPath>..\..\Binaries\Debug\ResourceEditor\</OutputPath> <RegisterForComInterop>False</RegisterForComInterop> <RemoveIntegerChecks>False</RemoveIntegerChecks> <TreatWarningsAsErrors>False</TreatWarningsAsErrors> @@ -65,6 +65,38 @@ <NoWarn> </NoWarn> </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> + <DebugSymbols>true</DebugSymbols> + <OutputPath>..\..\Binaries\Debug\ResourceEditor\</OutputPath> + <DefineConstants>DEBUG;TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x64</PlatformTarget> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> + <OutputPath>..\..\Binaries\Debug\ResourceEditor\</OutputPath> + <DefineConstants>TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <Optimize>true</Optimize> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x64</PlatformTarget> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> + <DebugSymbols>true</DebugSymbols> + <OutputPath>..\..\Binaries\Debug\ResourceEditor\</OutputPath> + <DefineConstants>DEBUG;TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x86</PlatformTarget> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> + <OutputPath>..\..\Binaries\Debug\ResourceEditor\</OutputPath> + <DefineConstants>TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <Optimize>true</Optimize> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x86</PlatformTarget> + </PropertyGroup> <ItemGroup> <Reference Include="System"> <Name>System</Name> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-01-08 18:35:29
|
Revision: 1183 http://agate.svn.sourceforge.net/agate/?rev=1183&view=rev Author: kanato Date: 2010-01-08 18:35:23 +0000 (Fri, 08 Jan 2010) Log Message: ----------- Make initialization with preferred drivers work. Modified Paths: -------------- trunk/AgateLib/AgateSetup.cs Modified: trunk/AgateLib/AgateSetup.cs =================================================================== --- trunk/AgateLib/AgateSetup.cs 2010-01-06 08:27:18 UTC (rev 1182) +++ trunk/AgateLib/AgateSetup.cs 2010-01-08 18:35:23 UTC (rev 1183) @@ -184,7 +184,7 @@ private void InitializeDisplay() { DoAskUser(); - InitializeDisplay(mSelectDisplay); + InitializeDisplay(mPreferredDisplay); } /// <summary> @@ -205,7 +205,7 @@ private void InitializeAudio() { DoAskUser(); - InitializeAudio(mSelectAudio); + InitializeAudio(mPreferredAudio); } /// <summary> /// Initializes the Audio subsystem, to the specified driver. @@ -226,7 +226,7 @@ private void InitializeInput() { DoAskUser(); - InitializeInput(mSelectInput); + InitializeInput(mPreferredInput); } /// <summary> /// Initializes the Input subsystem, to the specified driver. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-01-06 08:27:25
|
Revision: 1182 http://agate.svn.sourceforge.net/agate/?rev=1182&view=rev Author: kanato Date: 2010-01-06 08:27:18 +0000 (Wed, 06 Jan 2010) Log Message: ----------- Initial GL3 implementation of Basic2D shader. Modified Paths: -------------- trunk/Drivers/AgateOTK/AgateOTK.csproj trunk/Drivers/AgateOTK/GL3/DrawBuffer.cs trunk/Drivers/AgateOTK/GL_Display.cs trunk/Drivers/AgateOTK/GL_DisplayControl.cs trunk/Drivers/AgateOTK/Legacy/FixedFunction/FixedFunctionShaderFactory.cs trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Basic2DShader.cs trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Lighting2D.cs trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Lighting3D.cs Added Paths: ----------- trunk/Drivers/AgateOTK/GL3/ShaderSources.Designer.cs trunk/Drivers/AgateOTK/GL3/Shaders/ trunk/Drivers/AgateOTK/GL3/Shaders/GL3_Basic2DShader.cs trunk/Drivers/AgateOTK/GL3/Shaders/GlslFragmentProgram.cs trunk/Drivers/AgateOTK/GL3/Shaders/GlslShader.cs trunk/Drivers/AgateOTK/GL3/Shaders/GlslShaderCompiler.cs trunk/Drivers/AgateOTK/GL3/Shaders/GlslVertexProgram.cs trunk/Drivers/AgateOTK/GL3/Shaders/IGL3Shader.cs trunk/Drivers/AgateOTK/GL3/Shaders/ShaderFactory3.cs trunk/Drivers/AgateOTK/GL3/Shaders/ShaderSources.Designer.cs trunk/Drivers/AgateOTK/GL3/Shaders/ShaderSources.resx trunk/Drivers/AgateOTK/Legacy/FixedFunction/ trunk/Drivers/AgateOTK/Resources/ trunk/Drivers/AgateOTK/Resources/Basic2D_pixel.txt trunk/Drivers/AgateOTK/Resources/Basic2D_vert.txt trunk/Drivers/AgateOTK/ShaderFactory.cs Removed Paths: ------------- trunk/Drivers/AgateOTK/Legacy/ArbShader.cs trunk/Drivers/AgateOTK/Legacy/ArbShaderCompiler.cs trunk/Drivers/AgateOTK/Shaders/ Modified: trunk/Drivers/AgateOTK/AgateOTK.csproj =================================================================== --- trunk/Drivers/AgateOTK/AgateOTK.csproj 2010-01-06 08:15:41 UTC (rev 1181) +++ trunk/Drivers/AgateOTK/AgateOTK.csproj 2010-01-06 08:27:18 UTC (rev 1182) @@ -146,12 +146,12 @@ <Compile Include="GL3\DrawBuffer.cs" /> <Compile Include="GL3\GLVertexBuffer.cs" /> <Compile Include="GL3\GLPrimitiveRenderer.cs" /> - <Compile Include="Legacy\ArbShader.cs"> - <SubType>Code</SubType> + <Compile Include="GL3\Shaders\IGL3Shader.cs" /> + <Compile Include="GL3\Shaders\ShaderSources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>ShaderSources.resx</DependentUpon> </Compile> - <Compile Include="Legacy\ArbShaderCompiler.cs"> - <SubType>Code</SubType> - </Compile> <Compile Include="ContextFB.cs" /> <Compile Include="frmFullScreen.cs"> <SubType>Form</SubType> @@ -167,16 +167,18 @@ <Compile Include="Legacy\LegacyDrawBuffer.cs" /> <Compile Include="Legacy\LegacyPrimitiveRenderer.cs" /> <Compile Include="PrimitiveRenderer.cs" /> - <Compile Include="Shaders\GlslFragmentProgram.cs"> + <Compile Include="GL3\Shaders\ShaderFactory3.cs" /> + <Compile Include="GL3\Shaders\GL3_Basic2DShader.cs" /> + <Compile Include="GL3\Shaders\GlslFragmentProgram.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="Shaders\GlslShader.cs"> + <Compile Include="GL3\Shaders\GlslShader.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="Shaders\GlslShaderCompiler.cs"> + <Compile Include="GL3\Shaders\GlslShaderCompiler.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="Shaders\GlslVertexProgram.cs"> + <Compile Include="GL3\Shaders\GlslVertexProgram.cs"> <SubType>Code</SubType> </Compile> <Compile Include="GL_Display.cs"> @@ -199,18 +201,15 @@ <SubType>Code</SubType> </Compile> <Compile Include="Legacy\FrameBufferReadPixels.cs" /> - <Compile Include="Shaders\OtkShader.cs"> - <SubType>Code</SubType> - </Compile> <Compile Include="Otk_Reporter.cs"> <SubType>Code</SubType> </Compile> <Compile Include="GL_FrameBuffer.cs" /> - <Compile Include="Shaders\FixedFunction\FixedFunctionShaderFactory.cs" /> - <Compile Include="Shaders\FixedFunction\OTK_FF_Basic2DShader.cs" /> - <Compile Include="Shaders\FixedFunction\OTK_FF_Lighting3D.cs" /> - <Compile Include="Shaders\FixedFunction\OTK_FF_Lighting2D.cs" /> - <Compile Include="Shaders\ShaderFactory.cs" /> + <Compile Include="Legacy\FixedFunction\FixedFunctionShaderFactory.cs" /> + <Compile Include="Legacy\FixedFunction\OTK_FF_Basic2DShader.cs" /> + <Compile Include="Legacy\FixedFunction\OTK_FF_Lighting3D.cs" /> + <Compile Include="Legacy\FixedFunction\OTK_FF_Lighting2D.cs" /> + <Compile Include="ShaderFactory.cs" /> <Compile Include="TextureCoordinates.cs"> <SubType>Code</SubType> </Compile> @@ -221,6 +220,11 @@ <SubType>Designer</SubType> <DependentUpon>frmFullScreen.cs</DependentUpon> </EmbeddedResource> + <EmbeddedResource Include="GL3\Shaders\ShaderSources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <SubType>Designer</SubType> + <LastGenOutput>ShaderSources.Designer.cs</LastGenOutput> + </EmbeddedResource> </ItemGroup> <ItemGroup> <Content Include="OpenTK.dll"> @@ -229,6 +233,8 @@ <Content Include="OpenTK.xml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> + <None Include="Resources\Basic2D_pixel.txt" /> + <None Include="Resources\Basic2D_vert.txt" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> <PropertyGroup> Modified: trunk/Drivers/AgateOTK/GL3/DrawBuffer.cs =================================================================== --- trunk/Drivers/AgateOTK/GL3/DrawBuffer.cs 2010-01-06 08:15:41 UTC (rev 1181) +++ trunk/Drivers/AgateOTK/GL3/DrawBuffer.cs 2010-01-06 08:27:18 UTC (rev 1182) @@ -83,7 +83,7 @@ } #endregion - PositionTextureColorNormal[] mVerts; + PositionTextureColor[] mVerts; int mIndex; int mCurrentTexture; @@ -103,7 +103,7 @@ private void SetBufferSize(int size) { - mVerts = new PositionTextureColorNormal[size]; + mVerts = new PositionTextureColor[size]; mIndex = 0; } @@ -196,8 +196,6 @@ { mVerts[mIndex + i].X = pts[i].X; mVerts[mIndex + i].Y = pts[i].Y; - - mVerts[mIndex + i].Normal = new Vector3(0, 0, -1); } mVerts[mIndex].U = texCoord.Left; @@ -243,26 +241,29 @@ BufferData(); - GL.BindTexture(TextureTarget.Texture2D, mCurrentTexture); - SetGLInterpolation(); - GL.EnableClientState(EnableCap.TextureCoordArray); - GL.EnableClientState(EnableCap.ColorArray); - GL.EnableClientState(EnableCap.VertexArray); - GL.EnableClientState(EnableCap.NormalArray); + GL_Display display = (GL_Display)Display.Impl; + Shaders.IGL3Shader shader = (Shaders.IGL3Shader) display.Shader.Impl; - int size = Marshal.SizeOf(typeof(PositionTextureColorNormal)); - int tex = PositionTextureColorNormal.VertexLayout.ElementByteIndex(VertexElement.Texture); - int color = PositionTextureColorNormal.VertexLayout.ElementByteIndex(VertexElement.DiffuseColor); - int pos = PositionTextureColorNormal.VertexLayout.ElementByteIndex(VertexElement.Position); - int norm = PositionTextureColorNormal.VertexLayout.ElementByteIndex(VertexElement.Normal); + shader.SetVertexAttributes(PositionTextureColor.VertexLayout); - GL.TexCoordPointer(2, TexCoordPointerType.Float, size, (IntPtr) tex); - GL.ColorPointer(4, ColorPointerType.UnsignedByte, size, (IntPtr) color); - GL.VertexPointer(2, VertexPointerType.Float, size, (IntPtr) pos); - GL.NormalPointer(NormalPointerType.Float, size, (IntPtr)norm); + + GL.ActiveTexture(TextureUnit.Texture0); + GL.BindTexture(TextureTarget.Texture2D, mCurrentTexture); + shader.SetTexture(0); + //int size = Marshal.SizeOf(typeof(PositionTextureColorNormal)); + //int tex = PositionTextureColorNormal.VertexLayout.ElementByteIndex(VertexElement.Texture); + //int color = PositionTextureColorNormal.VertexLayout.ElementByteIndex(VertexElement.DiffuseColor); + //int pos = PositionTextureColorNormal.VertexLayout.ElementByteIndex(VertexElement.Position); + //int norm = PositionTextureColorNormal.VertexLayout.ElementByteIndex(VertexElement.Normal); + + //GL.TexCoordPointer(2, TexCoordPointerType.Float, size, (IntPtr) tex); + //GL.ColorPointer(4, ColorPointerType.UnsignedByte, size, (IntPtr) color); + //GL.VertexPointer(2, VertexPointerType.Float, size, (IntPtr) pos); + //GL.NormalPointer(NormalPointerType.Float, size, (IntPtr)norm); + GL.DrawArrays(BeginMode.Quads, 0, mIndex); mIndex = 0; Added: trunk/Drivers/AgateOTK/GL3/ShaderSources.Designer.cs =================================================================== --- trunk/Drivers/AgateOTK/GL3/ShaderSources.Designer.cs (rev 0) +++ trunk/Drivers/AgateOTK/GL3/ShaderSources.Designer.cs 2010-01-06 08:27:18 UTC (rev 1182) @@ -0,0 +1,124 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <data name="Basic2D.vert" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\Basic2D.vert.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value> + </data> +</root> \ No newline at end of file Added: trunk/Drivers/AgateOTK/GL3/Shaders/GL3_Basic2DShader.cs =================================================================== --- trunk/Drivers/AgateOTK/GL3/Shaders/GL3_Basic2DShader.cs (rev 0) +++ trunk/Drivers/AgateOTK/GL3/Shaders/GL3_Basic2DShader.cs 2010-01-06 08:27:18 UTC (rev 1182) @@ -0,0 +1,165 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using AgateLib.DisplayLib.Shaders.Implementation; +using AgateLib.Geometry; +using OpenTK.Graphics.OpenGL; + +namespace AgateOTK.GL3.Shaders +{ + class GL3_Basic2DShader : Basic2DImpl, IGL3Shader + { + GlslShader shader; + Rectangle coords; + + public GL3_Basic2DShader() + { + shader = GlslShaderCompiler.CompileShader( + ShaderSources.Basic2D_vert, ShaderSources.Basic2D_pixel); + } + + public override Rectangle CoordinateSystem + { + get + { + return coords; + } + set + { + coords = value; + } + } + + + public override void Begin() + { + GL.UseProgram(shader.Handle); + + shader.SetUniform("transform", Matrix4x4.Ortho((RectangleF)coords, -1, 1)); + + } + + public override void BeginPass(int passIndex) + { + throw new NotImplementedException(); + } + + public override void EndPass() + { + throw new NotImplementedException(); + } + + public override void End() + { + } + + + public override void SetTexture(AgateLib.DisplayLib.Shaders.EffectTexture tex, string variableName) + { + throw new NotImplementedException(); + } + + public override void SetVariable(string name, params float[] v) + { + throw new NotImplementedException(); + } + + public override void SetVariable(string name, params int[] v) + { + throw new NotImplementedException(); + } + + public override void SetVariable(string name, Matrix4x4 matrix) + { + throw new NotImplementedException(); + } + + public override void SetVariable(string name, Color color) + { + throw new NotImplementedException(); + } + + public override int Passes + { + get { throw new NotImplementedException(); } + } + + + #region IGL3Shader Members + + public void SetTexture(int value) + { + shader.SetUniform("texture", value ); + } + public void SetVertexAttributes(AgateLib.Geometry.VertexTypes.VertexLayout layout) + { + for (int i = 0; i < layout.Count; i++) + { + var desc = layout[i]; + + int pos = shader.GetAttribLocation(VaryingName(desc)); + int count = CountOf(desc.DataType); + VertexAttribPointerType type = AttribTypeOf(desc.DataType); + + GL.VertexAttribPointer(pos, count, type, false, layout.VertexSize, + layout.ElementByteIndex(desc.ElementType)); + + GL.EnableVertexAttribArray(pos); + } + } + + private int CountOf(AgateLib.Geometry.VertexTypes.VertexElementDataType vertexElementDataType) + { + switch (vertexElementDataType) + { + case AgateLib.Geometry.VertexTypes.VertexElementDataType.Float1: + return 1; + + case AgateLib.Geometry.VertexTypes.VertexElementDataType.Float2: + return 2; + case AgateLib.Geometry.VertexTypes.VertexElementDataType.Float3: + return 3; + case AgateLib.Geometry.VertexTypes.VertexElementDataType.Float4: + case AgateLib.Geometry.VertexTypes.VertexElementDataType.Int: + return 4; + + default: + throw new AgateLib.AgateException("Unrecognized data type."); + } + } + private VertexAttribPointerType AttribTypeOf(AgateLib.Geometry.VertexTypes.VertexElementDataType vertexElementDataType) + { + switch (vertexElementDataType) + { + case AgateLib.Geometry.VertexTypes.VertexElementDataType.Float1: + case AgateLib.Geometry.VertexTypes.VertexElementDataType.Float2: + case AgateLib.Geometry.VertexTypes.VertexElementDataType.Float3: + case AgateLib.Geometry.VertexTypes.VertexElementDataType.Float4: + return VertexAttribPointerType.Float; + + case AgateLib.Geometry.VertexTypes.VertexElementDataType.Int: + return VertexAttribPointerType.Byte; + + default: + throw new AgateLib.AgateException("Unrecognized data type."); + } + } + + string VaryingName(AgateLib.Geometry.VertexTypes.VertexElementDesc vertexElementDesc) + { + switch (vertexElementDesc.ElementType) + { + case AgateLib.Geometry.VertexTypes.VertexElement.Position: + return "position"; + case AgateLib.Geometry.VertexTypes.VertexElement.DiffuseColor: + return "color"; + case AgateLib.Geometry.VertexTypes.VertexElement.Texture: + return "texCoord"; + default: + return null; + } + } + #endregion + } +} \ No newline at end of file Copied: trunk/Drivers/AgateOTK/GL3/Shaders/GlslFragmentProgram.cs (from rev 1157, trunk/Drivers/AgateOTK/Shaders/GlslFragmentProgram.cs) =================================================================== --- trunk/Drivers/AgateOTK/GL3/Shaders/GlslFragmentProgram.cs (rev 0) +++ trunk/Drivers/AgateOTK/GL3/Shaders/GlslFragmentProgram.cs 2010-01-06 08:27:18 UTC (rev 1182) @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using AgateLib.DisplayLib.Shaders; + +namespace AgateOTK.GL3.Shaders +{ + class GlslFragmentProgram + { + int index; + + public GlslFragmentProgram(int index, string source) + { + this.index = index; + this.Source = source; + } + + public string Source { get; private set; } + public int ShaderHandle + { + get { return index; } + } + } +} \ No newline at end of file Copied: trunk/Drivers/AgateOTK/GL3/Shaders/GlslShader.cs (from rev 1157, trunk/Drivers/AgateOTK/Shaders/GlslShader.cs) =================================================================== --- trunk/Drivers/AgateOTK/GL3/Shaders/GlslShader.cs (rev 0) +++ trunk/Drivers/AgateOTK/GL3/Shaders/GlslShader.cs 2010-01-06 08:27:18 UTC (rev 1182) @@ -0,0 +1,251 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using AgateLib.DisplayLib.Shaders; +using OpenTK.Graphics.OpenGL; + +namespace AgateOTK.GL3.Shaders +{ + class GlslShader + { + struct UniformInfo + { + public string Name; + public int Location; + public ActiveUniformType Type; + public int Size; + + public override string ToString() + { + return "Uniform: " + Name + " | " + Type.ToString(); + } + } + struct AttributeInfo + { + public string Name; + public int Location; + public ActiveAttribType Type; + public int Size; + + public override string ToString() + { + return "Uniform: " + Name + " | " + Type.ToString(); + } + } + + List<UniformInfo> mUniforms = new List<UniformInfo>(); + List<AttributeInfo> mAttributes = new List<AttributeInfo>(); + List<string> mAttributeNames; + + List<string> mSampler2DUniforms = new List<string>(); + int programHandle; + + GlslVertexProgram vertex; + GlslFragmentProgram pixel; + + public GlslShader(int handle, GlslVertexProgram vert, GlslFragmentProgram frag) + { + programHandle = handle; + this.vertex = vert; + this.pixel = frag; + + LoadUniforms(); + LoadAttributes(); + } + + private void LoadAttributes() + { + int count; + GL.GetProgram(programHandle, ProgramParameter.ActiveAttributes, out count); + + StringBuilder b = new StringBuilder(1000); + for (int i = 0; i < count; i++) + { + int length; + int size; + ActiveAttribType type; + string name; + GL.GetActiveAttrib(programHandle, i, 1000, out length, out size, out type, b); + name = b.ToString(); + + int loc = GL.GetAttribLocation(programHandle, name); + + // ignore active attributes that we aren't interested in because we don't set them + // with glVertexAttribPointer + if (loc == -1) + continue; + + AttributeInfo info = new AttributeInfo(); + + info.Name = name; + info.Location = loc; + info.Type = type; + info.Size = size; + + mAttributes.Add(info); + } + + mAttributeNames = mAttributes.Select(x => x.Name).ToList(); + } + private void LoadUniforms() + { + int count; + GL.GetProgram(programHandle, ProgramParameter.ActiveUniforms, out count); + + StringBuilder b = new StringBuilder(1000); + for (int i = 0; i < count; i++) + { + int length; + int size; + ActiveUniformType type; + string name; + GL.GetActiveUniform(programHandle, i, 1000, out length, out size, out type, b); + name = b.ToString(); + + // Apparently OpenGL reports not just user uniforms, but also built-in uniforms + // that are determined "active" and accessible in program execution. Built-in uniforms + // won't return a location because they cannot be directly modified by the OpenGL client. + int loc = GL.GetUniformLocation(programHandle, name); + if (loc == -1) + continue; + + UniformInfo info = new UniformInfo(); + + info.Name = name; + info.Location = loc; + info.Type = type; + info.Size = size; + + mUniforms.Add(info); + } + + mSampler2DUniforms = mUniforms + .Where(x => x.Type == ActiveUniformType.Sampler2D) + .Select(x => x.Name) + .ToList(); + } + + public IList<string> Attributes + { + get { return mAttributeNames; } + } + public IList<string> Sampler2DUniforms + { + get + { + return mSampler2DUniforms; + } + } + + public GlslFragmentProgram PixelShader + { + get { return pixel; } + } + public GlslVertexProgram VertexShader + { + get { return vertex; } + } + + public int Handle + { + get { return programHandle; } + } + + private int GetUniformLocation(string name) + { + if (mUniforms.Any(x => x.Name == name)) + return mUniforms.First(x => x.Name == name).Location; + + int loc = GL.GetUniformLocation(programHandle, name); + + if (loc != -1) + return loc; + else + throw new AgateLib.AgateException("Could not find uniform {0} in the GLSL program.", name); + } + internal int GetAttribLocation(string name) + { + if (mAttributes.Any(x => x.Name == name)) + return mAttributes.First(x => x.Name == name).Location; + + int loc = GL.GetAttribLocation(programHandle, name); + + if (loc != -1) + return loc; + else + throw new AgateLib.AgateException("Could not find attribute {0} in the GLSL program.", name); + } + + public void SetUniform(string name, params float[] v) + { + int loc = GetUniformLocation(name); + + switch (v.Length) + { + case 0: throw new AgateLib.AgateException("A value for the uniform must be specified."); + case 1: + GL.Uniform1(loc, v[0]); + break; + + case 2: + GL.Uniform2(loc, v[0], v[1]); + break; + + case 3: + GL.Uniform3(loc, v[0], v[1], v[2]); + break; + + case 4: + GL.Uniform4(loc, v[0], v[1], v[2], v[3]); + break; + + default: + throw new AgateLib.AgateException("Too many parameters to SetUniform."); + } + } + public void SetUniform(string name, params int[] v) + { + int loc = GetUniformLocation(name); + + switch (v.Length) + { + case 0: throw new AgateLib.AgateException("Must specify a value."); + case 1: + GL.Uniform1(loc, v[0]); + break; + + case 2: + GL.Uniform2(loc, v[0], v[1]); + break; + + case 3: + GL.Uniform3(loc, v[0], v[1], v[2]); + break; + + case 4: + GL.Uniform4(loc, v[0], v[1], v[2], v[3]); + break; + + default: + throw new AgateLib.AgateException("Too many parameters to SetUniform."); + } + } + + public void SetUniform(string name, AgateLib.Geometry.Matrix4x4 matrix) + { + int loc = GetUniformLocation(name); + + unsafe + { + GL.UniformMatrix4(loc, 16, true, (float*)&matrix); + } + } + + + public void Render<T>(RenderHandler<T> handler, T obj) + { + throw new NotImplementedException(); + } + } +} Copied: trunk/Drivers/AgateOTK/GL3/Shaders/GlslShaderCompiler.cs (from rev 1165, trunk/Drivers/AgateOTK/Shaders/GlslShaderCompiler.cs) =================================================================== --- trunk/Drivers/AgateOTK/GL3/Shaders/GlslShaderCompiler.cs (rev 0) +++ trunk/Drivers/AgateOTK/GL3/Shaders/GlslShaderCompiler.cs 2010-01-06 08:27:18 UTC (rev 1182) @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using AgateLib.DisplayLib.ImplementationBase; +using AgateLib.DisplayLib.Shaders; +using OpenTK.Graphics.OpenGL; + +namespace AgateOTK.GL3.Shaders +{ + static class GlslShaderCompiler + { + static public GlslShader CompileShader(string vertexShaderSource, string pixelShaderSource) + { + GlslVertexProgram vert = CompileVertexProgram(vertexShaderSource); + GlslFragmentProgram frag = CompileFragmentProgram(pixelShaderSource); + + return LinkPrograms(vert, frag); + } + + static private GlslShader LinkPrograms(GlslVertexProgram vert, GlslFragmentProgram frag) + { + int program = GL.CreateProgram(); + + GL.AttachShader(program, vert.ShaderHandle); + GL.AttachShader(program, frag.ShaderHandle); + + GL.LinkProgram(program); + + GL.ValidateProgram(program); + + int status; + GL.GetProgram(program, ProgramParameter.ValidateStatus, out status); + + if (status == 0) + { + string info = GL.GetProgramInfoLog(program); + + throw new AgateLib.AgateException("Failed to validate GLSL shader program.\n{0}", info); + } + + return new GlslShader(program, vert, frag); + } + + static private GlslVertexProgram CompileVertexProgram(string vertexShaderSource) + { + return new GlslVertexProgram(CompileShader(ShaderType.VertexShader, vertexShaderSource), vertexShaderSource); + } + static private GlslFragmentProgram CompileFragmentProgram(string pixelShaderSource) + { + return new GlslFragmentProgram(CompileShader(ShaderType.FragmentShader, pixelShaderSource), pixelShaderSource); + } + + static private int CompileShader(ShaderType type, string source) + { + int shaderHandle; + + shaderHandle = GL.CreateShader(type); + + GL.ShaderSource(shaderHandle, source); + GL.CompileShader(shaderHandle); + + int status; + GL.GetShader(shaderHandle, ShaderParameter.CompileStatus, out status); + + if (status == 0) + { + string info; + GL.GetShaderInfoLog(shaderHandle, out info); + + throw new AgateLib.AgateException("Failed to compile {0} shader.\n{1}", + type, info); + } + + return shaderHandle; + } + } +} Copied: trunk/Drivers/AgateOTK/GL3/Shaders/GlslVertexProgram.cs (from rev 1157, trunk/Drivers/AgateOTK/Shaders/GlslVertexProgram.cs) =================================================================== --- trunk/Drivers/AgateOTK/GL3/Shaders/GlslVertexProgram.cs (rev 0) +++ trunk/Drivers/AgateOTK/GL3/Shaders/GlslVertexProgram.cs 2010-01-06 08:27:18 UTC (rev 1182) @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using AgateLib.DisplayLib.Shaders; + +namespace AgateOTK.GL3.Shaders +{ + class GlslVertexProgram + { + int index; + + public GlslVertexProgram(int index, string source) + { + this.index = index; + this.Source = source; + } + + public int ShaderHandle + { + get { return index; } + } + public string Source { get; private set; } + } +} Added: trunk/Drivers/AgateOTK/GL3/Shaders/IGL3Shader.cs =================================================================== --- trunk/Drivers/AgateOTK/GL3/Shaders/IGL3Shader.cs (rev 0) +++ trunk/Drivers/AgateOTK/GL3/Shaders/IGL3Shader.cs 2010-01-06 08:27:18 UTC (rev 1182) @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using AgateLib.Geometry.VertexTypes; + +namespace AgateOTK.GL3.Shaders +{ + interface IGL3Shader + { + void SetVertexAttributes(VertexLayout layout); + + void SetTexture(int p); + } +} Added: trunk/Drivers/AgateOTK/GL3/Shaders/ShaderFactory3.cs =================================================================== --- trunk/Drivers/AgateOTK/GL3/Shaders/ShaderFactory3.cs (rev 0) +++ trunk/Drivers/AgateOTK/GL3/Shaders/ShaderFactory3.cs 2010-01-06 08:27:18 UTC (rev 1182) @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using AgateLib.DisplayLib.Shaders.Implementation; + +namespace AgateOTK.GL3.Shaders +{ + class ShaderFactory3 : ShaderFactory + { + + protected override AgateShaderImpl CreateBuiltInShaderImpl(BuiltInShader builtInShader) + { + switch (builtInShader) + { + case BuiltInShader.Basic2DShader: + return new GL3_Basic2DShader(); + + default: + return null; + } + } + } +} Added: trunk/Drivers/AgateOTK/GL3/Shaders/ShaderSources.Designer.cs =================================================================== --- trunk/Drivers/AgateOTK/GL3/Shaders/ShaderSources.Designer.cs (rev 0) +++ trunk/Drivers/AgateOTK/GL3/Shaders/ShaderSources.Designer.cs 2010-01-06 08:27:18 UTC (rev 1182) @@ -0,0 +1,106 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:2.0.50727.4927 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace AgateOTK.GL3.Shaders { + using System; + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class ShaderSources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal ShaderSources() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AgateOTK.GL3.Shaders.ShaderSources", typeof(ShaderSources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// <summary> + /// Looks up a localized string similar to #version 140 + /// + ///in vec2 texture; + ///in int color; + /// + ///uniform sampler2D texture; + /// + ///void main() + ///{ + /// vec4 pos = vec4(position, 1); + /// + /// gl_Position = transform * pos; + ///}. + /// </summary> + internal static string Basic2D_pixel { + get { + return ResourceManager.GetString("Basic2D_pixel", resourceCulture); + } + } + + /// <summary> + /// Looks up a localized string similar to #version 140 + /// + ///in vec3 position; + ///inout vec2 texture; + ///inout int color; + /// + ///uniform mat4x4 transform; + /// + ///void main() + ///{ + /// vec4 pos = vec4(position, 1); + /// + /// gl_Position = transform * pos; + ///}. + /// </summary> + internal static string Basic2D_vert { + get { + return ResourceManager.GetString("Basic2D_vert", resourceCulture); + } + } + } +} Added: trunk/Drivers/AgateOTK/GL3/Shaders/ShaderSources.resx =================================================================== --- trunk/Drivers/AgateOTK/GL3/Shaders/ShaderSources.resx (rev 0) +++ trunk/Drivers/AgateOTK/GL3/Shaders/ShaderSources.resx 2010-01-06 08:27:18 UTC (rev 1182) @@ -0,0 +1,127 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <data name="Basic2D_pixel" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\..\resources\basic2d_pixel.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value> + </data> + <data name="Basic2D_vert" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\..\resources\basic2d_vert.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value> + </data> +</root> \ No newline at end of file Modified: trunk/Drivers/AgateOTK/GL_Display.cs =================================================================== --- trunk/Drivers/AgateOTK/GL_Display.cs 2010-01-06 08:15:41 UTC (rev 1181) +++ trunk/Drivers/AgateOTK/GL_Display.cs 2010-01-06 08:27:18 UTC (rev 1182) @@ -90,7 +90,7 @@ protected override AgateLib.DisplayLib.Shaders.Implementation.AgateShaderImpl CreateBuiltInShader(AgateLib.DisplayLib.Shaders.Implementation.BuiltInShader BuiltInShaderType) { - return Shaders.ShaderFactory.CreateBuiltInShader(BuiltInShaderType); + return ShaderFactory.CreateBuiltInShader(BuiltInShaderType); } public override DisplayWindowImpl CreateDisplayWindow(CreateWindowParams windowParams) { @@ -164,6 +164,8 @@ protected override void OnBeginFrame() { mRenderTarget.BeginRender(); + + GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); } protected override void OnEndFrame() { @@ -306,11 +308,11 @@ mSupportsShaders = true; } + ShaderFactory.Initialize(mGL3); + Trace.WriteLine(string.Format("OpenGL version {0} from vendor {1} detected.", mGLVersion, vendor)); Trace.WriteLine("NPOT: " + mNonPowerOf2Textures.ToString()); Trace.WriteLine("Shaders: " + mSupportsShaders.ToString()); - - InitializeShaders(); } string[] extensions; @@ -392,50 +394,6 @@ #region --- Shaders --- - [Obsolete] - protected override ShaderCompilerImpl CreateShaderCompiler() - { - if (this.CapsBool(DisplayBoolCaps.CustomShaders)) - { - if (mGLVersion < 2.0m) - return new ArbShaderCompiler(); - else - return new GlslShaderCompiler(); - } - else - return base.CreateShaderCompiler(); - } - - OtkShader mCurrentShader; - - public new OtkShader Shader - { - get - { - return mCurrentShader; - } - set - { - if (value == null) - return; - - if (value is OtkShader == false) - throw new AgateLib.AgateException(string.Format( - "Shader type is {0} but must be IGlShader.", value.GetType())); - - mCurrentShader = (OtkShader)value; - - if (mCurrentShader == null) - { - GL.UseProgram(0); - } - else - { - GL.UseProgram(mCurrentShader.Handle); - } - - } - } public override void Dispose() { mFakeDisplayWindow.Dispose(); Modified: trunk/Drivers/AgateOTK/GL_DisplayControl.cs =================================================================== --- trunk/Drivers/AgateOTK/GL_DisplayControl.cs 2010-01-06 08:15:41 UTC (rev 1181) +++ trunk/Drivers/AgateOTK/GL_DisplayControl.cs 2010-01-06 08:27:18 UTC (rev 1182) @@ -119,6 +119,7 @@ mDisplay.ProcessEventsEvent += new EventHandler(mDisplay_ProcessEventsEvent); mDisplay.InitializeCurrentContext(); + } void mDisplay_ProcessEventsEvent(object sender, EventArgs e) Deleted: trunk/Drivers/AgateOTK/Legacy/ArbShader.cs =================================================================== --- trunk/Drivers/AgateOTK/Legacy/ArbShader.cs 2010-01-06 08:15:41 UTC (rev 1181) +++ trunk/Drivers/AgateOTK/Legacy/ArbShader.cs 2010-01-06 08:27:18 UTC (rev 1182) @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using AgateLib.DisplayLib.Shaders; -using OpenTK.Graphics.OpenGL; - -namespace AgateOTK -{ - class ArbShader : OtkShader - { - int programHandle; - Dictionary<string, int> mUniforms = new Dictionary<string, int>(); - - public ArbShader(int handle, GlslVertexProgram vert, GlslFragmentProgram frag) - { - programHandle = handle; - this.vertex = vert; - this.pixel = frag; - } - - GlslVertexProgram vertex; - GlslFragmentProgram pixel; - - public GlslFragmentProgram PixelShader - { - get { return pixel; } - } - public GlslVertexProgram VertexShader - { - get { return vertex; } - } - - public override int Handle - { - get { return programHandle; } - } - - private int GetUniformLocation(string name) - { - if (mUniforms.ContainsKey(name)) - return mUniforms[name]; - - return GL.Arb.GetUniformLocation(programHandle, name); - } - - public void SetUniform(string name, params float[] v) - { - int loc = GetUniformLocation(name); - - } - public void SetUniform(string name, params int[] v) - { - } - - public void SetUniform(string name, AgateLib.Geometry.Matrix4x4 matrix) - { - } - - public void Render<T>(RenderHandler<T> handler, T obj) - { - throw new NotImplementedException(); - } - } -} Deleted: trunk/Drivers/AgateOTK/Legacy/ArbShaderCompiler.cs =================================================================== --- trunk/Drivers/AgateOTK/Legacy/ArbShaderCompiler.cs 2010-01-06 08:15:41 UTC (rev 1181) +++ trunk/Drivers/AgateOTK/Legacy/ArbShaderCompiler.cs 2010-01-06 08:27:18 UTC (rev 1182) @@ -1,76 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using AgateLib.DisplayLib.ImplementationBase; -using AgateLib.DisplayLib.Shaders; -using OpenTK.Graphics.OpenGL; - -namespace AgateOTK -{ - [Obsolete] - class ArbShaderCompiler : ShaderCompilerImpl - { - public ArbShaderCompiler() - { - } - - public OtkShader CompileShader(ShaderLanguage language, string vertexShaderSource, string pixelShaderSource) - { - if (language != ShaderLanguage.Glsl) - throw new NotSupportedException("AgateOTK can only compile and use GLSL shaders."); - - GlslVertexProgram vert = CompileVertexProgram(vertexShaderSource); - GlslFragmentProgram frag = CompileFragmentProgram(pixelShaderSource); - - return LinkPrograms(vert, frag); - } - - private OtkShader LinkPrograms(GlslVertexProgram vert, GlslFragmentProgram frag) - { - int program = GL.Arb.CreateProgramObject(); - - GL.Arb.AttachObject(program, vert.ShaderHandle); - GL.Arb.AttachObject(program, frag.ShaderHandle); - - GL.Arb.LinkProgram(program); - - return new ArbShader(program, vert, frag); - } - - private GlslVertexProgram CompileVertexProgram(string vertexShaderSource) - { - return new GlslVertexProgram(CompileShader(ShaderType.VertexShader, vertexShaderSource), vertexShaderSource); - } - - private GlslFragmentProgram CompileFragmentProgram(string pixelShaderSource) - { - return new GlslFragmentProgram(CompileShader(ShaderType.FragmentShader, pixelShaderSource), pixelShaderSource); - } - - private int CompileShader(ShaderType type, string source) - { - int shaderHandle; - - if (type == ShaderType.VertexShader) - shaderHandle = GL.Arb.CreateShaderObject((ArbShaderObjects)0x8B31); - else - shaderHandle = GL.Arb.CreateShaderObject((ArbShaderObjects)0x8B30); - - string[] src = new string[1] { source }; - - unsafe - { - GL.Arb.ShaderSource(shaderHandle, 1, src, (int*)IntPtr.Zero); - } - GL.Arb.CompileShader(shaderHandle); - - return shaderHandle; - } - - public override Effect CompileEffect(ShaderLanguage language, string effectSource) - { - throw new NotImplementedException(); - } - } -} Modified: trunk/Drivers/AgateOTK/Legacy/FixedFunction/FixedFunctionShaderFactory.cs =================================================================== --- trunk/Drivers/AgateOTK/Shaders/FixedFunction/FixedFunctionShaderFactory.cs 2009-12-18 18:03:30 UTC (rev 1157) +++ trunk/Drivers/AgateOTK/Legacy/FixedFunction/FixedFunctionShaderFactory.cs 2010-01-06 08:27:18 UTC (rev 1182) @@ -5,7 +5,7 @@ using AgateLib.DisplayLib.Shaders; using AgateLib.DisplayLib.Shaders.Implementation; -namespace AgateOTK.Shaders.FixedFunction +namespace AgateOTK.Legacy.FixedFunction { class FixedFunctionShaderFactory : ShaderFactory { Modified: trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Basic2DShader.cs =================================================================== --- trunk/Drivers/AgateOTK/Shaders/FixedFunction/OTK_FF_Basic2DShader.cs 2009-12-18 18:03:30 UTC (rev 1157) +++ trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Basic2DShader.cs 2010-01-06 08:27:18 UTC (rev 1182) @@ -8,7 +8,7 @@ using AgateLib.Geometry; using OpenTK.Graphics.OpenGL; -namespace AgateOTK.Shaders.FixedFunction +namespace AgateOTK.Legacy.FixedFunction { class OTK_FF_Basic2DShader : Basic2DImpl { Modified: trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Lighting2D.cs =================================================================== --- trunk/Drivers/AgateOTK/Shaders/FixedFunction/OTK_FF_Lighting2D.cs 2009-12-18 18:03:30 UTC (rev 1157) +++ trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Lighting2D.cs 2010-01-06 08:27:18 UTC (rev 1182) @@ -7,7 +7,7 @@ using AgateLib.DisplayLib.Shaders.Implementation; using AgateLib.Geometry; -namespace AgateOTK.Shaders.FixedFunction +namespace AgateOTK.Legacy.FixedFunction { class OTK_FF_Lighting2D : Lighting2DImpl { Modified: trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Lighting3D.cs =================================================================== --- trunk/Drivers/AgateOTK/Shaders/FixedFunction/OTK_FF_Lighting3D.cs 2009-12-18 18:03:30 UTC (rev 1157) +++ trunk/Drivers/AgateOTK/Legacy/FixedFunction/OTK_FF_Lighting3D.cs 2010-01-06 08:27:18 UTC (rev 1182) @@ -8,7 +8,7 @@ using AgateLib.DisplayLib.Shaders.Implementation; using OpenTK.Graphics.OpenGL; -namespace AgateOTK.Shaders.FixedFunction +namespace AgateOTK.Legacy.FixedFunction { class OTK_FF_Lighting3D : Lighting3DImpl { Added: trunk/Drivers/AgateOTK/Resources/Basic2D_pixel.txt =================================================================== --- trunk/Drivers/AgateOTK/Resources/Basic2D_pixel.txt (rev 0) +++ trunk/Drivers/AgateOTK/Resources/Basic2D_pixel.txt 2010-01-06 08:27:18 UTC (rev 1182) @@ -0,0 +1,13 @@ +#version 140 + +uniform sampler2D texture; + +in vec4 colorVal; +in vec2 texCoordVal; + +out vec4 color; + +void main() +{ + color = texture2D(texture, texCoordVal); +} Added: trunk/Drivers/AgateOTK/Resources/Basic2D_vert.txt =================================================================== --- trunk/Drivers/AgateOTK/Resources/Basic2D_vert.txt (rev 0) +++ trunk/Drivers/AgateOTK/Resources/Basic2D_vert.txt 2010-01-06 08:27:18 UTC (rev 1182) @@ -0,0 +1,20 @@ +#version 140 + +in vec3 position; +in vec4 color; +in vec2 texCoord; + +uniform mat4x4 transform; + +out vec4 colorVal; +out vec2 texCoordVal; + +void main() +{ + vec4 pos = vec4(position, 1); + + colorVal = color; + texCoordVal = texCoord; + + gl_Position = transform * pos; +} Copied: trunk/Drivers/AgateOTK/ShaderFactory.cs (from rev 1157, trunk/Drivers/AgateOTK/Shaders/ShaderFactory.cs) =================================================================== --- trunk/Drivers/AgateOTK/ShaderFactory.cs (rev 0) +++ trunk/Drivers/AgateOTK/ShaderFactory.cs 2010-01-06 08:27:18 UTC (rev 1182) @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using AgateLib.DisplayLib.Shaders; +using AgateLib.DisplayLib.Shaders.Implementation; + +namespace AgateOTK +{ + abstract class ShaderFactory + { + static ShaderFactory inst = new Legacy.FixedFunction.FixedFunctionShaderFactory(); + + public static AgateShaderImpl CreateBuiltInShader(BuiltInShader builtInShader) + { + return inst.CreateBuiltInShaderImpl(builtInShader); + } + + protected abstract AgateShaderImpl CreateBuiltInShaderImpl(BuiltInShader builtInShader); + + internal static void Initialize(bool gl3supported) + { + //if (gl3supported) + // inst = new GL3.Shaders.ShaderFactory3(); + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-01-06 08:15:49
|
Revision: 1181 http://agate.svn.sourceforge.net/agate/?rev=1181&view=rev Author: kanato Date: 2010-01-06 08:15:41 +0000 (Wed, 06 Jan 2010) Log Message: ----------- Display: Enable alpha blending on BeginFrame. DisplayImpl: Remove obsolete shader initialization. AgateShader: Make implementation public. PTC: Add U and V properties for texture coordinates. Modified Paths: -------------- trunk/AgateLib/DisplayLib/Display.cs trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs trunk/AgateLib/DisplayLib/Shaders/AgateShader.cs trunk/AgateLib/Geometry/VertexTypes/PositionTextureColor.cs trunk/AgateLib/InternalResources/Data.cs Modified: trunk/AgateLib/DisplayLib/Display.cs =================================================================== --- trunk/AgateLib/DisplayLib/Display.cs 2010-01-04 20:42:31 UTC (rev 1180) +++ trunk/AgateLib/DisplayLib/Display.cs 2010-01-06 08:15:41 UTC (rev 1181) @@ -302,6 +302,8 @@ AgateBuiltInShaders.Basic2DShader.Activate(); mCurrentClipRect = new Rectangle(Point.Empty, RenderTarget.Size); + + RenderState.AlphaBlend = true; } /// <summary> /// EndFrame must be called at the end of each frame. Modified: trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs =================================================================== --- trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs 2010-01-04 20:42:31 UTC (rev 1180) +++ trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs 2010-01-06 08:15:41 UTC (rev 1181) @@ -648,19 +648,7 @@ } } - [Obsolete] - protected void InitializeShaders() - { - if (Display.Caps.SupportsCustomShaders) - { - ShaderCompiler.Initialize(CreateShaderCompiler()); - } - else - ShaderCompiler.Disable(); - } - - protected internal abstract bool GetRenderState(RenderStateBool renderStateBool); protected internal abstract void SetRenderState(RenderStateBool renderStateBool, bool value); Modified: trunk/AgateLib/DisplayLib/Shaders/AgateShader.cs =================================================================== --- trunk/AgateLib/DisplayLib/Shaders/AgateShader.cs 2010-01-04 20:42:31 UTC (rev 1180) +++ trunk/AgateLib/DisplayLib/Shaders/AgateShader.cs 2010-01-06 08:15:41 UTC (rev 1181) @@ -48,7 +48,7 @@ /// <summary> /// Gets the implementation. /// </summary> - protected AgateShaderImpl Impl + public AgateShaderImpl Impl { get { return impl; } } Modified: trunk/AgateLib/Geometry/VertexTypes/PositionTextureColor.cs =================================================================== --- trunk/AgateLib/Geometry/VertexTypes/PositionTextureColor.cs 2010-01-04 20:42:31 UTC (rev 1180) +++ trunk/AgateLib/Geometry/VertexTypes/PositionTextureColor.cs 2010-01-06 08:15:41 UTC (rev 1181) @@ -67,6 +67,15 @@ public float Z { get { return Position.Z; } set { Position.Z = value; } } /// <summary> + /// Gets or sets the U texture coordinate. + /// </summary> + public float U { get { return TexCoord.X; } set { TexCoord.X = value; } } + /// <summary> + /// Gets or sets the V texture coordinate. + /// </summary> + public float V { get { return TexCoord.Y; } set { TexCoord.Y = value; } } + + /// <summary> /// ToString debugging information. /// </summary> /// <returns></returns> Modified: trunk/AgateLib/InternalResources/Data.cs =================================================================== --- trunk/AgateLib/InternalResources/Data.cs 2010-01-04 20:42:31 UTC (rev 1180) +++ trunk/AgateLib/InternalResources/Data.cs 2010-01-06 08:15:41 UTC (rev 1181) @@ -44,7 +44,6 @@ mSans.Clear(); mSerif.Clear(); mMono.Clear(); - } private static void LoadFonts() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-01-04 20:42:53
|
Revision: 1180 http://agate.svn.sourceforge.net/agate/?rev=1180&view=rev Author: kanato Date: 2010-01-04 20:42:31 +0000 (Mon, 04 Jan 2010) Log Message: ----------- Change some permissions, etc. Modified Paths: -------------- trunk/Drivers/AgateOTK/AgateOTK.csproj trunk/Drivers/AgateOTK/GL_Display.cs trunk/Drivers/AgateOTK/Otk_Reporter.cs trunk/Drivers/AgateSDL/AgateSDL.csproj trunk/Drivers/AgateSDL/Tao.Sdl/Sdl.cs trunk/Drivers/AgateSDL/Tao.Sdl/SdlGfx.cs trunk/Drivers/AgateSDL/Tao.Sdl/SdlMixer.cs trunk/Drivers/AgateSDL/Tao.Sdl/Smpeg.cs Modified: trunk/Drivers/AgateOTK/AgateOTK.csproj =================================================================== --- trunk/Drivers/AgateOTK/AgateOTK.csproj 2010-01-04 18:38:45 UTC (rev 1179) +++ trunk/Drivers/AgateOTK/AgateOTK.csproj 2010-01-04 20:42:31 UTC (rev 1180) @@ -1,7 +1,7 @@ <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <PropertyGroup> <ProjectType>Local</ProjectType> - <ProductVersion>9.0.30729</ProductVersion> + <ProductVersion>9.0.21022</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{9E095F03-BA3F-4EAD-A905-2A2647CE4405}</ProjectGuid> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> @@ -131,9 +131,8 @@ <Name>AgateLib</Name> </ProjectReference> <ProjectReference Include="..\AgateLib.WinForms\AgateLib.WinForms.csproj"> + <Project>{BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}</Project> <Name>AgateLib.WinForms</Name> - <Project>{16139F84-99AE-4EDD-A9DA-282C05BA9C82}</Project> - <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> </ProjectReference> </ItemGroup> <ItemGroup> Modified: trunk/Drivers/AgateOTK/GL_Display.cs =================================================================== --- trunk/Drivers/AgateOTK/GL_Display.cs 2010-01-04 18:38:45 UTC (rev 1179) +++ trunk/Drivers/AgateOTK/GL_Display.cs 2010-01-04 20:42:31 UTC (rev 1180) @@ -392,6 +392,7 @@ #region --- Shaders --- + [Obsolete] protected override ShaderCompilerImpl CreateShaderCompiler() { if (this.CapsBool(DisplayBoolCaps.CustomShaders)) @@ -407,7 +408,7 @@ OtkShader mCurrentShader; - public OtkShader Shader + public new OtkShader Shader { get { Modified: trunk/Drivers/AgateOTK/Otk_Reporter.cs =================================================================== --- trunk/Drivers/AgateOTK/Otk_Reporter.cs 2010-01-04 18:38:45 UTC (rev 1179) +++ trunk/Drivers/AgateOTK/Otk_Reporter.cs 2010-01-04 20:42:31 UTC (rev 1180) @@ -59,16 +59,16 @@ // OpenAL driver has not been updated to latest OpenTK API, so it is disabled. return false; - try - { - // test for the presence of working OpenAL. - new OpenTK.Audio.AudioContext().Dispose(); - return true; - } - catch (Exception) - { - return false; - } + //try + //{ + // // test for the presence of working OpenAL. + // new OpenTK.Audio.AudioContext().Dispose(); + // return true; + //} + //catch (Exception) + //{ + // return false; + //} } } Modified: trunk/Drivers/AgateSDL/AgateSDL.csproj =================================================================== --- trunk/Drivers/AgateSDL/AgateSDL.csproj 2010-01-04 18:38:45 UTC (rev 1179) +++ trunk/Drivers/AgateSDL/AgateSDL.csproj 2010-01-04 20:42:31 UTC (rev 1180) @@ -102,10 +102,6 @@ <PlatformTarget>x86</PlatformTarget> </PropertyGroup> <ItemGroup> - <Reference Include="Tao.Sdl"> - <Name>Tao.Sdl</Name> - <HintPath>.\Tao.Sdl.dll</HintPath> - </Reference> <Reference Include="System"> <Name>System</Name> </Reference> Modified: trunk/Drivers/AgateSDL/Tao.Sdl/Sdl.cs =================================================================== --- trunk/Drivers/AgateSDL/Tao.Sdl/Sdl.cs 2010-01-04 18:38:45 UTC (rev 1179) +++ trunk/Drivers/AgateSDL/Tao.Sdl/Sdl.cs 2010-01-04 20:42:31 UTC (rev 1180) @@ -51,7 +51,7 @@ /// </remarks> #endregion Class Documentation [SuppressUnmanagedCodeSecurityAttribute()] - public static class Sdl + static class Sdl { #region Private Constants #region string SDL_NATIVE_LIBRARY Modified: trunk/Drivers/AgateSDL/Tao.Sdl/SdlGfx.cs =================================================================== --- trunk/Drivers/AgateSDL/Tao.Sdl/SdlGfx.cs 2010-01-04 18:38:45 UTC (rev 1179) +++ trunk/Drivers/AgateSDL/Tao.Sdl/SdlGfx.cs 2010-01-04 20:42:31 UTC (rev 1180) @@ -49,7 +49,7 @@ /// </summary> #endregion Class Documentation [SuppressUnmanagedCodeSecurityAttribute()] - public static class SdlGfx + static class SdlGfx { #region Private Constants #region string SDL_GFX_NATIVE_LIBRARY Modified: trunk/Drivers/AgateSDL/Tao.Sdl/SdlMixer.cs =================================================================== --- trunk/Drivers/AgateSDL/Tao.Sdl/SdlMixer.cs 2010-01-04 18:38:45 UTC (rev 1179) +++ trunk/Drivers/AgateSDL/Tao.Sdl/SdlMixer.cs 2010-01-04 20:42:31 UTC (rev 1180) @@ -97,7 +97,7 @@ /// </remarks> #endregion Class Documentation [SuppressUnmanagedCodeSecurityAttribute()] - public static class SdlMixer + static class SdlMixer { #region Private Constants #region string SDL_MIXER_NATIVE_LIBRARY Modified: trunk/Drivers/AgateSDL/Tao.Sdl/Smpeg.cs =================================================================== --- trunk/Drivers/AgateSDL/Tao.Sdl/Smpeg.cs 2010-01-04 18:38:45 UTC (rev 1179) +++ trunk/Drivers/AgateSDL/Tao.Sdl/Smpeg.cs 2010-01-04 20:42:31 UTC (rev 1180) @@ -41,7 +41,7 @@ /// </remarks> #endregion Class Documentation [SuppressUnmanagedCodeSecurityAttribute()] - public static class Smpeg + static class Smpeg { #region Private Constants #region string SMPEG_NATIVE_LIBRARY This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-01-04 18:39:17
|
Revision: 1179 http://agate.svn.sourceforge.net/agate/?rev=1179&view=rev Author: kanato Date: 2010-01-04 18:38:45 +0000 (Mon, 04 Jan 2010) Log Message: ----------- Remove unusued methods from Shader. Add XML comments. Modified Paths: -------------- trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferImpl.cs trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferSessionImpl.cs trunk/AgateLib/AudioLib/SoundBufferSession.cs trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs trunk/AgateLib/DisplayLib/Shaders/AgateShader.cs trunk/AgateLib/DisplayLib/Shaders/Implementation/AgateInternalShader.cs trunk/AgateLib/Gui/Container.cs trunk/AgateLib/Gui/ILayoutPerformer.cs trunk/AgateLib/Gui/Layout/BoxLayoutBase.cs trunk/AgateLib/Gui/Layout/HorizontalBox.cs Modified: trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferImpl.cs =================================================================== --- trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferImpl.cs 2010-01-04 04:18:53 UTC (rev 1178) +++ trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferImpl.cs 2010-01-04 18:38:45 UTC (rev 1179) @@ -43,6 +43,10 @@ /// </summary> public abstract double Volume { get; set; } + /// <summary> + /// Gets or sets a value indicating whether the sound buffer + /// should be looped when played. + /// </summary> public virtual bool Loop { get { return false; } set { } } } Modified: trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferSessionImpl.cs =================================================================== --- trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferSessionImpl.cs 2010-01-04 04:18:53 UTC (rev 1178) +++ trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferSessionImpl.cs 2010-01-04 18:38:45 UTC (rev 1179) @@ -45,6 +45,9 @@ /// </summary> public abstract void Stop(); + /// <summary> + /// Gets the current location in the sound buffer. + /// </summary> public abstract int CurrentLocation { get; } /// <summary> Modified: trunk/AgateLib/AudioLib/SoundBufferSession.cs =================================================================== --- trunk/AgateLib/AudioLib/SoundBufferSession.cs 2010-01-04 04:18:53 UTC (rev 1178) +++ trunk/AgateLib/AudioLib/SoundBufferSession.cs 2010-01-04 18:38:45 UTC (rev 1179) @@ -128,6 +128,9 @@ set { impl.Pan = value; } } + /// <summary> + /// Gets the current location in the sound buffer. + /// </summary> public int CurrentLocation { get { return impl.CurrentLocation; } Modified: trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs =================================================================== --- trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs 2010-01-04 04:18:53 UTC (rev 1178) +++ trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs 2010-01-04 18:38:45 UTC (rev 1179) @@ -641,10 +641,10 @@ FlushDrawBuffer(); if (mShader != null) - mShader.End(); + mShader.EndInternal(); mShader = value; - mShader.Begin(); + mShader.BeginInternal(); } } Modified: trunk/AgateLib/DisplayLib/Shaders/AgateShader.cs =================================================================== --- trunk/AgateLib/DisplayLib/Shaders/AgateShader.cs 2010-01-04 04:18:53 UTC (rev 1178) +++ trunk/AgateLib/DisplayLib/Shaders/AgateShader.cs 2010-01-04 18:38:45 UTC (rev 1179) @@ -25,10 +25,18 @@ namespace AgateLib.DisplayLib.Shaders { + /// <summary> + /// Base class for a shader. + /// </summary> public class AgateShader { AgateShaderImpl impl; + /// <summary> + /// Sets the implementation. If the implementation is already set, then + /// an exception is thrown. + /// </summary> + /// <param name="impl"></param> protected internal void SetImpl(AgateShaderImpl impl) { if (this.impl != null) @@ -37,81 +45,43 @@ this.impl = impl; } + /// <summary> + /// Gets the implementation. + /// </summary> protected AgateShaderImpl Impl { get { return impl; } } - - public int Passes + /// <summary> + /// Returns true if this shader has an implementation. + /// </summary> + public bool IsValid { - get { return impl.Passes; } + get { return impl != null; } } - public void Begin() + internal void BeginInternal() { impl.Begin(); } - public void BeginPass(int passIndex) + internal void EndInternal() { - impl.BeginPass(passIndex); - } - public void EndPass() - { - impl.EndPass(); - } - public void End() - { impl.End(); } - public bool IsValid - { - get { return impl != null; } - } - + /// <summary> + /// Returns true if this is the currently active shader. + /// </summary> public bool IsActive { get { return Display.Shader == this; } } - + /// <summary> + /// Activates this shader. + /// </summary> public void Activate() { Display.Shader = this; } - public void SetTexture(EffectTexture tex, string variableName) - { - impl.SetTexture(tex, variableName); - } - public void SetVariable(string name, params float[] v) - { - impl.SetVariable(name, v); - } - public void SetVariable(string name, params int[] v) - { - impl.SetVariable(name, v); - } - public void SetVariable(string name, Matrix4x4 matrix) - { - impl.SetVariable(name, matrix); - } - - public void SetVariable(string name, Vector2 v) - { - SetVariable(name, v.X, v.Y); - } - public void SetVariable(string name, Vector3 v) - { - SetVariable(name, v.X, v.Y, v.Z); - } - public void SetVariable(string name, Vector4 v) - { - SetVariable(name, v.X, v.Y, v.Z, v.W); - } - public void SetVariable(string name, Color color) - { - impl.SetVariable(name, color); - } - } - } Modified: trunk/AgateLib/DisplayLib/Shaders/Implementation/AgateInternalShader.cs =================================================================== --- trunk/AgateLib/DisplayLib/Shaders/Implementation/AgateInternalShader.cs 2010-01-04 04:18:53 UTC (rev 1178) +++ trunk/AgateLib/DisplayLib/Shaders/Implementation/AgateInternalShader.cs 2010-01-04 18:38:45 UTC (rev 1179) @@ -23,13 +23,24 @@ namespace AgateLib.DisplayLib.Shaders.Implementation { + /// <summary> + /// Base class for implementing a shader which is built-in to AgateLib. + /// </summary> public abstract class AgateInternalShader : AgateShader { + /// <summary> + /// Constructs an AgateInternalShader. + /// </summary> protected AgateInternalShader() { SetImpl(Display.Impl.CreateBuiltInShader(BuiltInShaderType)); } + /// <summary> + /// Gets an enum value which indicates what built-in shader this + /// class represents. This is called from the AgateInternalShader + /// constructor in order to create the implementation object. + /// </summary> protected abstract BuiltInShader BuiltInShaderType { get; } } Modified: trunk/AgateLib/Gui/Container.cs =================================================================== --- trunk/AgateLib/Gui/Container.cs 2010-01-04 04:18:53 UTC (rev 1178) +++ trunk/AgateLib/Gui/Container.cs 2010-01-04 18:38:45 UTC (rev 1179) @@ -26,6 +26,9 @@ namespace AgateLib.Gui { + /// <summary> + /// Abstract base class for a GUI component that can contain other components. + /// </summary> public abstract class Container : Widget { WidgetList mChildren; Modified: trunk/AgateLib/Gui/ILayoutPerformer.cs =================================================================== --- trunk/AgateLib/Gui/ILayoutPerformer.cs 2010-01-04 04:18:53 UTC (rev 1178) +++ trunk/AgateLib/Gui/ILayoutPerformer.cs 2010-01-04 18:38:45 UTC (rev 1179) @@ -24,14 +24,35 @@ namespace AgateLib.Gui { + /// <summary> + /// Interface for an object which performs layout of GUI components. + /// </summary> public interface ILayoutPerformer { + /// <summary> + /// Called when the GUI components must be layed out. + /// </summary> + /// <param name="container">The container in which the layout occurs.</param> void DoLayout(Container container); - + /// <summary> + /// Calculates the minimum size of the container. + /// </summary> + /// <param name="container"></param> + /// <returns></returns> Size RecalcMinSize(Container container); - + /// <summary> + /// + /// </summary> + /// <param name="keyCode"></param> + /// <returns></returns> bool AcceptInputKey(AgateLib.InputLib.KeyCode keyCode); - + /// <summary> + /// + /// </summary> + /// <param name="container"></param> + /// <param name="currentFocus"></param> + /// <param name="direction"></param> + /// <returns></returns> Widget CanMoveFocus(Container container, Widget currentFocus, Direction direction); } } Modified: trunk/AgateLib/Gui/Layout/BoxLayoutBase.cs =================================================================== --- trunk/AgateLib/Gui/Layout/BoxLayoutBase.cs 2010-01-04 04:18:53 UTC (rev 1178) +++ trunk/AgateLib/Gui/Layout/BoxLayoutBase.cs 2010-01-04 18:38:45 UTC (rev 1179) @@ -24,6 +24,9 @@ namespace AgateLib.Gui.Layout { + /// <summary> + /// Base class for the HorizontalBox and VerticalBox classes. + /// </summary> public abstract class BoxLayoutBase : ILayoutPerformer { bool doingLayout = false; @@ -31,13 +34,21 @@ Container container; - + /// <summary> + /// Calculates the minimum size for the container. + /// </summary> + /// <param name="container"></param> + /// <returns></returns> public Size RecalcMinSize(Container container) { this.container = container; return RecalcMinSizeInternal(); } - + /// <summary> + /// Calculates the minimum size for the container. + /// </summary> + /// <param name="horizontal"></param> + /// <returns></returns> protected Size RecalcMinSizeBox(bool horizontal) { _horizontal = horizontal; @@ -57,7 +68,10 @@ return SetSize(minSize, totalSize); } - + /// <summary> + /// Performs the layout of widgets in the container. + /// </summary> + /// <param name="container"></param> public void DoLayout(Container container) { if (doingLayout) @@ -76,11 +90,21 @@ doingLayout = false; } } - + /// <summary> + /// Override to do the actual layout. + /// </summary> protected abstract void DoLayoutInternal(); + /// <summary> + /// Override to recalculate the minimum size of the container. + /// </summary> + /// <returns></returns> protected abstract Size RecalcMinSizeInternal(); bool _horizontal; + /// <summary> + /// Method for doing the Box layout type. + /// </summary> + /// <param name="horizontal">Pass true for a horizontal box.</param> protected void DoBoxLayout(bool horizontal) { _horizontal = horizontal; @@ -289,13 +313,23 @@ return container.ClientArea.Height; } + /// <summary> + /// Returns whether or not the key passed is used to move focus from one control to + /// another inside this container. + /// </summary> + /// <param name="keyCode"></param> + /// <returns></returns> public virtual bool AcceptInputKey(AgateLib.InputLib.KeyCode keyCode) { return false; } - + /// <summary> + /// Gets the root control of the specified widget. + /// </summary> + /// <param name="widget"></param> + /// <returns></returns> protected GuiRoot Root(Widget widget) { if (widget is GuiRoot) @@ -303,6 +337,14 @@ else return Root(widget.Parent); } + /// <summary> + /// Gets the index in the container's children + /// which contains this widget. The index may refer to a container + /// which contains this widget. + /// </summary> + /// <param name="container">The container within which to search.</param> + /// <param name="widget">The widget to search for.</param> + /// <returns></returns> protected int GetParentIndex(Container container, Widget widget) { if (widget is GuiRoot) @@ -314,10 +356,22 @@ return GetParentIndex(container, widget.Parent); } - + /// <summary> + /// Gets the widget that would be moved to if the focus were moved in the particular direction. + /// </summary> + /// <param name="container"></param> + /// <param name="currentFocus"></param> + /// <param name="direction"></param> + /// <returns></returns> public abstract Widget CanMoveFocus(Container container, Widget currentFocus, Direction direction); - + /// <summary> + /// Gets the next child in the specified direction. + /// </summary> + /// <param name="container"></param> + /// <param name="index"></param> + /// <param name="direction"></param> + /// <returns></returns> protected Widget GetNextChild(Container container, int index, int direction) { for (index += direction; index >= 0 && index < container.Children.Count; index += direction) Modified: trunk/AgateLib/Gui/Layout/HorizontalBox.cs =================================================================== --- trunk/AgateLib/Gui/Layout/HorizontalBox.cs 2010-01-04 04:18:53 UTC (rev 1178) +++ trunk/AgateLib/Gui/Layout/HorizontalBox.cs 2010-01-04 18:38:45 UTC (rev 1179) @@ -24,18 +24,31 @@ namespace AgateLib.Gui.Layout { + /// <summary> + /// Class which lays out GUI components horizontally. + /// </summary> public class HorizontalBox : BoxLayoutBase { + /// <summary> + /// Performs the layout. + /// </summary> protected override void DoLayoutInternal() { DoBoxLayout(true); } - + /// <summary> + /// Recalculates the minimum size. + /// </summary> + /// <returns></returns> protected override Size RecalcMinSizeInternal() { return RecalcMinSizeBox(true); } - + /// <summary> + /// Returns whether the specified input key moves focus within this container. + /// </summary> + /// <param name="keyCode"></param> + /// <returns></returns> public override bool AcceptInputKey(AgateLib.InputLib.KeyCode keyCode) { switch (keyCode) @@ -48,7 +61,13 @@ return false; } } - + /// <summary> + /// Gets the widget focus would move to in the specified direction. + /// </summary> + /// <param name="container"></param> + /// <param name="currentFocus"></param> + /// <param name="direction"></param> + /// <returns></returns> public override Widget CanMoveFocus(Container container, Widget currentFocus, Direction direction) { if (direction == Direction.Up || direction == Direction.Down) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-01-04 04:18:59
|
Revision: 1178 http://agate.svn.sourceforge.net/agate/?rev=1178&view=rev Author: kanato Date: 2010-01-04 04:18:53 +0000 (Mon, 04 Jan 2010) Log Message: ----------- Updated product version for some reason. Modified Paths: -------------- trunk/Tests/Tests.csproj Modified: trunk/Tests/Tests.csproj =================================================================== --- trunk/Tests/Tests.csproj 2010-01-04 04:18:23 UTC (rev 1177) +++ trunk/Tests/Tests.csproj 2010-01-04 04:18:53 UTC (rev 1178) @@ -1,7 +1,7 @@ <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <PropertyGroup> <ProjectType>Local</ProjectType> - <ProductVersion>9.0.30729</ProductVersion> + <ProductVersion>9.0.21022</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{DC687DB2-90A8-484D-AB99-B3D29FDD8D44}</ProjectGuid> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> @@ -369,9 +369,11 @@ </Compile> <EmbeddedResource Include="CoreTests\PlatformDetection\PlatformDetection.resx"> <DependentUpon>PlatformDetection.cs</DependentUpon> + <SubType>Designer</SubType> </EmbeddedResource> <EmbeddedResource Include="DisplayTests\Capabilities\frmCapabilities.resx"> <DependentUpon>frmCapabilities.cs</DependentUpon> + <SubType>Designer</SubType> </EmbeddedResource> <EmbeddedResource Include="frmLauncher.resx"> <SubType>Designer</SubType> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-01-04 04:18:29
|
Revision: 1177 http://agate.svn.sourceforge.net/agate/?rev=1177&view=rev Author: kanato Date: 2010-01-04 04:18:23 +0000 (Mon, 04 Jan 2010) Log Message: ----------- Add some debug output. Modified Paths: -------------- trunk/Drivers/AgateOTK/GL3/DrawBuffer.cs trunk/Drivers/AgateOTK/Legacy/LegacyDrawBuffer.cs Modified: trunk/Drivers/AgateOTK/GL3/DrawBuffer.cs =================================================================== --- trunk/Drivers/AgateOTK/GL3/DrawBuffer.cs 2010-01-04 04:15:18 UTC (rev 1176) +++ trunk/Drivers/AgateOTK/GL3/DrawBuffer.cs 2010-01-04 04:18:23 UTC (rev 1177) @@ -96,7 +96,7 @@ public DrawBuffer() { GL.GenBuffers(1, out mBufferID); - Debug.Print("Draw buffer ID: {0}", mBufferID); + Debug.Print("GL3 DrawBuffer: Draw buffer ID: {0}", mBufferID); SetBufferSize(1000); } @@ -259,8 +259,8 @@ int norm = PositionTextureColorNormal.VertexLayout.ElementByteIndex(VertexElement.Normal); GL.TexCoordPointer(2, TexCoordPointerType.Float, size, (IntPtr) tex); - GL.ColorPointer(4, ColorPointerType.UnsignedByte, size, color); - GL.VertexPointer(2, VertexPointerType.Float, size, pos); + GL.ColorPointer(4, ColorPointerType.UnsignedByte, size, (IntPtr) color); + GL.VertexPointer(2, VertexPointerType.Float, size, (IntPtr) pos); GL.NormalPointer(NormalPointerType.Float, size, (IntPtr)norm); GL.DrawArrays(BeginMode.Quads, 0, mIndex); Modified: trunk/Drivers/AgateOTK/Legacy/LegacyDrawBuffer.cs =================================================================== --- trunk/Drivers/AgateOTK/Legacy/LegacyDrawBuffer.cs 2010-01-04 04:15:18 UTC (rev 1176) +++ trunk/Drivers/AgateOTK/Legacy/LegacyDrawBuffer.cs 2010-01-04 04:18:23 UTC (rev 1177) @@ -96,7 +96,7 @@ public LegacyDrawBuffer() { GL.GenBuffers(1, out mBufferID); - Debug.Print("Draw buffer ID: {0}", mBufferID); + Debug.Print("LegacyDrawBuffer: Draw buffer ID: {0}", mBufferID); SetBufferSize(1000); } @@ -261,8 +261,8 @@ int norm = PositionTextureColorNormal.VertexLayout.ElementByteIndex(VertexElement.Normal); GL.TexCoordPointer(2, TexCoordPointerType.Float, size, (IntPtr) tex); - GL.ColorPointer(4, ColorPointerType.UnsignedByte, size, color); - GL.VertexPointer(2, VertexPointerType.Float, size, pos); + GL.ColorPointer(4, ColorPointerType.UnsignedByte, size, (IntPtr) color); + GL.VertexPointer(2, VertexPointerType.Float, size, (IntPtr) pos); GL.NormalPointer(NormalPointerType.Float, size, (IntPtr)norm); GL.DrawArrays(BeginMode.Quads, 0, mIndex); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-01-04 04:15:25
|
Revision: 1176 http://agate.svn.sourceforge.net/agate/?rev=1176&view=rev Author: kanato Date: 2010-01-04 04:15:18 +0000 (Mon, 04 Jan 2010) Log Message: ----------- Fix structure alignment Modified Paths: -------------- trunk/AgateLib/Geometry/VertexTypes/PositionColor.cs trunk/AgateLib/Geometry/VertexTypes/PositionTextureColor.cs trunk/AgateLib/Geometry/VertexTypes/PositionTextureColorNormal.cs Modified: trunk/AgateLib/Geometry/VertexTypes/PositionColor.cs =================================================================== --- trunk/AgateLib/Geometry/VertexTypes/PositionColor.cs 2010-01-03 07:28:23 UTC (rev 1175) +++ trunk/AgateLib/Geometry/VertexTypes/PositionColor.cs 2010-01-04 04:15:18 UTC (rev 1176) @@ -9,7 +9,7 @@ /// <summary> /// Vertex layout which only contains position and color information. /// </summary> - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct PositionColor { /// <summary> Modified: trunk/AgateLib/Geometry/VertexTypes/PositionTextureColor.cs =================================================================== --- trunk/AgateLib/Geometry/VertexTypes/PositionTextureColor.cs 2010-01-03 07:28:23 UTC (rev 1175) +++ trunk/AgateLib/Geometry/VertexTypes/PositionTextureColor.cs 2010-01-04 04:15:18 UTC (rev 1176) @@ -9,7 +9,7 @@ /// <summary> /// Vertex structure with position, texture and color values /// </summary> - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct PositionTextureColor { /// <summary> Modified: trunk/AgateLib/Geometry/VertexTypes/PositionTextureColorNormal.cs =================================================================== --- trunk/AgateLib/Geometry/VertexTypes/PositionTextureColorNormal.cs 2010-01-03 07:28:23 UTC (rev 1175) +++ trunk/AgateLib/Geometry/VertexTypes/PositionTextureColorNormal.cs 2010-01-04 04:15:18 UTC (rev 1176) @@ -5,11 +5,11 @@ using System.Text; namespace AgateLib.Geometry.VertexTypes -{ +{ /// <summary> /// Vertex structure with position, texture and normal values. /// </summary> - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct PositionTextureColorNormal { /// <summary> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-01-03 07:28:34
|
Revision: 1175 http://agate.svn.sourceforge.net/agate/?rev=1175&view=rev Author: kanato Date: 2010-01-03 07:28:23 +0000 (Sun, 03 Jan 2010) Log Message: ----------- Add x86 and x64 solution configurations for AgateLib-Windows.sln. Modified Paths: -------------- trunk/AgateLib-Windows.sln trunk/Drivers/AgateSDX/AgateSDX.csproj Modified: trunk/AgateLib-Windows.sln =================================================================== --- trunk/AgateLib-Windows.sln 2010-01-02 21:35:38 UTC (rev 1174) +++ trunk/AgateLib-Windows.sln 2010-01-03 07:28:23 UTC (rev 1175) @@ -28,12 +28,18 @@ Debug|Any CPU = Debug|Any CPU Debug|Mixed Platforms = Debug|Mixed Platforms Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Public|Any CPU = Public|Any CPU Public|Mixed Platforms = Public|Mixed Platforms Public|Win32 = Public|Win32 + Public|x64 = Public|x64 + Public|x86 = Public|x86 Release|Any CPU = Release|Any CPU Release|Mixed Platforms = Release|Mixed Platforms Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -41,114 +47,202 @@ {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Mixed Platforms.Build.0 = Debug|x86 {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Win32.ActiveCfg = Debug|x86 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|x64.ActiveCfg = Debug|x64 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|x64.Build.0 = Debug|x64 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|x86.ActiveCfg = Debug|x86 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|x86.Build.0 = Debug|x86 {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|Any CPU.ActiveCfg = Release|x86 {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|Mixed Platforms.ActiveCfg = Release|x86 {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|Mixed Platforms.Build.0 = Release|x86 {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|Win32.ActiveCfg = Release|x86 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|x64.ActiveCfg = Release|x86 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|x86.ActiveCfg = Release|x86 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|x86.Build.0 = Release|x86 {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Any CPU.ActiveCfg = Release|Any CPU {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Any CPU.Build.0 = Release|Any CPU {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Mixed Platforms.ActiveCfg = Release|x86 {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Mixed Platforms.Build.0 = Release|x86 {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Win32.ActiveCfg = Release|x86 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|x64.ActiveCfg = Release|x64 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|x64.Build.0 = Release|x64 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|x86.ActiveCfg = Release|x86 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|x86.Build.0 = Release|x86 {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|Any CPU.Build.0 = Debug|Any CPU {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|Mixed Platforms.Build.0 = Debug|x86 {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|Win32.ActiveCfg = Debug|x86 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|x64.ActiveCfg = Debug|x64 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|x64.Build.0 = Debug|x64 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|x86.ActiveCfg = Debug|x86 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|x86.Build.0 = Debug|x86 {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Public|Any CPU.ActiveCfg = Release|x86 {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Public|Mixed Platforms.ActiveCfg = Release|x86 {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Public|Mixed Platforms.Build.0 = Release|x86 {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Public|Win32.ActiveCfg = Release|x86 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Public|x64.ActiveCfg = Release|x86 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Public|x86.ActiveCfg = Release|x86 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Public|x86.Build.0 = Release|x86 {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|Any CPU.ActiveCfg = Release|Any CPU {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|Any CPU.Build.0 = Release|Any CPU {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|Mixed Platforms.ActiveCfg = Release|x86 {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|Mixed Platforms.Build.0 = Release|x86 {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|Win32.ActiveCfg = Release|x86 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|x64.ActiveCfg = Release|x64 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|x64.Build.0 = Release|x64 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|x86.ActiveCfg = Release|x86 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|x86.Build.0 = Release|x86 {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|Any CPU.Build.0 = Debug|Any CPU {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|Mixed Platforms.Build.0 = Debug|x86 {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|Win32.ActiveCfg = Debug|x86 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|x64.ActiveCfg = Debug|x64 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|x64.Build.0 = Debug|x64 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|x86.ActiveCfg = Debug|x86 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|x86.Build.0 = Debug|x86 {164A785D-924E-40FB-A517-D7E677F3B53A}.Public|Any CPU.ActiveCfg = Release|x86 {164A785D-924E-40FB-A517-D7E677F3B53A}.Public|Mixed Platforms.ActiveCfg = Release|x86 {164A785D-924E-40FB-A517-D7E677F3B53A}.Public|Mixed Platforms.Build.0 = Release|x86 {164A785D-924E-40FB-A517-D7E677F3B53A}.Public|Win32.ActiveCfg = Release|x86 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Public|x64.ActiveCfg = Release|x86 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Public|x86.ActiveCfg = Release|x86 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Public|x86.Build.0 = Release|x86 {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|Any CPU.ActiveCfg = Release|Any CPU {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|Any CPU.Build.0 = Release|Any CPU {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|Mixed Platforms.ActiveCfg = Release|x86 {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|Mixed Platforms.Build.0 = Release|x86 {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|Win32.ActiveCfg = Release|x86 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|x64.ActiveCfg = Release|x64 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|x64.Build.0 = Release|x64 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|x86.ActiveCfg = Release|x86 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|x86.Build.0 = Release|x86 {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Debug|Any CPU.Build.0 = Debug|Any CPU {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Debug|Mixed Platforms.Build.0 = Debug|x86 {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Debug|Win32.ActiveCfg = Debug|x86 + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Debug|x64.ActiveCfg = Debug|x64 + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Debug|x64.Build.0 = Debug|x64 + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Debug|x86.ActiveCfg = Debug|x86 + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Debug|x86.Build.0 = Debug|x86 {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Public|Any CPU.ActiveCfg = Release|x86 {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Public|Mixed Platforms.ActiveCfg = Release|x86 {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Public|Mixed Platforms.Build.0 = Release|x86 {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Public|Win32.ActiveCfg = Release|x86 + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Public|x64.ActiveCfg = Release|x86 + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Public|x86.ActiveCfg = Release|x86 + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Public|x86.Build.0 = Release|x86 {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Release|Any CPU.ActiveCfg = Release|Any CPU {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Release|Any CPU.Build.0 = Release|Any CPU {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Release|Mixed Platforms.ActiveCfg = Release|x86 {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Release|Mixed Platforms.Build.0 = Release|x86 {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Release|Win32.ActiveCfg = Release|x86 + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Release|x64.ActiveCfg = Release|x64 + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Release|x64.Build.0 = Release|x64 + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Release|x86.ActiveCfg = Release|x86 + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Release|x86.Build.0 = Release|x86 {EF993B30-D9A9-4962-80BB-6826D39B3465}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EF993B30-D9A9-4962-80BB-6826D39B3465}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EF993B30-D9A9-4962-80BB-6826D39B3465}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {EF993B30-D9A9-4962-80BB-6826D39B3465}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Debug|Mixed Platforms.Build.0 = Debug|x86 {EF993B30-D9A9-4962-80BB-6826D39B3465}.Debug|Win32.ActiveCfg = Debug|Any CPU + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Debug|x64.ActiveCfg = Debug|x64 + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Debug|x64.Build.0 = Debug|x64 + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Debug|x86.ActiveCfg = Debug|x86 + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Debug|x86.Build.0 = Debug|x86 {EF993B30-D9A9-4962-80BB-6826D39B3465}.Public|Any CPU.ActiveCfg = Release|Any CPU {EF993B30-D9A9-4962-80BB-6826D39B3465}.Public|Any CPU.Build.0 = Release|Any CPU {EF993B30-D9A9-4962-80BB-6826D39B3465}.Public|Mixed Platforms.ActiveCfg = Release|Any CPU {EF993B30-D9A9-4962-80BB-6826D39B3465}.Public|Mixed Platforms.Build.0 = Release|Any CPU {EF993B30-D9A9-4962-80BB-6826D39B3465}.Public|Win32.ActiveCfg = Release|Any CPU + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Public|x64.ActiveCfg = Release|x64 + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Public|x64.Build.0 = Release|x64 + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Public|x86.ActiveCfg = Release|x64 {EF993B30-D9A9-4962-80BB-6826D39B3465}.Release|Any CPU.ActiveCfg = Release|Any CPU {EF993B30-D9A9-4962-80BB-6826D39B3465}.Release|Any CPU.Build.0 = Release|Any CPU {EF993B30-D9A9-4962-80BB-6826D39B3465}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {EF993B30-D9A9-4962-80BB-6826D39B3465}.Release|Mixed Platforms.Build.0 = Release|Any CPU {EF993B30-D9A9-4962-80BB-6826D39B3465}.Release|Win32.ActiveCfg = Release|Any CPU + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Release|x64.ActiveCfg = Release|x64 + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Release|x64.Build.0 = Release|x64 + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Release|x86.ActiveCfg = Release|x86 + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Release|x86.Build.0 = Release|x86 {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Any CPU.Build.0 = Debug|Any CPU {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Mixed Platforms.Build.0 = Debug|x86 {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Win32.ActiveCfg = Debug|x86 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x64.ActiveCfg = Debug|x64 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x64.Build.0 = Debug|x64 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x86.ActiveCfg = Debug|x86 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|x86.Build.0 = Debug|x86 {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|Any CPU.ActiveCfg = Release|x86 {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|Mixed Platforms.ActiveCfg = Release|x86 {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|Mixed Platforms.Build.0 = Release|x86 {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|Win32.ActiveCfg = Release|x86 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|x64.ActiveCfg = Release|x86 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|x86.ActiveCfg = Release|x86 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|x86.Build.0 = Release|x86 {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Any CPU.ActiveCfg = Release|Any CPU {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Any CPU.Build.0 = Release|Any CPU {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Mixed Platforms.ActiveCfg = Release|x86 {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Mixed Platforms.Build.0 = Release|x86 {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Win32.ActiveCfg = Release|x86 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x64.ActiveCfg = Release|x64 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x64.Build.0 = Release|x64 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x86.ActiveCfg = Release|x86 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|x86.Build.0 = Release|x86 {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Debug|Any CPU.Build.0 = Debug|Any CPU {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Debug|Mixed Platforms.Build.0 = Debug|x86 {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Debug|Win32.ActiveCfg = Debug|x86 + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Debug|x64.ActiveCfg = Debug|x64 + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Debug|x64.Build.0 = Debug|x64 + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Debug|x86.ActiveCfg = Debug|x86 + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Debug|x86.Build.0 = Debug|x86 {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Public|Any CPU.ActiveCfg = Release|x86 {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Public|Mixed Platforms.ActiveCfg = Release|x86 {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Public|Mixed Platforms.Build.0 = Release|x86 {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Public|Win32.ActiveCfg = Release|x86 + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Public|x64.ActiveCfg = Release|x86 + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Public|x86.ActiveCfg = Release|x86 + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Public|x86.Build.0 = Release|x86 {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Release|Any CPU.ActiveCfg = Release|Any CPU {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Release|Any CPU.Build.0 = Release|Any CPU {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Release|Mixed Platforms.ActiveCfg = Release|x86 {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Release|Mixed Platforms.Build.0 = Release|x86 {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Release|Win32.ActiveCfg = Release|x86 + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Release|x64.ActiveCfg = Release|x64 + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Release|x64.Build.0 = Release|x64 + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Release|x86.ActiveCfg = Release|x86 + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Release|x86.Build.0 = Release|x86 {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Debug|Any CPU.Build.0 = Debug|Any CPU {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Debug|Mixed Platforms.Build.0 = Debug|x86 {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Debug|Win32.ActiveCfg = Debug|x86 + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Debug|x64.ActiveCfg = Debug|x64 + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Debug|x64.Build.0 = Debug|x64 + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Debug|x86.ActiveCfg = Debug|x86 + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Debug|x86.Build.0 = Debug|x86 {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Public|Any CPU.ActiveCfg = Release|x86 {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Public|Mixed Platforms.ActiveCfg = Release|x86 {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Public|Mixed Platforms.Build.0 = Release|x86 {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Public|Win32.ActiveCfg = Release|x86 + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Public|x64.ActiveCfg = Release|x86 + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Public|x86.ActiveCfg = Release|x86 + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Public|x86.Build.0 = Release|x86 {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Release|Any CPU.ActiveCfg = Release|Any CPU {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Release|Any CPU.Build.0 = Release|Any CPU {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Release|Mixed Platforms.ActiveCfg = Release|x86 {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Release|Mixed Platforms.Build.0 = Release|x86 {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Release|Win32.ActiveCfg = Release|x86 + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Release|x64.ActiveCfg = Release|x64 + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Release|x64.Build.0 = Release|x64 + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Release|x86.ActiveCfg = Release|x86 + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: trunk/Drivers/AgateSDX/AgateSDX.csproj =================================================================== --- trunk/Drivers/AgateSDX/AgateSDX.csproj 2010-01-02 21:35:38 UTC (rev 1174) +++ trunk/Drivers/AgateSDX/AgateSDX.csproj 2010-01-03 07:28:23 UTC (rev 1175) @@ -83,6 +83,24 @@ <FileAlignment>4096</FileAlignment> <PlatformTarget>x86</PlatformTarget> </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> + <DebugSymbols>true</DebugSymbols> + <OutputPath>bin\x64\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x64</PlatformTarget> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> + <OutputPath>bin\x64\Release\</OutputPath> + <DefineConstants>TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <Optimize>true</Optimize> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x64</PlatformTarget> + </PropertyGroup> <ItemGroup> <Reference Include="SlimDX, Version=2.0.8.42, Culture=neutral, PublicKeyToken=b1b0c32fd1ffe4f9, processorArchitecture=x86" /> <Reference Include="System"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-01-02 21:35:45
|
Revision: 1174 http://agate.svn.sourceforge.net/agate/?rev=1174&view=rev Author: kanato Date: 2010-01-02 21:35:38 +0000 (Sat, 02 Jan 2010) Log Message: ----------- Refactor some XAudio2 threading stuff. Modified Paths: -------------- trunk/AgateLib/AudioLib/SoundFormat.cs trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs Modified: trunk/AgateLib/AudioLib/SoundFormat.cs =================================================================== --- trunk/AgateLib/AudioLib/SoundFormat.cs 2010-01-02 18:07:36 UTC (rev 1173) +++ trunk/AgateLib/AudioLib/SoundFormat.cs 2010-01-02 21:35:38 UTC (rev 1174) @@ -50,5 +50,17 @@ { return new SoundFormat { BitsPerSample = 16, Channels = 1, SamplingFrequency = samplingFrequency }; } + /// <summary> + /// Creates and returns a SoundFormat object + /// for a 16-bit, single channel stream at the + /// specified sampling frequency. + /// </summary> + /// <param name="samplingFrequency">The sampling frequency for the stream.</param> + /// <param name="channels">Number of channels in the audio stream.</param> + /// <returns></returns> + public static SoundFormat Pcm16(int samplingFrequency, int channels) + { + return new SoundFormat { BitsPerSample = 16, Channels = channels, SamplingFrequency = samplingFrequency }; + } } } Modified: trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs =================================================================== --- trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs 2010-01-02 18:07:36 UTC (rev 1173) +++ trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs 2010-01-02 21:35:38 UTC (rev 1174) @@ -37,6 +37,14 @@ Thread xaudThread; bool stopThread; + List<InvokeData> methodsToInvoke = new List<InvokeData>(); + + struct InvokeData + { + public Delegate method; + public object[] args; + } + public XAudio2 Device { get { return mDevice; } @@ -55,6 +63,8 @@ xaudThread.Start(); } + #region --- Threading --- + public bool InvokeRequired { get @@ -66,24 +76,25 @@ } } - struct invk - { - public Delegate method; - public object[] args; - } public void BeginInvoke(Delegate method, params object[] args) { - invk k = new invk { method = method, args = args }; + InvokeData k = new InvokeData { method = method, args = args }; - lock (invokeMethod) + lock (methodsToInvoke) { - invokeMethod.Add(k); + methodsToInvoke.Add(k); } } - List<invk> invokeMethod = new List<invk>(); + public void Invoke(Delegate method, object[] args) + { + BeginInvoke(method, args); + while (methodsToInvoke.Count > 0) + Thread.Sleep(1); + } + void Run(object unused) { mDevice = new XAudio2(); @@ -91,32 +102,34 @@ for (; ; ) { - lock (invokeMethod) + int count = methodsToInvoke.Count; + + for (int i = 0; i < count; i++) { - while (invokeMethod.Count > 0) - { - if (stopThread) - break; + if (stopThread) + break; - invk k = invokeMethod[0]; - invokeMethod.RemoveAt(0); + InvokeData k = methodsToInvoke[i]; - k.method.DynamicInvoke(k.args); + k.method.DynamicInvoke(k.args); + } - } + lock (methodsToInvoke) + { + methodsToInvoke.RemoveRange(0, count); } if (stopThread) break; Thread.Sleep(1); - } Dispose(); } - + #endregion + public override void Dispose() { if (InvokeRequired) @@ -139,7 +152,6 @@ return; } - // hack because there is access violation when XAudio2 shuts down? masteringVoice.Dispose(); mDevice.Dispose(); } @@ -169,6 +181,7 @@ { return new XAudio2_StreamingSoundBuffer(this, input, format); } + } public delegate void DisposeDelegate(); Modified: trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs =================================================================== --- trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs 2010-01-02 18:07:36 UTC (rev 1173) +++ trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs 2010-01-02 21:35:38 UTC (rev 1174) @@ -20,6 +20,7 @@ using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; +using System.Threading; using System.Text; using AgateLib.AudioLib; using AgateLib.AudioLib.ImplementationBase; @@ -42,6 +43,8 @@ double mPan; BinaryWriter w; bool mIsDisposed; + bool mReadingData; + int thisBufferIndex; int mChunkSize; @@ -64,6 +67,9 @@ Initialize(); } + + #region --- Thread safety --- + public bool InvokeRequired { get { return mAudio.InvokeRequired; } @@ -72,12 +78,18 @@ { mAudio.BeginInvoke(method, args); } + void Invoke(Delegate method, params object[] args) + { + mAudio.Invoke(method, args); + } + #endregion + private void Initialize() { if (InvokeRequired) { - BeginInvoke(new DisposeDelegate(Initialize)); + Invoke(new DisposeDelegate(Initialize)); return; } @@ -101,6 +113,8 @@ buffer[i].buffer.Flags = BufferFlags.EndOfStream; } + thisBufferIndex = count; + string tempFileName = string.Format("xaudio2_buffer{0}.pcm", count); count++; @@ -113,40 +127,45 @@ { if (InvokeRequired) { - BeginInvoke(new DisposeDelegate(Initialize)); + Invoke(new DisposeDelegate(Dispose)); return; } + while (mReadingData) + Thread.Sleep(1); + mIsDisposed = true; + mVoice.FlushSourceBuffers(); + Thread.Sleep(1); + mVoice.Stop(); + w.BaseStream.Dispose(); + try + { + mVoice.Dispose(); + } + catch (Exception e) + { + System.Diagnostics.Debug.Print("Caught exception {0}.\n{1}", e.GetType(), e.Message); + } + foreach (var b in buffer) { b.buffer.Dispose(); } - mVoice.Stop(); - mVoice.Dispose(); + + System.Diagnostics.Debug.Print("Disposed streaming buffer {0}.", thisBufferIndex); } void mVoice_BufferEnd(object sender, ContextEventArgs e) { - ReadAndSubmitNextData(); - } - - private void ReadAndSubmitNextData() - { - if (mIsDisposed) + if (IsPlaying == false) return; - ReadData(buffer[mNextData]); - SubmitData(buffer[mNextData]); - - mNextData++; - - if (mNextData >= bufferCount) - mNextData = 0; + ReadAndSubmitNextData(); } public override void Play() @@ -164,7 +183,6 @@ mVoice.Start(); mPlaying = true; } - public override void Stop() { if (InvokeRequired) @@ -178,9 +196,47 @@ mVoice.Stop(); } + #region --- Reading Data --- + + int bytesRead = 0; + + private void ReadAndSubmitNextData() + { + if (mIsDisposed) + return; + + if (InvokeRequired) + { + Invoke(new DisposeDelegate(ReadAndSubmitNextData)); + return; + } + + try + { + mReadingData = true; + + ReadData(buffer[mNextData]); + SubmitData(buffer[mNextData]); + + mNextData++; + + if (mNextData >= bufferCount) + mNextData = 0; + } + finally + { + mReadingData = false; + } + } private void ReadData(BufferData bufferData) { + if (bufferData.backing == null) + { + ResizeBacking(); + } + int count = mInput.Read(bufferData.backing, 0, bufferData.backing.Length); + bytesRead += count; bufferData.ms.Position = 0; bufferData.buffer.AudioData = bufferData.ms; @@ -194,6 +250,8 @@ mVoice.SubmitSourceBuffer(bufferData.buffer); } + #endregion + public override int ChunkSize { get @@ -205,7 +263,6 @@ mChunkSize = value; ResizeBacking(); - } } @@ -220,11 +277,10 @@ { if (InvokeRequired) { - BeginInvoke(new DisposeDelegate(ResizeBacking)); + Invoke(new DisposeDelegate(ResizeBacking)); return; } - for (int i = 0; i < buffer.Length; i++) { buffer[i].backing = new byte[ChunkByteSize]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2010-01-02 18:07:42
|
Revision: 1173 http://agate.svn.sourceforge.net/agate/?rev=1173&view=rev Author: kanato Date: 2010-01-02 18:07:36 +0000 (Sat, 02 Jan 2010) Log Message: ----------- Make XAudio2 calls run on their own thread. Change interpretation of ChunkSize to be number of samples. Modified Paths: -------------- trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs trunk/Drivers/AgateSDX/AgateSDX.csproj trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs Modified: trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs =================================================================== --- trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs 2009-12-31 08:12:05 UTC (rev 1172) +++ trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs 2010-01-02 18:07:36 UTC (rev 1173) @@ -38,7 +38,7 @@ /// </summary> /// <param name="input">The stream from which audio data will be pulled from.</param> /// <param name="format">A SoundFormat object which indicates the PCM format for the data.</param> - /// <param name="chunkSize">The size of data that should be read from the stream each time + /// <param name="chunkSize">The number of samples from each channel that should be read from the stream each time /// new data is required.</param> public StreamingSoundBuffer(Stream input, SoundFormat format, int chunkSize) { @@ -87,7 +87,7 @@ } /// <summary> - /// Gets or sets a value indicating how many bytes should be read from the + /// Gets or sets a value indicating how many samples should be read from the /// stream at a time. This may only be set when the audio is stopped. /// </summary> public int ChunkSize Modified: trunk/Drivers/AgateSDX/AgateSDX.csproj =================================================================== --- trunk/Drivers/AgateSDX/AgateSDX.csproj 2009-12-31 08:12:05 UTC (rev 1172) +++ trunk/Drivers/AgateSDX/AgateSDX.csproj 2010-01-02 18:07:36 UTC (rev 1173) @@ -1,7 +1,7 @@ <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <PropertyGroup> <ProjectType>Local</ProjectType> - <ProductVersion>9.0.30729</ProductVersion> + <ProductVersion>9.0.21022</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{EF993B30-D9A9-4962-80BB-6826D39B3465}</ProjectGuid> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> @@ -65,6 +65,24 @@ <NoWarn> </NoWarn> </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> + <DebugSymbols>true</DebugSymbols> + <OutputPath>bin\x86\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x86</PlatformTarget> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> + <OutputPath>bin\x86\Release\</OutputPath> + <DefineConstants>TRACE;</DefineConstants> + <BaseAddress>285212672</BaseAddress> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <Optimize>true</Optimize> + <FileAlignment>4096</FileAlignment> + <PlatformTarget>x86</PlatformTarget> + </PropertyGroup> <ItemGroup> <Reference Include="SlimDX, Version=2.0.8.42, Culture=neutral, PublicKeyToken=b1b0c32fd1ffe4f9, processorArchitecture=x86" /> <Reference Include="System"> Modified: trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs =================================================================== --- trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs 2009-12-31 08:12:05 UTC (rev 1172) +++ trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs 2010-01-02 18:07:36 UTC (rev 1173) @@ -21,6 +21,7 @@ using System.IO; using System.Runtime.InteropServices; using System.Text; +using System.Threading; using AgateLib.AudioLib; using AgateLib.AudioLib.ImplementationBase; using AgateLib.Drivers; @@ -33,6 +34,8 @@ { XAudio2 mDevice; MasteringVoice masteringVoice; + Thread xaudThread; + bool stopThread; public XAudio2 Device { @@ -48,20 +51,97 @@ { Report("SlimDX XAudio2 driver instantiated for audio."); + xaudThread = new Thread(Run); + xaudThread.Start(); + } - mDevice = new XAudio2();//XAudio2Flags.DebugEngine, ProcessorSpecifier.AnyProcessor); + public bool InvokeRequired + { + get + { + if (Thread.CurrentThread == xaudThread) + return false; + else + return true; + } + } + + struct invk + { + public Delegate method; + public object[] args; + } + + public void BeginInvoke(Delegate method, params object[] args) + { + invk k = new invk { method = method, args = args }; + + lock (invokeMethod) + { + invokeMethod.Add(k); + } + } + + List<invk> invokeMethod = new List<invk>(); + + void Run(object unused) + { + mDevice = new XAudio2(); masteringVoice = new MasteringVoice(mDevice); + for (; ; ) + { + lock (invokeMethod) + { + while (invokeMethod.Count > 0) + { + if (stopThread) + break; + + invk k = invokeMethod[0]; + invokeMethod.RemoveAt(0); + + k.method.DynamicInvoke(k.args); + + } + } + + if (stopThread) + break; + + Thread.Sleep(1); + + } + + Dispose(); } + + public override void Dispose() { + if (InvokeRequired) + { + stopThread = true; + + int count = 0; + + while (xaudThread.ThreadState == ThreadState.Running) + { + Thread.Sleep(10); + count++; + + if (count > 20) + { + xaudThread.Abort(); + } + } + + return; + } + // hack because there is access violation when XAudio2 shuts down? - try - { - mDevice.Dispose(); - } - catch - { } + masteringVoice.Dispose(); + mDevice.Dispose(); } public override SoundBufferImpl CreateSoundBuffer(Stream inStream) @@ -71,45 +151,26 @@ public override MusicImpl CreateMusic(System.IO.Stream musicStream) { - CheckCoop(); - return new XAudio2_Music(this, musicStream); } public override MusicImpl CreateMusic(string filename) { - CheckCoop(); - return new XAudio2_Music(this, filename); } public override SoundBufferImpl CreateSoundBuffer(string filename) { - CheckCoop(); - return new XAudio2_SoundBuffer(this, filename); } public override SoundBufferSessionImpl CreateSoundBufferSession(SoundBufferImpl buffer) { - CheckCoop(); - return new XAudio2_SoundBufferSession(this, buffer as XAudio2_SoundBuffer); } public override StreamingSoundBufferImpl CreateStreamingSoundBuffer(Stream input, SoundFormat format) { return new XAudio2_StreamingSoundBuffer(this, input, format); } - - /// <summary> - /// hack to make sure the cooperative level is set after a window is created. - /// Is this necessary with XAudio2? - /// </summary> - private void CheckCoop() - { - if (System.Windows.Forms.Form.ActiveForm != null) - { - //mDSobject.SetCooperativeLevel(System.Windows.Forms.Form.ActiveForm.Handle, - // CooperativeLevel.Priority); - } - } } + public delegate void DisposeDelegate(); + } Modified: trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs =================================================================== --- trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs 2009-12-31 08:12:05 UTC (rev 1172) +++ trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs 2010-01-02 18:07:36 UTC (rev 1173) @@ -41,6 +41,7 @@ int mNextData; double mPan; BinaryWriter w; + bool mIsDisposed; int mChunkSize; @@ -53,52 +54,82 @@ public byte[] backing; } + static int count = 0; + public XAudio2_StreamingSoundBuffer(XAudio2_Audio audio, Stream input, SoundFormat format) { mAudio = audio; mInput = input; mFormat = format; + Initialize(); + } + public bool InvokeRequired + { + get { return mAudio.InvokeRequired; } + } + public void BeginInvoke(Delegate method, params object[] args) + { + mAudio.BeginInvoke(method, args); + } + + private void Initialize() + { + if (InvokeRequired) + { + BeginInvoke(new DisposeDelegate(Initialize)); + return; + } + xaudFormat = new WaveFormat(); - xaudFormat.BitsPerSample = (short) mFormat.BitsPerSample; + xaudFormat.BitsPerSample = (short)mFormat.BitsPerSample; xaudFormat.Channels = (short)mFormat.Channels; xaudFormat.BlockAlignment = (short)(mFormat.Channels * mFormat.BitsPerSample / 8); xaudFormat.FormatTag = WaveFormatTag.Pcm; - xaudFormat.SamplesPerSecond = format.SamplingFrequency; + xaudFormat.SamplesPerSecond = mFormat.SamplingFrequency; xaudFormat.AverageBytesPerSecond = xaudFormat.BlockAlignment * xaudFormat.SamplesPerSecond; - mVoice = new SourceVoice(audio.Device, xaudFormat); + mVoice = new SourceVoice(mAudio.Device, xaudFormat); mVoice.BufferEnd += new EventHandler<ContextEventArgs>(mVoice_BufferEnd); buffer = new BufferData[bufferCount]; for (int i = 0; i < bufferCount; i++) { buffer[i] = new BufferData(); + buffer[i].ms = new MemoryStream(); buffer[i].buffer = new AudioBuffer(); - buffer[i].ms = new MemoryStream(); + buffer[i].buffer.Flags = BufferFlags.EndOfStream; } - string tempFileName = Path.GetTempFileName(); + string tempFileName = string.Format("xaudio2_buffer{0}.pcm", count); + count++; - w = new BinaryWriter(File.Open(tempFileName + ".pcm", FileMode.Create)); + w = new BinaryWriter(File.Open(tempFileName, FileMode.Create)); Pan = 0; } public override void Dispose() { - try + if (InvokeRequired) { - w.BaseStream.Dispose(); + BeginInvoke(new DisposeDelegate(Initialize)); + return; + } - mVoice.Stop(); - mVoice.Dispose(); + mIsDisposed = true; + + w.BaseStream.Dispose(); + + foreach (var b in buffer) + { + b.buffer.Dispose(); } - catch - { - } + mVoice.Stop(); + mVoice.Dispose(); } + void mVoice_BufferEnd(object sender, ContextEventArgs e) { ReadAndSubmitNextData(); @@ -106,6 +137,9 @@ private void ReadAndSubmitNextData() { + if (mIsDisposed) + return; + ReadData(buffer[mNextData]); SubmitData(buffer[mNextData]); @@ -117,6 +151,12 @@ public override void Play() { + if (InvokeRequired) + { + BeginInvoke(new DisposeDelegate(Play)); + return; + } + mNextData = 0; ReadAndSubmitNextData(); ReadAndSubmitNextData(); @@ -127,6 +167,12 @@ public override void Stop() { + if (InvokeRequired) + { + BeginInvoke(new DisposeDelegate(Stop)); + return; + } + mPlaying = false; mVoice.Stop(); @@ -156,26 +202,36 @@ } set { - if (value <= xaudFormat.BlockAlignment) - throw new ArgumentOutOfRangeException(string.Format( - "Chunk size is too small. Must be multiple of {0} but was {1}.", - xaudFormat.BlockAlignment, value)); + mChunkSize = value; - if (value % xaudFormat.BlockAlignment != 0) - throw new ArgumentException(string.Format( - "Chunk size {0} was not a multiple of the block alignment {1}.", - value, xaudFormat.BlockAlignment)); + ResizeBacking(); - mChunkSize = value; + } + } - for (int i = 0; i < buffer.Length; i++) - { - buffer[i].backing = new byte[mChunkSize]; - buffer[i].ms = new MemoryStream(buffer[i].backing); - } + int ChunkByteSize + { + get + { + return ChunkSize * xaudFormat.BlockAlignment; } } + private void ResizeBacking() + { + if (InvokeRequired) + { + BeginInvoke(new DisposeDelegate(ResizeBacking)); + return; + } + + for (int i = 0; i < buffer.Length; i++) + { + buffer[i].backing = new byte[ChunkByteSize]; + buffer[i].ms = new MemoryStream(buffer[i].backing); + } + } + public override bool IsPlaying { get { return mPlaying; } @@ -188,10 +244,21 @@ set { mPan = value; - mVoice.SetChannelVolumes(2, GetChannelVolumes((float)value)); + ResetChannelVolumes(); } } + private void ResetChannelVolumes() + { + if (InvokeRequired) + { + BeginInvoke(new DisposeDelegate(ResetChannelVolumes)); + return; + } + + mVoice.SetChannelVolumes(2, GetChannelVolumes((float)mPan)); + } + private float[] GetChannelVolumes(float pan) { if (pan < 0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2009-12-31 08:12:13
|
Revision: 1172 http://agate.svn.sourceforge.net/agate/?rev=1172&view=rev Author: kanato Date: 2009-12-31 08:12:05 +0000 (Thu, 31 Dec 2009) Log Message: ----------- Integrate Tao.Sdl source code into AgateSDL. Add debug output to XAud2/XAudio2_StreamingSoundBuffer.cs. Make text useful in Lighting3DTest.cs. Modified Paths: -------------- trunk/Drivers/AgateSDL/AgateSDL.csproj trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs trunk/Tests/Shaders/Lighting3DTest.cs Added Paths: ----------- trunk/Drivers/AgateSDL/AgateSDL.dll.config trunk/Drivers/AgateSDL/Tao.Sdl/ trunk/Drivers/AgateSDL/Tao.Sdl/AUTHORS trunk/Drivers/AgateSDL/Tao.Sdl/COPYING trunk/Drivers/AgateSDL/Tao.Sdl/README trunk/Drivers/AgateSDL/Tao.Sdl/Sdl.cs trunk/Drivers/AgateSDL/Tao.Sdl/SdlGfx.cs trunk/Drivers/AgateSDL/Tao.Sdl/SdlMixer.cs trunk/Drivers/AgateSDL/Tao.Sdl/Smpeg.cs Removed Paths: ------------- trunk/Drivers/AgateSDL/Tao.Sdl.dll trunk/Drivers/AgateSDL/Tao.Sdl.dll.config Modified: trunk/Drivers/AgateSDL/AgateSDL.csproj =================================================================== --- trunk/Drivers/AgateSDL/AgateSDL.csproj 2009-12-30 20:42:39 UTC (rev 1171) +++ trunk/Drivers/AgateSDL/AgateSDL.csproj 2009-12-31 08:12:05 UTC (rev 1172) @@ -1,7 +1,7 @@ <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <PropertyGroup> <ProjectType>Local</ProjectType> - <ProductVersion>9.0.30729</ProductVersion> + <ProductVersion>9.0.21022</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{00C7FA95-98F4-43D9-9B63-34122B1DB003}</ProjectGuid> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> @@ -150,12 +150,13 @@ <Compile Include="Properties\AssemblyInfo.cs"> <SubType>Code</SubType> </Compile> - <None Include="Tao.Sdl.dll.config"> + <Compile Include="Tao.Sdl\Sdl.cs" /> + <Compile Include="Tao.Sdl\SdlGfx.cs" /> + <Compile Include="Tao.Sdl\SdlMixer.cs" /> + <Compile Include="Tao.Sdl\Smpeg.cs" /> + <None Include="AgateSDL.dll.config"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> - <None Include="Tao.Sdl.dll"> - <CopyToOutputDirectory>Always</CopyToOutputDirectory> - </None> <None Include="SDL.dll"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> @@ -174,6 +175,9 @@ <None Include="Readme-SDL.txt"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> + <None Include="Tao.Sdl\AUTHORS" /> + <None Include="Tao.Sdl\COPYING" /> + <None Include="Tao.Sdl\README" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> <PropertyGroup> Copied: trunk/Drivers/AgateSDL/AgateSDL.dll.config (from rev 1157, trunk/Drivers/AgateSDL/Tao.Sdl.dll.config) =================================================================== --- trunk/Drivers/AgateSDL/AgateSDL.dll.config (rev 0) +++ trunk/Drivers/AgateSDL/AgateSDL.dll.config 2009-12-31 08:12:05 UTC (rev 1172) @@ -0,0 +1,6 @@ +<configuration> + <dllmap os="linux" dll="SDL.dll" target="libSDL-1.2.so.0"/> + <dllmap os="linux" dll="SDL_mixer.dll" target="libSDL_mixer-1.2.so.0"/> + <dllmap os="osx" dll="SDL.dll" target="SDL.framework/SDL"/> + <dllmap os="osx" dll="SDL_mixer.dll" target="SDL_mixer.framework/SDL_mixer"/> +</configuration> Added: trunk/Drivers/AgateSDL/Tao.Sdl/AUTHORS =================================================================== --- trunk/Drivers/AgateSDL/Tao.Sdl/AUTHORS (rev 0) +++ trunk/Drivers/AgateSDL/Tao.Sdl/AUTHORS 2009-12-31 08:12:05 UTC (rev 1172) @@ -0,0 +1 @@ +David Hudson (je...@ya...) Added: trunk/Drivers/AgateSDL/Tao.Sdl/COPYING =================================================================== --- trunk/Drivers/AgateSDL/Tao.Sdl/COPYING (rev 0) +++ trunk/Drivers/AgateSDL/Tao.Sdl/COPYING 2009-12-31 08:12:05 UTC (rev 1172) @@ -0,0 +1,22 @@ +MIT License +Copyright \xA92003-2006 Tao Framework Team +http://www.taoframework.com +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. Added: trunk/Drivers/AgateSDL/Tao.Sdl/README =================================================================== --- trunk/Drivers/AgateSDL/Tao.Sdl/README (rev 0) +++ trunk/Drivers/AgateSDL/Tao.Sdl/README 2009-12-31 08:12:05 UTC (rev 1172) @@ -0,0 +1,19 @@ +Tao.Sdl 1.2.12.0 +Copyright \xA92003-2005 Tao Framework Team +http://www.taoframework.com +All rights reserved. + +Tao.Sdl is an SDL API binding for .NET, implementing SDL 1.2.12. + +Change Log: +1.2.13.0 - January 2008: + Updated to latest version of SDL. +1.2.12.0 - August 2007: + Updated to latest version of SDL. +1.2.11 - June 2006: + Updated to latest version of SDL. +1.2.10.0 - June 15, 2006: + Updated to latest version of SDL. +1.2.7.0 - April 20, 2004: + Initial release. Special thanks to Dave Hudson for doing most of this + implementation. Added: trunk/Drivers/AgateSDL/Tao.Sdl/Sdl.cs =================================================================== --- trunk/Drivers/AgateSDL/Tao.Sdl/Sdl.cs (rev 0) +++ trunk/Drivers/AgateSDL/Tao.Sdl/Sdl.cs 2009-12-31 08:12:05 UTC (rev 1172) @@ -0,0 +1,13290 @@ +#region License +/* +MIT License +Copyright \xA92003-2006 Tao Framework Team +http://www.taoframework.com +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +#endregion License + +using System; +using System.IO; +using System.Collections; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Security; +using System.Text; + +namespace Tao.Sdl +{ + #region Class Documentation + /// <summary> + /// Simple DirectMedia Layer binding for .NET, implementing SDL 1.2.13. + /// </summary> + /// <remarks> + /// This library is designed to make it easy to write games that run + /// the .NET runtime using the various native high-performance media + /// interfaces, (for video, audio, etc) and presenting a single + /// source-code level API to your application. This is a fairly + /// low level API, but using this, completely portable applications + /// can be written with a great deal of flexibility. + /// <p>An introduction to SDL can be found online at: http://www.libsdl.org/intro/ </p> + /// <p>Binds to functions and definitions in SDL.dll or libSDL.so.</p> + /// </remarks> + #endregion Class Documentation + [SuppressUnmanagedCodeSecurityAttribute()] + public static class Sdl + { + #region Private Constants + #region string SDL_NATIVE_LIBRARY + /// <summary> + /// Specifies SDL's native library archive. + /// </summary> + /// <remarks> + /// Specifies SDL.dll everywhere; will be mapped via .config for mono. + /// </remarks> + private const string SDL_NATIVE_LIBRARY = "SDL.dll"; + #endregion string SDL_NATIVE_LIBRARY + + #region CallingConvention CALLING_CONVENTION + /// <summary> + /// Specifies the calling convention. + /// </summary> + /// <remarks> + /// Specifies <see cref="CallingConvention.Cdecl" /> + /// for Windows and Linux. + /// </remarks> + private const CallingConvention CALLING_CONVENTION = + CallingConvention.Cdecl; + #endregion CallingConvention CALLING_CONVENTION + + private const int BYTE_SIZE = 8; + #endregion Private Constants + + #region Private Methods + // OS X compatibility. + [DllImport("/System/Library/Frameworks/Cocoa.framework/Cocoa", EntryPoint = "NSApplicationLoad")] + private static extern void NSApplicationLoad(); + + /// <summary> + /// + /// </summary> + /// <param name="name"></param> + /// <returns></returns> + [DllImport("libobjc.dylib", EntryPoint = "objc_getClass")] + public static extern int objc_getClass(string name); + + /// <summary> + /// + /// </summary> + /// <param name="name"></param> + /// <returns></returns> + [DllImport("libobjc.dylib", EntryPoint = "sel_registerName")] + public static extern int sel_registerName(string name); + + /// <summary> + /// + /// </summary> + /// <param name="self"></param> + /// <param name="cmd"></param> + /// <returns></returns> + [DllImport("libobjc.dylib", EntryPoint = "objc_msgSend")] + public static extern int objc_msgSend(int self, int cmd); + + #endregion Private Methods + + #region Public Constants + #region SDL.h + #region SDL_INIT_TIMER + /// <summary> + /// The timer subsystem. + /// </summary> + // #define SDL_INIT_TIMER 0x00000001 + public const int SDL_INIT_TIMER = 0x00000001; + #endregion SDL_INIT_TIMER + + #region SDL_INIT_AUDIO + /// <summary> + /// The audio subsystem. + /// </summary> + // #define SDL_INIT_AUDIO 0x00000010 + public const int SDL_INIT_AUDIO = 0x00000010; + #endregion SDL_INIT_AUDIO + + #region SDL_INIT_VIDEO + /// <summary> + /// The video subsystem. + /// </summary> + // #define SDL_INIT_VIDEO 0x00000020 + public const int SDL_INIT_VIDEO = 0x00000020; + #endregion SDL_INIT_VIDEO + + #region SDL_INIT_CDROM + /// <summary> + /// The CD-ROM subsystem. + /// </summary> + // #define SDL_INIT_CDROM 0x00000100 + public const int SDL_INIT_CDROM = 0x00000100; + #endregion SDL_INIT_CDROM + + #region SDL_INIT_JOYSTICK + /// <summary> + /// The joystick subsystem. + /// </summary> + // #define SDL_INIT_JOYSTICK 0x00000200 + public const int SDL_INIT_JOYSTICK = 0x00000200; + #endregion SDL_INIT_JOYSTICK + + #region SDL_INIT_NOPARACHUTE + /// <summary> + /// Prevents SDL from catching fatal signals. + /// </summary> + // #define SDL_INIT_NOPARACHUTE 0x00100000 + public const int SDL_INIT_NOPARACHUTE = 0x00100000; + #endregion SDL_INIT_NOPARACHUTE + + #region SDL_INIT_EVENTTHREAD + /// <summary> + /// Not supported on all OS's. + /// </summary> + // #define SDL_INIT_EVENTTHREAD 0x01000000 + public const int SDL_INIT_EVENTTHREAD = 0x01000000; + #endregion SDL_INIT_EVENTTHREAD + + #region SDL_INIT_EVERYTHING + /// <summary> + /// All subsystems. + /// These are the flags which may be passed to SDL_Init() + /// -- you should specify the subsystems which you will be + /// using in your application.. + /// </summary> + // #define SDL_INIT_EVERYTHING 0x0000FFFF + public const int SDL_INIT_EVERYTHING = 0x0000FFFF; + #endregion SDL_INIT_EVERYTHING + #endregion SDL.h + + #region SDL_active.h + #region SDL_APPMOUSEFOCUS + /// <summary> + /// The app has mouse coverage + /// </summary> + /// <remarks> + /// The available application states + /// </remarks> + public const byte SDL_APPMOUSEFOCUS = 0x01; + #endregion SDL_APPMOUSEFOCUS + + #region SDL_APPINPUTFOCUS + /// <summary> + /// The app has input focus + /// </summary> + /// <remarks> + /// The available application states + /// </remarks> + public const byte SDL_APPINPUTFOCUS = 0x02; + #endregion SDL_APPINPUTFOCUS + + #region SDL_APPACTIVE + /// <summary> + /// The application is active + /// </summary> + /// <remarks> + /// The available application states + /// </remarks> + public const byte SDL_APPACTIVE = 0x04; + #endregion SDL_APPACTIVE + #endregion SDL_active.h + + #region SDL_audio.h + #region AUDIO_U8 + /// <summary> + /// Unsigned 8-bit samples. + /// </summary> + public const short AUDIO_U8 = 0x0008; + #endregion AUDIO_U8 + + #region AUDIO_S8 + /// <summary> + /// Signed 8-bit samples. + /// </summary> + public const short AUDIO_S8 = unchecked((short)0x8008); + #endregion AUDIO_S8 + + #region AUDIO_U16LSB + /// <summary> + /// Unsigned 16-bit little-endian samples. + /// </summary> + public const short AUDIO_U16LSB = 0x0010; + #endregion AUDIO_U16LSB + + #region AUDIO_S16LSB + /// <summary> + /// Signed 16-bit little-endian samples + /// </summary> + public const short AUDIO_S16LSB = unchecked((short)0x8010); + #endregion AUDIO_S16LSB + + #region AUDIO_U16MSB + /// <summary> + /// Unsigned 16-bit big-endian samples + /// </summary> + public const short AUDIO_U16MSB = 0x1010; + #endregion AUDIO_U16MSB + + #region AUDIO_S16MSB + /// <summary> + /// Signed 16-bit big-endian samples + /// </summary> + public const short AUDIO_S16MSB = unchecked((short)0x9010); + #endregion AUDIO_S16MSB + + #region AUDIO_U16 + /// <summary> + /// Unsigned 16-bit little-endian samples + /// </summary> + public static readonly short AUDIO_U16 = AUDIO_U16LSB; + #endregion AUDIO_U16 + + #region AUDIO_S16 + /// <summary> + /// Signed 16-bit little-endian samples + /// </summary> + public static readonly short AUDIO_S16 = unchecked((short)AUDIO_S16LSB); + #endregion AUDIO_S16 + + #region SDL_MIX_MAXVOLUME + /// <summary> + /// Full audio volume + /// </summary> + public const int SDL_MIX_MAXVOLUME = 128; + #endregion SDL_MIX_MAXVOLUME + #endregion SDL_audio.h + + // SDL_byteorder.h -- deprecated + + #region SDL_cdrom.h + #region SDL_MAX_TRACKS + /// <summary> + /// The maximum number of CD-ROM tracks on a disk + /// </summary> + public const int SDL_MAX_TRACKS = 99; + #endregion SDL_MAX_TRACKS + + #region SDL_AUDIO_TRACK + /// <summary> + /// The types of CD-ROM track possible + /// </summary> + public const int SDL_AUDIO_TRACK = 0x00; + #endregion SDL_AUDIO_TRACK + + #region SDL_DATA_TRACK + /// <summary> + /// The types of CD-ROM track possible + /// </summary> + public const int SDL_DATA_TRACK = 0x04; + #endregion SDL_DATA_TRACK + + #region CD_FPS + /// <summary> + /// Frames per second. + /// </summary> + public const int CD_FPS = 75; + #endregion CD_FPS + #endregion SDL_cdrom.h + + // SDL_config.h -- none + // SDL_copying.h -- none + // SDL_cpuinfo.h -- none + + #region SDL_endian.h + #region SDL_LIL_ENDIAN + /// <summary> + /// Little Endian + /// </summary> + /// <remarks> + /// e.g. i386 machines</remarks> + public const int SDL_LIL_ENDIAN = 1234; + #endregion SDL_LIL_ENDIAN + + #region SDL_BIG_ENDIAN + /// <summary> + /// Big Endian + /// </summary> + /// <remarks> + /// e.g. Macs + /// </remarks> + public const int SDL_BIG_ENDIAN = 4321; + #endregion SDL_BIG_ENDIAN + #endregion SDL_endian.h + + // SDL_error.h -- none + + #region SDL_events.h + /// <summary> + /// Button in pressed state. + /// </summary> + /// <remarks> + /// SDL_events.h defines SDL_PRESSED and <see cref="SDL_RELEASED"/> + /// in a nameless enum. Defining SDL_PRESSED as a const works + /// better for Tao.SDL purposes</remarks> + /// <seealso cref="SDL_RELEASED"/> + public const byte SDL_PRESSED = 0x01; + /// <summary> + /// Button in released state. + /// </summary> + /// <remarks> + /// SDL_events.h defines <see cref="SDL_PRESSED"/> and SDL_RELEASED + /// in a nameless enum. Defining SDL_RELEASED as a const works + /// better for Tao.SDL purposes</remarks> + /// <seealso cref="SDL_PRESSED"/> + public const byte SDL_RELEASED = 0x00; + + /// <summary> + /// This is the mask which refers to all hotkey bindings. + /// </summary> + public const int SDL_ALLEVENTS = unchecked((int)0xFFFFFFFF); + + /// <summary> + /// If 'state' is set to SDL_QUERY, SDL_EventState() + /// will return the + /// current processing state of the specified event. + /// </summary> + public const int SDL_QUERY = -1; + /// <summary> + /// If 'state' is set to SDL_IGNORE, that event will be + /// automatically dropped + /// from the event queue and will not event be filtered. + /// </summary> + public const int SDL_IGNORE = 0; + /// <summary> + /// + /// </summary> + public const int SDL_DISABLE = 0; + /// <summary> + /// If 'state' is set to SDL_ENABLE, that event will + /// be processed normally. + /// </summary> + public const int SDL_ENABLE = 1; + #endregion SDL_events.h + + // SDL_getenv.h -- deprecated + + #region SDL_joystick.h + /// <summary> + /// Indicates which position a joystick hat is pressed in + /// </summary> + public const byte SDL_HAT_CENTERED = 0x00; + + /// <summary> + /// + /// </summary> + public const byte SDL_HAT_UP = 0x01; + + /// <summary> + /// + /// </summary> + public const byte SDL_HAT_RIGHT = 0x02; + + /// <summary> + /// + /// </summary> + public const byte SDL_HAT_DOWN = 0x04; + + /// <summary> + /// + /// </summary> + public const byte SDL_HAT_LEFT = 0x08; + /// <summary> + /// + /// </summary> + public const byte SDL_HAT_RIGHTUP = (SDL_HAT_RIGHT | SDL_HAT_UP); + /// <summary> + /// + /// </summary> + public const byte SDL_HAT_RIGHTDOWN = (SDL_HAT_RIGHT | SDL_HAT_DOWN); + /// <summary> + /// + /// </summary> + public const byte SDL_HAT_LEFTUP = (SDL_HAT_LEFT | SDL_HAT_UP); + /// <summary> + /// + /// </summary> + public const byte SDL_HAT_LEFTDOWN = (SDL_HAT_LEFT | SDL_HAT_DOWN); + #endregion SDL_joystick.h + + #region SDL_keyboard.h + /// <summary> + /// This is the mask which refers to all hotkey bindings. + /// </summary> + public const int SDL_ALL_HOTKEYS = unchecked((int)0xFFFFFFFF); + + /// <summary> + /// Enable/Disable keyboard repeat. Keyboard repeat defaults to off. + /// 'delay' is the initial delay in ms between the time + /// when a key is pressed, + /// and keyboard repeat begins. + /// </summary> + /// <seealso cref="SDL_EnableKeyRepeat"/> + public const int SDL_DEFAULT_REPEAT_DELAY = 500; + + /// <summary> + /// Enable/Disable keyboard repeat. Keyboard repeat defaults to off. + /// 'interval' is the time in ms between keyboard repeat events. + /// </summary> + /// <seealso cref="SDL_EnableKeyRepeat"/> + public const int SDL_DEFAULT_REPEAT_INTERVAL = 30; + #endregion SDL_keyboard.h + + #region SDL_keysym.h + /// <summary> + /// Both CTRL keys. + /// </summary> + public const short KMOD_CTRL = + (short)(KMOD_LCTRL | KMOD_RCTRL); + + /// <summary> + /// Both SHIFT keys. + /// </summary> + public const short KMOD_SHIFT = + (short)(KMOD_LSHIFT | KMOD_RSHIFT); + + /// <summary> + /// Both ALT keys. + /// </summary> + public const short KMOD_ALT = + (short)(KMOD_LALT | KMOD_RALT); + + /// <summary> + /// Both META keys. + /// </summary> + public const short KMOD_META = ( + short)(KMOD_LMETA | KMOD_RMETA); + #endregion SDL_keysym.h + + // SDL_loadso.h -- none + // SDL_main.h -- none + + #region SDL_mouse.h + /// <summary> + /// Used as a mask when testing buttons in buttonstate + /// Button 1: Left mouse button + /// </summary> + public const byte SDL_BUTTON_LEFT = 1; + /// <summary> + /// Button 2: Middle mouse button + /// </summary> + public const byte SDL_BUTTON_MIDDLE = 2; + /// <summary> + /// Button 3: Right mouse button + /// </summary> + public const byte SDL_BUTTON_RIGHT = 3; + /// <summary> + /// Button 4: Mouse wheel up (may also be a real button) + /// </summary> + public const byte SDL_BUTTON_WHEELUP = 4; + /// <summary> + /// Button 5: Mouse wheel down (may also be a real button) + /// </summary> + public const byte SDL_BUTTON_WHEELDOWN = 5; + /// <summary> + /// + /// </summary> + public const byte SDL_BUTTON_X1 = 6; + /// <summary> + /// + /// </summary> + public const byte SDL_BUTTON_X2 = 7; + /// <summary> + /// + /// </summary> + public const byte SDL_BUTTON_LMASK = SDL_PRESSED << ((byte)SDL_BUTTON_LEFT - 1); + /// <summary> + /// + /// </summary> + public const byte SDL_BUTTON_MMASK = SDL_PRESSED << ((byte)SDL_BUTTON_MIDDLE - 1); + /// <summary> + /// + /// </summary> + public const byte SDL_BUTTON_RMASK = SDL_PRESSED << ((byte)SDL_BUTTON_RIGHT - 1); + /// <summary> + /// + /// </summary> + public const byte SDL_BUTTON_X1MASK = SDL_PRESSED << ((byte)SDL_BUTTON_X1 - 1); + /// <summary> + /// + /// </summary> + public const byte SDL_BUTTON_X2MASK = SDL_PRESSED << ((byte)SDL_BUTTON_X2 - 1); + #endregion SDL_mouse.h + + #region SDL_mutex.h + /// <summary> + /// Synchronization functions which can time out return this value + /// if they time out. + /// </summary> + public const int SDL_MUTEX_TIMEDOUT = 1; + /// <summary> + /// This is the timeout value which corresponds to never time out + /// </summary> + public const int SDL_MUTEX_MAXWAIT = (~(int)0); + #endregion SDL_mutex.h + + // SDL_name.h -- none + // SDL_opengl.h -- TODO superceded by Tao.OpenGL? + // SDL_platform.h -- none + // SDL_quit.h -- none + + #region SDL_rwops.h + /// <summary> + /// Seek from the beginning of data + /// </summary> + public const int RW_SEEK_SET = 0; + /// <summary> + /// Seek relative to current read point + /// </summary> + public const int RW_SEEK_CUR = 1; + /// <summary> + /// Seek relative to the end of data + /// </summary> + public const int RW_SEEK_END = 2; + #endregion SDL_rwops.h + + // SDL_stdinc.h -- TODO skipped for now + // SDL_syswm.h -- none + // SDL_thread.h -- none + + #region SDL_timer.h + #region SDL_TIMESLICE + /// <summary> + /// The OS scheduler timeslice, in milliseconds. + /// </summary> + public const int SDL_TIMESLICE = 10; + #endregion SDL_TIMESLICE + + #region TIMER_RESOLUTION + /// <summary> + /// The maximum resolution of the SDL timer on all platforms. + /// </summary> + /// <remarks> + /// Experimentally determined. + /// </remarks> + public const int TIMER_RESOLUTION = 10; + #endregion TIMER_RESOLUTION + #endregion SDL_timer.h + + // SDL_types.h - deprecated + + #region SDL_version.h + /// <summary> + /// Major Version + /// </summary> + public const int SDL_MAJOR_VERSION = 1; + /// <summary> + /// Minor Version + /// </summary> + public const int SDL_MINOR_VERSION = 2; + /// <summary> + /// Patch Version + /// </summary> + public const int SDL_PATCHLEVEL = 11; + #endregion SDL_version.h + + #region SDL_video.h + #region SDL_ALPHA_OPAQUE + /// <summary> + /// Transparency definition of Opaque + /// </summary> + /// <remarks> + /// Define alpha as the opacity of a surface + /// </remarks> + public const int SDL_ALPHA_OPAQUE = 255; + #endregion SDL_ALPHA_OPAQUE + + #region SDL_ALPHA_TRANSPARENT + /// <summary> + /// Transparency definition of Transparent + /// </summary> + /// <remarks> + /// Define alpha as the opacity of a surface + /// </remarks> + public const int SDL_ALPHA_TRANSPARENT = 0; + #endregion SDL_ALPHA_TRANSPARENT + + #region SDL_SWSURFACE + /// <summary> + /// Surface is in system memory + /// </summary> + public const int SDL_SWSURFACE = 0x00000000; + #endregion SDL_SWSURFACE + + #region SDL_HWSURFACE + /// <summary> + /// Surface is in video memory + /// </summary> + public const int SDL_HWSURFACE = 0x00000001; + #endregion SDL_HWSURFACE + + #region SDL_ASYNCBLIT + /// <summary> + /// Use asynchronous blits if possible + /// </summary> + public const int SDL_ASYNCBLIT = 0X00000004; + #endregion SDL_ASYNCBLIT + + #region SDL_ANYFORMAT + /// <summary> + /// Allow any video depth/pixel-format + /// </summary> + public const int SDL_ANYFORMAT = 0X10000000; + #endregion SDL_ANYFORMAT + + #region SDL_HWPALETTE + /// <summary> + /// Surface has exclusive palette + /// </summary> + public const int SDL_HWPALETTE = 0x20000000; + #endregion SDL_HWPALETTE + + #region SDL_DOUBLEBUF + /// <summary> + /// Set up double-buffered video mode + /// </summary> + public const int SDL_DOUBLEBUF = 0X40000000; + #endregion SDL_DOUBLEBUF + + #region SDL_FULLSCREEN + /// <summary> + /// Full screen display surface. + /// </summary> + // #define SDL_FULLSCREEN 0x80000000 + public const int SDL_FULLSCREEN = unchecked((int)0x80000000); + #endregion SDL_FULLSCREEN + + #region SDL_OPENGL + /// <summary> + /// Create an OpenGL rendering context + /// </summary> + public const int SDL_OPENGL = 0x00000002; + #endregion SDL_OPENGL + + #region SDL_OPENGLBLIT + /// <summary> + /// Create an OpenGL rendering context and use it for blitting + /// </summary> + public const int SDL_OPENGLBLIT = 0X0000000A; + #endregion SDL_OPENGLBLIT + + #region SDL_RESIZABLE + /// <summary> + /// This video mode may be resized + /// </summary> + public const int SDL_RESIZABLE = 0x00000010; + #endregion SDL_RESIZABLE + + #region SDL_NOFRAME + /// <summary> + /// No window caption or edge frame + /// </summary> + public const int SDL_NOFRAME = 0X00000020; + #endregion SDL_NOFRAME + + #region SDL_HWACCEL + /// <summary> + /// Blit uses hardware acceleration + /// </summary> + public const int SDL_HWACCEL = 0x00000100; + #endregion SDL_HWACCEL + + #region SDL_SRCCOLORKEY + /// <summary> + /// Blit uses a source color key + /// </summary> + public const int SDL_SRCCOLORKEY = 0x00001000; + #endregion SDL_SRCCOLORKEY + + #region SDL_RLEACCELOK + /// <summary> + /// Private flag + /// </summary> + public const int SDL_RLEACCELOK = 0x00002000; + #endregion SDL_RLEACCELOK + + #region SDL_RLEACCEL + /// <summary> + /// Surface is RLE encoded + /// </summary> + public const int SDL_RLEACCEL = 0X00004000; + #endregion SDL_RLEACCEL + + #region SDL_SRCALPHA + /// <summary> + /// Blit uses source alpha blending + /// </summary> + public const int SDL_SRCALPHA = 0x00010000; + #endregion SDL_SRCALPHA + + #region SDL_PREALLOC + /// <summary> + /// Surface uses preallocated memory + /// </summary> + public const int SDL_PREALLOC = 0x01000000; + #endregion SDL_PREALLOC + + #region SDL_YV12_OVERLAY + /// <summary> + ///One of the most common video overlay formats. + ///For an explanation of these pixel formats, see: + ///http://www.webartz.com/fourcc/indexyuv.htm + /// + ///For information on the relationship between color spaces, see: + ///http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html + /// + /// Planar mode: Y + V + U (3 planes) + /// </summary> + public const int SDL_YV12_OVERLAY = 0x32315659; + #endregion SDL_YV12_OVERLAY + + #region SDL_IYUV_OVERLAY + /// <summary> + ///One of the most common video overlay formats. + ///For an explanation of these pixel formats, see: + ///http://www.webartz.com/fourcc/indexyuv.htm + /// + ///For information on the relationship between color spaces, see: + ///http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html + /// + /// Planar mode: Y + U + V (3 planes) + /// </summary> + public const int SDL_IYUV_OVERLAY = 0x56555949; + #endregion SDL_IYUV_OVERLAY + + #region SDL_YUY2_OVERLAY + /// <summary> + ///One of the most common video overlay formats. + ///For an explanation of these pixel formats, see: + ///http://www.webartz.com/fourcc/indexyuv.htm + /// + ///For information on the relationship between color spaces, see: + ///http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html + /// + /// Packed mode: Y0+U0+Y1+V0 (1 plane) + /// </summary> + public const int SDL_YUY2_OVERLAY = 0x32595559; + #endregion SDL_YUY2_OVERLAY + + #region SDL_UYVY_OVERLAY + /// <summary> + ///One of the most common video overlay formats. + ///For an explanation of these pixel formats, see: + ///http://www.webartz.com/fourcc/indexyuv.htm + /// + ///For information on the relationship between color spaces, see: + ///http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html + /// + /// Packed mode: U0+Y0+V0+Y1 (1 plane) + /// </summary> + public const int SDL_UYVY_OVERLAY = 0x59565955; + #endregion SDL_UYVY_OVERLAY + + #region SDL_YVYU_OVERLAY + /// <summary> + ///One of the most common video overlay formats. + ///For an explanation of these pixel formats, see: + ///http://www.webartz.com/fourcc/indexyuv.htm + /// + ///For information on the relationship between color spaces, see: + ///http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html + /// + /// Packed mode: Y0+V0+Y1+U0 (1 plane) + /// </summary> + public const int SDL_YVYU_OVERLAY = 0x55595659; + #endregion SDL_YVYU_OVERLAY + + #region SDL_LOGPAL + /// <summary> + /// Flag for SDL_SetPalette() which represents a logical palette, which controls how blits + /// are mapped to/from the surface. + /// </summary> + public const byte SDL_LOGPAL = 0x01; + #endregion SDL_LOGPAL + + #region SDL_PHYSPAL + /// <summary> + /// Flag for SDL_SetPalette() which represents a physical palette, which controls how pixels + /// look on the screen. + /// </summary> + public const byte SDL_PHYSPAL = 0x02; + #endregion SDL_PHYSPAL + + //Where did this come from?? SDL_GL_DOUBLEBUFFER is in SDL_GLattr + // #region SDL_GL_DOUBLEBUFFER + // /// <summary> + // /// + // /// </summary> + // public const int SDL_GL_DOUBLEBUFFER = 5; + // #endregion SDL_GL_DOUBLEBUFFER + + #endregion SDL_video.h + #endregion Public Constants + + #region Public Enums + // SDL.h -- none + // SDL_active.h -- none + + #region SDL_audio.h + #region SDL_audiostatus + /// <summary> + /// SDL_audiostatus. Get the current audio state + /// </summary> + public const int SDL_AUDIO_STOPPED = 0; + /// <summary> + /// SDL_audiostatus. Get the current audio state + /// </summary> + public const int SDL_AUDIO_PLAYING = 1; + /// <summary> + /// SDL_audiostatus. Get the current audio state + /// </summary> + public const int SDL_AUDIO_PAUSED = 2; + #endregion SDL_audiostatus + #endregion SDL_audio.h + + // SDL_byteorder.h -- deprecated + + #region SDL_cdrom.h + #region CDstatus + /// <summary> + /// The CD tray is empty. + /// </summary> + /// <remarks> + /// CDstatus enum. + /// The possible states which a CD-ROM drive can be in. + /// </remarks> + public const int CD_TRAYEMPTY = 0; + /// <summary> + /// The CD has stopped playing. + /// </summary> + /// <remarks> + /// CDstatus enum. + /// The possible states which a CD-ROM drive can be in. + /// </remarks> + public const int CD_STOPPED = 1; + /// <summary> + /// The CD is playing. + /// </summary> + /// <remarks> + /// CDstatus enum. + /// The possible states which a CD-ROM drive can be in. + /// </remarks> + public const int CD_PLAYING = 2; + /// <summary> + /// The CD has been paused. + /// </summary> + /// <remarks> + /// CDstatus enum. + /// The possible states which a CD-ROM drive can be in. + /// </remarks> + public const int CD_PAUSED = 3; + /// <summary> + /// An error occured while getting the status. + /// </summary> + /// <remarks> + /// CDstatus enum. + /// The possible states which a CD-ROM drive can be in. + /// </remarks> + public const int CD_ERROR = -1; + #endregion CDstatus + #endregion SDL_cdrom.h + + // SDL_config.h -- none + // SDL_copying.h -- none + // SDL_cpuinfo.h -- none + // SDL_endian.h - none + // SDL_error.h -- none + + #region SDL_events.h + #region SDL_EventType + //The nameless enum from SDL_events.h was moved into a set of const + //instead of a C# enum. This makes it work more like the C Code. + /// <summary> + /// Unused (do not remove) + /// </summary> + public const int SDL_NOEVENT = 0; + /// <summary> + /// Application loses/gains visibility + /// </summary> + [CLSCompliant(false)] + public const int SDL_ACTIVEEVENT = 1; + /// <summary> + /// Keys pressed + /// </summary> + public const int SDL_KEYDOWN = 2; + /// <summary> + /// Keys released + /// </summary> + public const int SDL_KEYUP = 3; + /// <summary> + /// Mouse moved + /// </summary> + public const int SDL_MOUSEMOTION = 4; + /// <summary> + /// Mouse button pressed + /// </summary> + public const int SDL_MOUSEBUTTONDOWN = 5; + /// <summary> + /// Mouse button released + /// </summary> + public const int SDL_MOUSEBUTTONUP = 6; + /// <summary> + /// Joystick axis motion + /// </summary> + public const int SDL_JOYAXISMOTION = 7; + /// <summary> + /// Joystick trackball motion + /// </summary> + public const int SDL_JOYBALLMOTION = 8; + /// <summary> + /// Joystick hat position change + /// </summary> + public const int SDL_JOYHATMOTION = 9; + /// <summary> + /// Joystick button pressed + /// </summary> + public const int SDL_JOYBUTTONDOWN = 10; + /// <summary> + /// Joystick button released + /// </summary> + public const int SDL_JOYBUTTONUP = 11; + /// <summary> + /// User-requested quit + /// </summary> + [CLSCompliant(false)] + public const int SDL_QUIT = 12; + /// <summary> + /// System specific event + /// </summary> + [CLSCompliant(false)] + public const int SDL_SYSWMEVENT = 13; + /// <summary> + /// Reserved for future use.. + /// </summary> + public const int SDL_EVENT_RESERVEDA = 14; + /// <summary> + /// Reserved for future use.. + /// </summary> + public const int SDL_EVENT_RESERVEDB = 15; + /// <summary> + /// User resized video mode + /// </summary> + public const int SDL_VIDEORESIZE = 16; + /// <summary> + /// Screen needs to be redrawn + /// </summary> + public const int SDL_VIDEOEXPOSE = 17; + /// <summary> + /// Reserved for future use.. + /// </summary> + public const int SDL_EVENT_RESERVED2 = 18; + /// <summary> + /// Reserved for future use.. + /// </summary> + public const int SDL_EVENT_RESERVED3 = 19; + /// <summary> + /// Reserved for future use.. + /// </summary> + public const int SDL_EVENT_RESERVED4 = 20; + /// <summary> + /// Reserved for future use.. + /// </summary> + public const int SDL_EVENT_RESERVED5 = 21; + /// <summary> + /// Reserved for future use.. + /// </summary> + public const int SDL_EVENT_RESERVED6 = 22; + /// <summary> + /// Reserved for future use.. + /// </summary> + public const int SDL_EVENT_RESERVED7 = 23; + /// <summary> + /// Events SDL_USEREVENT through SDL_MAXEVENTS-1 are + /// for your use. + /// </summary> + [CLSCompliant(false)] + public const int SDL_USEREVENT = 24; + + /// <summary> + /// This last event is only for bounding internal arrays + /// It is the number of bits in the event mask datatype -- Uint32 + /// </summary> + public const int SDL_NUMEVENTS = 32; + #endregion SDL_EventType + + #region SDL_EventMask + /// <summary> + /// + /// </summary> + public const int SDL_ACTIVEEVENTMASK = 1 << SDL_ACTIVEEVENT; + /// <summary> + /// + /// </summary> + public const int SDL_KEYDOWNMASK = 1 << SDL_KEYDOWN; + /// <summary> + /// + /// </summary> + public const int SDL_KEYUPMASK = 1 << SDL_KEYUP; + /// <summary> + /// + /// </summary> + public const int SDL_KEYEVENTMASK = (1 << SDL_KEYUP | 1 << SDL_KEYDOWN); + /// <summary> + /// + /// </summary> + public const int SDL_MOUSEMOTIONMASK = 1 << SDL_MOUSEMOTION; + /// <summary> + /// + /// </summary> + public const int SDL_MOUSEBUTTONDOWNMASK = 1 << SDL_MOUSEBUTTONDOWN; + /// <summary> + /// + /// </summary> + public const int SDL_MOUSEBUTTONUPMASK = 1 << SDL_MOUSEBUTTONUP; + /// <summary> + /// + /// </summary> + public const int SDL_MOUSEEVENTMASK = (1 << SDL_MOUSEMOTION) | (1 << SDL_MOUSEBUTTONDOWN) | (1 << SDL_MOUSEBUTTONUP); + /// <summary> + /// + /// </summary> + public const int SDL_JOYAXISMOTIONMASK = 1 << SDL_JOYAXISMOTION; + /// <summary> + /// + /// </summary> + public const int SDL_JOYBALLMOTIONMASK = 1 << SDL_JOYBALLMOTION; + /// <summary> + /// + /// </summary> + public const int SDL_JOYHATMOTIONMASK = 1 << SDL_JOYHATMOTION; + /// <summary> + /// + /// </summary> + public const int SDL_JOYBUTTONDOWNMASK = 1 << SDL_JOYBUTTONDOWN; + /// <summary> + /// + /// </summary> + public const int SDL_JOYBUTTONUPMASK = 1 << SDL_JOYBUTTONUP; + /// <summary> + /// + /// </summary> + public const int SDL_JOYEVENTMASK = (1 << SDL_JOYAXISMOTION) | (1 << SDL_JOYBALLMOTION) | (1 << SDL_JOYHATMOTION) | (1 << SDL_JOYBUTTONDOWN) | (1 << SDL_JOYBUTTONUP); + /// <summary> + /// + /// </summary> + public const int SDL_VIDEORESIZEMASK = 1 << SDL_VIDEORESIZE; + /// <summary> + /// + /// </summary> + public const int SDL_VIDEOEXPOSEMASK = 1 << SDL_VIDEOEXPOSE; + /// <summary> + /// + /// </summary> + public const int SDL_QUITMASK = 1 << SDL_QUIT; + /// <summary> + /// + /// </summary> + public const int SDL_SYSWMEVENTMASK = 1 << SDL_SYSWMEVENT; + #endregion SDL_EventMask + + #region SDL_eventaction + /// <summary> + /// If 'action' is SDL_ADDEVENT, up to 'numevents' events will + /// be added to the back of the event queue. + /// </summary> + /// <remarks> + /// enum SDL_eventaction. + /// Various event types. + /// </remarks> + /// <seealso cref="SDL_PeepEvents(SDL_Event[], int, int, int)"/> + public const int SDL_ADDEVENT = 0; + /// <summary> + /// If 'action' is SDL_PEEKEVENT, up to 'numevents' events at + /// the front of the event queue, matching 'mask', will be + /// returned and will not be removed from the queue. + /// </summary> + /// <remarks> + /// enum SDL_eventaction. + /// Various event types. + /// </remarks> + /// <seealso cref="SDL_PeepEvents(SDL_Event[], int, int, int)"/> + public const int SDL_PEEKEVENT = 1; + /// <summary> + /// If 'action' is SDL_GETEVENT, up to 'numevents' events at + /// the front of the event queue, matching 'mask', will be + /// returned and will be removed from the queue. + /// </summary> + /// <remarks> + /// enum SDL_eventaction. + /// Various event types. + /// </remarks> + /// <seealso cref="SDL_PeepEvents(SDL_Event[], int, int, int)"/> + public const int SDL_GETEVENT = 2; + #endregion SDL_eventaction + #endregion SDL_events.h + + // SDL_getenv.h -- deprecated + // SDL_joystick.h -- none + // SDL_keyboard.h -- none + + #region SDL_keysym.h + #region SDLKey + // /// <summary> + // /// What we really want is a mapping of every raw key on the keyboard. + // /// To support international keyboards, we use the range 0xA1 - 0xFF + // /// as international virtual keycodes. + // /// We'll follow in the footsteps of X11... + // /// The keyboard syms have been cleverly chosen to map to ASCII + // /// </summary> + // //public enum SDLKey + // //{ + /// <summary> + /// + /// </summary> + public const int SDLK_UNKNOWN = 0; + /// <summary> + /// + /// </summary> + public const int SDLK_FIRST = 0; + /// <summary> + /// backspace. '\b' + /// </summary> + public const int SDLK_BACKSPACE = 8; + /// <summary> + /// tab. '\t' + /// </summary> + public const int SDLK_TAB = 9; + /// <summary> + /// clear + /// </summary> + public const int SDLK_CLEAR = 12; + /// <summary> + /// return. '\r' + /// </summary> + public const int SDLK_RETURN = 13; + /// <summary> + /// pause + /// </summary> + public const int SDLK_PAUSE = 19; + /// <summary> + /// escape. '^[' + /// </summary> + public const int SDLK_ESCAPE = 27; + /// <summary> + /// space. ' ' + /// </summary> + public const int SDLK_SPACE = 32; + /// <summary> + /// exclaim. '!' + /// </summary> + public const int SDLK_EXCLAIM = 33; + /// <summary> + /// quotedbl. '"' + /// </summary> + public const int SDLK_QUOTEDBL = 34; + /// <summary> + /// hash. '#' + /// </summary> + public const int SDLK_HASH = 35; + /// <summary> + /// dollar. '$' + /// </summary> + public const int SDLK_DOLLAR = 36; + /// <summary> + /// ampersand. '&' + /// </summary> + public const int SDLK_AMPERSAND = 38; + /// <summary> + /// quote. ''' + /// </summary> + public const int SDLK_QUOTE = 39; + /// <summary> + /// left parenthesis. '(' + /// </summary> + public const int SDLK_LEFTPAREN = 40; + /// <summary> + /// right parenthesis. ')' + /// </summary> + public const int SDLK_RIGHTPAREN = 41; + /// <summary> + /// asterisk. '*' + /// </summary> + public const int SDLK_ASTERISK = 42; + /// <summary> + /// plus sign. '+' + /// </summary> + public const int SDLK_PLUS = 43; + /// <summary> + /// comma. ';' + /// </summary> + public const int SDLK_COMMA = 44; + /// <summary> + /// minus sign. '-' + /// </summary> + public const int SDLK_MINUS = 45; + /// <summary> + /// period. '.' + /// </summary> + public const int SDLK_PERIOD = 46; + /// <summary> + /// forward slash. '/' + /// </summary> + public const int SDLK_SLASH = 47; + /// <summary> + /// 0 + /// </summary> + public const int SDLK_0 = 48; + /// <summary> + /// 1 + /// </summary> + public const int SDLK_1 = 49; + /// <summary> + /// 2 + /// </summary> + public const int SDLK_2 = 50; + /// <summary> + /// 3 + /// </summary> + public const int SDLK_3 = 51; + /// <summary> + /// 4 + /// </summary> + public const int SDLK_4 = 52; + /// <summary> + /// 5 + /// </summary> + public const int SDLK_5 = 53; + /// <summary> + /// 6 + /// </summary> + public const int SDLK_6 = 54; + /// <summary> + /// 7 + /// </summary> + public const int SDLK_7 = 55; + /// <summary> + /// 8 + /// </summary> + public const int SDLK_8 = 56; + /// <summary> + /// 9 + /// </summary> + public const int SDLK_9 = 57; + /// <summary> + /// colon. ':' + /// </summary> + public const int SDLK_COLON = 58; + /// <summary> + /// semicolon. ';' + /// </summary> + public const int SDLK_SEMICOLON = 59; + /// <summary> + /// less-than sign. '<' + /// </summary> + public const int SDLK_LESS = 60; + /// <summary> + /// equals sign. '=' + /// </summary> + public const int SDLK_EQUALS = 61; + /// <summary> + /// greater-than sign. '>' + /// </summary> + public const int SDLK_GREATER = 62; + /// <summary> + /// question mark. '?' + /// </summary> + public const int SDLK_QUESTION = 63; + /// <summary> + /// at. '@' + /// </summary> + public const int SDLK_AT = 64; + /* + Skip uppercase letters + */ + /// <summary> + /// left bracket. '[' + /// </summary> + public const int SDLK_LEFTBRACKET = 91; + /// <summary> + /// backslash. '\' + /// </summary> + public const int SDLK_BACKSLASH = 92; + /// <summary> + /// right bracket. ']' + /// </summary> + public const int SDLK_RIGHTBRACKET = 93; + /// <summary> + /// caret. '^' + /// </summary> + public const int SDLK_CARET = 94; + /// <summary> + /// underscore.'_' + /// </summary> + public const int SDLK_UNDERSCORE = 95; + /// <summary> + /// grave. '`' + /// </summary> + public const int SDLK_BACKQUOTE = 96; + /// <summary> + /// a + /// </summary> + public const int SDLK_a = 97; + /// <summary> + /// b + /// </summary> + public const int SDLK_b = 98; + /// <summary> + /// c + /// </summary> + public const int SDLK_c = 99; + /// <summary> + /// d + /// </summary> + public const int SDLK_d = 100; + /// <summary> + /// e + /// </summary> + public const int SDLK_e = 101; + /// <summary> + /// f + /// </summary> + public const int SDLK_f = 102; + /// <summary> + /// g + /// </summary> + public const int SDLK_g = 103; + /// <summary> + /// h + /// </summary> + public const int SDLK_h = 104; + /// <summary> + /// i + /// </summary> + public const int SDLK_i = 105; + /// <summary> + /// j + /// </summary> + public const int SDLK_j = 106; + /// <summary> + /// k + /// </summary> + public const int SDLK_k = 107; + /// <summary> + /// l + /// </summary> + public const int SDLK_l = 108; + /// <summary> + /// m + /// </summary> + public const int SDLK_m = 109; + /// <summary> + /// n + /// </summary> + public const int SDLK_n = 110; + /// <summary> + /// o + /// </summary> + public const int SDLK_o = 111; + /// <summary> + /// p + /// </summary> + public const int SDLK_p = 112; + /// <summary> + /// q + /// </summary> + public const int SDLK_q = 113; + /// <summary> + /// r + /// </summary> + public const int SDLK_r = 114; + /// <summary> + /// s + /// </summary> + public const int SDLK_s = 115; + /// <summary> + /// t + /// </summary> + public const int SDLK_t = 116; + /// <summary> + /// u + /// </summary> + public const int SDLK_u = 117; + /// <summary> + /// v + /// </summary> + public const int SDLK_v = 118; + /// <summary> + /// w + /// </summary> + public const int SDLK_w = 119; + /// <summary> + /// x + /// </summary> + public const int SDLK_x = 120; + /// <summary> + /// y + /// </summary> + public const int SDLK_y = 121; + /// <summary> + /// z + /// </summary> + public const int SDLK_z = 122; + /// <summary> + /// delete. '^?' + /// </summary> + public const int SDLK_DELETE = 127; + /* End of ASCII mapped keysyms */ + + /* International keyboard syms */ + /// <summary> + /// 0xA0 + /// </summary> + public const int SDLK_WORLD_0 = 160; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_1 = 161; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_2 = 162; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_3 = 163; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_4 = 164; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_5 = 165; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_6 = 166; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_7 = 167; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_8 = 168; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_9 = 169; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_10 = 170; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_11 = 171; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_12 = 172; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_13 = 173; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_14 = 174; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_15 = 175; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_16 = 176; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_17 = 177; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_18 = 178; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_19 = 179; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_20 = 180; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_21 = 181; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_22 = 182; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_23 = 183; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_24 = 184; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_25 = 185; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_26 = 186; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_27 = 187; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_28 = 188; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_29 = 189; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_30 = 190; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_31 = 191; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_32 = 192; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_33 = 193; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_34 = 194; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_35 = 195; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_36 = 196; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_37 = 197; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_38 = 198; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_39 = 199; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_40 = 200; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_41 = 201; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_42 = 202; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_43 = 203; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_44 = 204; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_45 = 205; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_46 = 206; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_47 = 207; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_48 = 208; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_49 = 209; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_50 = 210; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_51 = 211; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_52 = 212; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_53 = 213; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_54 = 214; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_55 = 215; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_56 = 216; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_57 = 217; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_58 = 218; + /// <summary> + /// + /// </summary> + public const int SDLK_WORLD_59 = 219; + /// <summary> + /// + /// </summary>... [truncated message content] |
From: <ka...@us...> - 2009-12-30 20:42:56
|
Revision: 1171 http://agate.svn.sourceforge.net/agate/?rev=1171&view=rev Author: kanato Date: 2009-12-30 20:42:39 +0000 (Wed, 30 Dec 2009) Log Message: ----------- Replace OpenTK.dll with one that has better 64-bit compatibility. Modified Paths: -------------- trunk/Drivers/AgateOTK/OpenTK.dll trunk/Drivers/AgateOTK/OpenTK.dll.config trunk/Drivers/AgateOTK/OpenTK.xml Modified: trunk/Drivers/AgateOTK/OpenTK.dll =================================================================== (Binary files differ) Modified: trunk/Drivers/AgateOTK/OpenTK.dll.config =================================================================== --- trunk/Drivers/AgateOTK/OpenTK.dll.config 2009-12-30 20:30:53 UTC (rev 1170) +++ trunk/Drivers/AgateOTK/OpenTK.dll.config 2009-12-30 20:42:39 UTC (rev 1171) @@ -7,5 +7,6 @@ <dllmap os="osx" dll="openal32.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" /> <dllmap os="osx" dll="alut.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" /> <dllmap os="osx" dll="libGLES.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" /> - <dllmap os="osx" dll="libGLESv2.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" /> + <dllmap os="osx" dll="libGLESv2.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" /> + <dllmap os="osx" dll="opencl.dll" target="/System/Library/Frameworks/OpenCL.framework/OpenCL"/> </configuration> Modified: trunk/Drivers/AgateOTK/OpenTK.xml =================================================================== --- trunk/Drivers/AgateOTK/OpenTK.xml 2009-12-30 20:30:53 UTC (rev 1170) +++ trunk/Drivers/AgateOTK/OpenTK.xml 2009-12-30 20:42:39 UTC (rev 1171) @@ -4,7 +4,24 @@ <name>OpenTK</name> </assembly> <members> + <member name="T:OpenTK.Properties.Resources"> + <summary> + A strongly-typed resource class, for looking up localized strings, etc. + </summary> + </member> + <member name="P:OpenTK.Properties.Resources.ResourceManager"> + <summary> + Returns the cached ResourceManager instance used by this class. + </summary> + </member> + <member name="P:OpenTK.Properties.Resources.Culture"> + <summary> + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + </summary> + </member> <member name="T:OpenTK.Platform.X11.Glx"> + \internal <summary> Provides access to GLX functions. </summary> @@ -64,558 +81,11330 @@ of the same type. For example, ES10.GL, OpenGL.GL and CL10.CL should all return unique objects, but all instances of ES10.GL should return the same object.</remarks> </member> - <member name="T:OpenTK.BezierCurve"> + <member name="T:OpenTK.Input.MouseButton"> <summary> - Represents a bezier curve with as many points as you want. + Enumerates all possible mouse buttons. </summary> </member> - <member name="F:OpenTK.BezierCurve.Parallel"> + <member name="F:OpenTK.Input.MouseButton.Left"> <summary> - The parallel value. + The left mouse button. </summary> - <remarks>This value defines whether the curve should be calculated as a - parallel curve to the original bezier curve. A value of 0.0f represents - the original curve, 5.0f i.e. stands for a curve that has always a distance - of 5.0f to the orignal curve at any point.</remarks> </member> - <member name="M:OpenTK.BezierCurve.#ctor(System.Collections.Generic.IEnumerable{OpenTK.Vector2})"> + <member name="F:OpenTK.Input.MouseButton.Middle"> <summary> - Constructs a new <see cref="T:OpenTK.BezierCurve"/>. + The middle mouse button. </summary> - <param name="points">The points.</param> </member> - <member name="M:OpenTK.BezierCurve.#ctor(OpenTK.Vector2[])"> + <member name="F:OpenTK.Input.MouseButton.Right"> <summary> - Constructs a new <see cref="T:OpenTK.BezierCurve"/>. + The right mouse button. </summary> - <param name="points">The points.</param> </member> - <member name="M:OpenTK.BezierCurve.#ctor(System.Single,OpenTK.Vector2[])"> + <member name="F:OpenTK.Input.MouseButton.Button1"> <summary> - Constructs a new <see cref="T:OpenTK.BezierCurve"/>. + The first extra mouse button. </summary> - <param name="parallel">The parallel value.</param> - <param name="points">The points.</param> </member> - <member name="M:OpenTK.BezierCurve.#ctor(System.Single,System.Collections.Generic.IEnumerable{OpenTK.Vector2})"> + <member name="F:OpenTK.Input.MouseButton.Button2"> <summary> - Constructs a new <see cref="T:OpenTK.BezierCurve"/>. + The second extra mouse button. </summary> - <param name="parallel">The parallel value.</param> - <param name="points">The points.</param> </member> - <member name="M:OpenTK.BezierCurve.CalculatePoint(System.Single)"> + <member name="F:OpenTK.Input.MouseButton.Button3"> <summary> - Calculates the point with the specified t. + The third extra mouse button. </summary> - <param name="t">The t value, between 0.0f and 1.0f.</param> - <returns>Resulting point.</returns> </member> - <member name="M:OpenTK.BezierCurve.CalculateLength(System.Single)"> + <member name="F:OpenTK.Input.MouseButton.Button4"> <summary> - Calculates the length of this bezier curve. + The fourth extra mouse button. </summary> - <param name="precision">The precision.</param> - <returns>Length of curve.</returns> - <remarks>The precision gets better as the <paramref name="precision"/> - value gets smaller.</remarks> </member> - <member name="M:OpenTK.BezierCurve.CalculateLength(System.Collections.Generic.IList{OpenTK.Vector2},System.Single)"> + <member name="F:OpenTK.Input.MouseButton.Button5"> <summary> - Calculates the length of the specified bezier curve. + The fifth extra mouse button. </summary> - <param name="points">The points.</param> - <param name="precision">The precision value.</param> - <returns>The precision gets better as the <paramref name="precision"/> - value gets smaller.</returns> </member> - <member name="M:OpenTK.BezierCurve.CalculateLength(System.Collections.Generic.IList{OpenTK.Vector2},System.Single,System.Single)"> + <member name="F:OpenTK.Input.MouseButton.Button6"> <summary> - Calculates the length of the specified bezier curve. + The sixth extra mouse button. </summary> - <param name="points">The points.</param> - <param name="precision">The precision value.</param> - <param name="parallel">The parallel value.</param> - <returns>Length of curve.</returns> - <remarks><para>The precision gets better as the <paramref name="precision"/> - value gets smaller.</para> - <para>The <paramref name="parallel"/> parameter defines whether the curve should be calculated as a - parallel curve to the original bezier curve. A value of 0.0f represents - the original curve, 5.0f represents a curve that has always a distance - of 5.0f to the orignal curve.</para></remarks> </member> - <member name="M:OpenTK.BezierCurve.CalculatePoint(System.Collections.Generic.IList{OpenTK.Vector2},System.Single)"> + <member name="F:OpenTK.Input.MouseButton.Button7"> <summary> - Calculates the point on the given bezier curve with the specified t parameter. + The seventh extra mouse button. </summary> - <param name="points">The points.</param> - <param name="t">The t parameter, a value between 0.0f and 1.0f.</param> - <returns>Resulting point.</returns> </member> - <member name="M:OpenTK.BezierCurve.CalculatePoint(System.Collections.Generic.IList{OpenTK.Vector2},System.Single,System.Single)"> + <member name="F:OpenTK.Input.MouseButton.Button8"> <summary> - Calculates the point on the given bezier curve with the specified t parameter. + The eigth extra mouse button. </summary> - <param name="points">The points.</param> - <param name="t">The t parameter, a value between 0.0f and 1.0f.</param> - <param name="parallel">The parallel value.</param> - <returns>Resulting point.</returns> - <remarks>The <paramref name="parallel"/> parameter defines whether the curve should be calculated as a - parallel curve to the original bezier curve. A value of 0.0f represents - the original curve, 5.0f represents a curve that has always a distance - of 5.0f to the orignal curve.</remarks> </member> - <member name="M:OpenTK.BezierCurve.CalculatePointOfDerivative(System.Collections.Generic.IList{OpenTK.Vector2},System.Single)"> + <member name="F:OpenTK.Input.MouseButton.Button9"> <summary> - Calculates the point with the specified t of the derivative of the given bezier function. + The ninth extra mouse button. </summary> - <param name="points">The points.</param> - <param name="t">The t parameter, value between 0.0f and 1.0f.</param> - <returns>Resulting point.</returns> </member> - <member name="P:OpenTK.BezierCurve.Points"> + <member name="F:OpenTK.Input.MouseButton.LastButton"> <summary> - Gets the points of this curve. + Indicates the last available mouse button. </summary> - <remarks>The first point and the last points represent the anchor points.</remarks> </member> - <member name="T:OpenTK.Input.Key"> + <member name="T:OpenTK.Input.IInputDriver"> <summary> - The available keyboard keys. + Defines the interface for an input driver. </summary> </member> - <member name="F:OpenTK.Input.Key.Unknown"> - <summary>A key outside the known keys.</summary> + <member name="T:OpenTK.Input.IKeyboardDriver"> + <summary> + Defines the interface for KeyboardDevice drivers. + </summary> </member> - <member name="F:OpenTK.Input.Key.ShiftLeft"> - <summary>The left shift key.</summary> + <member name="P:OpenTK.Input.IKeyboardDriver.Keyboard"> + <summary> + Gets the list of available KeyboardDevices. + </summary> </member> - <member name="F:OpenTK.Input.Key.LShift"> - <summary>The left shift key (equivalent to ShiftLeft).</summary> + <member name="T:OpenTK.Input.IMouseDriver"> + <summary> + Defines the interface for MouseDevice drivers. + </summary> </member> - <member name="F:OpenTK.Input.Key.ShiftRight"> - <summary>The right shift key.</summary> + <member name="P:OpenTK.Input.IMouseDriver.Mouse"> + <summary> + Gets the list of available MouseDevices. + </summary> </member> - <member name="F:OpenTK.Input.Key.RShift"> - <summary>The right shift key (equivalent to ShiftRight).</summary> + <member name="T:OpenTK.Input.IJoystickDriver"> + <summary> + Defines the interface for JoystickDevice drivers. + </summary> </member> - <member name="F:OpenTK.Input.Key.ControlLeft"> - <summary>The left control key.</summary> + <member name="P:OpenTK.Input.IJoystickDriver.Joysticks"> + <summary> + Gets the list of available JoystickDevices. + </summary> </member> - <member name="F:OpenTK.Input.Key.LControl"> - <summary>The left control key (equivalent to ControlLeft).</summary> + <member name="M:OpenTK.Input.IInputDriver.Poll"> + <summary> + Updates the state of the driver. + </summary> </member> - <member name="F:OpenTK.Input.Key.ControlRight"> - <summary>The right control key.</summary> + <member name="T:OpenTK.Graphics.ES20.GL"> + <summary> + Provides access to OpenGL ES 2.0 methods. + </summary> </member> - <member name="F:OpenTK.Input.Key.RControl"> - <summary>The right control key (equivalent to ControlRight).</summary> + <member name="T:OpenTK.Graphics.GraphicsBindingsBase"> + <summary> + Implements BindingsBase for the OpenTK.Graphics namespace (OpenGL and OpenGL|ES). + </summary> </member> - <member name="F:OpenTK.Input.Key.AltLeft"> - <summary>The left alt key.</summary> + <member name="M:OpenTK.Graphics.GraphicsBindingsBase.GetAddress(System.String)"> + <summary> + Retrieves an unmanaged function pointer to the specified function. + </summary> + <param name="funcname"> + A <see cref="T:System.String"/> that defines the name of the function. + </param> + <returns> + A <see cref="T:System.IntPtr"/> that contains the address of funcname or IntPtr.Zero, + if the function is not supported by the drivers. + </returns> + <remarks> + Note: some drivers are known to return non-zero values for unsupported functions. + Typical values include 1 and 2 - inheritors are advised to check for and ignore these + values. + </remarks> </member> - <member name="F:OpenTK.Input.Key.LAlt"> - <summary>The left alt key (equivalent to AltLeft.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.ActiveTexture(OpenTK.Graphics.ES20.TextureUnit)"> + <summary> + Select active texture unit + </summary> + <param name="texture"> + <para> + Specifies which texture unit to make active. The number of texture units is implementation dependent, but must be at least two. texture must be one of GL_TEXTURE, where i ranges from 0 to the larger of (GL_MAX_TEXTURE_COORDS - 1) and (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1). The initial value is GL_TEXTURE0. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.AltRight"> - <summary>The right alt key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.AttachShader(System.Int32,System.Int32)"> + <summary> + Attaches a shader object to a program object + </summary> + <param name="program"> + <para> + Specifies the program object to which a shader object will be attached. + </para> + </param> + <param name="shader"> + <para> + Specifies the shader object that is to be attached. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.RAlt"> - <summary>The right alt key (equivalent to AltRight).</summary> + <member name="M:OpenTK.Graphics.ES20.GL.AttachShader(System.UInt32,System.UInt32)"> + <summary> + Attaches a shader object to a program object + </summary> + <param name="program"> + <para> + Specifies the program object to which a shader object will be attached. + </para> + </param> + <param name="shader"> + <para> + Specifies the shader object that is to be attached. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.WinLeft"> - <summary>The left win key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BindAttribLocation(System.Int32,System.Int32,System.String)"> + <summary> + Associates a generic vertex attribute index with a named attribute variable + </summary> + <param name="program"> + <para> + Specifies the handle of the program object in which the association is to be made. + </para> + </param> + <param name="index"> + <para> + Specifies the index of the generic vertex attribute to be bound. + </para> + </param> + <param name="name"> + <para> + Specifies a null terminated string containing the name of the vertex shader attribute variable to which index is to be bound. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.LWin"> - <summary>The left win key (equivalent to WinLeft).</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BindAttribLocation(System.UInt32,System.UInt32,System.String)"> + <summary> + Associates a generic vertex attribute index with a named attribute variable + </summary> + <param name="program"> + <para> + Specifies the handle of the program object in which the association is to be made. + </para> + </param> + <param name="index"> + <para> + Specifies the index of the generic vertex attribute to be bound. + </para> + </param> + <param name="name"> + <para> + Specifies a null terminated string containing the name of the vertex shader attribute variable to which index is to be bound. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.WinRight"> - <summary>The right win key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BindBuffer(OpenTK.Graphics.ES20.BufferTarget,System.Int32)"> + <summary> + Bind a named buffer object + </summary> + <param name="target"> + <para> + Specifies the target to which the buffer object is bound. The symbolic constant must be GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER, or GL_PIXEL_UNPACK_BUFFER. + </para> + </param> + <param name="buffer"> + <para> + Specifies the name of a buffer object. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.RWin"> - <summary>The right win key (equivalent to WinRight).</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BindBuffer(OpenTK.Graphics.ES20.BufferTarget,System.UInt32)"> + <summary> + Bind a named buffer object + </summary> + <param name="target"> + <para> + Specifies the target to which the buffer object is bound. The symbolic constant must be GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER, or GL_PIXEL_UNPACK_BUFFER. + </para> + </param> + <param name="buffer"> + <para> + Specifies the name of a buffer object. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.Menu"> - <summary>The menu key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BindTexture(OpenTK.Graphics.ES20.TextureTarget,System.Int32)"> + <summary> + Bind a named texture to a texturing target + </summary> + <param name="target"> + <para> + Specifies the target to which the texture is bound. Must be either GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, or GL_TEXTURE_CUBE_MAP. + </para> + </param> + <param name="texture"> + <para> + Specifies the name of a texture. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F1"> - <summary>The F1 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BindTexture(OpenTK.Graphics.ES20.TextureTarget,System.UInt32)"> + <summary> + Bind a named texture to a texturing target + </summary> + <param name="target"> + <para> + Specifies the target to which the texture is bound. Must be either GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, or GL_TEXTURE_CUBE_MAP. + </para> + </param> + <param name="texture"> + <para> + Specifies the name of a texture. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F2"> - <summary>The F2 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BlendColor(System.Single,System.Single,System.Single,System.Single)"> + <summary> + Set the blend color + </summary> + <param name="red"> + <para> + specify the components of GL_BLEND_COLOR + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F3"> - <summary>The F3 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BlendEquation(OpenTK.Graphics.ES20.BlendEquationMode)"> + <summary> + Specify the equation used for both the RGB blend equation and the Alpha blend equation + </summary> + <param name="mode"> + <para> + specifies how source and destination colors are combined. It must be GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT, GL_MIN, GL_MAX. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F4"> - <summary>The F4 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BlendEquationSeparate(OpenTK.Graphics.ES20.BlendEquationMode,OpenTK.Graphics.ES20.BlendEquationMode)"> + <summary> + Set the RGB blend equation and the alpha blend equation separately + </summary> + <param name="modeRGB"> + <para> + specifies the RGB blend equation, how the red, green, and blue components of the source and destination colors are combined. It must be GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT, GL_MIN, GL_MAX. + </para> + </param> + <param name="modeAlpha"> + <para> + specifies the alpha blend equation, how the alpha component of the source and destination colors are combined. It must be GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT, GL_MIN, GL_MAX. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F5"> - <summary>The F5 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BlendFunc(OpenTK.Graphics.ES20.BlendingFactorSrc,OpenTK.Graphics.ES20.BlendingFactorDest)"> + <summary> + Specify pixel arithmetic + </summary> + <param name="sfactor"> + <para> + Specifies how the red, green, blue, and alpha source blending factors are computed. The following symbolic constants are accepted: GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_DST_COLOR, GL_ONE_MINUS_DST_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA, GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR, GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA, and GL_SRC_ALPHA_SATURATE. The initial value is GL_ONE. + </para> + </param> + <param name="dfactor"> + <para> + Specifies how the red, green, blue, and alpha destination blending factors are computed. The following symbolic constants are accepted: GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_DST_COLOR, GL_ONE_MINUS_DST_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA. GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR, GL_CONSTANT_ALPHA, and GL_ONE_MINUS_CONSTANT_ALPHA. The initial value is GL_ZERO. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F6"> - <summary>The F6 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BlendFuncSeparate(OpenTK.Graphics.ES20.BlendingFactorSrc,OpenTK.Graphics.ES20.BlendingFactorDest,OpenTK.Graphics.ES20.BlendingFactorSrc,OpenTK.Graphics.ES20.BlendingFactorDest)"> + <summary> + Specify pixel arithmetic for RGB and alpha components separately + </summary> + <param name="srcRGB"> + <para> + Specifies how the red, green, and blue blending factors are computed. The following symbolic constants are accepted: GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_DST_COLOR, GL_ONE_MINUS_DST_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA, GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR, GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA, and GL_SRC_ALPHA_SATURATE. The initial value is GL_ONE. + </para> + </param> + <param name="dstRGB"> + <para> + Specifies how the red, green, and blue destination blending factors are computed. The following symbolic constants are accepted: GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_DST_COLOR, GL_ONE_MINUS_DST_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA. GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR, GL_CONSTANT_ALPHA, and GL_ONE_MINUS_CONSTANT_ALPHA. The initial value is GL_ZERO. + </para> + </param> + <param name="srcAlpha"> + <para> + Specified how the alpha source blending factor is computed. The same symbolic constants are accepted as for srcRGB. The initial value is GL_ONE. + </para> + </param> + <param name="dstAlpha"> + <para> + Specified how the alpha destination blending factor is computed. The same symbolic constants are accepted as for dstRGB. The initial value is GL_ZERO. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F7"> - <summary>The F7 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BufferData(OpenTK.Graphics.ES20.BufferTarget,System.IntPtr,System.IntPtr,OpenTK.Graphics.ES20.BufferUsage)"> + <summary> + Creates and initializes a buffer object's data store + </summary> + <param name="target"> + <para> + Specifies the target buffer object. The symbolic constant must be GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER, or GL_PIXEL_UNPACK_BUFFER. + </para> + </param> + <param name="size"> + <para> + Specifies the size in bytes of the buffer object's new data store. + </para> + </param> + <param name="data"> + <para> + Specifies a pointer to data that will be copied into the data store for initialization, or NULL if no data is to be copied. + </para> + </param> + <param name="usage"> + <para> + Specifies the expected usage pattern of the data store. The symbolic constant must be GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY, GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY, GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F8"> - <summary>The F8 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BufferData``1(OpenTK.Graphics.ES20.BufferTarget,System.IntPtr,``0[],OpenTK.Graphics.ES20.BufferUsage)"> + <summary> + Creates and initializes a buffer object's data store + </summary> + <param name="target"> + <para> + Specifies the target buffer object. The symbolic constant must be GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER, or GL_PIXEL_UNPACK_BUFFER. + </para> + </param> + <param name="size"> + <para> + Specifies the size in bytes of the buffer object's new data store. + </para> + </param> + <param name="data"> + <para> + Specifies a pointer to data that will be copied into the data store for initialization, or NULL if no data is to be copied. + </para> + </param> + <param name="usage"> + <para> + Specifies the expected usage pattern of the data store. The symbolic constant must be GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY, GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY, GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F9"> - <summary>The F9 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BufferData``1(OpenTK.Graphics.ES20.BufferTarget,System.IntPtr,``0[0:,0:],OpenTK.Graphics.ES20.BufferUsage)"> + <summary> + Creates and initializes a buffer object's data store + </summary> + <param name="target"> + <para> + Specifies the target buffer object. The symbolic constant must be GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER, or GL_PIXEL_UNPACK_BUFFER. + </para> + </param> + <param name="size"> + <para> + Specifies the size in bytes of the buffer object's new data store. + </para> + </param> + <param name="data"> + <para> + Specifies a pointer to data that will be copied into the data store for initialization, or NULL if no data is to be copied. + </para> + </param> + <param name="usage"> + <para> + Specifies the expected usage pattern of the data store. The symbolic constant must be GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY, GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY, GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F10"> - <summary>The F10 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BufferData``1(OpenTK.Graphics.ES20.BufferTarget,System.IntPtr,``0[0:,0:,0:],OpenTK.Graphics.ES20.BufferUsage)"> + <summary> + Creates and initializes a buffer object's data store + </summary> + <param name="target"> + <para> + Specifies the target buffer object. The symbolic constant must be GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER, or GL_PIXEL_UNPACK_BUFFER. + </para> + </param> + <param name="size"> + <para> + Specifies the size in bytes of the buffer object's new data store. + </para> + </param> + <param name="data"> + <para> + Specifies a pointer to data that will be copied into the data store for initialization, or NULL if no data is to be copied. + </para> + </param> + <param name="usage"> + <para> + Specifies the expected usage pattern of the data store. The symbolic constant must be GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY, GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY, GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F11"> - <summary>The F11 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BufferData``1(OpenTK.Graphics.ES20.BufferTarget,System.IntPtr,``0@,OpenTK.Graphics.ES20.BufferUsage)"> + <summary> + Creates and initializes a buffer object's data store + </summary> + <param name="target"> + <para> + Specifies the target buffer object. The symbolic constant must be GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER, or GL_PIXEL_UNPACK_BUFFER. + </para> + </param> + <param name="size"> + <para> + Specifies the size in bytes of the buffer object's new data store. + </para> + </param> + <param name="data"> + <para> + Specifies a pointer to data that will be copied into the data store for initialization, or NULL if no data is to be copied. + </para> + </param> + <param name="usage"> + <para> + Specifies the expected usage pattern of the data store. The symbolic constant must be GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY, GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY, GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F12"> - <summary>The F12 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BufferSubData(OpenTK.Graphics.ES20.BufferTarget,System.IntPtr,System.IntPtr,System.IntPtr)"> + <summary> + Updates a subset of a buffer object's data store + </summary> + <param name="target"> + <para> + Specifies the target buffer object. The symbolic constant must be GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER, or GL_PIXEL_UNPACK_BUFFER. + </para> + </param> + <param name="offset"> + <para> + Specifies the offset into the buffer object's data store where data replacement will begin, measured in bytes. + </para> + </param> + <param name="size"> + <para> + Specifies the size in bytes of the data store region being replaced. + </para> + </param> + <param name="data"> + <para> + Specifies a pointer to the new data that will be copied into the data store. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F13"> - <summary>The F13 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BufferSubData``1(OpenTK.Graphics.ES20.BufferTarget,System.IntPtr,System.IntPtr,``0[])"> + <summary> + Updates a subset of a buffer object's data store + </summary> + <param name="target"> + <para> + Specifies the target buffer object. The symbolic constant must be GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER, or GL_PIXEL_UNPACK_BUFFER. + </para> + </param> + <param name="offset"> + <para> + Specifies the offset into the buffer object's data store where data replacement will begin, measured in bytes. + </para> + </param> + <param name="size"> + <para> + Specifies the size in bytes of the data store region being replaced. + </para> + </param> + <param name="data"> + <para> + Specifies a pointer to the new data that will be copied into the data store. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F14"> - <summary>The F14 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BufferSubData``1(OpenTK.Graphics.ES20.BufferTarget,System.IntPtr,System.IntPtr,``0[0:,0:])"> + <summary> + Updates a subset of a buffer object's data store + </summary> + <param name="target"> + <para> + Specifies the target buffer object. The symbolic constant must be GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER, or GL_PIXEL_UNPACK_BUFFER. + </para> + </param> + <param name="offset"> + <para> + Specifies the offset into the buffer object's data store where data replacement will begin, measured in bytes. + </para> + </param> + <param name="size"> + <para> + Specifies the size in bytes of the data store region being replaced. + </para> + </param> + <param name="data"> + <para> + Specifies a pointer to the new data that will be copied into the data store. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F15"> - <summary>The F15 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BufferSubData``1(OpenTK.Graphics.ES20.BufferTarget,System.IntPtr,System.IntPtr,``0[0:,0:,0:])"> + <summary> + Updates a subset of a buffer object's data store + </summary> + <param name="target"> + <para> + Specifies the target buffer object. The symbolic constant must be GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER, or GL_PIXEL_UNPACK_BUFFER. + </para> + </param> + <param name="offset"> + <para> + Specifies the offset into the buffer object's data store where data replacement will begin, measured in bytes. + </para> + </param> + <param name="size"> + <para> + Specifies the size in bytes of the data store region being replaced. + </para> + </param> + <param name="data"> + <para> + Specifies a pointer to the new data that will be copied into the data store. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F16"> - <summary>The F16 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.BufferSubData``1(OpenTK.Graphics.ES20.BufferTarget,System.IntPtr,System.IntPtr,``0@)"> + <summary> + Updates a subset of a buffer object's data store + </summary> + <param name="target"> + <para> + Specifies the target buffer object. The symbolic constant must be GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER, or GL_PIXEL_UNPACK_BUFFER. + </para> + </param> + <param name="offset"> + <para> + Specifies the offset into the buffer object's data store where data replacement will begin, measured in bytes. + </para> + </param> + <param name="size"> + <para> + Specifies the size in bytes of the data store region being replaced. + </para> + </param> + <param name="data"> + <para> + Specifies a pointer to the new data that will be copied into the data store. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F17"> - <summary>The F17 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.Clear(OpenTK.Graphics.ES20.ClearBufferMask)"> + <summary> + Clear buffers to preset values + </summary> + <param name="mask"> + <para> + Bitwise OR of masks that indicate the buffers to be cleared. The four masks are GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_ACCUM_BUFFER_BIT, and GL_STENCIL_BUFFER_BIT. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F18"> - <summary>The F18 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.ClearColor(System.Single,System.Single,System.Single,System.Single)"> + <summary> + Specify clear values for the color buffers + </summary> + <param name="red"> + <para> + Specify the red, green, blue, and alpha values used when the color buffers are cleared. The initial values are all 0. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F19"> - <summary>The F19 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.ClearDepth(System.Single)"> + <summary> + Specify the clear value for the depth buffer + </summary> + <param name="depth"> + <para> + Specifies the depth value used when the depth buffer is cleared. The initial value is 1. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F20"> - <summary>The F20 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.ClearStencil(System.Int32)"> + <summary> + Specify the clear value for the stencil buffer + </summary> + <param name="s"> + <para> + Specifies the index used when the stencil buffer is cleared. The initial value is 0. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F21"> - <summary>The F21 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.ColorMask(System.Boolean,System.Boolean,System.Boolean,System.Boolean)"> + <summary> + Enable and disable writing of frame buffer color components + </summary> + <param name="red"> + <para> + Specify whether red, green, blue, and alpha can or cannot be written into the frame buffer. The initial values are all GL_TRUE, indicating that the color components can be written. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F22"> - <summary>The F22 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.CompileShader(System.Int32)"> + <summary> + Compiles a shader object + </summary> + <param name="shader"> + <para> + Specifies the shader object to be compiled. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F23"> - <summary>The F23 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.CompileShader(System.UInt32)"> + <summary> + Compiles a shader object + </summary> + <param name="shader"> + <para> + Specifies the shader object to be compiled. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F24"> - <summary>The F24 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.CompressedTexImage2D(OpenTK.Graphics.ES20.TextureTarget,System.Int32,OpenTK.Graphics.ES20.PixelInternalFormat,System.Int32,System.Int32,System.Int32,System.Int32,System.IntPtr)"> + <summary> + Specify a two-dimensional texture image in a compressed format + </summary> + <param name="target"> + <para> + Specifies the target texture. Must be GL_TEXTURE_2D, GL_PROXY_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, or GL_PROXY_TEXTURE_CUBE_MAP. + </para> + </param> + <param name="level"> + <para> + Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. + </para> + </param> + <param name="internalformat"> + <para> + Specifies the format of the compressed image data stored at address data. + </para> + </param> + <param name="width"> + <para> + Specifies the width of the texture image including the border if any. If the GL version does not support non-power-of-two sizes, this value must be 2 sup n + 2 ( border ) for some integer . All implementations support 2D texture images that are at least 64 texels wide and cube-mapped texture images that are at least 16 texels wide. + </para> + </param> + <param name="height"> + <para> + Specifies the height of the texture image including the border if any. If the GL version does not support non-power-of-two sizes, this value must be Must be 2 sup n + 2 ( border ) for some integer . All implementations support 2D texture images that are at least 64 texels high and cube-mapped texture images that are at least 16 texels high. + </para> + </param> + <param name="border"> + <para> + Specifies the width of the border. Must be either 0 or 1. + </para> + </param> + <param name="imageSize"> + <para> + Specifies the number of unsigned bytes of image data starting at the address specified by data. + </para> + </param> + <param name="data"> + <para> + Specifies a pointer to the compressed image data in memory. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F25"> - <summary>The F25 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.CompressedTexImage2D``1(OpenTK.Graphics.ES20.TextureTarget,System.Int32,OpenTK.Graphics.ES20.PixelInternalFormat,System.Int32,System.Int32,System.Int32,System.Int32,``0[])"> + <summary> + Specify a two-dimensional texture image in a compressed format + </summary> + <param name="target"> + <para> + Specifies the target texture. Must be GL_TEXTURE_2D, GL_PROXY_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, or GL_PROXY_TEXTURE_CUBE_MAP. + </para> + </param> + <param name="level"> + <para> + Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. + </para> + </param> + <param name="internalformat"> + <para> + Specifies the format of the compressed image data stored at address data. + </para> + </param> + <param name="width"> + <para> + Specifies the width of the texture image including the border if any. If the GL version does not support non-power-of-two sizes, this value must be 2 sup n + 2 ( border ) for some integer . All implementations support 2D texture images that are at least 64 texels wide and cube-mapped texture images that are at least 16 texels wide. + </para> + </param> + <param name="height"> + <para> + Specifies the height of the texture image including the border if any. If the GL version does not support non-power-of-two sizes, this value must be Must be 2 sup n + 2 ( border ) for some integer . All implementations support 2D texture images that are at least 64 texels high and cube-mapped texture images that are at least 16 texels high. + </para> + </param> + <param name="border"> + <para> + Specifies the width of the border. Must be either 0 or 1. + </para> + </param> + <param name="imageSize"> + <para> + Specifies the number of unsigned bytes of image data starting at the address specified by data. + </para> + </param> + <param name="data"> + <para> + Specifies a pointer to the compressed image data in memory. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F26"> - <summary>The F26 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.CompressedTexImage2D``1(OpenTK.Graphics.ES20.TextureTarget,System.Int32,OpenTK.Graphics.ES20.PixelInternalFormat,System.Int32,System.Int32,System.Int32,System.Int32,``0[0:,0:])"> + <summary> + Specify a two-dimensional texture image in a compressed format + </summary> + <param name="target"> + <para> + Specifies the target texture. Must be GL_TEXTURE_2D, GL_PROXY_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, or GL_PROXY_TEXTURE_CUBE_MAP. + </para> + </param> + <param name="level"> + <para> + Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. + </para> + </param> + <param name="internalformat"> + <para> + Specifies the format of the compressed image data stored at address data. + </para> + </param> + <param name="width"> + <para> + Specifies the width of the texture image including the border if any. If the GL version does not support non-power-of-two sizes, this value must be 2 sup n + 2 ( border ) for some integer . All implementations support 2D texture images that are at least 64 texels wide and cube-mapped texture images that are at least 16 texels wide. + </para> + </param> + <param name="height"> + <para> + Specifies the height of the texture image including the border if any. If the GL version does not support non-power-of-two sizes, this value must be Must be 2 sup n + 2 ( border ) for some integer . All implementations support 2D texture images that are at least 64 texels high and cube-mapped texture images that are at least 16 texels high. + </para> + </param> + <param name="border"> + <para> + Specifies the width of the border. Must be either 0 or 1. + </para> + </param> + <param name="imageSize"> + <para> + Specifies the number of unsigned bytes of image data starting at the address specified by data. + </para> + </param> + <param name="data"> + <para> + Specifies a pointer to the compressed image data in memory. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F27"> - <summary>The F27 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.CompressedTexImage2D``1(OpenTK.Graphics.ES20.TextureTarget,System.Int32,OpenTK.Graphics.ES20.PixelInternalFormat,System.Int32,System.Int32,System.Int32,System.Int32,``0[0:,0:,0:])"> + <summary> + Specify a two-dimensional texture image in a compressed format + </summary> + <param name="target"> + <para> + Specifies the target texture. Must be GL_TEXTURE_2D, GL_PROXY_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, or GL_PROXY_TEXTURE_CUBE_MAP. + </para> + </param> + <param name="level"> + <para> + Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. + </para> + </param> + <param name="internalformat"> + <para> + Specifies the format of the compressed image data stored at address data. + </para> + </param> + <param name="width"> + <para> + Specifies the width of the texture image including the border if any. If the GL version does not support non-power-of-two sizes, this value must be 2 sup n + 2 ( border ) for some integer . All implementations support 2D texture images that are at least 64 texels wide and cube-mapped texture images that are at least 16 texels wide. + </para> + </param> + <param name="height"> + <para> + Specifies the height of the texture image including the border if any. If the GL version does not support non-power-of-two sizes, this value must be Must be 2 sup n + 2 ( border ) for some integer . All implementations support 2D texture images that are at least 64 texels high and cube-mapped texture images that are at least 16 texels high. + </para> + </param> + <param name="border"> + <para> + Specifies the width of the border. Must be either 0 or 1. + </para> + </param> + <param name="imageSize"> + <para> + Specifies the number of unsigned bytes of image data starting at the address specified by data. + </para> + </param> + <param name="data"> + <para> + Specifies a pointer to the compressed image data in memory. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F28"> - <summary>The F28 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.CompressedTexImage2D``1(OpenTK.Graphics.ES20.TextureTarget,System.Int32,OpenTK.Graphics.ES20.PixelInternalFormat,System.Int32,System.Int32,System.Int32,System.Int32,``0@)"> + <summary> + Specify a two-dimensional texture image in a compressed format + </summary> + <param name="target"> + <para> + Specifies the target texture. Must be GL_TEXTURE_2D, GL_PROXY_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, or GL_PROXY_TEXTURE_CUBE_MAP. + </para> + </param> + <param name="level"> + <para> + Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. + </para> + </param> + <param name="internalformat"> + <para> + Specifies the format of the compressed image data stored at address data. + </para> + </param> + <param name="width"> + <para> + Specifies the width of the texture image including the border if any. If the GL version does not support non-power-of-two sizes, this value must be 2 sup n + 2 ( border ) for some integer . All implementations support 2D texture images that are at least 64 texels wide and cube-mapped texture images that are at least 16 texels wide. + </para> + </param> + <param name="height"> + <para> + Specifies the height of the texture image including the border if any. If the GL version does not support non-power-of-two sizes, this value must be Must be 2 sup n + 2 ( border ) for some integer . All implementations support 2D texture images that are at least 64 texels high and cube-mapped texture images that are at least 16 texels high. + </para> + </param> + <param name="border"> + <para> + Specifies the width of the border. Must be either 0 or 1. + </para> + </param> + <param name="imageSize"> + <para> + Specifies the number of unsigned bytes of image data starting at the address specified by data. + </para> + </param> + <param name="data"> + <para> + Specifies a pointer to the compressed image data in memory. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F29"> - <summary>The F29 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.CompressedTexSubImage2D(OpenTK.Graphics.ES20.TextureTarget,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,OpenTK.Graphics.ES20.PixelFormat,System.Int32,System.IntPtr)"> + <summary> + Specify a two-dimensional texture subimage in a compressed format + </summary> + <param name="target"> + <para> + Specifies the target texture. Must be GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, or GL_TEXTURE_CUBE_MAP_NEGATIVE_Z. + </para> + </param> + <param name="level"> + <para> + Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. + </para> + </param> + <param name="xoffset"> + <para> + Specifies a texel offset in the x direction within the texture array. + </para> + </param> + <param name="yoffset"> + <para> + Specifies a texel offset in the y direction within the texture array. + </para> + </param> + <param name="width"> + <para> + Specifies the width of the texture subimage. + </para> + </param> + <param name="height"> + <para> + Specifies the height of the texture subimage. + </para> + </param> + <param name="format"> + <para> + Specifies the format of the compressed image data stored at address data. + </para> + </param> + <param name="imageSize"> + <para> + Specifies the number of unsigned bytes of image data starting at the address specified by data. + </para> + </param> + <param name="data"> + <para> + Specifies a pointer to the compressed image data in memory. + </para> + </param> </member> - <member name="F:OpenTK.Input.Key.F30"> - <summary>The F30 key.</summary> + <member name="M:OpenTK.Graphics.ES20.GL.CompressedTexSubImage2D``1(OpenTK.Graphics.ES20.TextureTarget,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,OpenTK.Graphics.ES20.PixelFormat,System.Int32,``0[])"> + <summary> + Specify a two-dimensional texture subimage in a compressed format + </summary> + <param name="target"> + <para> + Specifies the target texture. Must be GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, or GL_TEXTURE_CUBE_MAP_NEGATIVE_Z. + </para> + ... [truncated message content] |
From: <ka...@us...> - 2009-12-30 20:39:09
|
Revision: 1170 http://agate.svn.sourceforge.net/agate/?rev=1170&view=rev Author: kanato Date: 2009-12-30 20:30:53 +0000 (Wed, 30 Dec 2009) Log Message: ----------- Added detection of whether app is running as 64 bit or not. Modified Paths: -------------- trunk/AgateLib/Platform.cs Modified: trunk/AgateLib/Platform.cs =================================================================== --- trunk/AgateLib/Platform.cs 2009-12-29 00:39:45 UTC (rev 1169) +++ trunk/AgateLib/Platform.cs 2009-12-30 20:30:53 UTC (rev 1170) @@ -35,11 +35,13 @@ string mDocuments; string mAppData; string mAppDir; + bool m64Bit; internal Platform() { mType = DetectPlatformType(); mRuntime = DetectRuntime(); + m64Bit = Detect64Bit(); if (PlatformType != PlatformType.Windows) { @@ -77,8 +79,23 @@ { Trace.WriteLine("Could not open debug or trace log for writing."); } + + Trace.WriteLine("64-bit platform: " + m64Bit.ToString()); } + private bool Detect64Bit() + { + int size = Marshal.SizeOf(typeof(IntPtr)); + + switch (size) + { + case 4: return false; + case 8: return true; + default: + throw new AgateException(string.Format("Size of IntPtr is {0}.", size)); + } + } + private bool HasWriteAccessToAppDirectory() { // TODO: Maybe there is a better way to inspect permissions? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2009-12-29 00:40:09
|
Revision: 1169 http://agate.svn.sourceforge.net/agate/?rev=1169&view=rev Author: kanato Date: 2009-12-29 00:39:45 +0000 (Tue, 29 Dec 2009) Log Message: ----------- Updated Tests.csproj Modified Paths: -------------- trunk/Tests/Tests.csproj Modified: trunk/Tests/Tests.csproj =================================================================== --- trunk/Tests/Tests.csproj 2009-12-29 00:39:23 UTC (rev 1168) +++ trunk/Tests/Tests.csproj 2009-12-29 00:39:45 UTC (rev 1169) @@ -120,7 +120,7 @@ <Compile Include="AgateTestAttribute.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="AudioTests\GenerateAudio.cs" /> + <Compile Include="AudioTests\StreamAudio.cs" /> <Compile Include="CoreTests\PersistantSettingsTest.cs" /> <Compile Include="CoreTests\PlatformDetection\PlatformDetection.cs"> <SubType>Form</SubType> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2009-12-29 00:39:36
|
Revision: 1168 http://agate.svn.sourceforge.net/agate/?rev=1168&view=rev Author: kanato Date: 2009-12-29 00:39:23 +0000 (Tue, 29 Dec 2009) Log Message: ----------- Rename stream audio test, and fix popping on frequency change. Added Paths: ----------- trunk/Tests/AudioTests/StreamAudio.cs Removed Paths: ------------- trunk/Tests/AudioTests/GenerateAudio.cs Deleted: trunk/Tests/AudioTests/GenerateAudio.cs =================================================================== --- trunk/Tests/AudioTests/GenerateAudio.cs 2009-12-28 21:42:05 UTC (rev 1167) +++ trunk/Tests/AudioTests/GenerateAudio.cs 2009-12-29 00:39:23 UTC (rev 1168) @@ -1,189 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Text; -using AgateLib; -using AgateLib.AudioLib; -using AgateLib.DisplayLib; - -namespace Tests.AudioTests -{ - class GenerateAudio : IAgateTest - { - public string Name - { - get { return "Streaming Audio"; } - } - - public string Category - { - get { return "Audio"; } - } - - class LoopingStream : Stream - { - byte[] buffer; - int pos; - - public LoopingStream(byte[] buffer) - { - this.buffer = buffer; - } - - public override bool CanRead - { - get { return true; } - } - - public override bool CanSeek - { - get { return true; } - } - - public override bool CanWrite - { - get { return false; } - } - - public override void Flush() - { - throw new NotSupportedException(); - } - - public override long Length - { - get { return buffer.Length; } - } - - public override long Position - { - get - { - return pos; - } - set - { - pos = (int) value; - } - } - - public override int Read(byte[] buffer, int offset, int count) - { - if (count < Length - pos) - { - Array.Copy(this.buffer, pos, buffer, offset, count); - pos += count; - } - else - { - int firstcount = (int)(Length - pos); - - Array.Copy(this.buffer, pos, buffer, offset, firstcount); - - int secondCount = count - firstcount; - - Array.Copy(this.buffer, 0, buffer, offset + firstcount, secondCount); - pos = secondCount; - } - - return count; - } - - public override long Seek(long offset, SeekOrigin origin) - { - switch (origin) - { - case SeekOrigin.Begin: - pos = (int)offset; - break; - - case SeekOrigin.Current: - pos += (int)offset; - pos %= (int)Length; - break; - - case SeekOrigin.End: - pos = (int)(Length + offset); - pos %= (int)Length; - break; - } - - return pos; - } - - public override void SetLength(long value) - { - throw new NotImplementedException(); - } - - public override void Write(byte[] buffer, int offset, int count) - { - throw new NotImplementedException(); - } - } - public void Main(string[] args) - { - using (AgateSetup setup = new AgateSetup()) - { - setup.AskUser = true; - setup.Initialize(true, true, false); - if (setup.WasCanceled) - return; - - DisplayWindow wind = DisplayWindow.CreateWindowed("Generate Audio", 640, 480); - - short[] s = new short[44100]; - - int frequency = 100; - FillSoundBuffer(s, frequency); - - byte[] buffer = new byte[s.Length * 2]; - Buffer.BlockCopy(s, 0, buffer, 0, buffer.Length); - - LoopingStream sa = new LoopingStream(buffer); - StreamingSoundBuffer buf = new StreamingSoundBuffer(sa, SoundFormat.Pcm16(44100), 4100); - - buf.Play(); - - Stopwatch w = new Stopwatch(); - w.Start(); - - while (wind.IsClosed == false) - { - Display.BeginFrame(); - Display.Clear(); - - FontSurface.AgateSans14.Color = AgateLib.Geometry.Color.White; - FontSurface.AgateSans14.DrawText(0, 0, string.Format("Frequency: {0}", frequency)); - - Display.EndFrame(); - Core.KeepAlive(); - - if (w.ElapsedMilliseconds > 800) - { - frequency += 50; - FillSoundBuffer(s, frequency); - Buffer.BlockCopy(s, 0, buffer, 0, buffer.Length); - - w.Reset(); - w.Start(); - } - } - } - } - - private void FillSoundBuffer(short[] s, double frequency) - { - for (int i = 0; i < s.Length; i++) - { - double index = i / (double)s.Length; - index *= 2 * Math.PI * frequency; - - s[i] = (short)(Math.Sin(index) * short.MaxValue); - } - } - - } -} Copied: trunk/Tests/AudioTests/StreamAudio.cs (from rev 1166, trunk/Tests/AudioTests/GenerateAudio.cs) =================================================================== --- trunk/Tests/AudioTests/StreamAudio.cs (rev 0) +++ trunk/Tests/AudioTests/StreamAudio.cs 2009-12-29 00:39:23 UTC (rev 1168) @@ -0,0 +1,148 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using AgateLib; +using AgateLib.AudioLib; +using AgateLib.DisplayLib; + +namespace Tests.AudioTests +{ + class StreamAudio : IAgateTest + { + public string Name + { + get { return "Streaming Audio"; } + } + + public string Category + { + get { return "Audio"; } + } + + class LoopingStream : Stream + { + public double Frequency { get; set; } + + public LoopingStream() + { + } + + public override bool CanRead + { + get { return true; } + } + + public override bool CanSeek + { + get { return true; } + } + + public override bool CanWrite + { + get { return false; } + } + + public override void Flush() + { + throw new NotSupportedException(); + } + + public override long Length + { + get { return SamplingFrequency; } + } + + public override long Position + { + get + { + return 0; + } + set + { + } + } + + double lastValue; + const int SamplingFrequency = 44100; + + public override int Read(byte[] buffer, int offset, int count) + { + double lv = lastValue; + + for (int i = 0; i < count / 2; i++) + { + double time = i / (double)SamplingFrequency; + time *= 2 * Math.PI * Frequency; + time += lv; + lastValue = time; + + short val = (short)(Math.Sin(time) * short.MaxValue/2); + + buffer[offset + i * 2] = (byte)(val & 0xff); + buffer[offset + i * 2 + 1] = (byte)(val >> 8); + } + + return count; + } + + public override long Seek(long offset, SeekOrigin origin) + { + throw new NotImplementedException(); + } + public override void SetLength(long value) + { + throw new NotImplementedException(); + } + + public override void Write(byte[] buffer, int offset, int count) + { + throw new NotImplementedException(); + } + } + public void Main(string[] args) + { + using (AgateSetup setup = new AgateSetup()) + { + setup.AskUser = true; + setup.Initialize(true, true, false); + if (setup.WasCanceled) + return; + + DisplayWindow wind = DisplayWindow.CreateWindowed("Generate Audio", 640, 480); + + LoopingStream sa = new LoopingStream(); + sa.Frequency = 100; + + StreamingSoundBuffer buf = new StreamingSoundBuffer(sa, SoundFormat.Pcm16(44100), 100); + + buf.Play(); + + Stopwatch w = new Stopwatch(); + w.Start(); + + while (wind.IsClosed == false) + { + Display.BeginFrame(); + Display.Clear(); + + FontSurface.AgateSans14.Color = AgateLib.Geometry.Color.White; + FontSurface.AgateSans14.DrawText(0, 0, string.Format("Frequency: {0}", sa.Frequency)); + + Display.EndFrame(); + Core.KeepAlive(); + + if (w.ElapsedMilliseconds > 500) + { + sa.Frequency += 50; + w.Reset(); + w.Start(); + } + } + } + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2009-12-28 21:42:14
|
Revision: 1167 http://agate.svn.sourceforge.net/agate/?rev=1167&view=rev Author: kanato Date: 2009-12-28 21:42:05 +0000 (Mon, 28 Dec 2009) Log Message: ----------- Implement disposal and panning of StreamingSoundBuffer. Modified Paths: -------------- trunk/AgateLib/AudioLib/ImplementationBase/StreamingSoundBufferImpl.cs trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs Modified: trunk/AgateLib/AudioLib/ImplementationBase/StreamingSoundBufferImpl.cs =================================================================== --- trunk/AgateLib/AudioLib/ImplementationBase/StreamingSoundBufferImpl.cs 2009-12-28 20:50:32 UTC (rev 1166) +++ trunk/AgateLib/AudioLib/ImplementationBase/StreamingSoundBufferImpl.cs 2009-12-28 21:42:05 UTC (rev 1167) @@ -45,5 +45,18 @@ /// Gets a value indiciating whether or not audio is playing. /// </summary> public abstract bool IsPlaying { get; } + + /// <summary> + /// Releases resources. + /// </summary> + public abstract void Dispose(); + + /// <summary> + /// Gets or sets the left-right balance. + /// -1 is left speaker + /// 0 is middle (both) + /// 1 is right. + /// </summary> + public abstract double Pan { get; set; } } } Modified: trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs =================================================================== --- trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs 2009-12-28 20:50:32 UTC (rev 1166) +++ trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs 2009-12-28 21:42:05 UTC (rev 1167) @@ -28,7 +28,7 @@ /// <summary> /// Class which streams PCM audio data. /// </summary> - public class StreamingSoundBuffer + public class StreamingSoundBuffer : IDisposable { StreamingSoundBufferImpl impl; Stream stream; @@ -48,6 +48,14 @@ } /// <summary> + /// Releases resources. + /// </summary> + public void Dispose() + { + Impl.Dispose(); + } + + /// <summary> /// Returns the implementation object for the StreamingSoundBuffer. /// </summary> public StreamingSoundBufferImpl Impl @@ -95,5 +103,18 @@ { get { return impl.IsPlaying; } } + + /// <summary> + /// Gets or sets the left-right balance that will be used in new sessions. + /// -1 is entirely in the left speaker, + /// 0 is equally in both and, + /// 1 is entirely in the right speaker. + /// </summary> + public double Pan + { + get { return impl.Pan; } + set { impl.Pan = value; } + } + } } Modified: trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs =================================================================== --- trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs 2009-12-28 20:50:32 UTC (rev 1166) +++ trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs 2009-12-28 21:42:05 UTC (rev 1167) @@ -39,6 +39,7 @@ BufferData[] buffer; bool mPlaying; int mNextData; + double mPan; int mChunkSize; @@ -77,6 +78,18 @@ } } + public override void Dispose() + { + try + { + mVoice.Stop(); + mVoice.Dispose(); + } + catch + { + + } + } void mVoice_BufferEnd(object sender, ContextEventArgs e) { ReadAndSubmitNextData(); @@ -158,5 +171,32 @@ { get { return mPlaying; } } + + float[] channelVolumes = new float[2]; + public override double Pan + { + get { return mPan; } + set + { + mPan = value; + mVoice.SetChannelVolumes(2, GetChannelVolumes((float)value)); + } + } + + private float[] GetChannelVolumes(float pan) + { + if (pan < 0) + { + channelVolumes[0] = 1; + channelVolumes[1] = 1 + pan; + } + else + { + channelVolumes[0] = 1 - pan; + channelVolumes[1] = 1; + } + + return channelVolumes; + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2009-12-28 20:50:40
|
Revision: 1166 http://agate.svn.sourceforge.net/agate/?rev=1166&view=rev Author: kanato Date: 2009-12-28 20:50:32 +0000 (Mon, 28 Dec 2009) Log Message: ----------- Implement streaming audio in SDX. Modified Paths: -------------- trunk/AgateLib/AudioLib/ImplementationBase/AudioImpl.cs trunk/AgateLib/AudioLib/ImplementationBase/StreamingSoundBufferImpl.cs trunk/AgateLib/AudioLib/SoundBuffer.cs trunk/AgateLib/AudioLib/SoundFormat.cs trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs trunk/Drivers/AgateSDX/AgateSDX.csproj trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs trunk/Tests/AudioTests/GenerateAudio.cs Added Paths: ----------- trunk/Drivers/AgateSDX/XAud2/XAudio2_Music.cs trunk/Drivers/AgateSDX/XAud2/XAudio2_SoundBuffer.cs trunk/Drivers/AgateSDX/XAud2/XAudio2_SoundBufferSession.cs trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs Modified: trunk/AgateLib/AudioLib/ImplementationBase/AudioImpl.cs =================================================================== --- trunk/AgateLib/AudioLib/ImplementationBase/AudioImpl.cs 2009-12-28 19:44:19 UTC (rev 1165) +++ trunk/AgateLib/AudioLib/ImplementationBase/AudioImpl.cs 2009-12-28 20:50:32 UTC (rev 1166) @@ -74,13 +74,14 @@ public abstract SoundBufferImpl CreateSoundBuffer(Stream inStream); /// <summary> - /// Creates a SoundBufferImpl object. + /// Creates a streaming sound buffer. /// </summary> - /// <param name="inStream"></param> + /// <param name="input"></param> + /// <param name="format"></param> /// <returns></returns> - public virtual SoundBufferImpl CreateSoundBuffer(Stream inStream, AudioLib.SoundFormat format) + public virtual StreamingSoundBufferImpl CreateStreamingSoundBuffer(Stream input, SoundFormat format) { - throw new NotImplementedException(); + throw new NotSupportedException(); } /// <summary> @@ -92,6 +93,7 @@ { } + } } Modified: trunk/AgateLib/AudioLib/ImplementationBase/StreamingSoundBufferImpl.cs =================================================================== --- trunk/AgateLib/AudioLib/ImplementationBase/StreamingSoundBufferImpl.cs 2009-12-28 19:44:19 UTC (rev 1165) +++ trunk/AgateLib/AudioLib/ImplementationBase/StreamingSoundBufferImpl.cs 2009-12-28 20:50:32 UTC (rev 1166) @@ -24,7 +24,26 @@ namespace AgateLib.AudioLib.ImplementationBase { - class StreamingSoundBufferImpl + public abstract class StreamingSoundBufferImpl { + /// <summary> + /// Starts playing of the sound. + /// </summary> + public abstract void Play(); + /// <summary> + /// Stops playing of the sound. + /// </summary> + public abstract void Stop(); + + /// <summary> + /// Gets or sets a value indicating how many bytes should be read from the + /// stream at a time. + /// </summary> + public abstract int ChunkSize { get; set; } + + /// <summary> + /// Gets a value indiciating whether or not audio is playing. + /// </summary> + public abstract bool IsPlaying { get; } } } Modified: trunk/AgateLib/AudioLib/SoundBuffer.cs =================================================================== --- trunk/AgateLib/AudioLib/SoundBuffer.cs 2009-12-28 19:44:19 UTC (rev 1165) +++ trunk/AgateLib/AudioLib/SoundBuffer.cs 2009-12-28 20:50:32 UTC (rev 1166) @@ -92,15 +92,6 @@ } /// <summary> - /// Constructs a SoundBuffer object, loading audio data from the passed stream. - /// </summary> - /// <param name="source"></param> - public SoundBuffer(Stream source, SoundFormat format) - { - impl = Audio.Impl.CreateSoundBuffer(source, format); - } - - /// <summary> /// Disposes of the SoundBuffer object, and all SoundBufferSession objects /// created by this SoundBuffer. /// </summary> Modified: trunk/AgateLib/AudioLib/SoundFormat.cs =================================================================== --- trunk/AgateLib/AudioLib/SoundFormat.cs 2009-12-28 19:44:19 UTC (rev 1165) +++ trunk/AgateLib/AudioLib/SoundFormat.cs 2009-12-28 20:50:32 UTC (rev 1166) @@ -1,4 +1,22 @@ -using System; +// The contents of this file are subject to the Mozilla Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is AgateLib. +// +// The Initial Developer of the Original Code is Erik Ylvisaker. +// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. +// All Rights Reserved. +// +// Contributor(s): Erik Ylvisaker +// +using System; using System.Collections.Generic; using System.Linq; using System.Text; Modified: trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs =================================================================== --- trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs 2009-12-28 19:44:19 UTC (rev 1165) +++ trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs 2009-12-28 20:50:32 UTC (rev 1166) @@ -1,16 +1,99 @@ -using System; +// The contents of this file are subject to the Mozilla Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is AgateLib. +// +// The Initial Developer of the Original Code is Erik Ylvisaker. +// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. +// All Rights Reserved. +// +// Contributor(s): Erik Ylvisaker +// +using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using AgateLib.AudioLib.ImplementationBase; namespace AgateLib.AudioLib { + /// <summary> + /// Class which streams PCM audio data. + /// </summary> public class StreamingSoundBuffer { - public StreamingSoundBuffer(Stream input, SoundFormat format) + StreamingSoundBufferImpl impl; + Stream stream; + + /// <summary> + /// Constructs a StreamingSoundBuffer object. + /// </summary> + /// <param name="input">The stream from which audio data will be pulled from.</param> + /// <param name="format">A SoundFormat object which indicates the PCM format for the data.</param> + /// <param name="chunkSize">The size of data that should be read from the stream each time + /// new data is required.</param> + public StreamingSoundBuffer(Stream input, SoundFormat format, int chunkSize) { + impl = Audio.Impl.CreateStreamingSoundBuffer(input, format); + stream = input; + ChunkSize = chunkSize; + } + /// <summary> + /// Returns the implementation object for the StreamingSoundBuffer. + /// </summary> + public StreamingSoundBufferImpl Impl + { + get { return impl; } } + + /// <summary> + /// Gets the stream which audio data is pulled from. + /// </summary> + public Stream BaseStream + { + get { return stream; } + } + + /// <summary> + /// Starts playing of the sound. + /// </summary> + public void Play() + { + impl.Play(); + } + /// <summary> + /// Stops playing of the sound. + /// </summary> + public void Stop() + { + impl.Stop(); + } + + /// <summary> + /// Gets or sets a value indicating how many bytes should be read from the + /// stream at a time. This may only be set when the audio is stopped. + /// </summary> + public int ChunkSize + { + get { return impl.ChunkSize; } + set { impl.ChunkSize = value; } + } + + /// <summary> + /// Gets a bool indicating whether or not the streaming buffer is playing audio. + /// </summary> + public bool IsPlaying + { + get { return impl.IsPlaying; } + } } } Modified: trunk/Drivers/AgateSDX/AgateSDX.csproj =================================================================== --- trunk/Drivers/AgateSDX/AgateSDX.csproj 2009-12-28 19:44:19 UTC (rev 1165) +++ trunk/Drivers/AgateSDX/AgateSDX.csproj 2009-12-28 20:50:32 UTC (rev 1166) @@ -150,6 +150,10 @@ <Compile Include="Properties\AssemblyInfo.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="XAud2\XAudio2_Music.cs" /> + <Compile Include="XAud2\XAudio2_SoundBuffer.cs" /> + <Compile Include="XAud2\XAudio2_SoundBufferSession.cs" /> + <Compile Include="XAud2\XAudio2_StreamingSoundBuffer.cs" /> <EmbeddedResource Include="frmFullScreen.resx"> <SubType>Designer</SubType> <DependentUpon>frmFullScreen.cs</DependentUpon> Modified: trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs =================================================================== --- trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs 2009-12-28 19:44:19 UTC (rev 1165) +++ trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs 2009-12-28 20:50:32 UTC (rev 1166) @@ -66,35 +66,38 @@ public override SoundBufferImpl CreateSoundBuffer(Stream inStream) { - return new SDX_SoundBuffer(this, inStream); + return new XAudio2_SoundBuffer(this, inStream); } public override MusicImpl CreateMusic(System.IO.Stream musicStream) { CheckCoop(); - return new SDX_Music(this, musicStream); + return new XAudio2_Music(this, musicStream); } public override MusicImpl CreateMusic(string filename) { CheckCoop(); - return new SDX_Music(this, filename); + return new XAudio2_Music(this, filename); } public override SoundBufferImpl CreateSoundBuffer(string filename) { CheckCoop(); - return new SDX_SoundBuffer(this, filename); + return new XAudio2_SoundBuffer(this, filename); } public override SoundBufferSessionImpl CreateSoundBufferSession(SoundBufferImpl buffer) { CheckCoop(); - return new SDX_SoundBufferSession(this, buffer as SDX_SoundBuffer); + return new XAudio2_SoundBufferSession(this, buffer as XAudio2_SoundBuffer); } + public override StreamingSoundBufferImpl CreateStreamingSoundBuffer(Stream input, SoundFormat format) + { + return new XAudio2_StreamingSoundBuffer(this, input, format); + } - /// <summary> /// hack to make sure the cooperative level is set after a window is created. /// Is this necessary with XAudio2? @@ -109,382 +112,4 @@ } } - public class SDX_SoundBuffer : SoundBufferImpl - { - XAudio2_Audio mAudio; - AudioBuffer mBuffer; - double mVolume; - WaveFormat mFormat; - MemoryStream mem; - byte[] buffer; - - public SDX_SoundBuffer(XAudio2_Audio audio, Stream inStream) - { - mAudio = audio; - - WaveStream stream = new WaveStream(inStream); - - mBuffer = new AudioBuffer(); - mBuffer.AudioData = stream; - mBuffer.AudioBytes = (int)stream.Length; - mBuffer.Flags = BufferFlags.EndOfStream; - - mFormat = stream.Format; - } - - public SDX_SoundBuffer(XAudio2_Audio audio, string filename) - : this(audio, File.OpenRead(filename)) - { - - } - - public override bool Loop { get; set; } - - public override void Dispose() - { - mBuffer.Dispose(); - } - - public AudioBuffer Buffer - { - get { return mBuffer; } - } - public WaveFormat Format - { - get { return mFormat; } - } - - public override double Volume - { - get { return mVolume; } - set { mVolume = value; } - } - } - public class SDX_SoundBufferSession : SoundBufferSessionImpl - { - SDX_SoundBuffer mSource; - XAudio2_Audio mAudio; - AudioBuffer mBuffer; - SourceVoice mVoice; - double mVolume; - double mPan; - bool mIsPlaying; - bool mLoop = false; - bool mDisposing = false; - - public SDX_SoundBufferSession(XAudio2_Audio audio, SDX_SoundBuffer source) - { - mAudio = audio; - mSource = source; - mBuffer = source.Buffer; - mVolume = source.Volume; - mLoop = source.Loop; - - mVoice = new SourceVoice(mAudio.Device, mSource.Format); - mVoice.BufferEnd += new EventHandler<ContextEventArgs>(mVoice_BufferEnd); - - } - - void mVoice_BufferEnd(object sender, ContextEventArgs e) - { - if (mDisposing) - { - mVoice.Dispose(); - return; - } - - if (mLoop) - { - mVoice.SubmitSourceBuffer(mBuffer); - } - else - { - mIsPlaying = false; - } - } - public override void Dispose() - { - mLoop = false; - mVoice.Stop(); - - mDisposing = true; - } - - protected override void Initialize() - { - mVoice.Stop(); - mVoice.SubmitSourceBuffer(mBuffer); - } - - public override int CurrentLocation - { - get - { - return (int)mVoice.State.SamplesPlayed; - } - } - public override void Play() - { - mVoice.Stop(); - mVoice.Start(); - mIsPlaying = true; - } - - public override void Stop() - { - mVoice.Stop(); - - } - - public override double Volume - { - get { return mVolume; } - set - { - mVoice.Volume = (float)value; - mVolume = value; - } - } - - public override bool IsPlaying - { - get - { - return mIsPlaying; - } - } - - float[] channelVolumes = new float[2]; - public override double Pan - { - get { return mPan; } - set - { - mPan = value; - mVoice.SetChannelVolumes(2, GetChannelVolumes((float)value)); - } - } - - private float[] GetChannelVolumes(float pan) - { - if (pan < 0) - { - channelVolumes[0] = 1; - channelVolumes[1] = 1 + pan; - } - else - { - channelVolumes[0] = 1 - pan; - channelVolumes[1] = 1; - } - - return channelVolumes; - } - - } - public class SDX_Music : MusicImpl - { - XAudio2_Audio mAudio; - - public SDX_Music(XAudio2_Audio audio, string filename) - { - mAudio = audio; - - if (System.IO.Path.GetExtension(filename) == ".mp3") - throw new Exception("MP3 files cannot be played due to license restrictions."); - - //LoadMusic(filename); - } - - public SDX_Music(XAudio2_Audio audio, Stream infile) - { - mAudio = audio; - - //string tempfile = Path.GetTempFileName(); - //using (FileStream writer = File.OpenWrite(tempfile)) - //{ - // ReadWriteStream(infile, writer); - //} - - //try - //{ - // LoadMusic(tempfile); - //} - //catch (Microsoft.DirectX.DirectXException e) - //{ - // throw new AgateLib.AgateException( - // "Could not load the music file. The file format may be unsupported by DirectX.", e); - //} - //finally - //{ - // File.Delete(tempfile); - //} - } - /* - private void LoadMusic(string filename) - { - mAVAudio = new Microsoft.DirectX.AudioVideoPlayback.Audio(filename); - mAVAudio.Ending += new EventHandler(mAVAudio_Ending); - } - - private void ReadWriteStream(Stream readStream, Stream writeStream) - { - int Length = 256; - Byte[] buffer = new Byte[Length]; - int bytesRead = readStream.Read(buffer, 0, Length); - // write the required bytes - while (bytesRead > 0) - { - writeStream.Write(buffer, 0, bytesRead); - bytesRead = readStream.Read(buffer, 0, Length); - } - readStream.Close(); - writeStream.Close(); - } - - public override void Dispose() - { - mAVAudio.Dispose(); - } - - - protected override void OnSetLoop(bool value) - { - if (value == true) - mAVAudio.Ending += mAVAudio_Ending; - else - mAVAudio.Ending -= mAVAudio_Ending; - } - - public override void Play() - { - mAVAudio.Play(); - } - - public override void Stop() - { - mAVAudio.Stop(); - } - - /// <summary> - /// </summary> - public override double Volume - { - get - { - try - { - /// The DirectX AudioVideoPlayback object takes volume in the range of - /// -10000 to 0, indicating the number of hundredths of decibels the volume - /// is attenuated by, so we convert to zero to 1. - - double vol = (double)(mAVAudio.Volume + 10000) / 10000; - // logarithmic volume control - return Audio.TransformByExp(vol); - } - catch (Microsoft.DirectX.DirectXException e) - { - System.Diagnostics.Debug.WriteLine("Failed to read volume."); - System.Diagnostics.Debug.WriteLine(e.Message); - return 1.0; - } - } - set - { - // do a logarithmic volume control - try - { - mAVAudio.Volume = (int)(Audio.TransformByLog(value) * 10000.0 - 10000.0); - } - catch (Microsoft.DirectX.DirectXException e) - { - System.Diagnostics.Debug.WriteLine("Failed to set volume."); - System.Diagnostics.Debug.WriteLine(e.Message); - } - } - } - - - void mAVAudio_Ending(object sender, EventArgs e) - { - if (IsLooping) - { - mAVAudio.CurrentPosition = 0; - } - } - - public override bool IsPlaying - { - get { return mAVAudio.Playing; } - } - - public override double Pan - { - get - { - return mAVAudio.Balance / (double)10000.0; - } - set - { - try - { - mAVAudio.Balance = (int)(value * 10000.0); - } - catch (Microsoft.DirectX.DirectXException e) - { - if (e.ErrorCode != -2147220909) - throw e; - } - } - } - * */ - public override void Dispose() - { - throw new NotImplementedException(); - } - - public override bool IsPlaying - { - get { throw new NotImplementedException(); } - } - - protected override void OnSetLoop(bool value) - { - throw new NotImplementedException(); - } - - public override double Pan - { - get - { - throw new NotImplementedException(); - } - set - { - throw new NotImplementedException(); - } - } - - public override void Play() - { - throw new NotImplementedException(); - } - - public override void Stop() - { - throw new NotImplementedException(); - } - - public override double Volume - { - get - { - throw new NotImplementedException(); - } - set - { - throw new NotImplementedException(); - } - } - } } Added: trunk/Drivers/AgateSDX/XAud2/XAudio2_Music.cs =================================================================== --- trunk/Drivers/AgateSDX/XAud2/XAudio2_Music.cs (rev 0) +++ trunk/Drivers/AgateSDX/XAud2/XAudio2_Music.cs 2009-12-28 20:50:32 UTC (rev 1166) @@ -0,0 +1,238 @@ +// The contents of this file are subject to the Mozilla Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is AgateLib. +// +// The Initial Developer of the Original Code is Erik Ylvisaker. +// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. +// All Rights Reserved. +// +// Contributor(s): Erik Ylvisaker +// +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; +using AgateLib.AudioLib; +using AgateLib.AudioLib.ImplementationBase; +using AgateLib.Drivers; +using SlimDX.XAudio2; +using SlimDX.Multimedia; + +namespace AgateSDX.XAud2 +{ + + public class XAudio2_Music : MusicImpl + { + XAudio2_Audio mAudio; + + public XAudio2_Music(XAudio2_Audio audio, string filename) + { + mAudio = audio; + + if (System.IO.Path.GetExtension(filename) == ".mp3") + throw new Exception("MP3 files cannot be played due to license restrictions."); + + //LoadMusic(filename); + } + + public XAudio2_Music(XAudio2_Audio audio, Stream infile) + { + mAudio = audio; + + //string tempfile = Path.GetTempFileName(); + //using (FileStream writer = File.OpenWrite(tempfile)) + //{ + // ReadWriteStream(infile, writer); + //} + + //try + //{ + // LoadMusic(tempfile); + //} + //catch (Microsoft.DirectX.DirectXException e) + //{ + // throw new AgateLib.AgateException( + // "Could not load the music file. The file format may be unsupported by DirectX.", e); + //} + //finally + //{ + // File.Delete(tempfile); + //} + } + /* + private void LoadMusic(string filename) + { + mAVAudio = new Microsoft.DirectX.AudioVideoPlayback.Audio(filename); + mAVAudio.Ending += new EventHandler(mAVAudio_Ending); + } + + private void ReadWriteStream(Stream readStream, Stream writeStream) + { + int Length = 256; + Byte[] buffer = new Byte[Length]; + int bytesRead = readStream.Read(buffer, 0, Length); + // write the required bytes + while (bytesRead > 0) + { + writeStream.Write(buffer, 0, bytesRead); + bytesRead = readStream.Read(buffer, 0, Length); + } + readStream.Close(); + writeStream.Close(); + } + + public override void Dispose() + { + mAVAudio.Dispose(); + } + + + protected override void OnSetLoop(bool value) + { + if (value == true) + mAVAudio.Ending += mAVAudio_Ending; + else + mAVAudio.Ending -= mAVAudio_Ending; + } + + public override void Play() + { + mAVAudio.Play(); + } + + public override void Stop() + { + mAVAudio.Stop(); + } + + /// <summary> + /// </summary> + public override double Volume + { + get + { + try + { + /// The DirectX AudioVideoPlayback object takes volume in the range of + /// -10000 to 0, indicating the number of hundredths of decibels the volume + /// is attenuated by, so we convert to zero to 1. + + double vol = (double)(mAVAudio.Volume + 10000) / 10000; + // logarithmic volume control + return Audio.TransformByExp(vol); + } + catch (Microsoft.DirectX.DirectXException e) + { + System.Diagnostics.Debug.WriteLine("Failed to read volume."); + System.Diagnostics.Debug.WriteLine(e.Message); + return 1.0; + } + } + set + { + // do a logarithmic volume control + try + { + mAVAudio.Volume = (int)(Audio.TransformByLog(value) * 10000.0 - 10000.0); + } + catch (Microsoft.DirectX.DirectXException e) + { + System.Diagnostics.Debug.WriteLine("Failed to set volume."); + System.Diagnostics.Debug.WriteLine(e.Message); + } + } + } + + + void mAVAudio_Ending(object sender, EventArgs e) + { + if (IsLooping) + { + mAVAudio.CurrentPosition = 0; + } + } + + public override bool IsPlaying + { + get { return mAVAudio.Playing; } + } + + public override double Pan + { + get + { + return mAVAudio.Balance / (double)10000.0; + } + set + { + try + { + mAVAudio.Balance = (int)(value * 10000.0); + } + catch (Microsoft.DirectX.DirectXException e) + { + if (e.ErrorCode != -2147220909) + throw e; + } + } + } + * */ + public override void Dispose() + { + throw new NotImplementedException(); + } + + public override bool IsPlaying + { + get { throw new NotImplementedException(); } + } + + protected override void OnSetLoop(bool value) + { + throw new NotImplementedException(); + } + + public override double Pan + { + get + { + throw new NotImplementedException(); + } + set + { + throw new NotImplementedException(); + } + } + + public override void Play() + { + throw new NotImplementedException(); + } + + public override void Stop() + { + throw new NotImplementedException(); + } + + public override double Volume + { + get + { + throw new NotImplementedException(); + } + set + { + throw new NotImplementedException(); + } + } + } +} Added: trunk/Drivers/AgateSDX/XAud2/XAudio2_SoundBuffer.cs =================================================================== --- trunk/Drivers/AgateSDX/XAud2/XAudio2_SoundBuffer.cs (rev 0) +++ trunk/Drivers/AgateSDX/XAud2/XAudio2_SoundBuffer.cs 2009-12-28 20:50:32 UTC (rev 1166) @@ -0,0 +1,80 @@ +// The contents of this file are subject to the Mozilla Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is AgateLib. +// +// The Initial Developer of the Original Code is Erik Ylvisaker. +// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. +// All Rights Reserved. +// +// Contributor(s): Erik Ylvisaker +// +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; +using AgateLib.AudioLib; +using AgateLib.AudioLib.ImplementationBase; +using AgateLib.Drivers; +using SlimDX.XAudio2; +using SlimDX.Multimedia; + +namespace AgateSDX.XAud2 +{ + public class XAudio2_SoundBuffer : SoundBufferImpl + { + XAudio2_Audio mAudio; + AudioBuffer mBuffer; + double mVolume; + WaveFormat mFormat; + + public XAudio2_SoundBuffer(XAudio2_Audio audio, Stream inStream) + { + mAudio = audio; + + WaveStream stream = new WaveStream(inStream); + + mBuffer = new AudioBuffer(); + mBuffer.AudioData = stream; + mBuffer.AudioBytes = (int)stream.Length; + + mFormat = stream.Format; + } + + public XAudio2_SoundBuffer(XAudio2_Audio audio, string filename) + : this(audio, File.OpenRead(filename)) + { + + } + + public override bool Loop { get; set; } + + public override void Dispose() + { + mBuffer.Dispose(); + } + + public AudioBuffer Buffer + { + get { return mBuffer; } + } + public WaveFormat Format + { + get { return mFormat; } + } + + public override double Volume + { + get { return mVolume; } + set { mVolume = value; } + } + } +} Added: trunk/Drivers/AgateSDX/XAud2/XAudio2_SoundBufferSession.cs =================================================================== --- trunk/Drivers/AgateSDX/XAud2/XAudio2_SoundBufferSession.cs (rev 0) +++ trunk/Drivers/AgateSDX/XAud2/XAudio2_SoundBufferSession.cs 2009-12-28 20:50:32 UTC (rev 1166) @@ -0,0 +1,155 @@ +// The contents of this file are subject to the Mozilla Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is AgateLib. +// +// The Initial Developer of the Original Code is Erik Ylvisaker. +// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. +// All Rights Reserved. +// +// Contributor(s): Erik Ylvisaker +// +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; +using AgateLib.AudioLib; +using AgateLib.AudioLib.ImplementationBase; +using AgateLib.Drivers; +using SlimDX.XAudio2; +using SlimDX.Multimedia; + +namespace AgateSDX.XAud2 +{ + + public class XAudio2_SoundBufferSession : SoundBufferSessionImpl + { + XAudio2_SoundBuffer mSource; + XAudio2_Audio mAudio; + AudioBuffer mBuffer; + SourceVoice mVoice; + double mVolume; + double mPan; + bool mIsPlaying; + bool mLoop = false; + bool mDisposing = false; + + public XAudio2_SoundBufferSession(XAudio2_Audio audio, XAudio2_SoundBuffer source) + { + mAudio = audio; + mSource = source; + mBuffer = source.Buffer; + mVolume = source.Volume; + mLoop = source.Loop; + + mVoice = new SourceVoice(mAudio.Device, mSource.Format); + mVoice.BufferEnd += new EventHandler<ContextEventArgs>(mVoice_BufferEnd); + + } + + void mVoice_BufferEnd(object sender, ContextEventArgs e) + { + if (mDisposing) + { + mVoice.Dispose(); + return; + } + + if (mLoop) + { + mVoice.SubmitSourceBuffer(mBuffer); + } + else + { + mIsPlaying = false; + } + } + public override void Dispose() + { + mLoop = false; + mVoice.Stop(); + + mDisposing = true; + } + + protected override void Initialize() + { + mVoice.Stop(); + mVoice.SubmitSourceBuffer(mBuffer); + } + + public override int CurrentLocation + { + get + { + return (int)mVoice.State.SamplesPlayed; + } + } + public override void Play() + { + mVoice.Stop(); + mVoice.Start(); + mIsPlaying = true; + } + + public override void Stop() + { + mVoice.Stop(); + + } + + public override double Volume + { + get { return mVolume; } + set + { + mVoice.Volume = (float)value; + mVolume = value; + } + } + + public override bool IsPlaying + { + get + { + return mIsPlaying; + } + } + + float[] channelVolumes = new float[2]; + public override double Pan + { + get { return mPan; } + set + { + mPan = value; + mVoice.SetChannelVolumes(2, GetChannelVolumes((float)value)); + } + } + + private float[] GetChannelVolumes(float pan) + { + if (pan < 0) + { + channelVolumes[0] = 1; + channelVolumes[1] = 1 + pan; + } + else + { + channelVolumes[0] = 1 - pan; + channelVolumes[1] = 1; + } + + return channelVolumes; + } + + } +} Added: trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs =================================================================== --- trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs (rev 0) +++ trunk/Drivers/AgateSDX/XAud2/XAudio2_StreamingSoundBuffer.cs 2009-12-28 20:50:32 UTC (rev 1166) @@ -0,0 +1,162 @@ +// The contents of this file are subject to the Mozilla Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is AgateLib. +// +// The Initial Developer of the Original Code is Erik Ylvisaker. +// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. +// All Rights Reserved. +// +// Contributor(s): Erik Ylvisaker +// +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; +using AgateLib.AudioLib; +using AgateLib.AudioLib.ImplementationBase; +using AgateLib.Drivers; +using SlimDX.XAudio2; +using SlimDX.Multimedia; + +namespace AgateSDX.XAud2 +{ + class XAudio2_StreamingSoundBuffer : StreamingSoundBufferImpl + { + XAudio2_Audio mAudio; + Stream mInput; + SoundFormat mFormat; + SourceVoice mVoice; + WaveFormat xaudFormat; + BufferData[] buffer; + bool mPlaying; + int mNextData; + + int mChunkSize; + + const int bufferCount = 3; + + class BufferData + { + public AudioBuffer buffer; + public MemoryStream ms; + public byte[] backing; + } + + public XAudio2_StreamingSoundBuffer(XAudio2_Audio audio, Stream input, SoundFormat format) + { + mAudio = audio; + mInput = input; + mFormat = format; + + xaudFormat = new WaveFormat(); + xaudFormat.BitsPerSample = (short) mFormat.BitsPerSample; + xaudFormat.Channels = (short)mFormat.Channels; + xaudFormat.BlockAlignment = (short)(mFormat.Channels * mFormat.BitsPerSample / 8); + xaudFormat.FormatTag = WaveFormatTag.Pcm; + xaudFormat.SamplesPerSecond = format.SamplingFrequency; + xaudFormat.AverageBytesPerSecond = xaudFormat.BlockAlignment * xaudFormat.SamplesPerSecond; + + mVoice = new SourceVoice(audio.Device, xaudFormat); + mVoice.BufferEnd += new EventHandler<ContextEventArgs>(mVoice_BufferEnd); + + buffer = new BufferData[bufferCount]; + for (int i = 0; i < bufferCount; i++) + { + buffer[i] = new BufferData(); + buffer[i].buffer = new AudioBuffer(); + buffer[i].ms = new MemoryStream(); + } + } + + void mVoice_BufferEnd(object sender, ContextEventArgs e) + { + ReadAndSubmitNextData(); + } + + private void ReadAndSubmitNextData() + { + ReadData(buffer[mNextData]); + SubmitData(buffer[mNextData]); + + mNextData++; + + if (mNextData >= bufferCount) + mNextData = 0; + } + + public override void Play() + { + mNextData = 0; + ReadAndSubmitNextData(); + + mVoice.Start(); + mPlaying = true; + } + + + + public override void Stop() + { + mPlaying = false; + + mVoice.Stop(); + } + + + private void ReadData(BufferData bufferData) + { + int count = mInput.Read(bufferData.backing, 0, bufferData.backing.Length); + + bufferData.ms.Position = 0; + bufferData.buffer.AudioData = bufferData.ms; + bufferData.buffer.AudioBytes = count; + } + + private void SubmitData(BufferData bufferData) + { + mVoice.SubmitSourceBuffer(bufferData.buffer); + } + + public override int ChunkSize + { + get + { + return mChunkSize; + } + set + { + if (value <= xaudFormat.BlockAlignment) + throw new ArgumentOutOfRangeException(string.Format( + "Chunk size is too small. Must be multiple of {0} but was {1}.", + xaudFormat.BlockAlignment, value)); + + if (value % xaudFormat.BlockAlignment != 0) + throw new ArgumentException(string.Format( + "Chunk size {0} was not a multiple of the block alignment {1}.", + value, xaudFormat.BlockAlignment)); + + mChunkSize = value; + + for (int i = 0; i < buffer.Length; i++) + { + buffer[i].backing = new byte[mChunkSize]; + buffer[i].ms = new MemoryStream(buffer[i].backing); + } + } + } + + public override bool IsPlaying + { + get { return mPlaying; } + } + } +} Modified: trunk/Tests/AudioTests/GenerateAudio.cs =================================================================== --- trunk/Tests/AudioTests/GenerateAudio.cs 2009-12-28 19:44:19 UTC (rev 1165) +++ trunk/Tests/AudioTests/GenerateAudio.cs 2009-12-28 20:50:32 UTC (rev 1166) @@ -12,10 +12,9 @@ { class GenerateAudio : IAgateTest { - public string Name { - get { return "Generate Audio"; } + get { return "Streaming Audio"; } } public string Category @@ -23,6 +22,107 @@ get { return "Audio"; } } + class LoopingStream : Stream + { + byte[] buffer; + int pos; + + public LoopingStream(byte[] buffer) + { + this.buffer = buffer; + } + + public override bool CanRead + { + get { return true; } + } + + public override bool CanSeek + { + get { return true; } + } + + public override bool CanWrite + { + get { return false; } + } + + public override void Flush() + { + throw new NotSupportedException(); + } + + public override long Length + { + get { return buffer.Length; } + } + + public override long Position + { + get + { + return pos; + } + set + { + pos = (int) value; + } + } + + public override int Read(byte[] buffer, int offset, int count) + { + if (count < Length - pos) + { + Array.Copy(this.buffer, pos, buffer, offset, count); + pos += count; + } + else + { + int firstcount = (int)(Length - pos); + + Array.Copy(this.buffer, pos, buffer, offset, firstcount); + + int secondCount = count - firstcount; + + Array.Copy(this.buffer, 0, buffer, offset + firstcount, secondCount); + pos = secondCount; + } + + return count; + } + + public override long Seek(long offset, SeekOrigin origin) + { + switch (origin) + { + case SeekOrigin.Begin: + pos = (int)offset; + break; + + case SeekOrigin.Current: + pos += (int)offset; + pos %= (int)Length; + break; + + case SeekOrigin.End: + pos = (int)(Length + offset); + pos %= (int)Length; + break; + } + + return pos; + } + + public override void SetLength(long value) + { + throw new NotImplementedException(); + } + + public override void Write(byte[] buffer, int offset, int count) + { + throw new NotImplementedException(); + } + } public void Main(string[] args) { using (AgateSetup setup = new AgateSetup()) @@ -34,7 +134,7 @@ DisplayWindow wind = DisplayWindow.CreateWindowed("Generate Audio", 640, 480); - short[] s = new short[44010]; + short[] s = new short[44100]; int frequency = 100; FillSoundBuffer(s, frequency); @@ -42,13 +142,10 @@ byte[] buffer = new byte[s.Length * 2]; Buffer.BlockCopy(s, 0, buffer, 0, buffer.Length); - MemoryStream ms = new MemoryStream(buffer); - ms.Seek(0, SeekOrigin.Begin); - SoundBuffer buf = new SoundBuffer(ms, SoundFormat.Pcm16(44100)); + LoopingStream sa = new LoopingStream(buffer); + StreamingSoundBuffer buf = new StreamingSoundBuffer(sa, SoundFormat.Pcm16(44100), 4100); - buf.Loop = true; - - SoundBufferSession ses = buf.Play(); + buf.Play(); Stopwatch w = new Stopwatch(); w.Start(); @@ -70,8 +167,6 @@ FillSoundBuffer(s, frequency); Buffer.BlockCopy(s, 0, buffer, 0, buffer.Length); - ms.Seek(0, SeekOrigin.Begin); - buf.Play(); w.Reset(); w.Start(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2009-12-28 19:44:35
|
Revision: 1165 http://agate.svn.sourceforge.net/agate/?rev=1165&view=rev Author: kanato Date: 2009-12-28 19:44:19 +0000 (Mon, 28 Dec 2009) Log Message: ----------- Reorganize ImplementationBase into *Lib.ImplementationBase namespaces. Modified Paths: -------------- trunk/AgateLib/AgateLib.csproj trunk/AgateLib/AudioLib/Music.cs trunk/AgateLib/AudioLib/SoundFormat.cs trunk/AgateLib/BitmapFont/BitmapFontImpl.cs trunk/AgateLib/DisplayLib/Display.cs trunk/AgateLib/DisplayLib/DisplayWindow.cs trunk/AgateLib/DisplayLib/FontSurface.cs trunk/AgateLib/DisplayLib/FrameBuffer.cs trunk/AgateLib/DisplayLib/IndexBuffer.cs trunk/AgateLib/DisplayLib/Shaders/Implementation/ShaderCompiler.cs trunk/AgateLib/DisplayLib/Surface.cs trunk/AgateLib/DisplayLib/VertexBuffer.cs trunk/AgateLib/Drivers/AgateDriverInfo.cs trunk/AgateLib/Drivers/DriverImplBase.cs trunk/AgateLib/Drivers/NullInputImpl.cs trunk/AgateLib/Drivers/NullSoundImpl.cs trunk/AgateLib/Drivers/Registrar.cs trunk/AgateLib/InputLib/ImplementationBase/InputImpl.cs trunk/AgateLib/InputLib/ImplementationBase/JoystickImpl.cs trunk/AgateLib/InputLib/Joystick.cs trunk/AgateLib/InputLib/JoystickInput.cs trunk/AgateLib/Resources/AgateResourceCollection.cs trunk/AgateLib/Sprites/Sprite.cs trunk/AgateLib-Windows.sln trunk/Drivers/AgateDrawing/Drawing_Display.cs trunk/Drivers/AgateDrawing/Drawing_DisplayWindow.cs trunk/Drivers/AgateDrawing/Drawing_FontSurface.cs trunk/Drivers/AgateDrawing/Drawing_FrameBuffer.cs trunk/Drivers/AgateDrawing/Drawing_Surface.cs trunk/Drivers/AgateFMOD/FMOD_Audio.cs trunk/Drivers/AgateFMOD/FMOD_Music.cs trunk/Drivers/AgateFMOD/FMOD_SoundBuffer.cs trunk/Drivers/AgateFMOD/FMOD_SoundBufferSession.cs trunk/Drivers/AgateOTK/AL_Audio.cs trunk/Drivers/AgateOTK/GL3/FrameBuffer.cs trunk/Drivers/AgateOTK/GL3/GLVertexBuffer.cs trunk/Drivers/AgateOTK/GL_Display.cs trunk/Drivers/AgateOTK/GL_DisplayControl.cs trunk/Drivers/AgateOTK/GL_FrameBuffer.cs trunk/Drivers/AgateOTK/GL_GameWindow.cs trunk/Drivers/AgateOTK/GL_IndexBuffer.cs trunk/Drivers/AgateOTK/GL_Surface.cs trunk/Drivers/AgateOTK/Legacy/ArbShaderCompiler.cs trunk/Drivers/AgateOTK/Legacy/FrameBufferExt.cs trunk/Drivers/AgateOTK/Legacy/FrameBufferReadPixels.cs trunk/Drivers/AgateOTK/Legacy/LegacyVertexBuffer.cs trunk/Drivers/AgateOTK/Shaders/GlslShaderCompiler.cs trunk/Drivers/AgateSDL/Audio/SDL_Audio.cs trunk/Drivers/AgateSDL/Audio/SDL_Music.cs trunk/Drivers/AgateSDL/Audio/SDL_SoundBuffer.cs trunk/Drivers/AgateSDL/Audio/SDL_SoundBufferSession.cs trunk/Drivers/AgateSDL/Input/SDL_Input.cs trunk/Drivers/AgateSDX/FrameBufferSurface.cs trunk/Drivers/AgateSDX/FrameBufferWindow.cs trunk/Drivers/AgateSDX/HlslCompiler.cs trunk/Drivers/AgateSDX/SDX_Display.cs trunk/Drivers/AgateSDX/SDX_DisplayWindow.cs trunk/Drivers/AgateSDX/SDX_FrameBuffer.cs trunk/Drivers/AgateSDX/SDX_IndexBuffer.cs trunk/Drivers/AgateSDX/SDX_Input.cs trunk/Drivers/AgateSDX/SDX_Surface.cs trunk/Drivers/AgateSDX/SDX_VertexBuffer.cs trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs trunk/Tests/AudioTests/GenerateAudio.cs Added Paths: ----------- trunk/AgateLib/AudioLib/ImplementationBase/ trunk/AgateLib/AudioLib/ImplementationBase/AudioImpl.cs trunk/AgateLib/AudioLib/ImplementationBase/MusicImpl.cs trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferImpl.cs trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferSessionImpl.cs trunk/AgateLib/AudioLib/ImplementationBase/StreamingSoundBufferImpl.cs trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs trunk/AgateLib/DisplayLib/ImplementationBase/ trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs trunk/AgateLib/DisplayLib/ImplementationBase/DisplayWindowImpl.cs trunk/AgateLib/DisplayLib/ImplementationBase/FontSurfaceImpl.cs trunk/AgateLib/DisplayLib/ImplementationBase/FrameBufferImpl.cs trunk/AgateLib/DisplayLib/ImplementationBase/IndexBufferImpl.cs trunk/AgateLib/DisplayLib/ImplementationBase/ShaderCompilerImpl.cs trunk/AgateLib/DisplayLib/ImplementationBase/SurfaceImpl.cs trunk/AgateLib/DisplayLib/ImplementationBase/VertexBufferImpl.cs trunk/AgateLib/InputLib/ImplementationBase/ Removed Paths: ------------- trunk/AgateLib/ImplementationBase/ trunk/AgateLib/InputLib/ImplementationBase/AudioImpl.cs trunk/AgateLib/InputLib/ImplementationBase/DisplayImpl.cs trunk/AgateLib/InputLib/ImplementationBase/DisplayWindowImpl.cs trunk/AgateLib/InputLib/ImplementationBase/FontSurfaceImpl.cs trunk/AgateLib/InputLib/ImplementationBase/FrameBufferImpl.cs trunk/AgateLib/InputLib/ImplementationBase/IndexBufferImpl.cs trunk/AgateLib/InputLib/ImplementationBase/RenderTargetImpl.cs trunk/AgateLib/InputLib/ImplementationBase/ShaderCompilerImpl.cs trunk/AgateLib/InputLib/ImplementationBase/SurfaceImpl.cs trunk/AgateLib/InputLib/ImplementationBase/VertexBufferImpl.cs Modified: trunk/AgateLib/AgateLib.csproj =================================================================== --- trunk/AgateLib/AgateLib.csproj 2009-12-25 08:10:20 UTC (rev 1164) +++ trunk/AgateLib/AgateLib.csproj 2009-12-28 19:44:19 UTC (rev 1165) @@ -132,7 +132,12 @@ <Compile Include="AppInitParameters.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="AudioLib\ImplementationBase\MusicImpl.cs" /> + <Compile Include="AudioLib\ImplementationBase\SoundBufferImpl.cs" /> + <Compile Include="AudioLib\ImplementationBase\SoundBufferSessionImpl.cs" /> + <Compile Include="AudioLib\ImplementationBase\StreamingSoundBufferImpl.cs" /> <Compile Include="AudioLib\SoundFormat.cs" /> + <Compile Include="AudioLib\StreamingSoundBuffer.cs" /> <Compile Include="Core.cs"> <SubType>Code</SubType> </Compile> @@ -189,7 +194,7 @@ <Compile Include="IFileProvider.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="ImplementationBase\FrameBufferImpl.cs" /> + <Compile Include="DisplayLib\ImplementationBase\FrameBufferImpl.cs" /> <Compile Include="Platform.cs" /> <Compile Include="PlatformType.cs" /> <Compile Include="Settings\SettingsGroup.cs" /> @@ -400,39 +405,36 @@ <Compile Include="Geometry\VertexTypes\VertexLayout.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="ImplementationBase\AudioImpl.cs"> + <Compile Include="AudioLib\ImplementationBase\AudioImpl.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="ImplementationBase\DisplayImpl.cs"> + <Compile Include="DisplayLib\ImplementationBase\DisplayImpl.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="ImplementationBase\DisplayWindowImpl.cs"> + <Compile Include="DisplayLib\ImplementationBase\DisplayWindowImpl.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="ImplementationBase\FontSurfaceImpl.cs"> + <Compile Include="DisplayLib\ImplementationBase\FontSurfaceImpl.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="ImplementationBase\IndexBufferImpl.cs"> + <Compile Include="DisplayLib\ImplementationBase\IndexBufferImpl.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="ImplementationBase\InputImpl.cs"> + <Compile Include="InputLib\ImplementationBase\InputImpl.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="ImplementationBase\JoystickImpl.cs"> + <Compile Include="InputLib\ImplementationBase\JoystickImpl.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="ImplementationBase\RenderTargetImpl.cs"> + <Compile Include="DisplayLib\ImplementationBase\ShaderCompilerImpl.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="ImplementationBase\ShaderCompilerImpl.cs"> + <Compile Include="DisplayLib\ImplementationBase\SurfaceImpl.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="ImplementationBase\SurfaceImpl.cs"> + <Compile Include="DisplayLib\ImplementationBase\VertexBufferImpl.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="ImplementationBase\VertexBufferImpl.cs"> - <SubType>Code</SubType> - </Compile> <Compile Include="InputLib\InputEventArgs.cs"> <SubType>Code</SubType> </Compile> Added: trunk/AgateLib/AudioLib/ImplementationBase/AudioImpl.cs =================================================================== --- trunk/AgateLib/AudioLib/ImplementationBase/AudioImpl.cs (rev 0) +++ trunk/AgateLib/AudioLib/ImplementationBase/AudioImpl.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -0,0 +1,97 @@ +// The contents of this file are subject to the Mozilla Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is AgateLib. +// +// The Initial Developer of the Original Code is Erik Ylvisaker. +// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. +// All Rights Reserved. +// +// Contributor(s): Erik Ylvisaker +// +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using AgateLib.Drivers; + +namespace AgateLib.AudioLib.ImplementationBase +{ + /// <summary> + /// Implements Audio class factory. + /// </summary> + public abstract class AudioImpl : DriverImplBase + { + /// <summary> + /// Creates a SoundBufferImpl object. + /// </summary> + /// <param name="filename"></param> + /// <returns></returns> + public virtual SoundBufferImpl CreateSoundBuffer(string filename) + { + using (Stream stream = File.OpenRead(filename)) + { + return CreateSoundBuffer(stream); + } + } + + /// <summary> + /// Creates a MusicImpl object. + /// </summary> + /// <param name="filename"></param> + /// <returns></returns> + public virtual MusicImpl CreateMusic(string filename) + { + using (Stream stream = File.OpenRead(filename)) + { + return CreateMusic(stream); + } + } + /// <summary> + /// Creates a MusicImpl object. + /// </summary> + /// <param name="musicStream"></param> + /// <returns></returns> + public abstract MusicImpl CreateMusic(Stream musicStream); + /// <summary> + /// Creates a SoundBufferSessionImpl object. + /// </summary> + /// <param name="buffer"></param> + /// <returns></returns> + public abstract SoundBufferSessionImpl CreateSoundBufferSession(SoundBufferImpl buffer); + /// <summary> + /// Creates a SoundBufferImpl object. + /// </summary> + /// <param name="inStream"></param> + /// <returns></returns> + public abstract SoundBufferImpl CreateSoundBuffer(Stream inStream); + + /// <summary> + /// Creates a SoundBufferImpl object. + /// </summary> + /// <param name="inStream"></param> + /// <returns></returns> + public virtual SoundBufferImpl CreateSoundBuffer(Stream inStream, AudioLib.SoundFormat format) + { + throw new NotImplementedException(); + } + + /// <summary> + /// This function is called once a frame to allow the Audio driver to update + /// information. There is no need to call base.Update() if overriding this + /// function. + /// </summary> + public virtual void Update() + { + } + + } + +} Added: trunk/AgateLib/AudioLib/ImplementationBase/MusicImpl.cs =================================================================== --- trunk/AgateLib/AudioLib/ImplementationBase/MusicImpl.cs (rev 0) +++ trunk/AgateLib/AudioLib/ImplementationBase/MusicImpl.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -0,0 +1,95 @@ +// The contents of this file are subject to the Mozilla Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is AgateLib. +// +// The Initial Developer of the Original Code is Erik Ylvisaker. +// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. +// All Rights Reserved. +// +// Contributor(s): Erik Ylvisaker +// +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using AgateLib.AudioLib.ImplementationBase; + +namespace AgateLib.AudioLib.ImplementationBase +{ + + /// <summary> + /// Class which implements a Music object. + /// </summary> + public abstract class MusicImpl : IDisposable + { + private bool mIsLooping = true; + + /// <summary> + /// Gets or sets whether or not this Music is looping. + /// </summary> + public bool IsLooping + { + get { return mIsLooping; } + set + { + if (mIsLooping != value) + { + mIsLooping = value; + + OnSetLoop(value); + } + } + } + + /// <summary> + /// Function called when IsLooping is set to a new value. + /// </summary> + /// <param name="value"></param> + protected abstract void OnSetLoop(bool value); + + /// <summary> + /// Dispose + /// </summary> + public abstract void Dispose(); + + /// <summary> + /// Start over at beginning. + /// </summary> + public abstract void Play(); + /// <summary> + /// Stop playing. + /// </summary> + public abstract void Stop(); + + /// <summary> + /// Gets or sets the volume this audio file is playing at. + /// 0.0 is completely quiet. + /// 0.5 sounds like half maximum volume + /// 1.0 is maximum volume. + /// </summary> + public abstract double Volume { get; set; } + + /// <summary> + /// Gets or sets the left-right balance. This may or may not be supported + /// by some drivers. + /// -1 is entirely in the left speaker, + /// 0 is equally in both and, + /// 1 is entirely in the right speaker. + /// + /// If this is unsupported by the driver, don't allow impl.Pan to change from zero. + /// </summary> + public abstract double Pan { get; set; } + /// <summary> + /// Gets whether or not it's currently playing. + /// </summary> + public abstract bool IsPlaying { get; } + } +} Added: trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferImpl.cs =================================================================== --- trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferImpl.cs (rev 0) +++ trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferImpl.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -0,0 +1,49 @@ +// The contents of this file are subject to the Mozilla Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is AgateLib. +// +// The Initial Developer of the Original Code is Erik Ylvisaker. +// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. +// All Rights Reserved. +// +// Contributor(s): Erik Ylvisaker +// +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using AgateLib.AudioLib.ImplementationBase; + +namespace AgateLib.AudioLib.ImplementationBase +{ + + /// <summary> + /// Implements a SoundBuffer + /// </summary> + public abstract class SoundBufferImpl : IDisposable + { + /// <summary> + /// Destroys unmanaged resources. + /// </summary> + public abstract void Dispose(); + + /// <summary> + /// Gets or sets the volume this audio file is playing at. + /// 0.0 is completely quiet. + /// 0.5 sounds like half maximum volume + /// 1.0 is maximum volume. + /// </summary> + public abstract double Volume { get; set; } + + public virtual bool Loop { get { return false; } set { } } + + } +} Added: trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferSessionImpl.cs =================================================================== --- trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferSessionImpl.cs (rev 0) +++ trunk/AgateLib/AudioLib/ImplementationBase/SoundBufferSessionImpl.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -0,0 +1,75 @@ +// The contents of this file are subject to the Mozilla Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is AgateLib. +// +// The Initial Developer of the Original Code is Erik Ylvisaker. +// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. +// All Rights Reserved. +// +// Contributor(s): Erik Ylvisaker +// +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using AgateLib.AudioLib.ImplementationBase; + +namespace AgateLib.AudioLib.ImplementationBase +{ + + /// <summary> + /// Represents a playback instance. + /// </summary> + public abstract class SoundBufferSessionImpl : IDisposable + { + /// <summary> + /// Destroyes unmanaged resources. + /// </summary> + public abstract void Dispose(); + + /// <summary> + /// Starts at the beginning. + /// </summary> + public abstract void Play(); + + /// <summary> + /// Stops. + /// </summary> + public abstract void Stop(); + + public abstract int CurrentLocation { get; } + + /// <summary> + /// Gets or sets the volume this audio file is playing at. + /// 0.0 is completely quiet. + /// 0.5 sounds like half maximum volume + /// 1.0 is maximum volume. + /// </summary> + public abstract double Volume { get; set; } + /// <summary> + /// Gets or sets the left-right balance. + /// -1 is left speaker + /// 0 is middle (both) + /// 1 is right. + /// </summary> + public abstract double Pan { get; set; } + /// <summary> + /// Gets whether or not this playback instance is actually playing. + /// </summary> + public abstract bool IsPlaying { get; } + + /// <summary> + /// Initializes the SoundBufferSession to begin playing. + /// </summary> + protected internal abstract void Initialize(); + } + +} Added: trunk/AgateLib/AudioLib/ImplementationBase/StreamingSoundBufferImpl.cs =================================================================== --- trunk/AgateLib/AudioLib/ImplementationBase/StreamingSoundBufferImpl.cs (rev 0) +++ trunk/AgateLib/AudioLib/ImplementationBase/StreamingSoundBufferImpl.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -0,0 +1,30 @@ +// The contents of this file are subject to the Mozilla Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is AgateLib. +// +// The Initial Developer of the Original Code is Erik Ylvisaker. +// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. +// All Rights Reserved. +// +// Contributor(s): Erik Ylvisaker +// +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using AgateLib.AudioLib.ImplementationBase; + +namespace AgateLib.AudioLib.ImplementationBase +{ + class StreamingSoundBufferImpl + { + } +} Modified: trunk/AgateLib/AudioLib/Music.cs =================================================================== --- trunk/AgateLib/AudioLib/Music.cs 2009-12-25 08:10:20 UTC (rev 1164) +++ trunk/AgateLib/AudioLib/Music.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -21,7 +21,7 @@ using System.IO; using System.Text; using AgateLib.Drivers; -using AgateLib.ImplementationBase; +using AgateLib.AudioLib.ImplementationBase; using AgateLib.Utility; namespace AgateLib.AudioLib Modified: trunk/AgateLib/AudioLib/SoundFormat.cs =================================================================== --- trunk/AgateLib/AudioLib/SoundFormat.cs 2009-12-25 08:10:20 UTC (rev 1164) +++ trunk/AgateLib/AudioLib/SoundFormat.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -6,17 +6,31 @@ namespace AgateLib.AudioLib { /// <summary> - /// Enum describing what format the audio data is in. + /// Class describing what format the raw audio data is in. /// </summary> - public enum SoundFormat + public class SoundFormat { + public SoundFormat() + { + BitsPerSample = 16; + Channels = 1; + SamplingFrequency = 44100; + } + + public int BitsPerSample { get; set; } + public int Channels { get; set; } + public int SamplingFrequency { get; set; } + /// <summary> - /// Raw 16 bit signed PCM data. + /// Creates and returns a SoundFormat object + /// for a 16-bit, single channel stream at the + /// specified sampling frequency. /// </summary> - RawInt16, - /// <summary> - /// Wav format. - /// </summary> - Wave, + /// <param name="samplingFrequency">The sampling frequency for the stream.</param> + /// <returns></returns> + public static SoundFormat Pcm16(int samplingFrequency) + { + return new SoundFormat { BitsPerSample = 16, Channels = 1, SamplingFrequency = samplingFrequency }; + } } } Added: trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs =================================================================== --- trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs (rev 0) +++ trunk/AgateLib/AudioLib/StreamingSoundBuffer.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; + +namespace AgateLib.AudioLib +{ + public class StreamingSoundBuffer + { + public StreamingSoundBuffer(Stream input, SoundFormat format) + { + + } + } +} Modified: trunk/AgateLib/BitmapFont/BitmapFontImpl.cs =================================================================== --- trunk/AgateLib/BitmapFont/BitmapFontImpl.cs 2009-12-25 08:10:20 UTC (rev 1164) +++ trunk/AgateLib/BitmapFont/BitmapFontImpl.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -22,8 +22,8 @@ using System.Xml; using AgateLib.DisplayLib; +using AgateLib.DisplayLib.ImplementationBase; using AgateLib.Geometry; -using AgateLib.ImplementationBase; using AgateLib.Resources; using AgateLib.DisplayLib.Cache; Modified: trunk/AgateLib/DisplayLib/Display.cs =================================================================== --- trunk/AgateLib/DisplayLib/Display.cs 2009-12-25 08:10:20 UTC (rev 1164) +++ trunk/AgateLib/DisplayLib/Display.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -20,11 +20,10 @@ using System.Collections.Generic; using System.IO; using System.Text; - +using AgateLib.DisplayLib.ImplementationBase; using AgateLib.DisplayLib.Shaders; using AgateLib.Drivers; using AgateLib.Geometry; -using AgateLib.ImplementationBase; using AgateLib.Utility; namespace AgateLib.DisplayLib Modified: trunk/AgateLib/DisplayLib/DisplayWindow.cs =================================================================== --- trunk/AgateLib/DisplayLib/DisplayWindow.cs 2009-12-25 08:10:20 UTC (rev 1164) +++ trunk/AgateLib/DisplayLib/DisplayWindow.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -19,9 +19,8 @@ using System; using System.Collections.Generic; using System.Text; - using AgateLib.Geometry; -using AgateLib.ImplementationBase; +using AgateLib.DisplayLib.ImplementationBase; namespace AgateLib.DisplayLib { Modified: trunk/AgateLib/DisplayLib/FontSurface.cs =================================================================== --- trunk/AgateLib/DisplayLib/FontSurface.cs 2009-12-25 08:10:20 UTC (rev 1164) +++ trunk/AgateLib/DisplayLib/FontSurface.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -22,8 +22,8 @@ using System.Text; using System.Text.RegularExpressions; using AgateLib.BitmapFont; +using AgateLib.DisplayLib.ImplementationBase; using AgateLib.Geometry; -using AgateLib.ImplementationBase; using AgateLib.Resources; namespace AgateLib.DisplayLib Modified: trunk/AgateLib/DisplayLib/FrameBuffer.cs =================================================================== --- trunk/AgateLib/DisplayLib/FrameBuffer.cs 2009-12-25 08:10:20 UTC (rev 1164) +++ trunk/AgateLib/DisplayLib/FrameBuffer.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -3,7 +3,7 @@ using System.Linq; using System.Text; using AgateLib.Geometry; -using AgateLib.ImplementationBase; +using AgateLib.DisplayLib.ImplementationBase; namespace AgateLib.DisplayLib { Added: trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs =================================================================== --- trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs (rev 0) +++ trunk/AgateLib/DisplayLib/ImplementationBase/DisplayImpl.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -0,0 +1,668 @@ +// The contents of this file are subject to the Mozilla Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is AgateLib. +// +// The Initial Developer of the Original Code is Erik Ylvisaker. +// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. +// All Rights Reserved. +// +// Contributor(s): Erik Ylvisaker +// +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using AgateLib.BitmapFont; +using AgateLib.DisplayLib; +using AgateLib.DisplayLib.Shaders; +using AgateLib.DisplayLib.Shaders.Implementation; +using AgateLib.Drivers; +using AgateLib.Geometry; +using AgateLib.Utility; + +namespace AgateLib.DisplayLib.ImplementationBase +{ + /// <summary> + /// Abstract base class for implementing the Display object. + /// </summary> + public abstract class DisplayImpl : DriverImplBase + { + private double mAlphaThreshold = 5.0 / 255.0; + + private FrameBuffer mRenderTarget; + + #region --- Capabilities Reporting --- + + public abstract bool CapsBool(DisplayBoolCaps caps); + public abstract Size CapsSize(DisplaySizeCaps displaySizeCaps); + + #endregion + + public abstract IEnumerable<DisplayLib.Shaders.ShaderLanguage> SupportedShaderLanguages { get; } + + private static AgateShader mShader; + + /// <summary> + /// Gets or sets the current render target. + /// </summary> + public FrameBuffer RenderTarget + { + get + { + return mRenderTarget; + } + set + { + if (value == mRenderTarget) + return; + + if (mInFrame) + throw new AgateException("Cannot change render target between BeginFrame and EndFrame"); + + FrameBuffer old = mRenderTarget; + mRenderTarget = value; + + OnRenderTargetChange(old); + } + } + + /// <summary> + /// The pixelformat that created surfaces should use. + /// </summary> + public abstract PixelFormat DefaultSurfaceFormat { get; } + + /// <summary> + /// Event raised when the current render target is changed. + /// </summary> + /// <param name="oldRenderTarget"></param> + protected abstract void OnRenderTargetChange(FrameBuffer oldRenderTarget); + /// <summary> + /// Event raised when the render target is resized. + /// </summary> + protected abstract void OnRenderTargetResize(); + + ///// <summary> + ///// Creates a DisplayWindowImpl derived object. + ///// </summary> + ///// <param name="title"></param> + ///// <param name="clientWidth"></param> + ///// <param name="clientHeight"></param> + ///// <param name="allowResize"></param> + ///// <param name="iconFile"></param> + ///// <param name="startFullscreen"></param> + ///// <returns></returns> + //public abstract DisplayWindowImpl CreateDisplayWindow(string title, int clientWidth, int clientHeight, string iconFile, bool startFullscreen, bool allowResize); + ///// <summary> + ///// Creates a DisplayWindowImpl derived object. + ///// </summary> + //public abstract DisplayWindowImpl CreateDisplayWindow(System.Windows.Forms.Control renderTarget); + + /// <summary> + /// Creates a DisplayWindowImpl derived object. + /// </summary> + /// <param name="windowParams"></param> + /// <returns></returns> + public abstract DisplayWindowImpl CreateDisplayWindow(CreateWindowParams windowParams); + + /// <summary> + /// Creates a SurfaceImpl derived object. + /// </summary> + /// <param name="provider"></param> + /// <param name="filename"></param> + /// <returns></returns> + public virtual SurfaceImpl CreateSurface(IFileProvider provider, string filename) + { + return CreateSurface(provider.OpenRead(filename)); + } + /// <summary> + /// Creates a SurfaceImpl derived object. + /// </summary> + public abstract SurfaceImpl CreateSurface(string fileName); + /// <summary> + /// Creates a SurfaceImpl derived object from a stream containing + /// the file contents. + /// </summary> + /// <param name="fileStream"></param> + /// <returns></returns> + public abstract SurfaceImpl CreateSurface(Stream fileStream); + + /// <summary> + /// Creates a SurfaceImpl derived object. + /// </summary> + public abstract SurfaceImpl CreateSurface(Size surfaceSize); + + /// <summary> + /// Creates a SurfaceImpl derived object. + /// Forwards the call to CreateSurface(Size). + /// </summary> + public SurfaceImpl CreateSurface(int width, int height) + { + return CreateSurface(new Size(width, height)); + } + /// <summary> + /// Creates a FontSurfaceImpl derived object. + /// </summary> + /// <param name="fontFamily"></param> + /// <param name="sizeInPoints"></param> + /// <param name="style"></param> + /// <returns></returns> + public abstract FontSurfaceImpl CreateFont(string fontFamily, + float sizeInPoints, FontStyle style); + + /// <summary> + /// Creates a BitmapFontImpl object from the specified options. + /// </summary> + /// <param name="bitmapOptions"></param> + /// <returns></returns> + public abstract FontSurfaceImpl CreateFont(BitmapFontOptions bitmapOptions); + + /// <summary> + /// Gets or sets the threshold value for alpha transparency below which + /// pixels are considered completely transparent, and may not be drawn. + /// </summary> + public double AlphaThreshold + { + get { return mAlphaThreshold; } + set + { + if (value < 0) + mAlphaThreshold = 0; + else if (value > 1) + mAlphaThreshold = 1; + else + mAlphaThreshold = value; + } + } + + #region --- BeginFrame / EndFrame and DeltaTime stuff --- + + private bool mInFrame = false; + private double mDeltaTime; + private double mLastTime; + private bool mRanOnce = false; + + private double mFPSStart; + private int mFrames = 0; + private double mFPS = 0; + + // BeginFrame and EndFrame must be called at the start and end of each frame. + /// <summary> + /// Must be called at the start of each frame. + /// </summary> + public void BeginFrame() + { + if (mInFrame) + throw new AgateException( + "Called BeginFrame() while already inside a BeginFrame..EndFrame block!\n" + + "Did you forget to call EndFrame()?"); + if (mRenderTarget == null) + throw new AgateException("BeginFrame was called but the render target has not been set."); + + mInFrame = true; + + OnBeginFrame(); + } + + /// <summary> + /// A version of EndFrame must be called at the end of each frame. + /// This version allows the caller to indicate to the implementation whether or + /// not it is preferred to wait for the vertical blank to do the drawing. + /// </summary> + public void EndFrame() + { + CheckInFrame("EndFrame"); + + OnEndFrame(); + + mFrames++; + mInFrame = false; + + CalcDeltaTime(); + } + + private void CalcDeltaTime() + { + double now = Core.GetTime(); + + if (mRanOnce) + { + mDeltaTime = now - mLastTime; + mLastTime = now; + + if (now - mFPSStart > 200) + { + double time = (now - mFPSStart) * 0.001; + + // average current framerate with that of the last update + mFPS = (mFrames / time) * 0.8 + mFPS * 0.2; + + mFPSStart = now; + mFrames = 0; + + } + + // hack to make sure delta time is never zero. + if (mDeltaTime == 0.0) + { + System.Threading.Thread.Sleep(1); + CalcDeltaTime(); + return; + } + } + else + { + mDeltaTime = 0; + mLastTime = now; + + mFPSStart = now; + mFrames = 0; + + mRanOnce = true; + } + } + + /// <summary> + /// Called by BeginFrame to let the driver know to do its setup stuff for starting + /// the next render pass. + /// </summary> + protected abstract void OnBeginFrame(); + /// <summary> + /// Called by EndFrame to let the driver know that it's time to swap buffers or whatever + /// is required to finish rendering the frame. + /// </summary> + protected abstract void OnEndFrame(); + + /// <summary> + /// Checks to see whether or not we are currently inside a + /// BeginFrame..EndFrame block, and throws an exception if + /// we are not. This is only meant to be called + /// from functions which must operate between these calls. + /// </summary> + /// <param name="functionName">The name of the calling function, + /// for debugging purposes.</param> + public void CheckInFrame(string functionName) + { + if (mInFrame) + return; + + throw new AgateException( + functionName + " called outside of BeginFrame..EndFrame block!" + + "Did you forget to call BeginFrame() before doing drawing?"); + } + + /// <summary> + /// Gets the amount of time in milliseconds that has passed between this frame + /// and the last one. + /// </summary> + public double DeltaTime + { + get + { + return mDeltaTime; + } + } + /// <summary> + /// Provides a means to set the value returned by DeltaTime. + /// </summary> + /// <param name="deltaTime"></param> + public void SetDeltaTime(double deltaTime) + { + mDeltaTime = deltaTime; + } + /// <summary> + /// Gets the framerate + /// </summary> + public double FramesPerSecond + { + get { return mFPS; } + } + + #endregion + [Obsolete("Use Display.Caps instead.", true)] + public virtual Size MaxSurfaceSize { get { return Display.Caps.MaxSurfaceSize; } } + + #region --- SetClipRect --- + + /// <summary> + /// Set the current clipping rect. + /// </summary> + /// <param name="newClipRect"></param> + public abstract void SetClipRect(Rectangle newClipRect); + + #endregion + #region --- Direct modification of the back buffer --- + + /// <summary> + /// Clears the buffer to black. + /// </summary> + public virtual void Clear() + { + Clear(Color.Black); + } + /// <summary> + /// Clears the buffer to the specified color. + /// </summary> + /// <param name="color"></param> + public abstract void Clear(Color color); + /// <summary> + /// Clears a region of the buffer to the specified color. + /// </summary> + /// <param name="color"></param> + /// <param name="dest"></param> + public abstract void Clear(Color color, Rectangle dest); + + /// <summary> + /// Draws an ellipse by making a bunch of connected lines. + /// + /// Info for developers: + /// The base class implements this by calculating points on the circumference of + /// the ellipse, then making a call to DrawLines. + /// </summary> + /// <param name="rect"></param> + /// <param name="color"></param> + public virtual void DrawEllipse(Rectangle rect, Color color) + { + Point center = new Point(rect.Left + rect.Width / 2, + rect.Top + rect.Height / 2); + + double radiusX = rect.Width / 2; + double radiusY = rect.Height / 2; + double h = Math.Pow(radiusX - radiusY, 2) / Math.Pow(radiusX + radiusY, 2); + + //Ramanujan's second approximation to the circumference of an ellipse. + double circumference = + Math.PI * (radiusX + radiusY) * (1 + 3 * h / (10 + Math.Sqrt(4 - 3 * h))); + + // we will take the circumference as being the number of points to draw + // on the ellipse. + Point[] pts = new Point[(int)Math.Ceiling(circumference * 2)]; + double step = 2 * Math.PI / (pts.Length - 1); + + for (int i = 0; i < pts.Length; i++) + { + pts[i] = new Point((int)(center.X + radiusX * Math.Cos(step * i) + 0.5), + (int)(center.Y + radiusY * Math.Sin(step * i) + 0.5)); + } + + DrawLines(pts, color); + } + + + public virtual void FillEllipse(RectangleF rect, Color color) + { + PointF center = new PointF(rect.Left + rect.Width / 2, + rect.Top + rect.Height / 2); + + double radiusX = rect.Width / 2; + double radiusY = rect.Height / 2; + double h = Math.Pow(radiusX - radiusY, 2) / Math.Pow(radiusX + radiusY, 2); + + //Ramanujan's second approximation to the circumference of an ellipse. + double circumference = + Math.PI * (radiusX + radiusY) * (1 + 3 * h / (10 + Math.Sqrt(4 - 3 * h))); + + // we will take the circumference as being the number of points to draw + // on the ellipse. + PointF[] pts = new PointF[(int)Math.Ceiling(circumference * 2)]; + double step = 2 * Math.PI / (pts.Length - 1); + + for (int i = 0; i < pts.Length; i++) + { + pts[i] = new PointF((float)(center.X + radiusX * Math.Cos(step * i) + 0.5), + (float)(center.Y + radiusY * Math.Sin(step * i) + 0.5)); + } + + FillPolygon(pts, color); + } + + public abstract void FillPolygon(PointF[] pts, Color color); + + /// <summary> + /// Draws a line between the two specified endpoints. + /// </summary> + /// <param name="a"></param> + /// <param name="b"></param> + /// <param name="color"></param> + public abstract void DrawLine(Point a, Point b, Color color); + /// <summary> + /// Draws a bunch of connected points. + /// + /// Info for developers: + /// The base class implements this by making several calls to DrawLine. + /// You may want to override this one to minimize state changes. + /// </summary> + /// <param name="pt"></param> + /// <param name="color"></param> + public virtual void DrawLines(Point[] pt, Color color) + { + for (int i = 0; i < pt.Length - 1; i++) + DrawLine(pt[i], pt[i + 1], color); + } + /// <summary> + /// Draws a bunch of unconnected lines. + /// <para> + /// Info for developers: + /// pt should be an array whose length is even.</para> + /// </summary> + /// <param name="pt"></param> + /// <param name="color"></param> + public virtual void DrawLineSegments(Point[] pt, Color color) + { + for (int i = 0; i < pt.Length; i += 2) + DrawLine(pt[i], pt[i + 1], color); + } + + /// <summary> + /// Draws the outline of a rectangle. + /// </summary> + /// <param name="rect"></param> + /// <param name="color"></param> + public abstract void DrawRect(Rectangle rect, Color color); + /// <summary> + /// Draws the outline of a rectangle. + /// </summary> + /// <param name="rect"></param> + /// <param name="color"></param> + public abstract void DrawRect(RectangleF rect, Color color); + /// <summary> + /// Draws a filled rectangle. + /// </summary> + /// <param name="rect"></param> + /// <param name="color"></param> + public abstract void FillRect(Rectangle rect, Color color); + /// <summary> + /// Draws a filled rectangle with a gradient. + /// </summary> + /// <param name="rect"></param> + /// <param name="color"></param> + public abstract void FillRect(Rectangle rect, Gradient color); + /// <summary> + /// Draws a filled rectangle. + /// </summary> + /// <param name="rect"></param> + /// <param name="color"></param> + public abstract void FillRect(RectangleF rect, Color color); + /// <summary> + /// Draws a filled rectangle with a gradient. + /// </summary> + /// <param name="rect"></param> + /// <param name="color"></param> + public abstract void FillRect(RectangleF rect, Gradient color); + + #endregion + + /// <summary> + /// Builds a surface of the specified size, using the information + /// generated by the SurfacePacker. + /// </summary> + /// <param name="size"></param> + /// <param name="packedRects"></param> + /// <returns></returns> + public virtual Surface BuildPackedSurface(Size size, SurfacePacker.RectPacker<Surface> packedRects) + { + PixelBuffer buffer = new PixelBuffer(Display.DefaultSurfaceFormat, size); + + foreach (SurfacePacker.RectHolder<Surface> rect in packedRects) + { + Surface surf = rect.Tag; + Rectangle dest = rect.Rect; + + PixelBuffer pixels = surf.ReadPixels(); + + buffer.CopyFrom(pixels, new Rectangle(Point.Empty, surf.SurfaceSize), + dest.Location, false); + } + + Surface retval = new Surface(buffer); + + foreach (SurfacePacker.RectHolder<Surface> rect in packedRects) + { + rect.Tag.SetSourceSurface(retval, rect.Rect); + } + + return retval; + + } + + /// <summary> + /// Enumerates a list of screen modes. + /// </summary> + /// <returns></returns> + public virtual ScreenMode[] EnumScreenModes() + { + return new ScreenMode[] { }; + } + + /// <summary> + /// Flushes the 2D draw buffer, if applicable. + /// </summary> + public abstract void FlushDrawBuffer(); + + /// <summary> + /// Sets the boundary coordinates of the window. + /// </summary> + /// <param name="region"></param> + [Obsolete] + public virtual void SetOrthoProjection(Rectangle region) + { } + + /// <summary> + /// Processes pending events. + /// </summary> + protected internal abstract void ProcessEvents(); + + /// <summary> + /// Returns true if the application is idle and processing of events can be skipped. + /// Base method just returns false to force processing of events at every frame. + /// </summary> + protected internal virtual bool IsAppIdle + { + get { return false; } + } + + /// <summary> + /// + /// </summary> + /// <param name="pixelBuffer"></param> + /// <param name="filename"></param> + /// <param name="format"></param> + protected internal virtual void SavePixelBuffer(PixelBuffer pixelBuffer, string filename, ImageFileFormat format) + { + throw new AgateException("Display driver does not support saving pixel buffers."); + } + + /// <summary> + /// Makes the OS mouse pointer visible. + /// </summary> + protected internal abstract void ShowCursor(); + /// <summary> + /// Hides the OS mouse pointer. + /// </summary> + protected internal abstract void HideCursor(); + + + protected internal virtual VertexBufferImpl CreateVertexBuffer( + Geometry.VertexTypes.VertexLayout layout, int vertexCount) + { + throw new AgateException("Cannot create a vertex buffer with a driver that does not support 3D."); + } + + protected internal virtual IndexBufferImpl CreateIndexBuffer(IndexBufferType type, int size) + { + throw new AgateException("Cannot create an index buffer with a driver that does not support 3D."); + } + + + /// <summary> + /// Creates one of the build in shaders in AgateLib. Implementers should + /// return null for any built in shader that is not supported. + /// Basic2DShader must have an implementation, but any other shader can be unsupported. + /// </summary> + /// <param name="BuiltInShaderType"></param> + /// <returns></returns> + protected internal abstract AgateShaderImpl CreateBuiltInShader(AgateLib.DisplayLib.Shaders.Implementation.BuiltInShader BuiltInShaderType); + + /// <summary> + /// Creates a + /// </summary> + /// <param name="size"></param> + protected internal abstract FrameBufferImpl CreateFrameBuffer(Size size); + + /// <summary> + /// Override this method if shaders are supported. + /// Only call the base class method if shaders aren't supported, as it throws a NotSupportedException. + /// </summary> + /// <returns></returns> + [Obsolete] + protected internal virtual ShaderCompilerImpl CreateShaderCompiler() + { + throw new NotSupportedException("The current driver does not support shaders."); + } + + [Obsolete] + public virtual Effect Effect + { + get { return null; } + set { throw new NotSupportedException("The current driver does not support shaders."); } + } + public virtual AgateShader Shader + { + get { return mShader; } + set + { + FlushDrawBuffer(); + + if (mShader != null) + mShader.End(); + + mShader = value; + mShader.Begin(); + } + } + + [Obsolete] + protected void InitializeShaders() + { + if (Display.Caps.SupportsCustomShaders) + { + ShaderCompiler.Initialize(CreateShaderCompiler()); + } + else + ShaderCompiler.Disable(); + } + + + + protected internal abstract bool GetRenderState(RenderStateBool renderStateBool); + protected internal abstract void SetRenderState(RenderStateBool renderStateBool, bool value); + + } +} Added: trunk/AgateLib/DisplayLib/ImplementationBase/DisplayWindowImpl.cs =================================================================== --- trunk/AgateLib/DisplayLib/ImplementationBase/DisplayWindowImpl.cs (rev 0) +++ trunk/AgateLib/DisplayLib/ImplementationBase/DisplayWindowImpl.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -0,0 +1,113 @@ +// The contents of this file are subject to the Mozilla Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is AgateLib. +// +// The Initial Developer of the Original Code is Erik Ylvisaker. +// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. +// All Rights Reserved. +// +// Contributor(s): Erik Ylvisaker +// +using System; +using System.Collections.Generic; +using System.Text; + +using AgateLib.Geometry; +using AgateLib.Utility; + +namespace AgateLib.DisplayLib.ImplementationBase +{ + /// <summary> + /// Implementation of DisplayWindow class. + /// </summary> + public abstract class DisplayWindowImpl : IDisposable + { + /// <summary> + /// Disposes of unmanaged resources. + /// </summary> + public abstract void Dispose(); + /// <summary> + /// Returns true if the DisplayWindowImpl has been closed. + /// This happens if the user clicks the close box, or Dispose is called. + /// </summary> + public abstract bool IsClosed { get; } + /// <summary> + /// Returns true if this DisplayWindowImpl is being used as a full-screen + /// device. + /// </summary> + public abstract bool IsFullScreen { get; } + + /// <summary> + /// Returns the frame buffer that is rendered to for rendering to this + /// window. + /// </summary> + public abstract FrameBufferImpl FrameBuffer { get; } + + /// <summary> + /// Sets the display to windowed. Does nothing if the display is already + /// windowed. The DisplayWindow retains the same height and width as the + /// previous full screen resolution. + /// </summary> + public abstract void SetWindowed(); + + /// <summary> + /// Sets the display to a full screen Display. This overload should use the + /// same resolution as the desktop environment. + /// </summary> + public abstract void SetFullScreen(); + /// <summary> + /// Sets the display to a full screen Display. The resolution chosen is + /// driver/video card/monitor dependent, but it should be fairly close to + /// values specified. + /// </summary> + /// <param name="width"></param> + /// <param name="height"></param> + /// <param name="bpp"></param> + public abstract void SetFullScreen(int width, int height, int bpp); + + /// <summary> + /// Gets or sets the size of the render area. + /// </summary> + public abstract Size Size { get; set; } + + /// <summary> + /// Gets or sets the width of the render area. + /// </summary> + public int Width + { + get { return Size.Width; } + set + { + Size = new Size(value, Size.Height); + } + } + /// <summary> + /// Gets or sets the height of the render area. + /// </summary> + public int Height + { + get { return Size.Height; } + set + { + Size = new Size(Size.Width, value); + } + } + /// <summary> + /// Gets or sets the window title. + /// </summary> + public abstract string Title { get; set; } + /// <summary> + /// Gets or sets the mouse position within the render area. + /// </summary> + public abstract Point MousePosition { get; set; } + + } +} \ No newline at end of file Added: trunk/AgateLib/DisplayLib/ImplementationBase/FontSurfaceImpl.cs =================================================================== --- trunk/AgateLib/DisplayLib/ImplementationBase/FontSurfaceImpl.cs (rev 0) +++ trunk/AgateLib/DisplayLib/ImplementationBase/FontSurfaceImpl.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -0,0 +1,69 @@ +// The contents of this file are subject to the Mozilla Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is AgateLib. +// +// The Initial Developer of the Original Code is Erik Ylvisaker. +// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. +// All Rights Reserved. +// +// Contributor(s): Erik Ylvisaker +// +using System; +using System.Collections.Generic; +using System.Text; + +using AgateLib.DisplayLib; +using AgateLib.Geometry; + +namespace AgateLib.DisplayLib.ImplementationBase +{ + /// <summary> + /// Implements a FontSurface + /// </summary> + public abstract class FontSurfaceImpl : IDisposable + { + private string mFontName = "Unknown"; + + /// <summary> + /// Returns the name/size of the font. + /// </summary> + public string FontName + { + get { return mFontName; } + protected internal set { mFontName = value; } + } + + /// <summary> + /// Gets the height of a single line of text. + /// </summary> + public abstract int FontHeight { get; } + + /// <summary> + /// Draws text to the screen. + /// </summary> + /// <param name="state"></param> + public abstract void DrawText(FontState state); + + /// <summary> + /// Disposes of unmanaged resources. + /// </summary> + public abstract void Dispose(); + + /// <summary> + /// Measures the size of the given string. + /// </summary> + /// <param name="state"></param> + /// <param name="text"></param> + /// <returns></returns> + public abstract Size MeasureString(FontState state, string text); + } + +} Added: trunk/AgateLib/DisplayLib/ImplementationBase/FrameBufferImpl.cs =================================================================== --- trunk/AgateLib/DisplayLib/ImplementationBase/FrameBufferImpl.cs (rev 0) +++ trunk/AgateLib/DisplayLib/ImplementationBase/FrameBufferImpl.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -0,0 +1,76 @@ +// The contents of this file are subject to the Mozilla Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is AgateLib. +// +// The Initial Developer of the Original Code is Erik Ylvisaker. +// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. +// All Rights Reserved. +// +// Contributor(s): Erik Ylvisaker +// +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using AgateLib.Geometry; + +namespace AgateLib.DisplayLib.ImplementationBase +{ + /// <summary> + /// Base class for implementing a render target. + /// </summary> + public abstract class FrameBufferImpl : IDisposable + { + /// <summary> + /// Disposes of the unmanaged resources. + /// </summary> + public abstract void Dispose(); + + /// <summary> + /// Size in pixels of the render target. + /// </summary> + public abstract Size Size { get; } + + /// <summary> + /// Width in pixels of the render target. + /// </summary> + public int Width { get { return Size.Width; } } + /// <summary> + /// Height in pixels of the render target. + /// </summary> + public int Height { get { return Size.Height; } } + + /// <summary> + /// Begins rendering to the render target. + /// </summary> + public abstract void BeginRender(); + /// <summary> + /// Ends rendering to the render target. + /// </summary> + public abstract void EndRender(); + + /// <summary> + /// Return true to indicate that the back buffer can be read and used as a texture. + /// </summary> + public virtual bool CanAccessRenderTarget + { + get { return false; } + } + /// <summary> + /// Gets the SurfaceImpl which points to the render target, to be used as a texture. + /// Throw an AgateException if CanAccessBackBuffer is false. + /// </summary> + public virtual SurfaceImpl RenderTarget + { + get { throw new AgateException("Cannot access the back buffer in this frame buffer."); } + } + } +} Added: trunk/AgateLib/DisplayLib/ImplementationBase/IndexBufferImpl.cs =================================================================== --- trunk/AgateLib/DisplayLib/ImplementationBase/IndexBufferImpl.cs (rev 0) +++ trunk/AgateLib/DisplayLib/ImplementationBase/IndexBufferImpl.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -0,0 +1,53 @@ +// The contents of this file are subject to the Mozilla Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is AgateLib. +// +// The Initial Developer of the Original Code is Erik Ylvisaker. +// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. +// All Rights Reserved. +// +// Contributor(s): Erik Ylvisaker +// +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using AgateLib.DisplayLib; + +namespace AgateLib.DisplayLib.ImplementationBase +{ + /// <summary> + /// Base class for implementing a hardware stored index buffer. + /// </summary> + public abstract class IndexBufferImpl + { + /// <summary> + /// Writes indices to the index buffer. + /// </summary> + /// <param name="indices"></param> + public abstract void WriteIndices(short[] indices); + /// <summary> + /// Writes indices to the index buffer. + /// </summary> + /// <param name="indices"></param> + public abstract void WriteIndices(int[] indices); + + /// <summary> + /// Gets the number of indices in the index buffer. + /// </summary> + public abstract int Count { get; } + + /// <summary> + /// Gets the type of indices in the index buffer. + /// </summary> + public abstract IndexBufferType IndexType { get; } + } +} Added: trunk/AgateLib/DisplayLib/ImplementationBase/ShaderCompilerImpl.cs =================================================================== --- trunk/AgateLib/DisplayLib/ImplementationBase/ShaderCompilerImpl.cs (rev 0) +++ trunk/AgateLib/DisplayLib/ImplementationBase/ShaderCompilerImpl.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -0,0 +1,41 @@ +// The contents of this file are subject to the Mozilla Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is AgateLib. +// +// The Initial Developer of the Original Code is Erik Ylvisaker. +// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. +// All Rights Reserved. +// +// Contributor(s): Erik Ylvisaker +// +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using AgateLib.DisplayLib.Shaders; + +namespace AgateLib.DisplayLib.ImplementationBase +{ + /// <summary> + /// + /// </summary> + [Obsolete] + public abstract class ShaderCompilerImpl + { + /// <summary> + /// + /// </summary> + /// <param name="language"></param> + /// <param name="effectSource"></param> + /// <returns></returns> + public abstract Effect CompileEffect(ShaderLanguage language, string effectSource); + } +} Added: trunk/AgateLib/DisplayLib/ImplementationBase/SurfaceImpl.cs =================================================================== --- trunk/AgateLib/DisplayLib/ImplementationBase/SurfaceImpl.cs (rev 0) +++ trunk/AgateLib/DisplayLib/ImplementationBase/SurfaceImpl.cs 2009-12-28 19:44:19 UTC (rev 1165) @@ -0,0 +1,252 @@ +// The contents of this file are subject to the Mozilla Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is AgateLib. +// +// The Initial Developer of the Original Code is Erik Ylvisaker. +// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. +// All Rights Reserved. +// +// Contributor(s): Erik Ylvisaker +// +using System; +using System.Collections.Generic; +using System.Text; + +using AgateLib.DisplayLib; +using AgateLib.Geometry; + +namespace AgateLib.DisplayLib.ImplementationBase +{ + /// <summary> + /// Base class for implementing a Surface structure. + /// </summary> + public abstract class SurfaceImpl : IDisposable + { + #region --- Private Fields --- + + private bool mIsDisposed = false; + private bool mShouldBePacked = true; + + #endregion + + #region --- Creation / Destruction --- + + /// <summary> + /// Constructs a SurfaceImpl object. + /// </summary> + public SurfaceImpl() + { + } + /// <summary> + /// Frees unmanaged resources. + /// </summary> + public abstract void Dispose(); + + #endregion + + #region --- Dra... [truncated message content] |
From: <ka...@us...> - 2009-12-25 08:10:30
|
Revision: 1164 http://agate.svn.sourceforge.net/agate/?rev=1164&view=rev Author: kanato Date: 2009-12-25 08:10:20 +0000 (Fri, 25 Dec 2009) Log Message: ----------- Hack to deal with exception on XAudio2 disposal. Modified Paths: -------------- trunk/Drivers/AgateSDX/AgateSDX.csproj trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs Modified: trunk/Drivers/AgateSDX/AgateSDX.csproj =================================================================== --- trunk/Drivers/AgateSDX/AgateSDX.csproj 2009-12-25 07:42:17 UTC (rev 1163) +++ trunk/Drivers/AgateSDX/AgateSDX.csproj 2009-12-25 08:10:20 UTC (rev 1164) @@ -66,6 +66,7 @@ </NoWarn> </PropertyGroup> <ItemGroup> + <Reference Include="SlimDX, Version=2.0.8.42, Culture=neutral, PublicKeyToken=b1b0c32fd1ffe4f9, processorArchitecture=x86" /> <Reference Include="System"> <Name>System</Name> </Reference> @@ -155,10 +156,6 @@ </EmbeddedResource> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\..\..\..\slimdx-read-only\build\SlimDX.vcproj"> - <Project>{8ECCE443-0440-40F4-A94C-F02E027282C3}</Project> - <Name>SlimDX</Name> - </ProjectReference> <ProjectReference Include="..\..\AgateLib\AgateLib.csproj"> <Project>{9490B719-829E-43A7-A5FE-8001F8A81759}</Project> <Name>AgateLib</Name> Modified: trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs =================================================================== --- trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs 2009-12-25 07:42:17 UTC (rev 1163) +++ trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs 2009-12-25 08:10:20 UTC (rev 1164) @@ -55,7 +55,13 @@ } public override void Dispose() { - mDevice.Dispose(); + // hack because there is access violation when XAudio2 shuts down? + try + { + mDevice.Dispose(); + } + catch + { } } public override SoundBufferImpl CreateSoundBuffer(Stream inStream) @@ -202,6 +208,8 @@ double mVolume; double mPan; bool mIsPlaying; + bool mLoop = false; + bool mDisposing = false; public SDX_SoundBufferSession(XAudio2_Audio audio, SDX_SoundBuffer source) { @@ -209,18 +217,36 @@ mSource = source; mBuffer = source.Buffer; mVolume = source.Volume; + mLoop = source.Loop; mVoice = new SourceVoice(mAudio.Device, mSource.Format); mVoice.BufferEnd += new EventHandler<ContextEventArgs>(mVoice_BufferEnd); + } void mVoice_BufferEnd(object sender, ContextEventArgs e) { - mIsPlaying = false; + if (mDisposing) + { + mVoice.Dispose(); + return; + } + + if (mLoop) + { + mVoice.SubmitSourceBuffer(mBuffer); + } + else + { + mIsPlaying = false; + } } public override void Dispose() { - mVoice.Dispose(); + mLoop = false; + mVoice.Stop(); + + mDisposing = true; } protected override void Initialize() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ka...@us...> - 2009-12-25 07:42:25
|
Revision: 1163 http://agate.svn.sourceforge.net/agate/?rev=1163&view=rev Author: kanato Date: 2009-12-25 07:42:17 +0000 (Fri, 25 Dec 2009) Log Message: ----------- Improvements to SDX audio. Modified Paths: -------------- trunk/AgateLib/AudioLib/SoundBufferSession.cs trunk/AgateLib/AudioLib/SoundFormat.cs trunk/AgateLib-Windows.sln trunk/Drivers/AgateSDX/AgateSDX.csproj trunk/Drivers/AgateSDX/Reporter.cs trunk/Drivers/AgateSDX/SDX_Input.cs trunk/Tests/AudioTests/GenerateAudio.cs Added Paths: ----------- trunk/Drivers/AgateSDX/XAud2/ trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs Removed Paths: ------------- trunk/Drivers/AgateSDX/SDX_Audio.cs Modified: trunk/AgateLib/AudioLib/SoundBufferSession.cs =================================================================== --- trunk/AgateLib/AudioLib/SoundBufferSession.cs 2009-12-25 05:22:19 UTC (rev 1162) +++ trunk/AgateLib/AudioLib/SoundBufferSession.cs 2009-12-25 07:42:17 UTC (rev 1163) @@ -55,10 +55,10 @@ internal void Initialize() { + impl.Initialize(); + Volume = mSource.Volume; Pan = mSource.Pan; - - impl.Initialize(); } /// <summary> Modified: trunk/AgateLib/AudioLib/SoundFormat.cs =================================================================== --- trunk/AgateLib/AudioLib/SoundFormat.cs 2009-12-25 05:22:19 UTC (rev 1162) +++ trunk/AgateLib/AudioLib/SoundFormat.cs 2009-12-25 07:42:17 UTC (rev 1163) @@ -5,9 +5,18 @@ namespace AgateLib.AudioLib { + /// <summary> + /// Enum describing what format the audio data is in. + /// </summary> public enum SoundFormat { - Raw16, + /// <summary> + /// Raw 16 bit signed PCM data. + /// </summary> + RawInt16, + /// <summary> + /// Wav format. + /// </summary> Wave, } } Modified: trunk/AgateLib-Windows.sln =================================================================== --- trunk/AgateLib-Windows.sln 2009-12-25 05:22:19 UTC (rev 1162) +++ trunk/AgateLib-Windows.sln 2009-12-25 07:42:17 UTC (rev 1163) @@ -23,44 +23,149 @@ TODO.txt = TODO.txt EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SlimDX", "..\..\slimdx-read-only\build\SlimDX.vcproj", "{8ECCE443-0440-40F4-A94C-F02E027282C3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|Win32 = Debug|Win32 + Public|Any CPU = Public|Any CPU + Public|Mixed Platforms = Public|Mixed Platforms + Public|Win32 = Public|Win32 Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Win32.ActiveCfg = Debug|x86 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|Any CPU.ActiveCfg = Release|x86 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|Mixed Platforms.ActiveCfg = Release|x86 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|Mixed Platforms.Build.0 = Release|x86 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Public|Win32.ActiveCfg = Release|x86 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Any CPU.Build.0 = Release|Any CPU + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Mixed Platforms.Build.0 = Release|x86 + {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Win32.ActiveCfg = Release|x86 {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Debug|Win32.ActiveCfg = Debug|x86 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Public|Any CPU.ActiveCfg = Release|x86 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Public|Mixed Platforms.ActiveCfg = Release|x86 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Public|Mixed Platforms.Build.0 = Release|x86 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Public|Win32.ActiveCfg = Release|x86 {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|Any CPU.ActiveCfg = Release|Any CPU {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|Any CPU.Build.0 = Release|Any CPU + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|Mixed Platforms.Build.0 = Release|x86 + {BEF6D67B-4C84-4D3E-8047-6DB2C8754D77}.Release|Win32.ActiveCfg = Release|x86 {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Debug|Win32.ActiveCfg = Debug|x86 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Public|Any CPU.ActiveCfg = Release|x86 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Public|Mixed Platforms.ActiveCfg = Release|x86 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Public|Mixed Platforms.Build.0 = Release|x86 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Public|Win32.ActiveCfg = Release|x86 {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|Any CPU.ActiveCfg = Release|Any CPU {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|Any CPU.Build.0 = Release|Any CPU + {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|Mixed Platforms.Build.0 = Release|x86 + {164A785D-924E-40FB-A517-D7E677F3B53A}.Release|Win32.ActiveCfg = Release|x86 {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Debug|Any CPU.Build.0 = Debug|Any CPU + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Debug|Win32.ActiveCfg = Debug|x86 + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Public|Any CPU.ActiveCfg = Release|x86 + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Public|Mixed Platforms.ActiveCfg = Release|x86 + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Public|Mixed Platforms.Build.0 = Release|x86 + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Public|Win32.ActiveCfg = Release|x86 {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Release|Any CPU.ActiveCfg = Release|Any CPU {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Release|Any CPU.Build.0 = Release|Any CPU + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Release|Mixed Platforms.Build.0 = Release|x86 + {00C7FA95-98F4-43D9-9B63-34122B1DB003}.Release|Win32.ActiveCfg = Release|x86 {EF993B30-D9A9-4962-80BB-6826D39B3465}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EF993B30-D9A9-4962-80BB-6826D39B3465}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Debug|Win32.ActiveCfg = Debug|Any CPU + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Public|Any CPU.ActiveCfg = Release|Any CPU + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Public|Any CPU.Build.0 = Release|Any CPU + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Public|Mixed Platforms.ActiveCfg = Release|Any CPU + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Public|Mixed Platforms.Build.0 = Release|Any CPU + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Public|Win32.ActiveCfg = Release|Any CPU {EF993B30-D9A9-4962-80BB-6826D39B3465}.Release|Any CPU.ActiveCfg = Release|Any CPU {EF993B30-D9A9-4962-80BB-6826D39B3465}.Release|Any CPU.Build.0 = Release|Any CPU - {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DC687DB2-90A8-484D-AB99-B3D29FDD8D44}.Release|Any CPU.Build.0 = Release|Any CPU + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {EF993B30-D9A9-4962-80BB-6826D39B3465}.Release|Win32.ActiveCfg = Release|Any CPU {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Debug|Win32.ActiveCfg = Debug|x86 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|Any CPU.ActiveCfg = Release|x86 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|Mixed Platforms.ActiveCfg = Release|x86 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|Mixed Platforms.Build.0 = Release|x86 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Public|Win32.ActiveCfg = Release|x86 {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Any CPU.ActiveCfg = Release|Any CPU {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Any CPU.Build.0 = Release|Any CPU + {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Mixed Platforms.Build.0 = Release|x86 + {9490B719-829E-43A7-A5FE-8001F8A81759}.Release|Win32.ActiveCfg = Release|x86 {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Debug|Win32.ActiveCfg = Debug|x86 + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Public|Any CPU.ActiveCfg = Release|x86 + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Public|Mixed Platforms.ActiveCfg = Release|x86 + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Public|Mixed Platforms.Build.0 = Release|x86 + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Public|Win32.ActiveCfg = Release|x86 {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Release|Any CPU.ActiveCfg = Release|Any CPU {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Release|Any CPU.Build.0 = Release|Any CPU + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Release|Mixed Platforms.Build.0 = Release|x86 + {424C08A9-6CC6-4FFF-B782-CBD58BC42FCA}.Release|Win32.ActiveCfg = Release|x86 {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Debug|Win32.ActiveCfg = Debug|x86 + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Public|Any CPU.ActiveCfg = Release|x86 + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Public|Mixed Platforms.ActiveCfg = Release|x86 + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Public|Mixed Platforms.Build.0 = Release|x86 + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Public|Win32.ActiveCfg = Release|x86 {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Release|Any CPU.ActiveCfg = Release|Any CPU {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Release|Any CPU.Build.0 = Release|Any CPU + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Release|Mixed Platforms.Build.0 = Release|x86 + {9E095F03-BA3F-4EAD-A905-2A2647CE4405}.Release|Win32.ActiveCfg = Release|x86 + {8ECCE443-0440-40F4-A94C-F02E027282C3}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {8ECCE443-0440-40F4-A94C-F02E027282C3}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {8ECCE443-0440-40F4-A94C-F02E027282C3}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {8ECCE443-0440-40F4-A94C-F02E027282C3}.Debug|Win32.ActiveCfg = Debug|Win32 + {8ECCE443-0440-40F4-A94C-F02E027282C3}.Debug|Win32.Build.0 = Debug|Win32 + {8ECCE443-0440-40F4-A94C-F02E027282C3}.Public|Any CPU.ActiveCfg = Public|Win32 + {8ECCE443-0440-40F4-A94C-F02E027282C3}.Public|Mixed Platforms.ActiveCfg = Public|Win32 + {8ECCE443-0440-40F4-A94C-F02E027282C3}.Public|Mixed Platforms.Build.0 = Public|Win32 + {8ECCE443-0440-40F4-A94C-F02E027282C3}.Public|Win32.ActiveCfg = Public|Win32 + {8ECCE443-0440-40F4-A94C-F02E027282C3}.Public|Win32.Build.0 = Public|Win32 + {8ECCE443-0440-40F4-A94C-F02E027282C3}.Release|Any CPU.ActiveCfg = Release|Win32 + {8ECCE443-0440-40F4-A94C-F02E027282C3}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {8ECCE443-0440-40F4-A94C-F02E027282C3}.Release|Mixed Platforms.Build.0 = Release|Win32 + {8ECCE443-0440-40F4-A94C-F02E027282C3}.Release|Win32.ActiveCfg = Release|Win32 + {8ECCE443-0440-40F4-A94C-F02E027282C3}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: trunk/Drivers/AgateSDX/AgateSDX.csproj =================================================================== --- trunk/Drivers/AgateSDX/AgateSDX.csproj 2009-12-25 05:22:19 UTC (rev 1162) +++ trunk/Drivers/AgateSDX/AgateSDX.csproj 2009-12-25 07:42:17 UTC (rev 1163) @@ -66,9 +66,6 @@ </NoWarn> </PropertyGroup> <ItemGroup> - <Reference Include="SlimDX"> - <Name>SlimDX</Name> - </Reference> <Reference Include="System"> <Name>System</Name> </Reference> @@ -117,7 +114,7 @@ <Compile Include="Reporter.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="SDX_Audio.cs"> + <Compile Include="XAud2\XAudio2_Audio.cs"> <SubType>Code</SubType> </Compile> <Compile Include="SDX_Display.cs"> @@ -158,6 +155,10 @@ </EmbeddedResource> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\..\..\..\slimdx-read-only\build\SlimDX.vcproj"> + <Project>{8ECCE443-0440-40F4-A94C-F02E027282C3}</Project> + <Name>SlimDX</Name> + </ProjectReference> <ProjectReference Include="..\..\AgateLib\AgateLib.csproj"> <Project>{9490B719-829E-43A7-A5FE-8001F8A81759}</Project> <Name>AgateLib</Name> Modified: trunk/Drivers/AgateSDX/Reporter.cs =================================================================== --- trunk/Drivers/AgateSDX/Reporter.cs 2009-12-25 05:22:19 UTC (rev 1162) +++ trunk/Drivers/AgateSDX/Reporter.cs 2009-12-25 07:42:17 UTC (rev 1163) @@ -35,8 +35,8 @@ yield return new AgateDriverInfo( AudioTypeID.XAudio2, - typeof(SDX_Audio), - "SlimDX - DirectSound", + typeof(XAud2.XAudio2_Audio), + "SlimDX - XAudio 2", 100); yield return new AgateDriverInfo( Deleted: trunk/Drivers/AgateSDX/SDX_Audio.cs =================================================================== --- trunk/Drivers/AgateSDX/SDX_Audio.cs 2009-12-25 05:22:19 UTC (rev 1162) +++ trunk/Drivers/AgateSDX/SDX_Audio.cs 2009-12-25 07:42:17 UTC (rev 1163) @@ -1,497 +0,0 @@ -// The contents of this file are subject to the Mozilla Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.mozilla.org/MPL/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations -// under the License. -// -// The Original Code is AgateLib. -// -// The Initial Developer of the Original Code is Erik Ylvisaker. -// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. -// All Rights Reserved. -// -// Contributor(s): Erik Ylvisaker -// -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using SlimDX.XAudio2; -using SlimDX.Multimedia; -using AgateLib.AudioLib; -using AgateLib.Drivers; -using AgateLib.ImplementationBase; - -namespace AgateSDX -{ - public class SDX_Audio : AudioImpl - { - XAudio2 mDevice; - - public XAudio2 Device - { - get { return mDevice; } - } - - public SDX_Audio() - { - - } - - public override void Initialize() - { - Report("SlimDX XAudio2 driver instantiated for audio."); - - mDevice = new XAudio2(); - MasteringVoice masteringVoice = new MasteringVoice(mDevice); - - } - public override void Dispose() - { - mDevice.Dispose(); - } - - public override SoundBufferImpl CreateSoundBuffer(Stream inStream) - { - return new SDX_SoundBuffer(this, inStream); - } - public override SoundBufferImpl CreateSoundBuffer(Stream inStream, SoundFormat format) - { - return new SDX_SoundBuffer(this, inStream, format); - } - - public override MusicImpl CreateMusic(System.IO.Stream musicStream) - { - CheckCoop(); - - return new SDX_Music(this, musicStream); - } - public override MusicImpl CreateMusic(string filename) - { - CheckCoop(); - - return new SDX_Music(this, filename); - } - public override SoundBufferImpl CreateSoundBuffer(string filename) - { - CheckCoop(); - - return new SDX_SoundBuffer(this, filename); - } - public override SoundBufferSessionImpl CreateSoundBufferSession(SoundBufferImpl buffer) - { - CheckCoop(); - - return new SDX_SoundBufferSession(this, buffer as SDX_SoundBuffer); - } - - - /// <summary> - /// hack to make sure the cooperative level is set after a window is created. - /// Is this necessary with XAudio2? - /// </summary> - private void CheckCoop() - { - if (System.Windows.Forms.Form.ActiveForm != null) - { - //mDSobject.SetCooperativeLevel(System.Windows.Forms.Form.ActiveForm.Handle, - // CooperativeLevel.Priority); - } - } - } - - public class SDX_SoundBuffer : SoundBufferImpl - { - SDX_Audio mAudio; - AudioBuffer mBuffer; - double mVolume; - WaveFormat mFormat; - MemoryStream mem; - byte[] buffer; - - public SDX_SoundBuffer(SDX_Audio audio, Stream inStream) - { - mAudio = audio; - - WaveStream stream = new WaveStream(inStream); - - mBuffer = new AudioBuffer(); - mBuffer.AudioData = stream; - mBuffer.AudioBytes = (int)inStream.Length; - mBuffer.Flags = BufferFlags.EndOfStream; - - mFormat = stream.Format; - } - - public SDX_SoundBuffer(SDX_Audio audio, Stream inStream, SoundFormat format) - { - mAudio = audio; - - switch (format) - { - case SoundFormat.Wave: - WaveStream stream = new WaveStream(inStream); - - mBuffer = new AudioBuffer(); - mBuffer.AudioData = stream; - mBuffer.AudioBytes = (int)inStream.Length; - mBuffer.Flags = BufferFlags.EndOfStream; - - mFormat = stream.Format; - break; - - case SoundFormat.Raw16: - mBuffer = new AudioBuffer(); - mBuffer.AudioData = inStream; - mBuffer.AudioBytes = (int)inStream.Length; - mBuffer.Flags = BufferFlags.EndOfStream; - - mFormat = new WaveFormat(); - mFormat.BitsPerSample = 16; - mFormat.BlockAlignment = 2; - mFormat.Channels = 1; - mFormat.FormatTag = SlimDX.WaveFormatTag.Pcm; - mFormat.SamplesPerSecond = 44100; - mFormat.AverageBytesPerSecond = - mFormat.SamplesPerSecond * mFormat.BitsPerSample / 8; - - break; - } - } - public SDX_SoundBuffer(SDX_Audio audio, string filename) - : this(audio, File.OpenRead(filename)) - { - - } - - public override bool Loop { get; set; } - - public override void Dispose() - { - mBuffer.Dispose(); - } - - public AudioBuffer Buffer - { - get { return mBuffer; } - } - public WaveFormat Format - { - get { return mFormat; } - } - - public override double Volume - { - get { return mVolume; } - set { mVolume = value; } - } - } - public class SDX_SoundBufferSession : SoundBufferSessionImpl - { - SDX_SoundBuffer mSource; - SDX_Audio mAudio; - AudioBuffer mBuffer; - SourceVoice mVoice; - double mVolume; - double mPan; - - public SDX_SoundBufferSession(SDX_Audio audio, SDX_SoundBuffer source) - { - mAudio = audio; - mSource = source; - mBuffer = source.Buffer; - mVolume = source.Volume; - - Initialize(); - } - public override void Dispose() - { - mVoice.Dispose(); - } - - protected override void Initialize() - { - if (mVoice != null) - { - mVoice.Stop(); - mVoice.Dispose(); - } - - mVoice = new SourceVoice(mAudio.Device, mSource.Format); - mVoice.SubmitSourceBuffer(mBuffer); - } - - public override int CurrentLocation - { - get - { - return mVoice.State.SamplesPlayed; - } - } - public override void Play() - { - mVoice.Start(); - } - - public override void Stop() - { - mVoice.Stop(); - } - - public override double Volume - { - get { return mVolume; } - set - { - mVoice.Volume = (float)value; - mVolume = value; - } - } - - public override bool IsPlaying - { - get - { - //return mVoice.State. - return false; - } - } - - float[] channelVolumes = new float[2]; - public override double Pan - { - get { return mPan; } - set - { - mPan = value; - mVoice.SetChannelVolumes(2, GetChannelVolumes((float)value)); - } - } - - private float[] GetChannelVolumes(float pan) - { - if (pan < 0) - { - channelVolumes[0] = 1; - channelVolumes[1] = 1 + pan; - } - else - { - channelVolumes[0] = 1 - pan; - channelVolumes[1] = 1; - } - - return channelVolumes; - } - - } - public class SDX_Music : MusicImpl - { - SDX_Audio mAudio; - - public SDX_Music(SDX_Audio audio, string filename) - { - mAudio = audio; - - if (System.IO.Path.GetExtension(filename) == ".mp3") - throw new Exception("MP3 files cannot be played due to license restrictions."); - - //LoadMusic(filename); - } - - public SDX_Music(SDX_Audio audio, Stream infile) - { - mAudio = audio; - - //string tempfile = Path.GetTempFileName(); - //using (FileStream writer = File.OpenWrite(tempfile)) - //{ - // ReadWriteStream(infile, writer); - //} - - //try - //{ - // LoadMusic(tempfile); - //} - //catch (Microsoft.DirectX.DirectXException e) - //{ - // throw new AgateLib.AgateException( - // "Could not load the music file. The file format may be unsupported by DirectX.", e); - //} - //finally - //{ - // File.Delete(tempfile); - //} - } - /* - private void LoadMusic(string filename) - { - mAVAudio = new Microsoft.DirectX.AudioVideoPlayback.Audio(filename); - mAVAudio.Ending += new EventHandler(mAVAudio_Ending); - } - - private void ReadWriteStream(Stream readStream, Stream writeStream) - { - int Length = 256; - Byte[] buffer = new Byte[Length]; - int bytesRead = readStream.Read(buffer, 0, Length); - // write the required bytes - while (bytesRead > 0) - { - writeStream.Write(buffer, 0, bytesRead); - bytesRead = readStream.Read(buffer, 0, Length); - } - readStream.Close(); - writeStream.Close(); - } - - public override void Dispose() - { - mAVAudio.Dispose(); - } - - - protected override void OnSetLoop(bool value) - { - if (value == true) - mAVAudio.Ending += mAVAudio_Ending; - else - mAVAudio.Ending -= mAVAudio_Ending; - } - - public override void Play() - { - mAVAudio.Play(); - } - - public override void Stop() - { - mAVAudio.Stop(); - } - - /// <summary> - /// </summary> - public override double Volume - { - get - { - try - { - /// The DirectX AudioVideoPlayback object takes volume in the range of - /// -10000 to 0, indicating the number of hundredths of decibels the volume - /// is attenuated by, so we convert to zero to 1. - - double vol = (double)(mAVAudio.Volume + 10000) / 10000; - // logarithmic volume control - return Audio.TransformByExp(vol); - } - catch (Microsoft.DirectX.DirectXException e) - { - System.Diagnostics.Debug.WriteLine("Failed to read volume."); - System.Diagnostics.Debug.WriteLine(e.Message); - return 1.0; - } - } - set - { - // do a logarithmic volume control - try - { - mAVAudio.Volume = (int)(Audio.TransformByLog(value) * 10000.0 - 10000.0); - } - catch (Microsoft.DirectX.DirectXException e) - { - System.Diagnostics.Debug.WriteLine("Failed to set volume."); - System.Diagnostics.Debug.WriteLine(e.Message); - } - } - } - - - void mAVAudio_Ending(object sender, EventArgs e) - { - if (IsLooping) - { - mAVAudio.CurrentPosition = 0; - } - } - - public override bool IsPlaying - { - get { return mAVAudio.Playing; } - } - - public override double Pan - { - get - { - return mAVAudio.Balance / (double)10000.0; - } - set - { - try - { - mAVAudio.Balance = (int)(value * 10000.0); - } - catch (Microsoft.DirectX.DirectXException e) - { - if (e.ErrorCode != -2147220909) - throw e; - } - } - } - * */ - public override void Dispose() - { - throw new NotImplementedException(); - } - - public override bool IsPlaying - { - get { throw new NotImplementedException(); } - } - - protected override void OnSetLoop(bool value) - { - throw new NotImplementedException(); - } - - public override double Pan - { - get - { - throw new NotImplementedException(); - } - set - { - throw new NotImplementedException(); - } - } - - public override void Play() - { - throw new NotImplementedException(); - } - - public override void Stop() - { - throw new NotImplementedException(); - } - - public override double Volume - { - get - { - throw new NotImplementedException(); - } - set - { - throw new NotImplementedException(); - } - } - } -} Modified: trunk/Drivers/AgateSDX/SDX_Input.cs =================================================================== --- trunk/Drivers/AgateSDX/SDX_Input.cs 2009-12-25 05:22:19 UTC (rev 1162) +++ trunk/Drivers/AgateSDX/SDX_Input.cs 2009-12-25 07:42:17 UTC (rev 1163) @@ -74,7 +74,7 @@ case DeviceType.Gamepad: case DeviceType.Joystick: - Device<JoystickState> d = new Device<JoystickState>(mDIobject, i.InstanceGuid); + Joystick d = new Joystick(mDIobject, i.InstanceGuid); retval.Add(new SDX_Joystick(d)); @@ -92,7 +92,7 @@ /// </summary> public class SDX_Joystick : JoystickImpl { - private Device<JoystickState> mDevice; + private Joystick mDevice; private bool[] mButtons; private int[] shift = new int[8]; @@ -100,7 +100,7 @@ private double mThreshold; - public SDX_Joystick(Device<JoystickState> d) + public SDX_Joystick(Joystick d) { mDevice = d; mDevice.Acquire(); @@ -117,15 +117,15 @@ public override string Name { - get { return mDevice.DeviceInformation.InstanceName; } + get { return mDevice.Information.InstanceName; } } public override int AxisCount { - get { return mDevice.Caps.AxesCount; } + get { return mDevice.Capabilities.AxesCount; } } public override int ButtonCount { - get { return mDevice.Caps.ButtonCount; } + get { return mDevice.Capabilities.ButtonCount; } } public override bool GetButtonState(int buttonIndex) Added: trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs =================================================================== --- trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs (rev 0) +++ trunk/Drivers/AgateSDX/XAud2/XAudio2_Audio.cs 2009-12-25 07:42:17 UTC (rev 1163) @@ -0,0 +1,503 @@ +// The contents of this file are subject to the Mozilla Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is AgateLib. +// +// The Initial Developer of the Original Code is Erik Ylvisaker. +// Portions created by Erik Ylvisaker are Copyright (C) 2006-2009. +// All Rights Reserved. +// +// Contributor(s): Erik Ylvisaker +// +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using SlimDX.XAudio2; +using SlimDX.Multimedia; +using System.Runtime.InteropServices; +using AgateLib.AudioLib; +using AgateLib.Drivers; +using AgateLib.ImplementationBase; + +namespace AgateSDX.XAud2 +{ + public class XAudio2_Audio : AudioImpl + { + XAudio2 mDevice; + MasteringVoice masteringVoice; + + public XAudio2 Device + { + get { return mDevice; } + } + + public XAudio2_Audio() + { + + } + + public override void Initialize() + { + Report("SlimDX XAudio2 driver instantiated for audio."); + + + mDevice = new XAudio2();//XAudio2Flags.DebugEngine, ProcessorSpecifier.AnyProcessor); + masteringVoice = new MasteringVoice(mDevice); + + } + public override void Dispose() + { + mDevice.Dispose(); + } + + public override SoundBufferImpl CreateSoundBuffer(Stream inStream) + { + return new SDX_SoundBuffer(this, inStream); + } + public override SoundBufferImpl CreateSoundBuffer(Stream inStream, SoundFormat format) + { + return new SDX_SoundBuffer(this, inStream, format); + } + + public override MusicImpl CreateMusic(System.IO.Stream musicStream) + { + CheckCoop(); + + return new SDX_Music(this, musicStream); + } + public override MusicImpl CreateMusic(string filename) + { + CheckCoop(); + + return new SDX_Music(this, filename); + } + public override SoundBufferImpl CreateSoundBuffer(string filename) + { + CheckCoop(); + + return new SDX_SoundBuffer(this, filename); + } + public override SoundBufferSessionImpl CreateSoundBufferSession(SoundBufferImpl buffer) + { + CheckCoop(); + + return new SDX_SoundBufferSession(this, buffer as SDX_SoundBuffer); + } + + + /// <summary> + /// hack to make sure the cooperative level is set after a window is created. + /// Is this necessary with XAudio2? + /// </summary> + private void CheckCoop() + { + if (System.Windows.Forms.Form.ActiveForm != null) + { + //mDSobject.SetCooperativeLevel(System.Windows.Forms.Form.ActiveForm.Handle, + // CooperativeLevel.Priority); + } + } + } + + public class SDX_SoundBuffer : SoundBufferImpl + { + XAudio2_Audio mAudio; + AudioBuffer mBuffer; + double mVolume; + WaveFormat mFormat; + MemoryStream mem; + byte[] buffer; + + public SDX_SoundBuffer(XAudio2_Audio audio, Stream inStream) + { + mAudio = audio; + + WaveStream stream = new WaveStream(inStream); + + mBuffer = new AudioBuffer(); + mBuffer.AudioData = stream; + mBuffer.AudioBytes = (int)stream.Length; + mBuffer.Flags = BufferFlags.EndOfStream; + + mFormat = stream.Format; + } + + public SDX_SoundBuffer(XAudio2_Audio audio, Stream inStream, SoundFormat format) + { + mAudio = audio; + + switch (format) + { + case SoundFormat.Wave: + WaveStream stream = new WaveStream(inStream); + + mBuffer = new AudioBuffer(); + mBuffer.AudioData = stream; + mBuffer.AudioBytes = (int)stream.Length; + mBuffer.Flags = BufferFlags.EndOfStream; + + mFormat = stream.Format; + break; + + case SoundFormat.RawInt16: + mBuffer = new AudioBuffer(); + mBuffer.AudioData = inStream; + mBuffer.AudioBytes = (int)inStream.Length; + mBuffer.Flags = BufferFlags.EndOfStream; + + mFormat = new WaveFormat(); + mFormat.BitsPerSample = 16; + mFormat.BlockAlignment = 2; + mFormat.Channels = 1; + mFormat.FormatTag = WaveFormatTag.Pcm; + mFormat.SamplesPerSecond = 44100; + mFormat.AverageBytesPerSecond = + mFormat.SamplesPerSecond * mFormat.BitsPerSample / 8; + + break; + } + } + public SDX_SoundBuffer(XAudio2_Audio audio, string filename) + : this(audio, File.OpenRead(filename)) + { + + } + + public override bool Loop { get; set; } + + public override void Dispose() + { + mBuffer.Dispose(); + } + + public AudioBuffer Buffer + { + get { return mBuffer; } + } + public WaveFormat Format + { + get { return mFormat; } + } + + public override double Volume + { + get { return mVolume; } + set { mVolume = value; } + } + } + public class SDX_SoundBufferSession : SoundBufferSessionImpl + { + SDX_SoundBuffer mSource; + XAudio2_Audio mAudio; + AudioBuffer mBuffer; + SourceVoice mVoice; + double mVolume; + double mPan; + bool mIsPlaying; + + public SDX_SoundBufferSession(XAudio2_Audio audio, SDX_SoundBuffer source) + { + mAudio = audio; + mSource = source; + mBuffer = source.Buffer; + mVolume = source.Volume; + + mVoice = new SourceVoice(mAudio.Device, mSource.Format); + mVoice.BufferEnd += new EventHandler<ContextEventArgs>(mVoice_BufferEnd); + } + + void mVoice_BufferEnd(object sender, ContextEventArgs e) + { + mIsPlaying = false; + } + public override void Dispose() + { + mVoice.Dispose(); + } + + protected override void Initialize() + { + mVoice.Stop(); + mVoice.SubmitSourceBuffer(mBuffer); + } + + public override int CurrentLocation + { + get + { + return (int)mVoice.State.SamplesPlayed; + } + } + public override void Play() + { + mVoice.Stop(); + mVoice.Start(); + mIsPlaying = true; + } + + public override void Stop() + { + mVoice.Stop(); + + } + + public override double Volume + { + get { return mVolume; } + set + { + mVoice.Volume = (float)value; + mVolume = value; + } + } + + public override bool IsPlaying + { + get + { + return mIsPlaying; + } + } + + float[] channelVolumes = new float[2]; + public override double Pan + { + get { return mPan; } + set + { + mPan = value; + mVoice.SetChannelVolumes(2, GetChannelVolumes((float)value)); + } + } + + private float[] GetChannelVolumes(float pan) + { + if (pan < 0) + { + channelVolumes[0] = 1; + channelVolumes[1] = 1 + pan; + } + else + { + channelVolumes[0] = 1 - pan; + channelVolumes[1] = 1; + } + + return channelVolumes; + } + + } + public class SDX_Music : MusicImpl + { + XAudio2_Audio mAudio; + + public SDX_Music(XAudio2_Audio audio, string filename) + { + mAudio = audio; + + if (System.IO.Path.GetExtension(filename) == ".mp3") + throw new Exception("MP3 files cannot be played due to license restrictions."); + + //LoadMusic(filename); + } + + public SDX_Music(XAudio2_Audio audio, Stream infile) + { + mAudio = audio; + + //string tempfile = Path.GetTempFileName(); + //using (FileStream writer = File.OpenWrite(tempfile)) + //{ + // ReadWriteStream(infile, writer); + //} + + //try + //{ + // LoadMusic(tempfile); + //} + //catch (Microsoft.DirectX.DirectXException e) + //{ + // throw new AgateLib.AgateException( + // "Could not load the music file. The file format may be unsupported by DirectX.", e); + //} + //finally + //{ + // File.Delete(tempfile); + //} + } + /* + private void LoadMusic(string filename) + { + mAVAudio = new Microsoft.DirectX.AudioVideoPlayback.Audio(filename); + mAVAudio.Ending += new EventHandler(mAVAudio_Ending); + } + + private void ReadWriteStream(Stream readStream, Stream writeStream) + { + int Length = 256; + Byte[] buffer = new Byte[Length]; + int bytesRead = readStream.Read(buffer, 0, Length); + // write the required bytes + while (bytesRead > 0) + { + writeStream.Write(buffer, 0, bytesRead); + bytesRead = readStream.Read(buffer, 0, Length); + } + readStream.Close(); + writeStream.Close(); + } + + public override void Dispose() + { + mAVAudio.Dispose(); + } + + + protected override void OnSetLoop(bool value) + { + if (value == true) + mAVAudio.Ending += mAVAudio_Ending; + else + mAVAudio.Ending -= mAVAudio_Ending; + } + + public override void Play() + { + mAVAudio.Play(); + } + + public override void Stop() + { + mAVAudio.Stop(); + } + + /// <summary> + /// </summary> + public override double Volume + { + get + { + try + { + /// The DirectX AudioVideoPlayback object takes volume in the range of + /// -10000 to 0, indicating the number of hundredths of decibels the volume + /// is attenuated by, so we convert to zero to 1. + + double vol = (double)(mAVAudio.Volume + 10000) / 10000; + // logarithmic volume control + return Audio.TransformByExp(vol); + } + catch (Microsoft.DirectX.DirectXException e) + { + System.Diagnostics.Debug.WriteLine("Failed to read volume."); + System.Diagnostics.Debug.WriteLine(e.Message); + return 1.0; + } + } + set + { + // do a logarithmic volume control + try + { + mAVAudio.Volume = (int)(Audio.TransformByLog(value) * 10000.0 - 10000.0); + } + catch (Microsoft.DirectX.DirectXException e) + { + System.Diagnostics.Debug.WriteLine("Failed to set volume."); + System.Diagnostics.Debug.WriteLine(e.Message); + } + } + } + + + void mAVAudio_Ending(object sender, EventArgs e) + { + if (IsLooping) + { + mAVAudio.CurrentPosition = 0; + } + } + + public override bool IsPlaying + { + get { return mAVAudio.Playing; } + } + + public override double Pan + { + get + { + return mAVAudio.Balance / (double)10000.0; + } + set + { + try + { + mAVAudio.Balance = (int)(value * 10000.0); + } + catch (Microsoft.DirectX.DirectXException e) + { + if (e.ErrorCode != -2147220909) + throw e; + } + } + } + * */ + public override void Dispose() + { + throw new NotImplementedException(); + } + + public override bool IsPlaying + { + get { throw new NotImplementedException(); } + } + + protected override void OnSetLoop(bool value) + { + throw new NotImplementedException(); + } + + public override double Pan + { + get + { + throw new NotImplementedException(); + } + set + { + throw new NotImplementedException(); + } + } + + public override void Play() + { + throw new NotImplementedException(); + } + + public override void Stop() + { + throw new NotImplementedException(); + } + + public override double Volume + { + get + { + throw new NotImplementedException(); + } + set + { + throw new NotImplementedException(); + } + } + } +} Modified: trunk/Tests/AudioTests/GenerateAudio.cs =================================================================== --- trunk/Tests/AudioTests/GenerateAudio.cs 2009-12-25 05:22:19 UTC (rev 1162) +++ trunk/Tests/AudioTests/GenerateAudio.cs 2009-12-25 07:42:17 UTC (rev 1163) @@ -34,7 +34,7 @@ DisplayWindow wind = DisplayWindow.CreateWindowed("Generate Audio", 640, 480); - short[] s = new short[22050]; + short[] s = new short[44010]; int frequency = 100; FillSoundBuffer(s, frequency); @@ -43,7 +43,8 @@ Buffer.BlockCopy(s, 0, buffer, 0, buffer.Length); MemoryStream ms = new MemoryStream(buffer); - SoundBuffer buf = new SoundBuffer(ms, SoundFormat.Raw16); + ms.Seek(0, SeekOrigin.Begin); + SoundBuffer buf = new SoundBuffer(ms, SoundFormat.RawInt16); buf.Loop = true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |