cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [4/58] [abbrv] git commit: moved AudioFormatsHelper so it is available to all projects+templates
Date Thu, 01 Nov 2012 22:09:18 GMT
moved AudioFormatsHelper so it is available to all projects+templates


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/commit/502480b1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/tree/502480b1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/diff/502480b1

Branch: refs/heads/master
Commit: 502480b1a42b3afea128950b8df04332019ace99
Parents: e3defc9
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Wed Oct 31 16:32:46 2012 -0700
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Wed Oct 31 16:32:46 2012 -0700

----------------------------------------------------------------------
 .../CordovaLib/Commands/AudioFormatsHelper.cs      |   89 ---------------
 framework/WP7CordovaClassLib.csproj                |    4 +-
 templates/standalone/CordovaAppProj.csproj         |    1 +
 templates/standalone/CordovaSourceDictionary.xml   |    2 +-
 .../cordovalib/Commands/AudioFormatsHelper.cs      |   89 +++++++++++++++
 5 files changed, 94 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/blob/502480b1/framework/CordovaLib/Commands/AudioFormatsHelper.cs
----------------------------------------------------------------------
diff --git a/framework/CordovaLib/Commands/AudioFormatsHelper.cs b/framework/CordovaLib/Commands/AudioFormatsHelper.cs
deleted file mode 100644
index f93340f..0000000
--- a/framework/CordovaLib/Commands/AudioFormatsHelper.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-/*  
-	Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
-	
-	Unless required by applicable law or agreed to in writing, software
-	distributed under the License is distributed on an "AS IS" BASIS,
-	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	See the License for the specific language governing permissions and
-	limitations under the License.
-
- */
-
-using System;
-using System.IO;
-
-namespace WP7CordovaClassLib.Cordova.Commands
-{
-    /// <summary>
-    /// Provides extra functionality to support different audio formats.
-    /// </summary>
-    public static class AudioFormatsHelper
-    {
-        #region Wav
-        /// <summary>
-        /// Adds wav file format header to the stream
-        /// https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
-        /// </summary>
-        /// <param name="stream">The stream</param>
-        /// <param name="sampleRate">Sample Rate</param>
-        public static void InitializeWavStream(this Stream stream, int sampleRate)
-        {
-            #region args checking
-
-            if (stream == null) 
-            {
-                throw new ArgumentNullException("stream can't be null or empty");
-            }
-
-            #endregion
-
-            int numBits = 16;
-            int numBytes = numBits / 8;
-
-            stream.Write(System.Text.Encoding.UTF8.GetBytes("RIFF"), 0, 4);
-            stream.Write(BitConverter.GetBytes(0), 0, 4);
-            stream.Write(System.Text.Encoding.UTF8.GetBytes("WAVE"), 0, 4);
-            stream.Write(System.Text.Encoding.UTF8.GetBytes("fmt "), 0, 4);
-            stream.Write(BitConverter.GetBytes(16), 0, 4);
-            stream.Write(BitConverter.GetBytes((short)1), 0, 2);
-            stream.Write(BitConverter.GetBytes((short)1), 0, 2);
-            stream.Write(BitConverter.GetBytes(sampleRate), 0, 4);
-            stream.Write(BitConverter.GetBytes(sampleRate * numBytes), 0, 4);
-            stream.Write(BitConverter.GetBytes((short)(numBytes)), 0, 2);
-            stream.Write(BitConverter.GetBytes((short)(numBits)), 0, 2);
-            stream.Write(System.Text.Encoding.UTF8.GetBytes("data"), 0, 4);
-            stream.Write(BitConverter.GetBytes(0), 0, 4);
-        }
-
-        /// <summary>
-        /// Updates wav file format header
-        /// https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
-        /// </summary>
-        /// <param name="stream">Wav stream</param>
-        public static void UpdateWavStream(this Stream stream)
-        {
-            #region args checking
-
-            if (stream == null)
-            {
-                throw new ArgumentNullException("stream can't be null or empty");
-            }
-
-            #endregion
-
-            var position = stream.Position;
-
-            stream.Seek(4, SeekOrigin.Begin);
-            stream.Write(BitConverter.GetBytes((int)stream.Length - 8), 0, 4);
-            stream.Seek(40, SeekOrigin.Begin);
-            stream.Write(BitConverter.GetBytes((int)stream.Length - 44), 0, 4);
-            stream.Seek(position, SeekOrigin.Begin);
-        }
-
-        #endregion
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/blob/502480b1/framework/WP7CordovaClassLib.csproj
----------------------------------------------------------------------
diff --git a/framework/WP7CordovaClassLib.csproj b/framework/WP7CordovaClassLib.csproj
index a3257e3..1fdd929 100644
--- a/framework/WP7CordovaClassLib.csproj
+++ b/framework/WP7CordovaClassLib.csproj
@@ -86,6 +86,9 @@
     <Compile Include="..\templates\standalone\cordovalib\Commands\Accelerometer.cs">
       <Link>CordovaLib\Commands\Accelerometer.cs</Link>
     </Compile>
+    <Compile Include="..\templates\standalone\cordovalib\Commands\AudioFormatsHelper.cs">
+      <Link>CordovaLib\Commands\AudioFormatsHelper.cs</Link>
+    </Compile>
     <Compile Include="..\templates\standalone\cordovalib\Commands\AudioPlayer.cs">
       <Link>CordovaLib\Commands\AudioPlayer.cs</Link>
     </Compile>
@@ -184,7 +187,6 @@
       <Link>CordovaLib\UI\VideoRecorder.xaml.cs</Link>
       <DependentUpon>VideoRecorder.xaml</DependentUpon>
     </Compile>
-    <Compile Include="CordovaLib\Commands\AudioFormatsHelper.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/blob/502480b1/templates/standalone/CordovaAppProj.csproj
----------------------------------------------------------------------
diff --git a/templates/standalone/CordovaAppProj.csproj b/templates/standalone/CordovaAppProj.csproj
index 7135b92..a61520c 100644
--- a/templates/standalone/CordovaAppProj.csproj
+++ b/templates/standalone/CordovaAppProj.csproj
@@ -87,6 +87,7 @@
     <Compile Include="cordovalib\BrowserMouseHelper.cs" />
     <Compile Include="cordovalib\CommandFactory.cs" />
     <Compile Include="cordovalib\Commands\Accelerometer.cs" />
+    <Compile Include="cordovalib\Commands\AudioFormatsHelper.cs" />
     <Compile Include="cordovalib\Commands\AudioPlayer.cs" />
     <Compile Include="cordovalib\Commands\BaseCommand.cs" />
     <Compile Include="cordovalib\Commands\Battery.cs" />

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/blob/502480b1/templates/standalone/CordovaSourceDictionary.xml
----------------------------------------------------------------------
diff --git a/templates/standalone/CordovaSourceDictionary.xml b/templates/standalone/CordovaSourceDictionary.xml
index 19fcfd0..0658088 100644
--- a/templates/standalone/CordovaSourceDictionary.xml
+++ b/templates/standalone/CordovaSourceDictionary.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- This file is auto-generated, do not edit! -jm -->
 <CordovaSourceDictionary>
+    <FilePath Value="www\cordova-2.2.0.js"/>
     <FilePath Value="www\img\logo.png"/>
     <FilePath Value="www\js\index.js"/>
-    <FilePath Value="www\cordova-2.1.0.js"/>
     <FilePath Value="www\css\index.css"/>
     <FilePath Value="www\index.html"/>
 </CordovaSourceDictionary>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/blob/502480b1/templates/standalone/cordovalib/Commands/AudioFormatsHelper.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/Commands/AudioFormatsHelper.cs b/templates/standalone/cordovalib/Commands/AudioFormatsHelper.cs
new file mode 100644
index 0000000..f93340f
--- /dev/null
+++ b/templates/standalone/cordovalib/Commands/AudioFormatsHelper.cs
@@ -0,0 +1,89 @@
+/*  
+	Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+	
+	Unless required by applicable law or agreed to in writing, software
+	distributed under the License is distributed on an "AS IS" BASIS,
+	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	See the License for the specific language governing permissions and
+	limitations under the License.
+
+ */
+
+using System;
+using System.IO;
+
+namespace WP7CordovaClassLib.Cordova.Commands
+{
+    /// <summary>
+    /// Provides extra functionality to support different audio formats.
+    /// </summary>
+    public static class AudioFormatsHelper
+    {
+        #region Wav
+        /// <summary>
+        /// Adds wav file format header to the stream
+        /// https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
+        /// </summary>
+        /// <param name="stream">The stream</param>
+        /// <param name="sampleRate">Sample Rate</param>
+        public static void InitializeWavStream(this Stream stream, int sampleRate)
+        {
+            #region args checking
+
+            if (stream == null) 
+            {
+                throw new ArgumentNullException("stream can't be null or empty");
+            }
+
+            #endregion
+
+            int numBits = 16;
+            int numBytes = numBits / 8;
+
+            stream.Write(System.Text.Encoding.UTF8.GetBytes("RIFF"), 0, 4);
+            stream.Write(BitConverter.GetBytes(0), 0, 4);
+            stream.Write(System.Text.Encoding.UTF8.GetBytes("WAVE"), 0, 4);
+            stream.Write(System.Text.Encoding.UTF8.GetBytes("fmt "), 0, 4);
+            stream.Write(BitConverter.GetBytes(16), 0, 4);
+            stream.Write(BitConverter.GetBytes((short)1), 0, 2);
+            stream.Write(BitConverter.GetBytes((short)1), 0, 2);
+            stream.Write(BitConverter.GetBytes(sampleRate), 0, 4);
+            stream.Write(BitConverter.GetBytes(sampleRate * numBytes), 0, 4);
+            stream.Write(BitConverter.GetBytes((short)(numBytes)), 0, 2);
+            stream.Write(BitConverter.GetBytes((short)(numBits)), 0, 2);
+            stream.Write(System.Text.Encoding.UTF8.GetBytes("data"), 0, 4);
+            stream.Write(BitConverter.GetBytes(0), 0, 4);
+        }
+
+        /// <summary>
+        /// Updates wav file format header
+        /// https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
+        /// </summary>
+        /// <param name="stream">Wav stream</param>
+        public static void UpdateWavStream(this Stream stream)
+        {
+            #region args checking
+
+            if (stream == null)
+            {
+                throw new ArgumentNullException("stream can't be null or empty");
+            }
+
+            #endregion
+
+            var position = stream.Position;
+
+            stream.Seek(4, SeekOrigin.Begin);
+            stream.Write(BitConverter.GetBytes((int)stream.Length - 8), 0, 4);
+            stream.Seek(40, SeekOrigin.Begin);
+            stream.Write(BitConverter.GetBytes((int)stream.Length - 44), 0, 4);
+            stream.Seek(position, SeekOrigin.Begin);
+        }
+
+        #endregion
+    }
+}


Mime
View raw message