Adding new examples directory structure.

This commit is contained in:
Raynaldo Rivera 2011-08-24 01:16:40 -07:00
parent 8f6a8acace
commit e3663f2ba6
94 changed files with 13770 additions and 0 deletions

BIN
Examples/CAUDIOAppLogo.icns Normal file

Binary file not shown.

View File

@ -0,0 +1,78 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cAudioPlayer", "cAudioPlayer\cAudioPlayer.csproj", "{E7ACE267-B496-440E-B44D-CC846D39DAA7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cAudioCSharp", "..\..\cAudioCSharp\cAudioCSharp.csproj", "{4DDC8FD9-BEAF-422E-A28E-093D299F7DEF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpTutorial1_2DSound", "CSharpTutorial1_2DSound\CSharpTutorial1_2DSound.csproj", "{CB13F5F2-5203-4844-A445-7C5D751EC4FB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Player", "Player", "{0E06B86B-4B88-4762-B35D-BF5C0AB3D401}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CoreLib", "CoreLib", "{F5FF0CDC-1F04-4F96-B549-24AFBB8195D6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tutorials", "Tutorials", "{E37E1C89-A19A-430D-8959-C87DAD28B62E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpTutorial2_3DSound", "CSharpTutorial2_3DSound\CSharpTutorial2_3DSound.csproj", "{1BE1FACF-6A8F-4735-812D-B38137D1BD2B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpTutorial3_MemoryPlayback", "CSharpTutorial3_MemoryPlayback\CSharpTutorial3_MemoryPlayback.csproj", "{C272F657-D8D0-4587-8D5E-EFB8ED422043}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpTutorial4_AudioCapture", "CSharpTutorial4_AudioCapture\CSharpTutorial4_AudioCapture.csproj", "{7C483A37-F45D-433B-AEDC-60ABA5B273F7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpTutorial6_CustomEventHandler", "CSharpTutorial6_CustomEventHandler\CSharpTutorial6_CustomEventHandler.csproj", "{63F39DA0-F5B2-48E1-8E88-A5F3B2C02C56}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpTutorial7_CustomLogReceiver", "CSharpTutorial7_CustomLogReceiver\CSharpTutorial7_CustomLogReceiver.csproj", "{0BF079D8-BA31-4A97-8398-CC1274B50DE4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E7ACE267-B496-440E-B44D-CC846D39DAA7}.Debug|x86.ActiveCfg = Debug|x86
{E7ACE267-B496-440E-B44D-CC846D39DAA7}.Debug|x86.Build.0 = Debug|x86
{E7ACE267-B496-440E-B44D-CC846D39DAA7}.Release|x86.ActiveCfg = Release|x86
{E7ACE267-B496-440E-B44D-CC846D39DAA7}.Release|x86.Build.0 = Release|x86
{4DDC8FD9-BEAF-422E-A28E-093D299F7DEF}.Debug|x86.ActiveCfg = Debug|x86
{4DDC8FD9-BEAF-422E-A28E-093D299F7DEF}.Debug|x86.Build.0 = Debug|x86
{4DDC8FD9-BEAF-422E-A28E-093D299F7DEF}.Release|x86.ActiveCfg = Release|x86
{4DDC8FD9-BEAF-422E-A28E-093D299F7DEF}.Release|x86.Build.0 = Release|x86
{CB13F5F2-5203-4844-A445-7C5D751EC4FB}.Debug|x86.ActiveCfg = Debug|x86
{CB13F5F2-5203-4844-A445-7C5D751EC4FB}.Debug|x86.Build.0 = Debug|x86
{CB13F5F2-5203-4844-A445-7C5D751EC4FB}.Release|x86.ActiveCfg = Release|x86
{CB13F5F2-5203-4844-A445-7C5D751EC4FB}.Release|x86.Build.0 = Release|x86
{1BE1FACF-6A8F-4735-812D-B38137D1BD2B}.Debug|x86.ActiveCfg = Debug|x86
{1BE1FACF-6A8F-4735-812D-B38137D1BD2B}.Debug|x86.Build.0 = Debug|x86
{1BE1FACF-6A8F-4735-812D-B38137D1BD2B}.Release|x86.ActiveCfg = Release|x86
{1BE1FACF-6A8F-4735-812D-B38137D1BD2B}.Release|x86.Build.0 = Release|x86
{C272F657-D8D0-4587-8D5E-EFB8ED422043}.Debug|x86.ActiveCfg = Debug|x86
{C272F657-D8D0-4587-8D5E-EFB8ED422043}.Debug|x86.Build.0 = Debug|x86
{C272F657-D8D0-4587-8D5E-EFB8ED422043}.Release|x86.ActiveCfg = Release|x86
{C272F657-D8D0-4587-8D5E-EFB8ED422043}.Release|x86.Build.0 = Release|x86
{7C483A37-F45D-433B-AEDC-60ABA5B273F7}.Debug|x86.ActiveCfg = Debug|x86
{7C483A37-F45D-433B-AEDC-60ABA5B273F7}.Debug|x86.Build.0 = Debug|x86
{7C483A37-F45D-433B-AEDC-60ABA5B273F7}.Release|x86.ActiveCfg = Release|x86
{7C483A37-F45D-433B-AEDC-60ABA5B273F7}.Release|x86.Build.0 = Release|x86
{63F39DA0-F5B2-48E1-8E88-A5F3B2C02C56}.Debug|x86.ActiveCfg = Debug|x86
{63F39DA0-F5B2-48E1-8E88-A5F3B2C02C56}.Debug|x86.Build.0 = Debug|x86
{63F39DA0-F5B2-48E1-8E88-A5F3B2C02C56}.Release|x86.ActiveCfg = Release|x86
{63F39DA0-F5B2-48E1-8E88-A5F3B2C02C56}.Release|x86.Build.0 = Release|x86
{0BF079D8-BA31-4A97-8398-CC1274B50DE4}.Debug|x86.ActiveCfg = Debug|x86
{0BF079D8-BA31-4A97-8398-CC1274B50DE4}.Debug|x86.Build.0 = Debug|x86
{0BF079D8-BA31-4A97-8398-CC1274B50DE4}.Release|x86.ActiveCfg = Release|x86
{0BF079D8-BA31-4A97-8398-CC1274B50DE4}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{E7ACE267-B496-440E-B44D-CC846D39DAA7} = {0E06B86B-4B88-4762-B35D-BF5C0AB3D401}
{4DDC8FD9-BEAF-422E-A28E-093D299F7DEF} = {F5FF0CDC-1F04-4F96-B549-24AFBB8195D6}
{CB13F5F2-5203-4844-A445-7C5D751EC4FB} = {E37E1C89-A19A-430D-8959-C87DAD28B62E}
{1BE1FACF-6A8F-4735-812D-B38137D1BD2B} = {E37E1C89-A19A-430D-8959-C87DAD28B62E}
{C272F657-D8D0-4587-8D5E-EFB8ED422043} = {E37E1C89-A19A-430D-8959-C87DAD28B62E}
{7C483A37-F45D-433B-AEDC-60ABA5B273F7} = {E37E1C89-A19A-430D-8959-C87DAD28B62E}
{63F39DA0-F5B2-48E1-8E88-A5F3B2C02C56} = {E37E1C89-A19A-430D-8959-C87DAD28B62E}
{0BF079D8-BA31-4A97-8398-CC1274B50DE4} = {E37E1C89-A19A-430D-8959-C87DAD28B62E}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{CB13F5F2-5203-4844-A445-7C5D751EC4FB}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CSharpTutorial1_2DSound</RootNamespace>
<AssemblyName>CSharpTutorial1_2DSound</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\cAudioCSharp\cAudioCSharp.csproj">
<Project>{4DDC8FD9-BEAF-422E-A28E-093D299F7DEF}</Project>
<Name>cAudioCSharp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,71 @@
//****************************************************************
//cAudio 2.3.0 Tutorial 1 C#
//Basic 2d Audio
//****************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using cAudio;
namespace CSharpTutorial1_2DSound
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
//Some fancy text
Console.WriteLine("cAudio 2.2.0 Tutorial 1: Basic 2D Audio. C#\n");
Console.WriteLine("Available Playback Devices:\n");
//Grab a list of available devices
IAudioDeviceList pDeviceList = cAudioCSharpWrapper.createAudioDeviceList();
//Get the default device name.
string defaultDeviceName = pDeviceList.getDefaultDeviceName();
for (uint i=0; i< pDeviceList.getDeviceCount(); i++)
{
string deviceName = pDeviceList.getDeviceName(i);
if (deviceName.Equals(defaultDeviceName))
Console.WriteLine(" "+ i + "): " + deviceName + " [DEFAULT]");
else
Console.WriteLine(" "+ i + "): " + deviceName);
}
Console.WriteLine("\n");
Console.WriteLine("Choose a device by number: ");
string deviceSelection = Console.ReadLine();
uint deviceSelect = Convert.ToUInt32(deviceSelection);
Console.WriteLine("\n");
//Create an uninitialized Audio Manager
IAudioManager audioMgr = cAudioCSharpWrapper.createAudioManager(false);
audioMgr.initialize(pDeviceList.getDeviceName(deviceSelect));
IAudioSource mysound = audioMgr.create("bing", "../../../Media/cAudioTheme1.ogg");
if (mysound != null)
{
mysound.setVolume(0.5f);
mysound.play2d(false);
while (mysound.isPlaying())
{
cAudioCSharpWrapper.cAudioSleep(10);
}
}
audioMgr.Dispose();
Console.WriteLine(@"Press any key to quit ");
Console.ReadLine();
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("cAudioPlayer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("cAudioPlayer")]
[assembly: AssemblyCopyright("Copyright © 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("21f1a254-f4c3-402d-b9d4-ae988fc9086b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.235
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CSharpTutorial1_2DSound.Properties {
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", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <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("CSharpTutorial1_2DSound.Properties.Resources", typeof(Resources).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;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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>
</root>

View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.235
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CSharpTutorial1_2DSound.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{1BE1FACF-6A8F-4735-812D-B38137D1BD2B}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CSharpTutorial2_3DSound</RootNamespace>
<AssemblyName>CSharpTutorial2_3DSound</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\cAudioCSharp\cAudioCSharp.csproj">
<Project>{4DDC8FD9-BEAF-422E-A28E-093D299F7DEF}</Project>
<Name>cAudioCSharp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,100 @@
//****************************************************************
//cAudio 2.3.0 Tutorial 2 C#
//Basic 3d Audio. Moving Audio source. Must be mono sound source
//****************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using cAudio;
namespace CSharpTutorial2_3DSound
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
//Some fancy text
Console.WriteLine("cAudio 2.2.0 Tutorial 2: Basic 3D Audio. C#\n");
Console.WriteLine("Available Playback Devices:\n");
//Hold audio source x position
float rot = 0;
//Grab a list of available devices
IAudioDeviceList pDeviceList = cAudioCSharpWrapper.createAudioDeviceList();
//Get the default device name.
string defaultDeviceName = pDeviceList.getDefaultDeviceName();
for (uint i = 0; i < pDeviceList.getDeviceCount(); i++)
{
string deviceName = pDeviceList.getDeviceName(i);
if (deviceName.Equals(defaultDeviceName))
Console.WriteLine(" " + i + "): " + deviceName + " [DEFAULT]");
else
Console.WriteLine(" " + i + "): " + deviceName);
}
Console.WriteLine("\n");
Console.WriteLine("Choose a device by number: ");
string deviceSelection = Console.ReadLine();
uint deviceSelect = Convert.ToUInt32(deviceSelection);
Console.WriteLine("\n");
//Create an uninitialized Audio Manager
IAudioManager audioMgr = cAudioCSharpWrapper.createAudioManager(false);
audioMgr.initialize(pDeviceList.getDeviceName(deviceSelect));
//Grab the listener object, which allows us to manipulate where "we" are in the world
//It's useful to bind this to a camera if you are using a 3d graphics engine
IListener listener = audioMgr.getListener();
//Create the audio file
IAudioSource mysound = audioMgr.create("bing", "../../../Media/bling.ogg");
if (mysound != null)
{
listener.setPosition(new cVector3(0,0,0));
mysound.play3d(new cVector3(0,0,0), 2.0f, true);
mysound.setVolume(1.0f);
mysound.setMinDistance(1.0f);
mysound.setMaxDistance(100.0f);
//Play for 10 seconds
const int ticksToPlay = 10000;
int currentTick = 0;
int currentSecTick = 0;
while (mysound.isPlaying() && currentTick < ticksToPlay)
{
rot += 0.1f * 0.017453293f;
float x = (float)(5.0f * Math.Cos(rot) - 0.0f * Math.Sin(rot));
float z = (float)(0.0f * Math.Cos(rot) + 5.0f * Math.Sin(rot));
mysound.move(new cVector3(x,0.0f,z));
++currentTick;
if(currentTick/1000 > currentSecTick)
{
++currentSecTick;
Console.Write(".");
}
cAudioCSharpWrapper.cAudioSleep(10);
}
}
audioMgr.Dispose();
Console.WriteLine(@"Press any key to quit ");
Console.ReadLine();
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("cAudioPlayer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("cAudioPlayer")]
[assembly: AssemblyCopyright("Copyright © 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("21f1a254-f4c3-402d-b9d4-ae988fc9086b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.235
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CSharpTutorial2_3DSound.Properties {
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", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <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("CSharpTutorial2_3DSound.Properties.Resources", typeof(Resources).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;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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>
</root>

View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.235
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CSharpTutorial2_3DSound.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{C272F657-D8D0-4587-8D5E-EFB8ED422043}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CSharpTutorial3_MemoryPlayback</RootNamespace>
<AssemblyName>CSharpTutorial3_MemoryPlayback</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Bling.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\cAudioCSharp\cAudioCSharp.csproj">
<Project>{4DDC8FD9-BEAF-422E-A28E-093D299F7DEF}</Project>
<Name>cAudioCSharp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,75 @@
//****************************************************************
//cAudio 2.3.0 Tutorial 3 C#
//Basic Memory Playback *Virtual file systems*
//bling.h created with bin2h http://deadnode.org/sw/bin2h/
//****************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using cAudio;
namespace CSharpTutorial3_MemoryPlayback
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
//Some fancy text
Console.WriteLine("cAudio 2.2.0 Tutorial 3: Memory Playback. C#\n");
Console.WriteLine("Available Playback Devices:\n");
//Grab a list of available devices
IAudioDeviceList pDeviceList = cAudioCSharpWrapper.createAudioDeviceList();
//Get the default device name.
string defaultDeviceName = pDeviceList.getDefaultDeviceName();
for (uint i = 0; i < pDeviceList.getDeviceCount(); i++)
{
string deviceName = pDeviceList.getDeviceName(i);
if (deviceName.Equals(defaultDeviceName))
Console.WriteLine(" " + i + "): " + deviceName + " [DEFAULT]");
else
Console.WriteLine(" " + i + "): " + deviceName);
}
Console.WriteLine("\n");
Console.WriteLine("Choose a device by number: ");
string deviceSelection = Console.ReadLine();
uint deviceSelect = Convert.ToUInt32(deviceSelection);
Console.WriteLine("\n");
//Create an uninitialized Audio Manager
IAudioManager audioMgr = cAudioCSharpWrapper.createAudioManager(false);
audioMgr.initialize(pDeviceList.getDeviceName(deviceSelect));
//Create the Bling class which holds our blign sound
Bling bling = new Bling();
IAudioSource currentSource = audioMgr.createFromMemory("bling", System.Text.Encoding.Default.GetString(bling.bling),bling.bling_size,"wav");
if (currentSource != null)
{
currentSource.setVolume(0.5f);
currentSource.play2d(false);
while (currentSource.isPlaying())
{
cAudioCSharpWrapper.cAudioSleep(10);
}
}
audioMgr.Dispose();
Console.WriteLine(@"Press any key to quit ");
Console.ReadLine();
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("cAudioPlayer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("cAudioPlayer")]
[assembly: AssemblyCopyright("Copyright © 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("21f1a254-f4c3-402d-b9d4-ae988fc9086b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.235
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CSharpTutorial3_MemoryPlayback.Properties {
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", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <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("CSharpTutorial3_MemoryPlayback.Properties.Resources", typeof(Resources).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;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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>
</root>

View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.235
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CSharpTutorial3_MemoryPlayback.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{7C483A37-F45D-433B-AEDC-60ABA5B273F7}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CSharpTutorial4_AudioCapture</RootNamespace>
<AssemblyName>CSharpTutorial4_AudioCapture</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\cAudioCSharp\cAudioCSharp.csproj">
<Project>{4DDC8FD9-BEAF-422E-A28E-093D299F7DEF}</Project>
<Name>cAudioCSharp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,133 @@
//****************************************************************
//cAudio 2.3.0 Tutorial 4 C#
//Audio Capture and playback
//****************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using cAudio;
namespace CSharpTutorial4_AudioCapture
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
//Some fancy text
Console.WriteLine("cAudio 2.2.0 Tutorial 4: Audio Capture. C#\n");
Console.WriteLine("Available Playback Devices:\n");
//Setup the default frequency and duration
UInt32 CAPTURE_FREQUENCY = 22050;
UInt32 CAPTURE_DURATION = 10;
AudioFormats CAPTURE_FORMAT = AudioFormats.EAF_16BIT_MONO;
String formatName;
if(CAPTURE_FORMAT == AudioFormats.EAF_8BIT_MONO)
formatName = "8 Bit Mono";
else if(CAPTURE_FORMAT == AudioFormats.EAF_8BIT_STEREO)
formatName = "8 Bit Stereo";
else if (CAPTURE_FORMAT == AudioFormats.EAF_16BIT_MONO)
formatName = "16 Bit Mono";
else
formatName = "16 Bit Stereo";
//Create an audio manager with default settings
IAudioManager audioMgr = cAudioCSharpWrapper.createAudioManager();
//! The capture interface can be gotten at any time, and can even be used completely seperate from the manager
// Also it is possible to have more than one capture interface at the same time, useful for recording from multiple sources
IAudioCapture capture = cAudioCSharpWrapper.createAudioCapture(false);
// ! Here we enumerate different devices
IAudioDeviceList pAudioDeviceList = cAudioCSharpWrapper.createAudioDeviceList(cAudio.IDeviceType.DT_RECORDING);
bool captureReady = pAudioDeviceList.isSupported();
Console.WriteLine("Capturing Supported: " + captureReady + "\n");
if (captureReady)
{
Console.WriteLine("Available Capture Devices: ");
UInt32 deviceCount = pAudioDeviceList.getDeviceCount();
string defaultDeviceName = pAudioDeviceList.getDefaultDeviceName();
for(UInt32 i=0; i < deviceCount; ++i)
{
string deviceName = pAudioDeviceList.getDeviceName(i);
if(deviceName.Equals(defaultDeviceName))
Console.WriteLine("" + i + "): " + deviceName + " [DEFAULT] ");
else
Console.WriteLine("" + i + "): " + deviceName);
}
Console.WriteLine("");
Console.WriteLine("Choose a device by number: ");
string deviceSelection = Console.ReadLine();
uint deviceSelect = Convert.ToUInt32(deviceSelection);
Console.WriteLine("\n");
captureReady = capture.initialize(pAudioDeviceList.getDeviceName(deviceSelect), CAPTURE_FREQUENCY, CAPTURE_FORMAT);
Console.WriteLine("Ready to capture audio: " + captureReady + "\n");
UInt32 targetRecordSize = CAPTURE_FREQUENCY * CAPTURE_DURATION * capture.getSampleSize();
Console.WriteLine("Capture Device: " + capture.getDeviceName() + ".");
Console.WriteLine("Capture Frequency: " + CAPTURE_FREQUENCY + " hertz.");
Console.WriteLine("Capture Duration: " + CAPTURE_DURATION + " seconds.");
Console.WriteLine("Capture Format: " + formatName + ".");
Console.WriteLine("Sample Size: " + capture.getSampleSize() + " bytes.");
Console.WriteLine("Target size of audio: " + targetRecordSize + " bytes.");
Console.WriteLine("");
UInt32 currentsize = 0;
Console.WriteLine("Starting capture...");
if(capture.beginCapture())
{
while(currentsize < targetRecordSize)
{
currentsize = capture.getCurrentCapturedAudioSize();
//Sleep for 1 ms to free some CPU
cAudioCSharpWrapper.cAudioSleep(1);
}
}
capture.stopCapture();
Console.WriteLine("Capture stopped... \n");
//Grab the total size again, ensures we get ALL the audio data
//Not completely necessary, as starting a capture again will clear the old audio data
currentsize = capture.getCurrentCapturedAudioSize();
Console.WriteLine("Captured " + currentsize + " bytes of audio data. \n ");
//Create a IAudio object and load a sound from a file
var buffer = capture.getCapturedAudioBuffer();
IAudioSource mysound = audioMgr.createFromAudioBuffer("sound1", buffer, CAPTURE_FREQUENCY, CAPTURE_FORMAT);
buffer.Dispose();
if (mysound != null)
{
mysound.setVolume(0.5f);
mysound.play2d(false);
while (mysound.isPlaying())
{
cAudioCSharpWrapper.cAudioSleep(10);
}
}
}
audioMgr.Dispose();
Console.WriteLine(@"Press any key to quit ");
Console.ReadLine();
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("cAudioPlayer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("cAudioPlayer")]
[assembly: AssemblyCopyright("Copyright © 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("21f1a254-f4c3-402d-b9d4-ae988fc9086b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.235
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CSharpTutorial4_AudioCapture.Properties {
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", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <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("CSharpTutorial4_AudioCapture.Properties.Resources", typeof(Resources).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;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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>
</root>

View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.235
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CSharpTutorial4_AudioCapture.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{63F39DA0-F5B2-48E1-8E88-A5F3B2C02C56}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CSharpTutorial6_CustomEventHandler</RootNamespace>
<AssemblyName>CSharpTutorial6_CustomEventHandler</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="EventHandler.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\cAudioCSharp\cAudioCSharp.csproj">
<Project>{4DDC8FD9-BEAF-422E-A28E-093D299F7DEF}</Project>
<Name>cAudioCSharp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,43 @@
//****************************************************************
//cAudio 2.3.0 Tutorial 6 C#
//Custom Event Handler
//****************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAudio;
namespace CSharpTutorial6_CustomEventHandler
{
public class EventHandler : ISourceEventHandler
{
public override void onUpdate()
{
Console.WriteLine("onPlay");
}
public override void onRelease()
{
Console.WriteLine("onRelease");
}
public override void onPlay()
{
Console.WriteLine("onPlay");
}
public override void onStop()
{
Console.WriteLine("onStop");
}
public override void onPause()
{
Console.WriteLine("onPause");
}
}
}

View File

@ -0,0 +1,78 @@
//****************************************************************
//cAudio 2.3.0 Tutorial 6 C#
//Custom Event Handler
//****************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using cAudio;
namespace CSharpTutorial6_CustomEventHandler
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
//Some fancy text
Console.WriteLine("cAudio 2.2.0 Tutorial 6: Custom Event Handler. C#\n");
Console.WriteLine("Available Playback Devices:\n");
//Grab a list of available devices
IAudioDeviceList pDeviceList = cAudioCSharpWrapper.createAudioDeviceList();
//Create a Event Handler Object
EventHandler eventHandler = new EventHandler();
//Get the default device name.
string defaultDeviceName = pDeviceList.getDefaultDeviceName();
for (uint i = 0; i < pDeviceList.getDeviceCount(); i++)
{
string deviceName = pDeviceList.getDeviceName(i);
if (deviceName.Equals(defaultDeviceName))
Console.WriteLine(" " + i + "): " + deviceName + " [DEFAULT]");
else
Console.WriteLine(" " + i + "): " + deviceName);
}
Console.WriteLine("\n");
Console.WriteLine("Choose a device by number: ");
string deviceSelection = Console.ReadLine();
uint deviceSelect = Convert.ToUInt32(deviceSelection);
Console.WriteLine("\n");
//Create an uninitialized Audio Manager
IAudioManager audioMgr = cAudioCSharpWrapper.createAudioManager(false);
audioMgr.initialize(pDeviceList.getDeviceName(deviceSelect));
IAudioSource mysound = audioMgr.create("bing", "../../../Media/cAudioTheme1.ogg");
//We register the event handler with the audio source
mysound.registerEventHandler(eventHandler);
if (mysound != null)
{
mysound.setVolume(0.5f);
mysound.play2d(false);
while (mysound.isPlaying())
{
cAudioCSharpWrapper.cAudioSleep(10);
}
}
audioMgr.Dispose();
Console.WriteLine(@"Press any key to quit ");
Console.ReadLine();
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("cAudioPlayer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("cAudioPlayer")]
[assembly: AssemblyCopyright("Copyright © 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("21f1a254-f4c3-402d-b9d4-ae988fc9086b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.235
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CSharpTutorial6_CustomEventHandler.Properties {
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", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <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("CSharpTutorial6_CustomEventHandler.Properties.Resources", typeof(Resources).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;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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>
</root>

View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.235
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CSharpTutorial6_CustomEventHandler.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{0BF079D8-BA31-4A97-8398-CC1274B50DE4}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CSharpTutorial7_CustomLogReceiver</RootNamespace>
<AssemblyName>CSharpTutorial7_CustomLogReceiver</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Logger.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\cAudioCSharp\cAudioCSharp.csproj">
<Project>{4DDC8FD9-BEAF-422E-A28E-093D299F7DEF}</Project>
<Name>cAudioCSharp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,23 @@
//****************************************************************
//cAudio 2.3.0 Tutorial 7 C#
//Custom log receiver
//****************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAudio;
namespace CSharpTutorial7_CustomLogReceiver
{
class Logger : ILogReceiver
{
public override bool OnLogMessage(string sender, string message, cAudio.LogLevel level, float time)
{
Console.WriteLine("Message");
return true;
}
}
}

View File

@ -0,0 +1,78 @@
//****************************************************************
//cAudio 2.3.0 Tutorial 7 C#
//Custom log receiver
//****************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using cAudio;
namespace CSharpTutorial7_CustomLogReceiver
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
//Some fancy text
Console.WriteLine("cAudio 2.2.0 Tutorial 7: Custom Log Receiver. C#\n");
Console.WriteLine("Available Playback Devices:\n");
//Grab a list of available devices
IAudioDeviceList pDeviceList = cAudioCSharpWrapper.createAudioDeviceList();
//Create a logger object
Logger loggin = new Logger();
//Grab the logging instance
ILogger log = cAudioCSharpWrapper.getLogger();
//Then we pass our new receiver to it with a unique name
log.registerLogReceiver(loggin, "Loggin");
//Get the default device name.
string defaultDeviceName = pDeviceList.getDefaultDeviceName();
for (uint i = 0; i < pDeviceList.getDeviceCount(); i++)
{
string deviceName = pDeviceList.getDeviceName(i);
if (deviceName.Equals(defaultDeviceName))
Console.WriteLine(" " + i + "): " + deviceName + " [DEFAULT]");
else
Console.WriteLine(" " + i + "): " + deviceName);
}
Console.WriteLine("\n");
Console.WriteLine("Choose a device by number: ");
string deviceSelection = Console.ReadLine();
uint deviceSelect = Convert.ToUInt32(deviceSelection);
Console.WriteLine("\n");
//Create an uninitialized Audio Manager
IAudioManager audioMgr = cAudioCSharpWrapper.createAudioManager(false);
audioMgr.initialize(pDeviceList.getDeviceName(deviceSelect));
IAudioSource mysound = audioMgr.create("bing", "../../../Media/cAudioTheme1.ogg");
if (mysound != null)
{
mysound.setVolume(0.5f);
mysound.play2d(false);
while (mysound.isPlaying())
{
cAudioCSharpWrapper.cAudioSleep(10);
}
}
audioMgr.Dispose();
Console.WriteLine(@"Press any key to quit ");
Console.ReadLine();
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("cAudioPlayer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("cAudioPlayer")]
[assembly: AssemblyCopyright("Copyright © 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("21f1a254-f4c3-402d-b9d4-ae988fc9086b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.235
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CSharpTutorial7_CustomLogReceiver.Properties {
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", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <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("CSharpTutorial7_CustomLogReceiver.Properties.Resources", typeof(Resources).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;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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>
</root>

View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.235
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CSharpTutorial7_CustomLogReceiver.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAudio;
namespace cAudioPlayer
{
public class AudioSourceListener : ISourceEventHandler
{
private readonly MainWnd mPlayer;
public AudioSourceListener(MainWnd player)
{
mPlayer = player;
}
public override void onUpdate()
{
}
public override void onRelease()
{
}
public override void onPlay()
{
Console.Out.WriteLine("onPlay");
}
public override void onStop()
{
Console.Out.WriteLine("onStop");
mPlayer.OnStop();
}
public override void onPause()
{
Console.Out.WriteLine("onPause");
}
}
}

View File

@ -0,0 +1,116 @@
namespace cAudioPlayer
{
partial class MainWnd
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.fileNFO = new System.Windows.Forms.Label();
this.btnOpen = new System.Windows.Forms.Button();
this.currentPostion = new System.Windows.Forms.TrackBar();
this.btnPlay = new System.Windows.Forms.Button();
this.btnStop = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.currentPostion)).BeginInit();
this.SuspendLayout();
//
// fileNFO
//
this.fileNFO.AutoSize = true;
this.fileNFO.Location = new System.Drawing.Point(51, 9);
this.fileNFO.Name = "fileNFO";
this.fileNFO.Size = new System.Drawing.Size(46, 13);
this.fileNFO.TabIndex = 0;
this.fileNFO.Text = "File: n/a";
//
// btnOpen
//
this.btnOpen.Location = new System.Drawing.Point(2, 4);
this.btnOpen.Name = "btnOpen";
this.btnOpen.Size = new System.Drawing.Size(43, 23);
this.btnOpen.TabIndex = 1;
this.btnOpen.Text = "Open";
this.btnOpen.UseVisualStyleBackColor = true;
this.btnOpen.Click += new System.EventHandler(this.BtnOpenClick);
//
// currentPostion
//
this.currentPostion.Location = new System.Drawing.Point(2, 33);
this.currentPostion.Maximum = 1000;
this.currentPostion.Name = "currentPostion";
this.currentPostion.Size = new System.Drawing.Size(492, 45);
this.currentPostion.TabIndex = 2;
this.currentPostion.TickStyle = System.Windows.Forms.TickStyle.Both;
//
// btnPlay
//
this.btnPlay.Location = new System.Drawing.Point(2, 84);
this.btnPlay.Name = "btnPlay";
this.btnPlay.Size = new System.Drawing.Size(43, 23);
this.btnPlay.TabIndex = 3;
this.btnPlay.Text = "Play";
this.btnPlay.UseVisualStyleBackColor = true;
this.btnPlay.Click += new System.EventHandler(this.BtnPlayClick);
//
// btnStop
//
this.btnStop.Location = new System.Drawing.Point(51, 84);
this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(43, 23);
this.btnStop.TabIndex = 4;
this.btnStop.Text = "Stop";
this.btnStop.UseVisualStyleBackColor = true;
this.btnStop.Click += new System.EventHandler(this.BtnStopClick);
//
// MainWnd
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(498, 113);
this.Controls.Add(this.btnStop);
this.Controls.Add(this.btnPlay);
this.Controls.Add(this.currentPostion);
this.Controls.Add(this.btnOpen);
this.Controls.Add(this.fileNFO);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "MainWnd";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "cAudio C# Player";
((System.ComponentModel.ISupportInitialize)(this.currentPostion)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label fileNFO;
private System.Windows.Forms.Button btnOpen;
private System.Windows.Forms.TrackBar currentPostion;
private System.Windows.Forms.Button btnPlay;
private System.Windows.Forms.Button btnStop;
}
}

View File

@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using cAudio;
namespace cAudioPlayer
{
public partial class MainWnd : Form
{
private IAudioManager mAudioMgr;
private IAudioSource mCurrentSource;
private readonly AudioSourceListener mAudioListener;
private readonly Timer mUpdateTimer = new Timer();
public MainWnd()
{
InitializeComponent();
mAudioMgr = cAudioCSharpWrapper.createAudioManager(true);
mAudioListener = new AudioSourceListener(this);
mUpdateTimer.Tick += UpdateTimerTick;
Closing += MainWnd_Closing;
}
void MainWnd_Closing(object sender, CancelEventArgs e)
{
if (mCurrentSource != null)
{
mCurrentSource.unRegisterEventHandler(mAudioListener);
mCurrentSource = null;
}
mAudioMgr.Dispose();
mAudioMgr = null;
}
void UpdateTimerTick(object sender, EventArgs e)
{
UpdateSlider();
}
private void BtnOpenClick(object sender, EventArgs e)
{
btnPlay.Text = "Play";
btnPlay.Enabled = false;
btnStop.Enabled = false;
currentPostion.Value = 0;
mUpdateTimer.Stop();
if (mCurrentSource != null)
{
mCurrentSource.unRegisterEventHandler(mAudioListener);
mAudioMgr.release(mCurrentSource);
mCurrentSource = null;
}
var openFileDlg = new OpenFileDialog();
if (openFileDlg.ShowDialog() == DialogResult.OK)
{
var file = openFileDlg.FileName;
mCurrentSource = mAudioMgr.create("musicFile", file);
mCurrentSource.registerEventHandler(mAudioListener);
fileNFO.Text = "File:" + file.Substring(file.LastIndexOf("\\") + 1) + " | Length: " + (mCurrentSource.getTotalAudioTime() / 60).ToString("#.00") + " min";
btnPlay.Enabled = true;
}
}
private void BtnPlayClick(object sender, EventArgs e)
{
btnStop.Enabled = true;
if(btnPlay.Text == "Play")
{
btnPlay.Text = "Pause";
mCurrentSource.play2d(false);
mUpdateTimer.Interval = 50;
mUpdateTimer.Start();
}
else
{
btnPlay.Text = "Play";
mCurrentSource.pause();
mUpdateTimer.Stop();
}
}
private void BtnStopClick(object sender, EventArgs e)
{
OnStop();
}
public void OnStop()
{
btnPlay.Invoke((MethodInvoker)delegate { btnPlay.Text = "Play"; });
btnStop.Invoke((MethodInvoker)delegate { btnStop.Enabled = false; });
if(mCurrentSource.isPlaying())
mCurrentSource.stop();
mUpdateTimer.Stop();
currentPostion.Invoke((MethodInvoker)delegate { currentPostion.Value = 0; });
}
public void UpdateSlider()
{
var percent = (int)((mCurrentSource.getCurrentAudioTime() / mCurrentSource.getTotalAudioTime()) * 1000);
if (currentPostion.InvokeRequired)
{
currentPostion.Invoke((MethodInvoker)delegate { currentPostion.Value = percent; });
}
else
{
currentPostion.Value = percent;
}
}
}
}

View File

@ -0,0 +1,120 @@
<?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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace cAudioPlayer
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainWnd());
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("cAudioPlayer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("cAudioPlayer")]
[assembly: AssemblyCopyright("Copyright © 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("21f1a254-f4c3-402d-b9d4-ae988fc9086b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.225
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace cAudioPlayer.Properties {
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", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <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("cAudioPlayer.Properties.Resources", typeof(Resources).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;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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>
</root>

View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.225
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace cAudioPlayer.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E7ACE267-B496-440E-B44D-CC846D39DAA7}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>cAudioPlayer</RootNamespace>
<AssemblyName>cAudioPlayer</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AudioSourceListener.cs" />
<Compile Include="MainWnd.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainWnd.Designer.cs">
<DependentUpon>MainWnd.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="MainWnd.resx">
<DependentUpon>MainWnd.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\cAudioCSharp\cAudioCSharp.csproj">
<Project>{4DDC8FD9-BEAF-422E-A28E-093D299F7DEF}</Project>
<Name>cAudioCSharp</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

54
Examples/Info.plist Normal file
View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array/>
<key>CFBundleExecutable</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIconFile</key>
<string>CAUDIOAppLogo.icns</string>
<key>CFBundleIdentifier</key>
<string>com.YOURCOMPANY</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string></string>
<key>CFBundleName</key>
<string></string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array/>
<key>CFBundleVersion</key>
<string></string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>UIStatusBarHidden</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
</array>
<key>UTExportedTypeDeclarations</key>
<array/>
<key>UTImportedTypeDeclarations</key>
<array/>
</dict>
</plist>

Binary file not shown.

BIN
Examples/Media/bling.ogg Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,54 @@
#-------------------------------------------------------------------
# This file is part of the CMake build system for CAUDIO
#-------------------------------------------------------------------
############################################################
# Tutorial1_2DSound Player
############################################################
PROJECT(Tutorial1_2DSound)
set (SOURCE_FILES
src/Main.cpp
)
if(CAUDIO_IOS_BUILD)
# TODO add ios appdelegate
endif()
include_directories (include ${CAUDIO_INCLUDE_DIR} )
add_executable(Tutorial1_2DSound ${SOURCE_FILES})
target_link_libraries(Tutorial1_2DSound cAudio)
add_dependencies(Tutorial1_2DSound cAudio)
if(CAUDIO_IOS_BUILD)
set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS "-x objective-c++")
endif()
if(${CAUDIO_STATIC})
ADD_DEFINITIONS(-DCAUDIO_STATIC_LIB=1)
endif()
if (WIN32)
# append _d for debug builds
set_property(TARGET Tutorial1_2DSound APPEND PROPERTY DEBUG_POSTFIX "_d")
endif()
if (APPLE)
# On OS X, create .app bundle
set_property(TARGET Tutorial1_2DSound PROPERTY MACOSX_BUNDLE TRUE)
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.YOUR_COMPANY.\${PRODUCT_NAME:rfc1034identifier}")
set_property(TARGET Tutorial1_2DSound PROPERTY MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/../Info.plist)
if(CAUDIO_IOS_BUILD)
set_target_properties(Tutorial1_2DSound PROPERTIES XCODE_ATTRIBUTE_GCC_THUMB_SUPPORT "NO")
set_target_properties(Tutorial1_2DSound PROPERTIES XCODE_ATTRIBUTE_GCC_UNROLL_LOOPS "YES")
set_target_properties(Tutorial1_2DSound PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer")
endif()
endif ()
install_all_targets(Tutorial1_2DSound)

View File

@ -0,0 +1,101 @@
//****************************************************************
//cAudio 2.3.0 Tutorial 1
//Basic 2d Audio
//****************************************************************
#include <iostream>
#include <string>
//Include cAudio.h so we can work wtih cAudio
#include "cAudio.h"
#if defined(CAUDIO_COMILER_MINGW)
// do nothing
#elif defined(CAUDIO_PLATFORM_WIN)
# define AUDIO_FILE(_soundName_) CAUDIO_MEDIA_ROOT##_soundName_
#else
# define AUDIO_FILE(_soundName_) CAUDIO_MEDIA_ROOT#_soundName_
#endif
using namespace std;
int main(int argc, char* argv[]) {
//Some fancy text
cout << "cAudio 2.3.0 Tutorial 1: Basic 2D Audio. \n \n";
//Create an uninitialized Audio Manager
cAudio::IAudioManager* audioMgr = cAudio::createAudioManager(false);
if(audioMgr)
{
//Allow the user to choose a playback device
cout << "\nAvailable Playback Devices: \n";
cAudio::IAudioDeviceList* pDeviceList = cAudio::createAudioDeviceList();
unsigned int deviceCount = pDeviceList->getDeviceCount();
cAudio::cAudioString defaultDeviceName = pDeviceList->getDefaultDeviceName();
for(unsigned int i=0; i<deviceCount; ++i)
{
cAudio::cAudioString deviceName = pDeviceList->getDeviceName(i);
if(deviceName.compare(defaultDeviceName) == 0)
cout << i << "): " << deviceName.c_str() << " [DEFAULT] \n";
else
cout << i << "): " << deviceName.c_str() << " \n";
}
cout << std::endl;
cout << "Choose a device by number: ";
unsigned int deviceSelection = 0;
cin >> deviceSelection;
cout << std::endl;
//Initialize the Audio Manager with the user settings
audioMgr->initialize(pDeviceList->getDeviceName(deviceSelection).c_str());
CAUDIO_DELETE pDeviceList;
pDeviceList = 0;
//Create a IAudio object and load a sound from a file
#if defined(CAUDIO_COMPILER_MINGW)
cAudio::IAudioSource* mysound = audioMgr->create("bling", "../Media/cAudioTheme1.ogg",true);
#elif defined(CAUDIO_PLATFORM_WIN)
cAudio::IAudioSource* mysound = audioMgr->create("bling", AUDIO_FILE("cAudioTheme1.ogg")),true);
#else
cAudio::IAudioSource* mysound = audioMgr->create("bling", AUDIO_FILE(cAudioTheme1.ogg),true);
#endif
for (size_t i=0; i<10; i++)
{
#if defined(CAUDIO_COMPILER_MINGW)
audioMgr->play2D("../Media/bling.ogg");
#elif defined(CAUDIO_PLATFORM_WIN)
audioMgr->play2D(AUDIO_FILE("bling.ogg"));
#else
audioMgr->play2D(AUDIO_FILE(bling.ogg));
#endif
}
if(mysound)
{
mysound->setVolume(0.5);
//Set the IAudio Sound to play2d and loop
mysound->play2d(false);
//Wait for the sound to finish playing
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
cAudio::destroyAudioManager(audioMgr);
}
else
{
std::cout << "Failed to create audio playback audioMgr. \n";
}
std::cout << "Press any key to quit \n";
std::cin.get();
std::cin.get();
return 0;
}

View File

@ -0,0 +1,54 @@
#-------------------------------------------------------------------
# This file is part of the CMake build system for CAUDIO
#-------------------------------------------------------------------
############################################################
# Tutorial1_3DSound Player
############################################################
PROJECT(Tutorial1_3DSound)
set (SOURCE_FILES
src/Main.cpp
)
if(CAUDIO_IOS_BUILD)
# TODO add ios appdelegate
endif()
include_directories (include ${CAUDIO_INCLUDE_DIR} )
add_executable(Tutorial1_3DSound ${SOURCE_FILES})
target_link_libraries(Tutorial1_3DSound cAudio)
add_dependencies(Tutorial1_3DSound cAudio)
if(CAUDIO_IOS_BUILD)
set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS "-x objective-c++")
endif()
if(${CAUDIO_STATIC})
ADD_DEFINITIONS(-DCAUDIO_STATIC_LIB=1)
endif()
if (WIN32)
# append _d for debug builds
set_property(TARGET Tutorial1_3DSound APPEND PROPERTY DEBUG_POSTFIX "_d")
endif()
if (APPLE)
# On OS X, create .app bundle
set_property(TARGET Tutorial1_3DSound PROPERTY MACOSX_BUNDLE TRUE)
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.YOUR_COMPANY.\${PRODUCT_NAME:rfc1034identifier}")
set_property(TARGET Tutorial1_3DSound PROPERTY MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/../Info.plist)
if(CAUDIO_IOS_BUILD)
set_target_properties(Tutorial1_3DSound PROPERTIES XCODE_ATTRIBUTE_GCC_THUMB_SUPPORT "NO")
set_target_properties(Tutorial1_3DSound PROPERTIES XCODE_ATTRIBUTE_GCC_UNROLL_LOOPS "YES")
set_target_properties(Tutorial1_3DSound PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer")
endif()
endif ()
install_all_targets(Tutorial1_3DSound)

View File

@ -0,0 +1,125 @@
//****************************************************************
//cAudio 2.3.0 Tutorial 2
//Basic 3d Audio. Moving Audio source. Must be mono sound source
//****************************************************************
#include <iostream>
#include <string>
#include <math.h>
//Include cAudio.h so we can work wtih cAudio
#include "cAudio.h"
#if defined(CAUDIO_COMILER_MINGW)
// do nothing
#elif defined(CAUDIO_PLATFORM_WIN)
# define AUDIO_FILE(_soundName_) CAUDIO_MEDIA_ROOT##_soundName_
#else
# define AUDIO_FILE(_soundName_) CAUDIO_MEDIA_ROOT#_soundName_
#endif
using namespace std;
int main(int argc, char* argv[])
{
//Some fancy text
cout << "cAudio 2.3.0 Tutorial 2: Basic 3D Audio. \n \n";
//Hold audio source x position
float rot = 0;
//Create an uninitialized Audio Manager
cAudio::IAudioManager* audioMgr = cAudio::createAudioManager(false);
if(audioMgr)
{
//Allow the user to choose a playback device
cout << "\nAvailable Playback Devices: \n";
cAudio::IAudioDeviceList* pDeviceList = cAudio::createAudioDeviceList();
unsigned int deviceCount = pDeviceList->getDeviceCount();
cAudio::cAudioString defaultDeviceName = pDeviceList->getDefaultDeviceName();
for(unsigned int i=0; i<deviceCount; ++i)
{
cAudio::cAudioString deviceName = pDeviceList->getDeviceName(i);
if(deviceName.compare(defaultDeviceName) == 0)
cout << i << "): " << deviceName.c_str() << " [DEFAULT] \n";
else
cout << i << "): " << deviceName.c_str() << " \n";
}
cout << std::endl;
cout << "Choose a device by number: ";
unsigned int deviceSelection = 0;
cin >> deviceSelection;
cout << std::endl;
//Initialize the manager with the user settings
audioMgr->initialize(pDeviceList->getDeviceName(deviceSelection).c_str());
CAUDIO_DELETE pDeviceList;
pDeviceList = 0;
//Grab the listener object, which allows us to manipulate where "we" are in the world
//It's useful to bind this to a camera if you are using a 3d graphics engine
cAudio::IListener* listener = audioMgr->getListener();
//Create a IAudio object and load a sound from a file
#if defined(CAUDIO_COMPILER_MINGW)
cAudio::IAudioSource* mysound = audioMgr->create("bling", "../Media/bling.ogg",true);
#elif defined(CAUDIO_PLATFORM_WIN)
cAudio::IAudioSource* mysound = audioMgr->create("bling", AUDIO_FILE("bling.ogg")),true);
#else
cAudio::IAudioSource* mysound = audioMgr->create("bling", AUDIO_FILE(bling.ogg),true);
#endif
//Set the IAudio Sound to play3d and loop
//play3d takes 4 arguments play3d(toloop,x,y,z,strength)
if(mysound && listener)
{
listener->setPosition(cAudio::cVector3(0,0,0));
mysound->play3d(cAudio::cVector3(0,0,0),2.0f,true);
mysound->setVolume(1.0f);
mysound->setMinDistance(1.0f);
mysound->setMaxDistance(100.0f);
//Play for 10 seconds
const int ticksToPlay = 10000;
int currentTick = 0;
int currentSecTick = 0;
while(mysound->isPlaying() && currentTick < ticksToPlay)
{
//Figure out the location of our rotated sound
rot+=0.1f * 0.017453293f; //0.1 degrees a frame
//Sound "starts" at x=5, y=0, z=0
float x = 5.0f * cosf(rot) - 0.0f * sinf(rot);
float z = 0.0f * cosf(rot) + 5.0f * sinf(rot);
mysound->move(cAudio::cVector3(x,0.0,z));
++currentTick;
if(currentTick/1000 > currentSecTick)
{
++currentSecTick;
std::cout << ".";
}
//Sleep for 1 ms to free some CPU
cAudio::cAudioSleep(1);
}
}
std::cout << std::endl;
cAudio::destroyAudioManager(audioMgr);
}
else
{
std::cout << "Failed to create audio playback manager. \n";
}
std::cout << "Press any key to quit \n";
std::cin.get();
std::cin.get();
return 0;
}

View File

@ -0,0 +1,55 @@
#-------------------------------------------------------------------
# This file is part of the CMake build system for CAUDIO
#-------------------------------------------------------------------
############################################################
# Tutorial3_MemoryPlayback Player
############################################################
PROJECT(Tutorial3_MemoryPlayback)
set (SOURCE_FILES
include/bling.h
src/Main.cpp
)
if(CAUDIO_IOS_BUILD)
# TODO add ios appdelegate
endif()
include_directories (include ${CAUDIO_INCLUDE_DIR} )
add_executable(Tutorial3_MemoryPlayback ${SOURCE_FILES})
target_link_libraries(Tutorial3_MemoryPlayback cAudio)
add_dependencies(Tutorial3_MemoryPlayback cAudio)
if(CAUDIO_IOS_BUILD)
set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS "-x objective-c++")
endif()
if(${CAUDIO_STATIC})
ADD_DEFINITIONS(-DCAUDIO_STATIC_LIB=1)
endif()
if (WIN32)
# append _d for debug builds
set_property(TARGET Tutorial3_MemoryPlayback APPEND PROPERTY DEBUG_POSTFIX "_d")
endif()
if (APPLE)
# On OS X, create .app bundle
set_property(TARGET Tutorial3_MemoryPlayback PROPERTY MACOSX_BUNDLE TRUE)
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.YOUR_COMPANY.\${PRODUCT_NAME:rfc1034identifier}")
set_property(TARGET Tutorial3_MemoryPlayback PROPERTY MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/../Info.plist)
if(CAUDIO_IOS_BUILD)
set_target_properties(Tutorial3_MemoryPlayback PROPERTIES XCODE_ATTRIBUTE_GCC_THUMB_SUPPORT "NO")
set_target_properties(Tutorial3_MemoryPlayback PROPERTIES XCODE_ATTRIBUTE_GCC_UNROLL_LOOPS "YES")
set_target_properties(Tutorial3_MemoryPlayback PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer")
endif()
endif ()
install_all_targets(Tutorial3_MemoryPlayback)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,82 @@
//****************************************************************
//cAudio 2.3.0 Tutorial 3
//Basic Memory Playback *Virtual file systems*
//bling.h created with bin2h http://deadnode.org/sw/bin2h/
//****************************************************************
#include <iostream>
#include <string>
//Include cAudio.h so we can work wtih cAudio
#include "cAudio.h"
#if defined(CAUDIO_COMILER_MINGW)
// do nothing
#elif defined(CAUDIO_PLATFORM_WIN)
# define AUDIO_FILE(_soundName_) CAUDIO_MEDIA_ROOT##_soundName_
#else
# define AUDIO_FILE(_soundName_) CAUDIO_MEDIA_ROOT#_soundName_
#endif
//Our Bling sound
#include "bling.h"
using namespace std;
int main(int argc, char* argv[])
{
//Some fancy text
cout << "cAudio 2.3.0 Tutorial 3: Memory Playback. \n \n";
//Create an uninitialized Audio Manager
cAudio::IAudioManager* audioMgr = cAudio::createAudioManager(false);
if(audioMgr)
{
//Allow the user to choose a playback device
cout << "\nAvailable Playback Devices: \n";
cAudio::IAudioDeviceList* pDeviceList = cAudio::createAudioDeviceList();
unsigned int deviceCount = pDeviceList->getDeviceCount();
cAudio::cAudioString defaultDeviceName = pDeviceList->getDefaultDeviceName();
for(unsigned int i=0; i<deviceCount; ++i)
{
cAudio::cAudioString deviceName = pDeviceList->getDeviceName(i);
if(deviceName.compare(defaultDeviceName) == 0)
cout << i << "): " << deviceName.c_str() << " [DEFAULT] \n";
else
cout << i << "): " << deviceName.c_str() << " \n";
}
cout << std::endl;
cout << "Choose a device by number: ";
unsigned int deviceSelection = 0;
cin >> deviceSelection;
cout << std::endl;
//Initialize the manager with the user settings
audioMgr->initialize(pDeviceList->getDeviceName(deviceSelection).c_str());
CAUDIO_DELETE pDeviceList;
pDeviceList = 0;
//Create a IAudio object and load a sound from memory. using the bling array and bling size generated by bin2h.
cAudio::IAudioSource* mysound = audioMgr->createFromMemory("bling",(const char*)bling,bling_size,"wav");
if(mysound)
{
//Set the IAudio Sound to play2d and loop
mysound->play2d(true);
//Sleep for 10,000 ms to free some CPU, also makes the example only last 10 seconds
cAudio::cAudioSleep(10000);
}
cAudio::destroyAudioManager(audioMgr);
}
else
{
std::cout << "Failed to create audio playback manager. \n";
}
std::cout << "Press any key to quit \n";
std::cin.get();
std::cin.get();
return 0;
}

View File

@ -0,0 +1,54 @@
#-------------------------------------------------------------------
# This file is part of the CMake build system for CAUDIO
#-------------------------------------------------------------------
############################################################
# Tutorial4_AudioCapture Player
############################################################
PROJECT(Tutorial4_AudioCapture)
set (SOURCE_FILES
src/Main.cpp
)
if(CAUDIO_IOS_BUILD)
# TODO add ios appdelegate
endif()
include_directories (include ${CAUDIO_INCLUDE_DIR} )
add_executable(Tutorial4_AudioCapture ${SOURCE_FILES})
target_link_libraries(Tutorial4_AudioCapture cAudio)
add_dependencies(Tutorial4_AudioCapture cAudio)
if(CAUDIO_IOS_BUILD)
set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS "-x objective-c++")
endif()
if(${CAUDIO_STATIC})
ADD_DEFINITIONS(-DCAUDIO_STATIC_LIB=1)
endif()
if (WIN32)
# append _d for debug builds
set_property(TARGET Tutorial4_AudioCapture APPEND PROPERTY DEBUG_POSTFIX "_d")
endif()
if (APPLE)
# On OS X, create .app bundle
set_property(TARGET Tutorial4_AudioCapture PROPERTY MACOSX_BUNDLE TRUE)
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.YOUR_COMPANY.\${PRODUCT_NAME:rfc1034identifier}")
set_property(TARGET Tutorial4_AudioCapture PROPERTY MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/../Info.plist)
if(CAUDIO_IOS_BUILD)
set_target_properties(Tutorial4_AudioCapture PROPERTIES XCODE_ATTRIBUTE_GCC_THUMB_SUPPORT "NO")
set_target_properties(Tutorial4_AudioCapture PROPERTIES XCODE_ATTRIBUTE_GCC_UNROLL_LOOPS "YES")
set_target_properties(Tutorial4_AudioCapture PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer")
endif()
endif ()
install_all_targets(Tutorial4_AudioCapture)

View File

@ -0,0 +1,153 @@
//****************************************************************
//cAudio 2.3.0 Tutorial 4
//Audio Capture and playback
//****************************************************************
#include <iostream>
#include <string>
//Include cAudio.h so we can work wtih cAudio
#include "cAudio.h"
#if defined(CAUDIO_COMILER_MINGW)
// do nothing
#elif defined(CAUDIO_PLATFORM_WIN)
# define AUDIO_FILE(_soundName_) CAUDIO_MEDIA_ROOT##_soundName_
#else
# define AUDIO_FILE(_soundName_) CAUDIO_MEDIA_ROOT#_soundName_
#endif
using namespace std;
const unsigned int CAPTURE_FREQUENCY = 22050;
const unsigned int CAPTURE_DURATION = 10;
const cAudio::AudioFormats CAPTURE_FORMAT = cAudio::EAF_16BIT_MONO;
int main(int argc, char* argv[])
{
//Some fancy text
cout << "\ncAudio 2.3.0 Tutorial 4: Capturing Audio. \n \n";
std::string formatName;
if(CAPTURE_FORMAT == cAudio::EAF_8BIT_MONO)
formatName = "8 Bit Mono";
else if(CAPTURE_FORMAT == cAudio::EAF_8BIT_STEREO)
formatName = "8 Bit Stereo";
else if(CAPTURE_FORMAT == cAudio::EAF_16BIT_MONO)
formatName = "16 Bit Mono";
else
formatName = "16 Bit Stereo";
//Create an Audio Manager with default settings
cAudio::IAudioManager* audioMgr = cAudio::createAudioManager();
if(audioMgr)
{
//! The capture interface can be gotten at any time, and can even be used completely seperate from the manager
// Also it is possible to have more than one capture interface at the same time, useful for recording from multiple sources
cAudio::IAudioCapture* capture = cAudio::createAudioCapture(false);
// ! Here we enumerate different devices
cAudio::IAudioDeviceList* pAudioDeviceList = cAudio::createAudioDeviceList(cAudio::DT_RECORDING);
if(pAudioDeviceList)
{
bool captureReady = pAudioDeviceList->isSupported();
cout << "Capturing Supported: " << std::boolalpha << captureReady << "\n \n";
if(captureReady)
{
cout << "Available Capture Devices: \n";
unsigned int deviceCount = pAudioDeviceList->getDeviceCount();
cAudio::cAudioString defaultDeviceName = pAudioDeviceList->getDefaultDeviceName();
for(unsigned int i=0; i<deviceCount; ++i)
{
cAudio::cAudioString deviceName = pAudioDeviceList->getDeviceName(i);
if(deviceName.compare(defaultDeviceName) == 0)
cout << i << "): " << deviceName.c_str() << " [DEFAULT] \n";
else
cout << i << "): " << deviceName.c_str() << " \n";
}
cout << std::endl;
cout << "Choose a device by number: ";
unsigned int deviceSelection = 0;
cin >> deviceSelection;
cout << std::endl;
captureReady = capture->initialize(pAudioDeviceList->getDeviceName(deviceSelection).c_str(), CAPTURE_FREQUENCY, CAPTURE_FORMAT);
CAUDIO_DELETE pAudioDeviceList; // Free up some memory
pAudioDeviceList = 0;
cout << "Ready to capture audio: " << std::boolalpha << captureReady << "\n \n";
//Quick math to figure out how large our data should be for the duration of the record time
const unsigned int targetRecordSize = CAPTURE_FREQUENCY * CAPTURE_DURATION * capture->getSampleSize();
//Print various information
cout << "Capture Device: " << capture->getDeviceName() << ". \n";
cout << "Capture Frequency: " << CAPTURE_FREQUENCY << " hertz. \n";
cout << "Capture Duration: " << CAPTURE_DURATION << " seconds. \n";
cout << "Capture Format: " << formatName << ". \n";
cout << "Sample Size: " << capture->getSampleSize() << " bytes. \n";
cout << "Target size of audio: " << targetRecordSize << " bytes. \n";
cout << std::endl;
unsigned int currentsize = 0;
cout << "Starting capture... \n";
if(capture->beginCapture())
{
while(currentsize < targetRecordSize)
{
currentsize = capture->getCurrentCapturedAudioSize();
//Sleep for 1 ms to free some CPU
cAudio::cAudioSleep(1);
}
}
capture->stopCapture();
cout << "Capture stopped... \n \n";
//Grab the total size again, ensures we get ALL the audio data
//Not completely necessary, as starting a capture again will clear the old audio data
currentsize = capture->getCurrentCapturedAudioSize();
cout << "Captured " << currentsize << " bytes of audio data. \n \n";
cAudio::AudioCaptureBuffer* buff = capture->getCapturedAudioBuffer();
//Create a IAudio object and load a sound from a file
cAudio::IAudioSource* mysound = audioMgr->createFromRaw("sound1", buff->getReadBuffer(), buff->getLength(), CAPTURE_FREQUENCY, CAPTURE_FORMAT);
delete buff;
if(mysound)
{
cout << "Playing back captured audio... \n \n";
mysound->setVolume(1.0);
//Set the IAudio Sound to play2d and loop
mysound->play2d(false);
while(mysound->isPlaying())
{
//Sleep for 10 ms to free some CPU
cAudio::cAudioSleep(10);
}
}
}
// Always remember to destroy the interface once you are done with it
cAudio::destroyAudioCapture(capture);
capture = 0x0;
}
cAudio::destroyAudioManager(audioMgr);
}
else
{
std::cout << "Failed to create audio playback manager. \n";
}
std::cout << "Press any key to quit \n";
std::cin.get();
std::cin.get();
return 0;
}

View File

@ -0,0 +1,54 @@
#-------------------------------------------------------------------
# This file is part of the CMake build system for CAUDIO
#-------------------------------------------------------------------
############################################################
# Tutorial5_AudioEffects Player
############################################################
PROJECT(Tutorial5_AudioEffects)
set (SOURCE_FILES
src/Main.cpp
)
if(CAUDIO_IOS_BUILD)
# TODO add ios appdelegate
endif()
include_directories (include ${CAUDIO_INCLUDE_DIR} )
add_executable(Tutorial5_AudioEffects ${SOURCE_FILES})
target_link_libraries(Tutorial5_AudioEffects cAudio)
add_dependencies(Tutorial5_AudioEffects cAudio)
if(CAUDIO_IOS_BUILD)
set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS "-x objective-c++")
endif()
if(${CAUDIO_STATIC})
ADD_DEFINITIONS(-DCAUDIO_STATIC_LIB=1)
endif()
if (WIN32)
# append _d for debug builds
set_property(TARGET Tutorial5_AudioEffects APPEND PROPERTY DEBUG_POSTFIX "_d")
endif()
if (APPLE)
# On OS X, create .app bundle
set_property(TARGET Tutorial5_AudioEffects PROPERTY MACOSX_BUNDLE TRUE)
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.YOUR_COMPANY.\${PRODUCT_NAME:rfc1034identifier}")
set_property(TARGET Tutorial5_AudioEffects PROPERTY MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/../Info.plist)
if(CAUDIO_IOS_BUILD)
set_target_properties(Tutorial5_AudioEffects PROPERTIES XCODE_ATTRIBUTE_GCC_THUMB_SUPPORT "NO")
set_target_properties(Tutorial5_AudioEffects PROPERTIES XCODE_ATTRIBUTE_GCC_UNROLL_LOOPS "YES")
set_target_properties(Tutorial5_AudioEffects PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer")
endif()
endif ()
install_all_targets(Tutorial5_AudioEffects)

View File

@ -0,0 +1,376 @@
//****************************************************************
//cAudio 2.3.0 Tutorial 5
//Audio effects
//****************************************************************
#include <iostream>
#include <string>
///Include cAudio.h so we can work wtih cAudio
#include "cAudio.h"
#if defined(CAUDIO_COMILER_MINGW)
// do nothing
#elif defined(CAUDIO_PLATFORM_WIN)
# define AUDIO_FILE(_soundName_) CAUDIO_MEDIA_ROOT##_soundName_
#else
# define AUDIO_FILE(_soundName_) CAUDIO_MEDIA_ROOT#_soundName_
#endif
using namespace std;
int main(int argc, char* argv[])
{
//Some fancy text
cout << "cAudio 2.3.0 Tutorial 5: Basic Audio Effects. \n \n";
//Create an uninitialized Audio Manager
cAudio::IAudioManager* audioMgr = cAudio::createAudioManager(false);
if(audioMgr)
{
//Allow the user to choose a playback device
cout << "\nAvailable Playback Devices: \n";
cAudio::IAudioDeviceList* pDeviceList = cAudio::createAudioDeviceList();
unsigned int deviceCount = pDeviceList->getDeviceCount();
cAudio::cAudioString defaultDeviceName = pDeviceList->getDefaultDeviceName();
for(unsigned int i=0; i<deviceCount; ++i)
{
cAudio::cAudioString deviceName = pDeviceList->getDeviceName(i);
if(deviceName.compare(defaultDeviceName) == 0)
cout << i << "): " << deviceName.c_str() << " [DEFAULT] \n";
else
cout << i << "): " << deviceName.c_str() << " \n";
}
cout << std::endl;
cout << "Choose a device by number: ";
unsigned int deviceSelection = 0;
cin >> deviceSelection;
cout << std::endl;
//Initialize the manager with the user settings
audioMgr->initialize(pDeviceList->getDeviceName(deviceSelection).c_str());
CAUDIO_DELETE pDeviceList;
pDeviceList = 0;
#if CAUDIO_EFX_ENABLED == 1
cAudio::IAudioEffects* effects = audioMgr->getEffects();
if(effects)
{
cAudio::IEffect* effect = effects->createEffect();
cAudio::IFilter* filter = effects->createFilter();
if(effect && effect->isValid() && filter && filter->isValid())
{
filter->setHighFrequencyVolume(0.1f);
filter->setLowFrequencyVolume(0.1f);
//Create a IAudio object and load a sound from a file
#if defined(CAUDIO_COMPILER_MINGW)
cAudio::IAudioSource* mysound = audioMgr->create("bling", "../Media/Footsteps.wav",true);
#elif defined(CAUDIO_PLATFORM_WIN)
cAudio::IAudioSource* mysound = audioMgr->create("bling", AUDIO_FILE("Footsteps.wav")),true);
#else
cAudio::IAudioSource* mysound = audioMgr->create("bling", AUDIO_FILE(Footsteps.wav),true);
#endif
if(mysound)
{
mysound->setVolume(1.0f);
mysound->attachFilter(filter);
mysound->attachEffect(0, effect);
std::cout << std::endl;
std::cout << "Simultaneous Effects Supported: " << effects->getMaxEffectsSupported() << ". \n";
std::cout << std::endl;
{
std::cout << "Playing sound with no effect or filter. \n";
filter->setType(cAudio::EFT_NULL);
effect->setType(cAudio::EET_NULL);
mysound->play2d(false);
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
if(effects->isFilterSupported(cAudio::EFT_LOWPASS))
{
std::cout << "Playing sound with lowpass filter. \n";
filter->setType(cAudio::EFT_LOWPASS);
mysound->play2d(false);
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
else
{
std::cout << "Lowpass filter not supported by this OpenAL device. \n";
}
if(effects->isFilterSupported(cAudio::EFT_HIGHPASS))
{
std::cout << "Playing sound with highpass filter. \n";
filter->setType(cAudio::EFT_HIGHPASS);
mysound->play2d(false);
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
else
{
std::cout << "Highpass filter not supported by this OpenAL device. \n";
}
if(effects->isFilterSupported(cAudio::EFT_BANDPASS))
{
std::cout << "Playing sound with bandpass filter. \n";
filter->setType(cAudio::EFT_BANDPASS);
mysound->play2d(false);
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
else
{
std::cout << "Bandpass filter not supported by this OpenAL device. \n";
}
filter->setType(cAudio::EFT_NULL);
if(effects->isEffectSupported(cAudio::EET_EAX_REVERB))
{
std::cout << "Playing sound with EAX Reverb effect. \n";
//Set the effect to a setting that distinctly shows off the effect (EAX_BATHROOM)
effect->setType(cAudio::EET_EAX_REVERB);
cAudio::sEAXReverbParameters param;
param.Gain = 0.316f;
param.GainHF = 0.251f;
param.GainLF = 1.0f;
param.Density = 0.17f;
param.DecayHFRatio = 0.54f;
param.ReflectionsGain = 0.653f;
param.ReflectionsDelay = 0.01f;
param.LateReverbDelay = 0.01f;
param.LateReverbGain = 3.273f;
effect->setEAXReverbParameters(param);
mysound->play2d(false);
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
else
{
std::cout << "EAX Reverb effect not supported by this OpenAL device. \n";
}
if(effects->isEffectSupported(cAudio::EET_REVERB))
{
std::cout << "Playing sound with Reverb effect. \n";
//Set the effect to a setting that distinctly shows off the effect (EAX_BATHROOM)
effect->setType(cAudio::EET_REVERB);
cAudio::sReverbParameters param;
param.Gain = 0.316f;
param.GainHF = 0.251f;
param.Density = 0.17f;
param.DecayHFRatio = 0.54f;
param.ReflectionsGain = 0.653f;
param.ReflectionsDelay = 0.01f;
param.LateReverbDelay = 0.01f;
param.LateReverbGain = 3.273f;
effect->setReverbParameters(param);
mysound->play2d(false);
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
else
{
std::cout << "Reverb effect not supported by this OpenAL device. \n";
}
if(effects->isEffectSupported(cAudio::EET_CHORUS))
{
std::cout << "Playing sound with Chorus effect. \n";
//Default settings
effect->setType(cAudio::EET_CHORUS);
mysound->play2d(false);
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
else
{
std::cout << "Chorus effect not supported by this OpenAL device. \n";
}
if(effects->isEffectSupported(cAudio::EET_DISTORTION))
{
std::cout << "Playing sound with Distortion effect. \n";
//Default settings
effect->setType(cAudio::EET_DISTORTION);
mysound->play2d(false);
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
else
{
std::cout << "Distortion effect not supported by this OpenAL device. \n";
}
if(effects->isEffectSupported(cAudio::EET_ECHO))
{
std::cout << "Playing sound with Echo effect. \n";
//Default settings
effect->setType(cAudio::EET_ECHO);
mysound->play2d(false);
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
else
{
std::cout << "Echo effect not supported by this OpenAL device. \n";
}
if(effects->isEffectSupported(cAudio::EET_FLANGER))
{
std::cout << "Playing sound with Flanger effect. \n";
//Default settings
effect->setType(cAudio::EET_FLANGER);
mysound->play2d(false);
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
else
{
std::cout << "Flanger effect not supported by this OpenAL device. \n";
}
if(effects->isEffectSupported(cAudio::EET_FREQUENCY_SHIFTER))
{
std::cout << "Playing sound with Frequency Shifter effect. \n";
//Default settings
effect->setType(cAudio::EET_FREQUENCY_SHIFTER);
mysound->play2d(false);
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
else
{
std::cout << "Frequency Shifter effect not supported by this OpenAL device. \n";
}
if(effects->isEffectSupported(cAudio::EET_VOCAL_MORPHER))
{
std::cout << "Playing sound with Vocal Morpher effect. \n";
//Default settings
effect->setType(cAudio::EET_VOCAL_MORPHER);
mysound->play2d(false);
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
else
{
std::cout << "Vocal Morpher effect not supported by this OpenAL device. \n";
}
if(effects->isEffectSupported(cAudio::EET_PITCH_SHIFTER))
{
std::cout << "Playing sound with Pitch Shifter effect. \n";
//Default settings
effect->setType(cAudio::EET_PITCH_SHIFTER);
mysound->play2d(false);
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
else
{
std::cout << "Pitch Shifter effect not supported by this OpenAL device. \n";
}
if(effects->isEffectSupported(cAudio::EET_RING_MODULATOR))
{
std::cout << "Playing sound with Ring Modulator effect. \n";
//Default settings
effect->setType(cAudio::EET_RING_MODULATOR);
mysound->play2d(false);
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
else
{
std::cout << "Ring Modulator effect not supported by this OpenAL device. \n";
}
if(effects->isEffectSupported(cAudio::EET_AUTOWAH))
{
std::cout << "Playing sound with Autowah effect. \n";
//Default settings
effect->setType(cAudio::EET_AUTOWAH);
mysound->play2d(false);
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
else
{
std::cout << "Autowah effect not supported by this OpenAL device. \n";
}
if(effects->isEffectSupported(cAudio::EET_COMPRESSOR))
{
std::cout << "Playing sound with Compressor effect. \n";
//Default settings
effect->setType(cAudio::EET_COMPRESSOR);
mysound->play2d(false);
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
else
{
std::cout << "Compressor effect not supported by this OpenAL device. \n";
}
if(effects->isEffectSupported(cAudio::EET_EQUALIZER))
{
std::cout << "Playing sound with Equalizer effect. \n";
//Default settings
effect->setType(cAudio::EET_EQUALIZER);
mysound->play2d(false);
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
else
{
std::cout << "Equalizer effect not supported by this OpenAL device. \n";
}
}
audioMgr->release(mysound);
filter->drop();
effect->drop();
}
}
#endif
cAudio::destroyAudioManager(audioMgr);
}
else
{
std::cout << "Failed to create audio playback manager. \n";
}
std::cout << "Press any key to quit \n";
std::cin.get();
std::cin.get();
return 0;
}

View File

@ -0,0 +1,56 @@
#-------------------------------------------------------------------
# This file is part of the CMake build system for CAUDIO
#-------------------------------------------------------------------
############################################################
# Tutorial6_CustomEventHandler Player
############################################################
PROJECT(Tutorial6_CustomEventHandler)
set (SOURCE_FILES
include/cTestHandler.h
src/cTestHandler.cpp
src/Main.cpp
)
if(CAUDIO_IOS_BUILD)
# TODO add ios appdelegate
endif()
include_directories (include ${CAUDIO_INCLUDE_DIR} )
add_executable(Tutorial6_CustomEventHandler ${SOURCE_FILES})
target_link_libraries(Tutorial6_CustomEventHandler cAudio)
add_dependencies(Tutorial6_CustomEventHandler cAudio)
if(CAUDIO_IOS_BUILD)
set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS "-x objective-c++")
endif()
if(${CAUDIO_STATIC})
ADD_DEFINITIONS(-DCAUDIO_STATIC_LIB=1)
endif()
if (WIN32)
# append _d for debug builds
set_property(TARGET Tutorial6_CustomEventHandler APPEND PROPERTY DEBUG_POSTFIX "_d")
endif()
if (APPLE)
# On OS X, create .app bundle
set_property(TARGET Tutorial6_CustomEventHandler PROPERTY MACOSX_BUNDLE TRUE)
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.YOUR_COMPANY.\${PRODUCT_NAME:rfc1034identifier}")
set_property(TARGET Tutorial6_CustomEventHandler PROPERTY MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/../Info.plist)
if(CAUDIO_IOS_BUILD)
set_target_properties(Tutorial6_CustomEventHandler PROPERTIES XCODE_ATTRIBUTE_GCC_THUMB_SUPPORT "NO")
set_target_properties(Tutorial6_CustomEventHandler PROPERTIES XCODE_ATTRIBUTE_GCC_UNROLL_LOOPS "YES")
set_target_properties(Tutorial6_CustomEventHandler PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer")
endif()
endif ()
install_all_targets(Tutorial6_CustomEventHandler)

View File

@ -0,0 +1,26 @@
//****************************************************************
//cAudio 2.3.0 Tutorial 6
//Custom event handler
//****************************************************************
///Include the ISourceHandler.h so we can inherit the interface
#include "ISourceEventHandler.h"
class cTestHandler : public cAudio::ISourceEventHandler
{
//In order for this handler to work it must have each of the following functions
public:
// This function calls on source update
void onUpdate();
// This function calls on source release
void onRelease();
// This function calls on source play
void onPlay();
// This function calls on source stop
void onStop();
// This function calls on source pause
void onPause();
};

View File

@ -0,0 +1,35 @@
//****************************************************************
//cAudio 2.3.0 Tutorial 6
//Custom event handler
//****************************************************************
#include "cTestHandler.h"
#include <iostream>
void cTestHandler::onUpdate()
{
//We comment this out because this will be constantly
//called as the sound is playing
//std::cout<<"Custom Event Handler: Sound source is updating\n";
}
void cTestHandler::onRelease()
{
std::cout<<"Custom Event Handler: Sound source was released\n";
}
void cTestHandler::onPlay()
{
std::cout<<"Custom Event Handler: Sound source started playing\n";
}
void cTestHandler::onStop()
{
std::cout<<"Custom Event Handler: Sound source stoped playing\n";
}
void cTestHandler::onPause()
{
std::cout<<"Custom Event Handler: Sound source was paused\n";
}

View File

@ -0,0 +1,94 @@
//****************************************************************
//cAudio 2.3.0 Tutorial 6
//Custom Event Handler
//****************************************************************
#include <iostream>
#include <string>
//Include cAudio.h so we can work wtih cAudio
#include "cAudio.h"
#if defined(CAUDIO_COMILER_MINGW)
// do nothing
#elif defined(CAUDIO_PLATFORM_WIN)
# define AUDIO_FILE(_soundName_) CAUDIO_MEDIA_ROOT##_soundName_
#else
# define AUDIO_FILE(_soundName_) CAUDIO_MEDIA_ROOT#_soundName_
#endif
//Include the custom handler
#include "cTestHandler.h"
using namespace std;
int main(int argc, char* argv[])
{
//Some fancy text
cout << "cAudio 2.3.0 Tutorial 6: Custom event handler. \n \n";
//Create an uninitialized Audio Manager
cAudio::IAudioManager* audioMgr = cAudio::createAudioManager(false);
//Make a pointer to our handler
cTestHandler *handle = new cTestHandler;
if(audioMgr)
{
//Allow the user to choose a playback device
cout << "\nAvailable Playback Devices: \n";
cAudio::IAudioDeviceList* pDeviceList = cAudio::createAudioDeviceList();
unsigned int deviceCount = pDeviceList->getDeviceCount();
cAudio::cAudioString defaultDeviceName = pDeviceList->getDefaultDeviceName();
for(unsigned int i=0; i<deviceCount; ++i)
{
cAudio::cAudioString deviceName = pDeviceList->getDeviceName(i);
if(deviceName.compare(defaultDeviceName) == 0)
cout << i << "): " << deviceName.c_str() << " [DEFAULT] \n";
else
cout << i << "): " << deviceName.c_str() << " \n";
}
cout << std::endl;
cout << "Choose a device by number: ";
unsigned int deviceSelection = 0;
cin >> deviceSelection;
cout << std::endl;
//Initialize the manager with the user settings
audioMgr->initialize(pDeviceList->getDeviceName(deviceSelection).c_str());
CAUDIO_DELETE pDeviceList;
pDeviceList = 0;
//Create a IAudio object and load a sound from a file
#if defined(CAUDIO_COMPILER_MINGW)
cAudio::IAudioSource* mysound = audioMgr->create("bling", "../Media/cAudioTheme1.ogg",true);
#elif defined(CAUDIO_PLATFORM_WIN)
cAudio::IAudioSource* mysound = audioMgr->create("bling", AUDIO_FILE("cAudioTheme1.ogg")),true);
#else
cAudio::IAudioSource* mysound = audioMgr->create("bling", AUDIO_FILE(cAudioTheme1.ogg),true);
#endif
mysound->registerEventHandler(handle);
if(mysound)
{
mysound->setVolume(0.5);
//Set the IAudio Sound to play2d and loop
mysound->play2d(false);
//Wait for the sound to finish playing
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
cAudio::destroyAudioManager(audioMgr);
}
else
{
std::cout << "Failed to create audio playback manager. \n";
}
std::cout << "Press any key to quit \n";
std::cin.get();
std::cin.get();
return 0;
}

View File

@ -0,0 +1,56 @@
#-------------------------------------------------------------------
# This file is part of the CMake build system for CAUDIO
#-------------------------------------------------------------------
############################################################
# Tutorial7_CustomLogReceiver Player
############################################################
PROJECT(Tutorial7_CustomLogReceiver)
set (SOURCE_FILES
include/cTestLogReceiver.h
src/cTestLogReceiver.cpp
src/Main.cpp
)
if(CAUDIO_IOS_BUILD)
# TODO add ios appdelegate
endif()
include_directories (include ${CAUDIO_INCLUDE_DIR} )
add_executable(Tutorial7_CustomLogReceiver ${SOURCE_FILES})
target_link_libraries(Tutorial7_CustomLogReceiver cAudio)
add_dependencies(Tutorial7_CustomLogReceiver cAudio)
if(CAUDIO_IOS_BUILD)
set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS "-x objective-c++")
endif()
if(${CAUDIO_STATIC})
ADD_DEFINITIONS(-DCAUDIO_STATIC_LIB=1)
endif()
if (WIN32)
# append _d for debug builds
set_property(TARGET Tutorial7_CustomLogReceiver APPEND PROPERTY DEBUG_POSTFIX "_d")
endif()
if (APPLE)
# On OS X, create .app bundle
set_property(TARGET Tutorial7_CustomLogReceiver PROPERTY MACOSX_BUNDLE TRUE)
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.YOUR_COMPANY.\${PRODUCT_NAME:rfc1034identifier}")
set_property(TARGET Tutorial7_CustomLogReceiver PROPERTY MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/../Info.plist)
if(CAUDIO_IOS_BUILD)
set_target_properties(Tutorial7_CustomLogReceiver PROPERTIES XCODE_ATTRIBUTE_GCC_THUMB_SUPPORT "NO")
set_target_properties(Tutorial7_CustomLogReceiver PROPERTIES XCODE_ATTRIBUTE_GCC_UNROLL_LOOPS "YES")
set_target_properties(Tutorial7_CustomLogReceiver PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer")
endif()
endif ()
install_all_targets(Tutorial7_CustomLogReceiver)

View File

@ -0,0 +1,22 @@
//****************************************************************
//cAudio 2.3.0 Tutorial 7
//Custom log receiver
//****************************************************************
//We include the interface of the log receiver
#include "ILogReceiver.h"
#include <string>
//Now we make our new class and inherit the ILogReceiver interface
class cTestLogReceiver : public cAudio::ILogReceiver
{
public:
//Must have the constructor and desconstructor
cTestLogReceiver();
~cTestLogReceiver();
//Only function that must be included in order for the receiver to work
bool OnLogMessage(const char* sender, const char* message, cAudio::LogLevel level, float time);
};

View File

@ -0,0 +1,32 @@
//****************************************************************
//cAudio 2.3.0 Tutorial 7
//Custom log receiver
//****************************************************************
#include "cTestLogReceiver.h"
#include <iostream>
cTestLogReceiver::cTestLogReceiver()
{
}
cTestLogReceiver::~cTestLogReceiver()
{
}
bool cTestLogReceiver::OnLogMessage(const char* sender, const char* message, cAudio::LogLevel level, float time)
{
//Every time we get a message it will have the following information
//What/who sent the message
//The message it contains
//What log level it is
//The time the message was logged
//For now we will just display the word MESSAGE everytime we get a new message
std::cout<<"Message!\n";
return true;
}

View File

@ -0,0 +1,99 @@
//****************************************************************
//cAudio 2.3.0 Tutorial 7
//Custom log receiver
//****************************************************************
#include <iostream>
#include <string>
//Include cAudio.h so we can work wtih cAudio
#include "cAudio.h"
#if defined(CAUDIO_COMILER_MINGW)
// do nothing
#elif defined(CAUDIO_PLATFORM_WIN)
# define AUDIO_FILE(_soundName_) CAUDIO_MEDIA_ROOT##_soundName_
#else
# define AUDIO_FILE(_soundName_) CAUDIO_MEDIA_ROOT#_soundName_
#endif
//Include the new log receiver
#include "cTestLogReceiver.h"
using namespace std;
int main(int argc, char* argv[])
{
//Some fancy text
cout << "cAudio 2.3.0 Tutorial 7: Custom log recevier. \n \n";
//Create an uninitialized Audio Manager
cAudio::IAudioManager* audioMgr = cAudio::createAudioManager(false);
//Now we make a new pointer to our receiver
cTestLogReceiver *loggin = new cTestLogReceiver;
//Once the manager is created we grab instance of the cAudio logger
cAudio::ILogger *log = cAudio::getLogger();
//Then we pass our new receiver to it with a unique name
log->registerLogReceiver(loggin,"Loggin");
if(audioMgr)
{
//Allow the user to choose a playback device
cout << "\nAvailable Playback Devices: \n";
cAudio::IAudioDeviceList* pDeviceList = cAudio::createAudioDeviceList();
unsigned int deviceCount = pDeviceList->getDeviceCount();
cAudio::cAudioString defaultDeviceName = pDeviceList->getDefaultDeviceName();
for(unsigned int i=0; i<deviceCount; ++i)
{
cAudio::cAudioString deviceName = pDeviceList->getDeviceName(i);
if(deviceName.compare(defaultDeviceName) == 0)
cout << i << "): " << deviceName.c_str() << " [DEFAULT] \n";
else
cout << i << "): " << deviceName.c_str() << " \n";
}
cout << std::endl;
cout << "Choose a device by number: ";
unsigned int deviceSelection = 0;
cin >> deviceSelection;
cout << std::endl;
//Initialize the manager with the user settings
audioMgr->initialize(pDeviceList->getDeviceName(deviceSelection).c_str());
CAUDIO_DELETE pDeviceList;
pDeviceList = 0;
//Create a IAudio object and load a sound from a file
#if defined(CAUDIO_COMPILER_MINGW)
cAudio::IAudioSource* mysound = audioMgr->create("bling", "../Media/cAudioTheme1.ogg",true);
#elif defined(CAUDIO_PLATFORM_WIN)
cAudio::IAudioSource* mysound = audioMgr->create("bling", AUDIO_FILE("cAudioTheme1.ogg")),true);
#else
cAudio::IAudioSource* mysound = audioMgr->create("bling", AUDIO_FILE(cAudioTheme1.ogg),true);
#endif
if(mysound)
{
mysound->setVolume(0.5);
//Set the IAudio Sound to play2d and loop
mysound->play2d(false);
//Wait for the sound to finish playing
while(mysound->isPlaying())
cAudio::cAudioSleep(10);
}
cAudio::destroyAudioManager(audioMgr);
}
else
{
std::cout << "Failed to create audio playback manager. \n";
}
std::cout << "Press any key to quit \n";
std::cin.get();
std::cin.get();
return 0;
}