You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by be...@apache.org on 2013/06/11 00:41:21 UTC

git commit: [wp7] moved AudioFormatsHelper to core, used in capture plugin as well

Updated Branches:
  refs/heads/master 0066f3727 -> 42498cf2d


[wp7] moved AudioFormatsHelper to core, used in capture plugin as well


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/commit/42498cf2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/tree/42498cf2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/diff/42498cf2

Branch: refs/heads/master
Commit: 42498cf2d9476b6845fc28b110fc345461c3c0e9
Parents: 0066f37
Author: Benn Mapes <be...@gmail.com>
Authored: Mon Jun 10 15:41:07 2013 -0700
Committer: Benn Mapes <be...@gmail.com>
Committed: Mon Jun 10 15:41:07 2013 -0700

----------------------------------------------------------------------
 plugin.xml                    |  1 -
 src/wp7/AudioFormatsHelper.cs | 89 --------------------------------------
 2 files changed, 90 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/blob/42498cf2/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index b806df0..1796ff8 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -44,7 +44,6 @@ id="org.apache.cordova.core.AudioHandler"
 
         <source-file src="src/wp7/Media.cs" /> 
         <source-file src="src/wp7/AudioPlayer.cs" /> 
-        <source-file src="src/wp7/AudioFormatsHelper.cs" /> 
     </platform>
     
             

http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/blob/42498cf2/src/wp7/AudioFormatsHelper.cs
----------------------------------------------------------------------
diff --git a/src/wp7/AudioFormatsHelper.cs b/src/wp7/AudioFormatsHelper.cs
deleted file mode 100644
index dca7ee6..0000000
--- a/src/wp7/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 WPCordovaClassLib.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
-    }
-}