* Update demo

This commit is contained in:
Murat Suri 2011-06-25 23:34:10 +00:00
parent 7f7eadf6c9
commit 02db1bcc5b
2 changed files with 36 additions and 61 deletions

View File

@ -16,29 +16,24 @@ namespace CSharpTutorial1_2DSound
{ {
//Some fancy text //Some fancy text
Console.WriteLine("cAudio 2.2.0 Tutorial 1: Basic 2D Audio. C# \n \n"); Console.WriteLine("cAudio 2.2.0 Tutorial 1: Basic 2D Audio. C# \n \n");
Console.WriteLine("\nAvailable Playback Devices: \n"); Console.WriteLine("\nAvailable Playback Devices: \n");
//Create an uninitialized Audio Manager
IAudioManager mAudioMgr = cAudioCSharpWrapper.createAudioManager(false);
//Grab a list of avalible devices //Grab a list of available devices
IAudioDeviceList pDeviceList = cAudioCSharpWrapper.createAudioDeviceList(); IAudioDeviceList pDeviceList = cAudioCSharpWrapper.createAudioDeviceList();
//Get the number of avalible devices.
uint deviceCount = pDeviceList.getDeviceCount();
//Get the defualt device name. //Get the default device name.
string defaultDeviceName = pDeviceList.getDefaultDeviceName().ToString(); string defaultDeviceName = pDeviceList.getDefaultDeviceName();
for(uint i=0; i< deviceCount; ++i) for(uint i=0; i< pDeviceList.getDeviceCount(); i++)
{ {
string deviceName = pDeviceList.getDeviceName(i).ToString(); string deviceName = pDeviceList.getDeviceName(i);
if(deviceName.Equals(defaultDeviceName)) if(deviceName.Equals(defaultDeviceName))
Console.WriteLine(" "+ i + "): " + deviceName.ToString() + " [DEFAULT] \n"); Console.WriteLine(" "+ i + "): " + deviceName + " [DEFAULT]");
else else
Console.WriteLine(" "+ i + "): " + deviceName.ToString() + " \n"); Console.WriteLine(" "+ i + "): " + deviceName);
} }
Console.WriteLine("\n"); Console.WriteLine("\n");
@ -46,37 +41,25 @@ namespace CSharpTutorial1_2DSound
string deviceSelection = Console.ReadLine(); string deviceSelection = Console.ReadLine();
uint deviceSelect = Convert.ToUInt32(deviceSelection); uint deviceSelect = Convert.ToUInt32(deviceSelection);
Console.WriteLine("\n"); Console.WriteLine("\n");
mAudioMgr.initialize(pDeviceList.getDeviceName(deviceSelect).ToString());
if (mAudioMgr != null) //Create an uninitialized Audio Manager
IAudioManager audioMgr = cAudioCSharpWrapper.createAudioManager(false);
audioMgr.initialize(pDeviceList.getDeviceName(deviceSelect));
IAudioSource currentSource = audioMgr.create("bing", "../../../Media/cAudioTheme1.ogg");
if (currentSource != null)
{ {
currentSource.setVolume(0.5f);
currentSource.play2d(false);
IAudioSource mCurrentSource; while (currentSource.isPlaying())
mCurrentSource = mAudioMgr.create("bing", "../../../../Media/cAudioTheme1.ogg");
if (mCurrentSource != null)
{ {
cAudioCSharpWrapper.cAudioSleep(10);
mCurrentSource.setVolume(0.5f);
mCurrentSource.play2d(false);
while (mCurrentSource.isPlaying())
{
cAudioCSharpWrapper.cAudioSleep(10);
}
} }
mAudioMgr.shutDown();
cAudioCSharpWrapper.destroyAudioManager(mAudioMgr);
} }
else audioMgr.Dispose();
{
Console.WriteLine("Failed to create audio playback manager. \n");
}
Console.WriteLine("Press any key to quit \n"); Console.WriteLine(@"Press any key to quit ");
Console.ReadLine(); Console.ReadLine();
} }
} }

View File

@ -8,10 +8,10 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace cAudioPlayer.Properties namespace cAudioPlayer.Properties {
{ using System;
/// <summary> /// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc. /// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary> /// </summary>
@ -22,48 +22,40 @@ namespace cAudioPlayer.Properties
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources internal class Resources {
{
private static global::System.Resources.ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture; private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() internal Resources() {
{
} }
/// <summary> /// <summary>
/// Returns the cached ResourceManager instance used by this class. /// Returns the cached ResourceManager instance used by this class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager internal static global::System.Resources.ResourceManager ResourceManager {
{ get {
get if (object.ReferenceEquals(resourceMan, null)) {
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("cAudioPlayer.Properties.Resources", typeof(Resources).Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("cAudioPlayer.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;
} }
} }
/// <summary> /// <summary>
/// Overrides the current thread's CurrentUICulture property for all /// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class. /// resource lookups using this strongly typed resource class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture internal static global::System.Globalization.CultureInfo Culture {
{ get {
get
{
return resourceCulture; return resourceCulture;
} }
set set {
{
resourceCulture = value; resourceCulture = value;
} }
} }