You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2013/07/10 20:10:09 UTC
[7/7] git commit: Removed AudioFormatsHelper from templates and added
ConsoleHelper
Removed AudioFormatsHelper from templates and added ConsoleHelper
Project: http://git-wip-us.apache.org/repos/asf/cordova-wp8/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-wp8/commit/29432294
Tree: http://git-wip-us.apache.org/repos/asf/cordova-wp8/tree/29432294
Diff: http://git-wip-us.apache.org/repos/asf/cordova-wp8/diff/29432294
Branch: refs/heads/master
Commit: 29432294d75dea97de034906405dc9eaa92660b5
Parents: e73b26c
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Jul 10 02:07:26 2013 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Jul 10 11:09:34 2013 -0700
----------------------------------------------------------------------
common/Plugins/AudioFormatsHelper.cs | 89 -----------------------------
wp7/framework/WPCordovaClassLib.csproj | 3 -
wp7/template/CordovaWP7AppProj.csproj | 1 -
wp7/template/MyTemplate.vstemplate | 2 +-
wp8/framework/WPCordovaClassLib.csproj | 3 -
wp8/template/CordovaWP8AppProj.csproj | 2 -
wp8/template/MyTemplate.vstemplate | 2 +-
7 files changed, 2 insertions(+), 100 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/29432294/common/Plugins/AudioFormatsHelper.cs
----------------------------------------------------------------------
diff --git a/common/Plugins/AudioFormatsHelper.cs b/common/Plugins/AudioFormatsHelper.cs
deleted file mode 100644
index dca7ee6..0000000
--- a/common/Plugins/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
- }
-}
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/29432294/wp7/framework/WPCordovaClassLib.csproj
----------------------------------------------------------------------
diff --git a/wp7/framework/WPCordovaClassLib.csproj b/wp7/framework/WPCordovaClassLib.csproj
index cd1e004..65685c9 100644
--- a/wp7/framework/WPCordovaClassLib.csproj
+++ b/wp7/framework/WPCordovaClassLib.csproj
@@ -83,9 +83,6 @@
<Compile Include="..\..\common\Plugins\Accelerometer.cs">
<Link>Plugins\Accelerometer.cs</Link>
</Compile>
- <Compile Include="..\..\common\Plugins\AudioFormatsHelper.cs">
- <Link>Plugins\AudioFormatsHelper.cs</Link>
- </Compile>
<Compile Include="..\..\common\Plugins\AudioPlayer.cs">
<Link>Plugins\AudioPlayer.cs</Link>
</Compile>
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/29432294/wp7/template/CordovaWP7AppProj.csproj
----------------------------------------------------------------------
diff --git a/wp7/template/CordovaWP7AppProj.csproj b/wp7/template/CordovaWP7AppProj.csproj
index 044b1df..13b1192 100644
--- a/wp7/template/CordovaWP7AppProj.csproj
+++ b/wp7/template/CordovaWP7AppProj.csproj
@@ -172,7 +172,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Plugins\Accelerometer.cs" />
- <Compile Include="Plugins\AudioFormatsHelper.cs" />
<Compile Include="Plugins\AudioPlayer.cs" />
<Compile Include="Plugins\Battery.cs" />
<Compile Include="Plugins\Camera.cs" />
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/29432294/wp7/template/MyTemplate.vstemplate
----------------------------------------------------------------------
diff --git a/wp7/template/MyTemplate.vstemplate b/wp7/template/MyTemplate.vstemplate
index 9ddc02a..8528cf0 100644
--- a/wp7/template/MyTemplate.vstemplate
+++ b/wp7/template/MyTemplate.vstemplate
@@ -64,6 +64,7 @@
<ProjectItem ReplaceParameters="true" TargetFileName="PluginResult.cs">PluginResult.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="ScriptCallback.cs">ScriptCallback.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="XHRHelper.cs">XHRHelper.cs</ProjectItem>
+ <ProjectItem ReplaceParameters="true" TargetFileName="ConsoleHelper.cs">ConsoleHelper.cs</ProjectItem>
</Folder>
<ProjectItem ReplaceParameters="true" TargetFileName="CordovaSourceDictionary.xml">CordovaSourceDictionary.xml</ProjectItem>
<Folder Name="Images" TargetFolderName="Images">
@@ -78,7 +79,6 @@
<ProjectItem ReplaceParameters="true" TargetFileName="MainPage.xaml.cs">MainPage.xaml.cs</ProjectItem>
<Folder Name="Plugins" TargetFolderName="Plugins">
<ProjectItem ReplaceParameters="true" TargetFileName="Accelerometer.cs">Accelerometer.cs</ProjectItem>
- <ProjectItem ReplaceParameters="true" TargetFileName="AudioFormatsHelper.cs">AudioFormatsHelper.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="AudioPlayer.cs">AudioPlayer.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="Battery.cs">Battery.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="Camera.cs">Camera.cs</ProjectItem>
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/29432294/wp8/framework/WPCordovaClassLib.csproj
----------------------------------------------------------------------
diff --git a/wp8/framework/WPCordovaClassLib.csproj b/wp8/framework/WPCordovaClassLib.csproj
index 2c0442b..46e2ac5 100644
--- a/wp8/framework/WPCordovaClassLib.csproj
+++ b/wp8/framework/WPCordovaClassLib.csproj
@@ -122,9 +122,6 @@
<Compile Include="..\..\common\Plugins\Accelerometer.cs">
<Link>Plugins\Accelerometer.cs</Link>
</Compile>
- <Compile Include="..\..\common\Plugins\AudioFormatsHelper.cs">
- <Link>Plugins\AudioFormatsHelper.cs</Link>
- </Compile>
<Compile Include="..\..\common\Plugins\AudioPlayer.cs">
<Link>Plugins\AudioPlayer.cs</Link>
</Compile>
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/29432294/wp8/template/CordovaWP8AppProj.csproj
----------------------------------------------------------------------
diff --git a/wp8/template/CordovaWP8AppProj.csproj b/wp8/template/CordovaWP8AppProj.csproj
index 68a5163..097d9a9 100644
--- a/wp8/template/CordovaWP8AppProj.csproj
+++ b/wp8/template/CordovaWP8AppProj.csproj
@@ -210,14 +210,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Plugins\Accelerometer.cs" />
- <Compile Include="Plugins\AudioFormatsHelper.cs" />
<Compile Include="Plugins\AudioPlayer.cs" />
<Compile Include="Plugins\Battery.cs" />
<Compile Include="Plugins\Camera.cs" />
<Compile Include="Plugins\Capture.cs" />
<Compile Include="Plugins\Compass.cs" />
<Compile Include="Plugins\Contacts.cs" />
- <Compile Include="Plugins\DebugConsole.cs" />
<Compile Include="Plugins\Device.cs" />
<Compile Include="Plugins\File.cs" />
<Compile Include="Plugins\FileTransfer.cs" />
http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/29432294/wp8/template/MyTemplate.vstemplate
----------------------------------------------------------------------
diff --git a/wp8/template/MyTemplate.vstemplate b/wp8/template/MyTemplate.vstemplate
index a343f45..94128bf 100644
--- a/wp8/template/MyTemplate.vstemplate
+++ b/wp8/template/MyTemplate.vstemplate
@@ -60,6 +60,7 @@
<ProjectItem ReplaceParameters="true" TargetFileName="PluginResult.cs">PluginResult.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="ScriptCallback.cs">ScriptCallback.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="XHRHelper.cs">XHRHelper.cs</ProjectItem>
+ <ProjectItem ReplaceParameters="true" TargetFileName="ConsoleHelper.cs">ConsoleHelper.cs</ProjectItem>
</Folder>
<Folder Name="Images" TargetFolderName="Images">
<ProjectItem ReplaceParameters="false" TargetFileName="appbar.back.rest.png">appbar.back.rest.png</ProjectItem>
@@ -73,7 +74,6 @@
<ProjectItem ReplaceParameters="true" TargetFileName="MainPage.xaml.cs">MainPage.xaml.cs</ProjectItem>
<Folder Name="Plugins" TargetFolderName="Plugins">
<ProjectItem ReplaceParameters="true" TargetFileName="Accelerometer.cs">Accelerometer.cs</ProjectItem>
- <ProjectItem ReplaceParameters="true" TargetFileName="AudioFormatsHelper.cs">AudioFormatsHelper.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="AudioPlayer.cs">AudioPlayer.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="Battery.cs">Battery.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="Camera.cs">Camera.cs</ProjectItem>