* Update demo
This commit is contained in:
parent
7f7eadf6c9
commit
02db1bcc5b
@ -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)
|
|
||||||
{
|
|
||||||
|
|
||||||
mCurrentSource.setVolume(0.5f);
|
|
||||||
mCurrentSource.play2d(false);
|
|
||||||
|
|
||||||
|
|
||||||
while (mCurrentSource.isPlaying())
|
|
||||||
{
|
{
|
||||||
cAudioCSharpWrapper.cAudioSleep(10);
|
cAudioCSharpWrapper.cAudioSleep(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
audioMgr.Dispose();
|
||||||
|
|
||||||
mAudioMgr.shutDown();
|
Console.WriteLine(@"Press any key to quit ");
|
||||||
cAudioCSharpWrapper.destroyAudioManager(mAudioMgr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine("Failed to create audio playback manager. \n");
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.WriteLine("Press any key to quit \n");
|
|
||||||
Console.ReadLine();
|
Console.ReadLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace cAudioPlayer.Properties
|
namespace cAudioPlayer.Properties {
|
||||||
{
|
using System;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -22,28 +22,23 @@ 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;
|
||||||
}
|
}
|
||||||
@ -56,14 +51,11 @@ namespace cAudioPlayer.Properties
|
|||||||
/// 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user