1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737
|
#region License
/*
MIT License
Copyright 2003-2006 Tao Framework Team
http://www.taoframework.com
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion License
using System;
using System.IO;
using System.Security;
using System.Runtime.InteropServices;
using System.Text;
namespace Tao.OpenAl
{
#region Class Documentation
/// <summary>
/// OpenAL binding for .NET, implementing ALUT 1.1.
/// </summary>
/// <remarks>
/// ALUT is non-standard.
/// </remarks>
#endregion Class Documentation
[Obsolete("Use OpenTK.Audio.OpenAL instead.")]
public static class Alut
{
// --- Fields ---
#region Private Constants
#region string ALUT_NATIVE_LIBRARY
/// <summary>
/// Specifies OpenAl's native library archive.
/// </summary>
/// <remarks>
/// Specifies OpenAl32.dll everywhere; will be mapped via .config for mono.
/// </remarks>
private const string ALUT_NATIVE_LIBRARY = "alut.dll";
#endregion string ALUT_NATIVE_LIBRARY
#region CallingConvention CALLING_CONVENTION
/// <summary>
/// Specifies the calling convention.
/// </summary>
/// <remarks>
/// Specifies <see cref="CallingConvention.Cdecl" />.
/// </remarks>
private const CallingConvention CALLING_CONVENTION = CallingConvention.Cdecl;
#endregion CallingConvention CALLING_CONVENTION
#endregion Private Constants
#region Public OpenAL 1.1 Constants
/// <summary>
///
/// </summary>
public const int ALUT_API_MAJOR_VERSION = 1;
/// <summary>
///
/// </summary>
public const int ALUT_API_MINOR_VERSION = 1;
/// <summary>
///
/// </summary>
public const int ALUT_ERROR_NO_ERROR = 0;
/// <summary>
///
/// </summary>
public const int ALUT_ERROR_OUT_OF_MEMORY = 0x200;
/// <summary>
///
/// </summary>
public const int ALUT_ERROR_INVALID_ENUM = 0x201;
/// <summary>
///
/// </summary>
public const int ALUT_ERROR_INVALID_VALUE = 0x202;
/// <summary>
///
/// </summary>
public const int ALUT_ERROR_INVALID_OPERATION = 0x203;
/// <summary>
///
/// </summary>
public const int ALUT_ERROR_NO_CURRENT_CONTEXT = 0x204;
/// <summary>
///
/// </summary>
public const int ALUT_ERROR_AL_ERROR_ON_ENTRY = 0x205;
/// <summary>
///
/// </summary>
public const int ALUT_ERROR_ALC_ERROR_ON_ENTRY = 0x206;
/// <summary>
///
/// </summary>
public const int ALUT_ERROR_OPEN_DEVICE = 0x207;
/// <summary>
///
/// </summary>
public const int ALUT_ERROR_CLOSE_DEVICE = 0x208;
/// <summary>
///
/// </summary>
public const int ALUT_ERROR_CREATE_CONTEXT = 0x209;
/// <summary>
///
/// </summary>
public const int ALUT_ERROR_MAKE_CONTEXT_CURRENT = 0x20A;
/// <summary>
///
/// </summary>
public const int ALUT_ERROR_DESTROY_CONTEXT = 0x20B;
/// <summary>
///
/// </summary>
public const int ALUT_ERROR_GEN_BUFFERS = 0x20C;
/// <summary>
///
/// </summary>
public const int ALUT_ERROR_BUFFER_DATA = 0x20D;
/// <summary>
///
/// </summary>
public const int ALUT_ERROR_IO_ERROR = 0x20E;
/// <summary>
///
/// </summary>
public const int ALUT_ERROR_UNSUPPORTED_FILE_TYPE = 0x20F;
/// <summary>
///
/// </summary>
public const int ALUT_ERROR_UNSUPPORTED_FILE_SUBTYPE = 0x210;
/// <summary>
///
/// </summary>
public const int ALUT_ERROR_CORRUPT_OR_TRUNCATED_DATA = 0x211;
/// <summary>
///
/// </summary>
public const int ALUT_WAVEFORM_SINE = 0x100;
/// <summary>
///
/// </summary>
public const int ALUT_WAVEFORM_SQUARE = 0x101;
/// <summary>
///
/// </summary>
public const int ALUT_WAVEFORM_SAWTOOTH = 0x102;
/// <summary>
///
/// </summary>
public const int ALUT_WAVEFORM_WHITENOISE = 0x103;
/// <summary>
///
/// </summary>
public const int ALUT_WAVEFORM_IMPULSE = 0x104;
/// <summary>
///
/// </summary>
public const int ALUT_LOADER_BUFFER = 0x300;
/// <summary>
///
/// </summary>
public const int ALUT_LOADER_MEMORY = 0x301;
#endregion Public OpenAL 1.1 Constants
// --- Public Methods ---
/// <summary>
///
/// </summary>
/// <param name="argcp"></param>
/// <param name="argv"></param>
/// <returns></returns>
// ALUT_API ALboolean ALUT_APIENTRY alutInit (int *argcp, char **argv);
[DllImport(ALUT_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern int alutInit(int[] argcp, string[] argv);
/// <summary>
///
/// </summary>
/// <returns></returns>
public static int alutInit()
{
return alutInit(null, null);
}
/// <summary>
///
/// </summary>
/// <param name="argcp"></param>
/// <param name="argv"></param>
/// <returns></returns>
// ALUT_API ALboolean ALUT_APIENTRY alutInitWithoutContext (int *argcp, char **argv);
[DllImport(ALUT_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern int alutInitWithoutContext(int[] argcp, string[] argv);
/// <summary>
///
/// </summary>
// ALUT_API ALboolean ALUT_APIENTRY alutExit (void);
[DllImport(ALUT_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern int alutExit();
/// <summary>
///
/// </summary>
// ALUT_API ALenum ALUT_APIENTRY alutGetError (void);
[DllImport(ALUT_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern int alutGetError();
/// <summary>
///
/// </summary>
/// <returns></returns>
// ALUT_API const char *ALUT_APIENTRY alutGetErrorString (ALenum error);
[DllImport(ALUT_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern string alutGetErrorString(int error);
/// <summary>
///
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
// ALUT_API ALuint ALUT_APIENTRY alutCreateBufferFromFile (const char *fileName);
[DllImport(ALUT_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern int alutCreateBufferFromFile(string fileName);
/// <summary>
///
/// </summary>
/// <param name="data"></param>
/// <param name="length"></param>
/// <returns></returns>
// ALUT_API ALuint ALUT_APIENTRY alutCreateBufferFromFileImage (const ALvoid *data, ALsizei length);
[DllImport(ALUT_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern int alutCreateBufferFromFileImage(IntPtr data, int length);
/// <summary>
///
/// </summary>
/// <returns></returns>
// ALUT_API ALuint ALUT_APIENTRY alutCreateBufferHelloWorld (void);
[DllImport(ALUT_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern int alutCreateBufferHelloWorld();
/// <summary>
///
/// </summary>
/// <param name="waveshape"></param>
/// <param name="frequency"></param>
/// <param name="phase"></param>
/// <param name="duration"></param>
/// <returns></returns>
// ALUT_API ALuint ALUT_APIENTRY alutCreateBufferWaveform (ALenum waveshape, ALfloat frequency, ALfloat phase, ALfloat duration);
[DllImport(ALUT_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern int alutCreateBufferWaveform(int waveshape, float frequency, float phase, float duration);
/// <summary>
///
/// </summary>
/// <param name="fileName"></param>
/// <param name="format"></param>
/// <param name="size"></param>
/// <param name="frequency"></param>
/// <returns></returns>
// ALUT_API ALvoid *ALUT_APIENTRY alutLoadMemoryFromFile (const char *fileName, ALenum *format, ALsizei *size, ALfloat *frequency);
[DllImport(ALUT_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern IntPtr alutLoadMemoryFromFile(string fileName, out int format, out int size, out float frequency);
/// <summary>
///
/// </summary>
/// <param name="data"></param>
/// <param name="length"></param>
/// <param name="format"></param>
/// <param name="size"></param>
/// <param name="frequency"></param>
/// <returns></returns>
// ALUT_API ALvoid *ALUT_APIENTRY alutLoadMemoryFromFileImage (const ALvoid *data, ALsizei length, ALenum *format, ALsizei *size, ALfloat *frequency);
[DllImport(ALUT_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern IntPtr alutLoadMemoryFromFileImage(IntPtr data, int length, out int format, out int size, out float frequency);
/// <summary>
///
/// </summary>
/// <param name="format"></param>
/// <param name="size"></param>
/// <param name="frequency"></param>
/// <returns></returns>
// ALUT_API ALvoid *ALUT_APIENTRY alutLoadMemoryHelloWorld (ALenum *format, ALsizei *size, ALfloat *frequency);
[DllImport(ALUT_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern IntPtr alutLoadMemoryHelloWorld(out int format, out int size, out float frequency);
/// <summary>
///
/// </summary>
/// <param name="waveshape"></param>
/// <param name="frequency"></param>
/// <param name="phase"></param>
/// <param name="duration"></param>
/// <param name="format"></param>
/// <param name="size"></param>
/// <param name="freq"></param>
/// <returns></returns>
// ALUT_API ALvoid *ALUT_APIENTRY alutLoadMemoryWaveform (ALenum waveshape, ALfloat frequency, ALfloat phase, ALfloat duration, ALenum *format, ALsizei *size, ALfloat *freq);
[DllImport(ALUT_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern IntPtr alutLoadMemoryWaveform(int waveshape, float frequency, float phase, float duration, out int format, out int size, out float freq);
/// <summary>
///
/// </summary>
/// <param name="loader"></param>
/// <returns></returns>
// ALUT_API const char *ALUT_APIENTRY alutGetMIMETypes (ALenum loader);
[DllImport(ALUT_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern string alutGetMIMETypes(int loader);
/// <summary>
///
/// </summary>
/// <returns></returns>
// ALUT_API ALint ALUT_APIENTRY alutGetMajorVersion (void);
[DllImport(ALUT_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern int alutGetMajorVersion();
/// <summary>
///
/// </summary>
/// <returns></returns>
// ALUT_API ALint ALUT_APIENTRY alutGetMinorVersion (void);
[DllImport(ALUT_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern int alutGetMinorVersion();
/// <summary>
///
/// </summary>
/// <param name="duration"></param>
/// <returns></returns>
// ALUT_API ALboolean ALUT_APIENTRY alutSleep (ALfloat duration);
[DllImport(ALUT_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern int alutSleep(float duration);
#region DEPRECATED
// #region InitializeAlut()
// /// <summary>
// /// Initializes OpenAL device and context.
// /// </summary>
// private static void InitializeAlut()
// {
//#if WIN32
// IntPtr device = Alc.alcOpenDevice("DirectSound3D");
//#else
//IntPtr device = Alc.alcOpenDevice(null);
//#endif
// IntPtr context = Alc.alcCreateContext(device, IntPtr.Zero);
// Alc.alcMakeContextCurrent(context);
// }
// #endregion InitializeAlut()
//
// #region ReadWavFile(Stream stream, out int format, out byte[] data, out int size, out int frequency, out int loop)
// /// <summary>
// /// Reads a WAV file.
// /// </summary>
// /// <param name="stream">
// /// The stream to be read.
// /// </param>
// /// <param name="format">
// /// The format of the WAV file.
// /// </param>
// /// <param name="data">
// /// The WAV file data.
// /// </param>
// /// <param name="size">
// /// The size of the WAV file data.
// /// </param>
// /// <param name="frequency">
// /// The frequency of the WAV file.
// /// </param>
// /// <param name="loop">
// /// Does the WAV file loop?
// /// </param>
// private static void ReadWavFile(Stream stream, out int format, out byte[] data, out int size, out int frequency, out int loop)
// {
// bool success = true;
// format = Al.AL_FORMAT_MONO16;
// data = null;
// size = 0;
// frequency = 22050;
// loop = Al.AL_FALSE;
//
// BinaryReader reader = new BinaryReader(stream, System.Text.Encoding.ASCII);
//
// try
// {
// WavFileHeader fileHeader = new WavFileHeader();
// WavChunkHeader chunkHeader = new WavChunkHeader();
// WavFormatChunk formatChunk = new WavFormatChunk();
//
// // Read WAV file header
// fileHeader.Id = reader.ReadChars(4);
// fileHeader.Length = reader.ReadInt32();
// fileHeader.Type = reader.ReadChars(4);
//
// if(new string(fileHeader.Id) != "RIFF" && fileHeader.Length <= 0 && new string(fileHeader.Type) != "WAVE")
// {
// success = false;
// }
// else
// {
// while(fileHeader.Length > 8)
// {
// // Read WAV chunk header
// chunkHeader.Id = reader.ReadChars(4);
// chunkHeader.Length = reader.ReadInt32();
//
// // Determine chunk action
// if(new string(chunkHeader.Id) == "fmt ")
// {
// // Read WAV format header
// formatChunk.Format = reader.ReadInt16();
// formatChunk.Channels = reader.ReadInt16();
// formatChunk.SamplesPerSecond = reader.ReadInt32();
// formatChunk.BytesPerSecond = reader.ReadInt32();
// formatChunk.BytesPerSample = reader.ReadInt16();
// formatChunk.BitsPerSample = reader.ReadInt16();
//
// if(chunkHeader.Length > 16)
// {
// formatChunk.ExtraBytesLength = reader.ReadInt16();
// formatChunk.ExtraBytes = reader.ReadBytes(formatChunk.ExtraBytesLength);
// }
// else
// {
// formatChunk.ExtraBytesLength = 0;
// formatChunk.ExtraBytes = null;
// }
//
// if(formatChunk.Format == 0x0001)
// {
// if(formatChunk.Channels == 1)
// {
// if(formatChunk.BitsPerSample == 8)
// {
// format = Al.AL_FORMAT_MONO8;
// }
// else
// {
// format = Al.AL_FORMAT_MONO16;
// }
// }
// else
// {
// if(formatChunk.BitsPerSample == 8)
// {
// format = Al.AL_FORMAT_STEREO8;
// }
// else
// {
// format = Al.AL_FORMAT_STEREO16;
// }
// }
// }
// frequency = formatChunk.SamplesPerSecond;
// }
// else if(new string(chunkHeader.Id) == "data")
// {
// if(formatChunk.Format == 0x0001)
// {
// size = chunkHeader.Length - 8;
// data = reader.ReadBytes(size);
// }
// }
// else
// {
// if(chunkHeader.Length <= fileHeader.Length && chunkHeader.Length > 0)
// {
// reader.ReadBytes(chunkHeader.Length);
// }
// }
//
// if(chunkHeader.Length <= fileHeader.Length && chunkHeader.Length > 0)
// {
// fileHeader.Length -= chunkHeader.Length;
// }
// else
// {
// fileHeader.Length = 0;
// }
// }
// }
// success = true;
// }
// catch
// {
// success = false;
// }
// finally
// {
// reader.Close();
// }
//
// if(!success)
// {
// format = -1;
// data = null;
// size = -1;
// frequency = -1;
// loop = -1;
// }
// }
// #endregion ReadWavFile(string fileName, out int format, out byte[] data, out int size, out int frequency, out int loop)
// #region alutExit()
// /// <summary>
// /// Destroys OpenAL context and device.
// /// </summary>
// // ALUTAPI ALvoid ALUTAPIENTRY alutExit(ALvoid);
// public static void alutExit()
// {
// IntPtr context = Alc.alcGetCurrentContext();
// IntPtr device = Alc.alcGetContextsDevice(context);
// Alc.alcMakeContextCurrent(IntPtr.Zero);
// Alc.alcDestroyContext(context);
// Alc.alcCloseDevice(device);
// context = IntPtr.Zero;
// device = IntPtr.Zero;
// }
// #endregion alutExit()
// #region alutInit()
// /// <summary>
// /// Initializes an OpenAL device and context.
// /// </summary>
// // ALUTAPI ALvoid ALUTAPIENTRY alutInit(ALint *argc, ALbyte **argv);
// public static void alutInit()
// {
// InitializeAlut();
// }
// #endregion alutInit()
//
// #region alutInit(int argc, StringBuilder argv)
// /// <summary>
// /// Initializes an OpenAL device and context.
// /// </summary>
// /// <param name="argc">
// /// Number of commandline arguments.
// /// </param>
// /// <param name="argv">
// /// The commandline arguments.
// /// </param>
// // ALUTAPI ALvoid ALUTAPIENTRY alutInit(ALint *argc, ALbyte **argv);
// public static void alutInit(int argc, StringBuilder argv)
// {
// InitializeAlut();
// }
// #endregion alutInit(int argc, StringBuilder argv)
// #region Private Structs
// #region WavFileHeader
// /// <summary>
// /// WAV file header.
// /// </summary>
// // 12 bytes total
// [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
// private struct WavFileHeader
// {
// [MarshalAs(UnmanagedType.ByValArray, SizeConst=4)]
// public char[] Id;
// public int Length;
// [MarshalAs(UnmanagedType.ByValArray, SizeConst=4)]
// public char[] Type;
// }
// #endregion WavFileHeader
//
// #region WavChunkHeader
// /// <summary>
// /// WAV chunk header.
// /// </summary>
// // 8 bytes total
// [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
// private struct WavChunkHeader
// {
// [MarshalAs(UnmanagedType.ByValArray, SizeConst=4)]
// public char[] Id;
// public int Length;
// }
// #endregion WavChunkHeader
//
// #region WavFormatChunk
// /// <summary>
// /// WAV format chunk.
// /// </summary>
// // 16 bytes total
// [StructLayout(LayoutKind.Sequential)]
// private struct WavFormatChunk
// {
// public short Format;
// public short Channels;
// public int SamplesPerSecond;
// public int BytesPerSecond;
// public short BytesPerSample;
// public short BitsPerSample;
// public short ExtraBytesLength;
// public byte[] ExtraBytes;
// }
// #endregion WavFormatChunk
// #endregion Private Structs
// #region alutLoadWAVFile(string fileName, out int format, out byte[] data, out int size, out int frequency, out int loop)
// /// <summary>
// /// Loads a WAV file.
// /// </summary>
// /// <param name="fileName">
// /// The filename to be loaded.
// /// </param>
// /// <param name="format">
// /// The format of the WAV file.
// /// </param>
// /// <param name="data">
// /// The WAV file data.
// /// </param>
// /// <param name="size">
// /// The size of the WAV file data.
// /// </param>
// /// <param name="frequency">
// /// The WAV file frequency.
// /// </param>
// /// <param name="loop">
// /// Does the WAV file loop?
// /// </param>
// // ALUTAPI ALvoid ALUTAPIENTRY alutLoadWAVFile(ALbyte *file, ALenum *format, ALvoid **data, ALsizei *size, ALsizei *freq, ALboolean *loop);
// public static void alutLoadWAVFile(string fileName, out int format, out byte[] data, out int size, out int frequency, out int loop)
// {
// if(File.Exists(fileName))
// {
// FileStream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);
// ReadWavFile(stream, out format, out data, out size, out frequency, out loop);
// stream.Close();
// stream = null;
// }
// else
// {
// format = -1;
// data = null;
// size = -1;
// frequency = -1;
// loop = -1;
// }
// }
// #endregion alutLoadWAVFile(string fileName, out int format, out byte[] data, out int size, out int frequency, out int loop)
//
// #region alutLoadWAVMemory([In] byte[] memory, out int format, out byte[] data, out int size, out int frequency, out int loop)
// /// <summary>
// /// Loads a WAV file from memory.
// /// </summary>
// /// <param name="memory">
// /// The WAV memory to be loaded.
// /// </param>
// /// <param name="format">
// /// The format of the WAV file.
// /// </param>
// /// <param name="data">
// /// The WAV file data.
// /// </param>
// /// <param name="size">
// /// The size of the WAV file data.
// /// </param>
// /// <param name="frequency">
// /// The WAV file frequency.
// /// </param>
// /// <param name="loop">
// /// Does the WAV file loop?
// /// </param>
// // ALUTAPI ALvoid ALUTAPIENTRY alutLoadWAVMemory(ALbyte *memory, ALenum *format, ALvoid **data, ALsizei *size, ALsizei *freq, ALboolean *loop);
// public static void alutLoadWAVMemory([In] byte[] memory, out int format, out byte[] data, out int size, out int frequency, out int loop)
// {
// if(memory != null)
// {
// MemoryStream stream = new MemoryStream(memory, 0, memory.Length);
// ReadWavFile(stream, out format, out data, out size, out frequency, out loop);
// stream.Close();
// stream = null;
// }
// else
// {
// format = -1;
// data = null;
// size = -1;
// frequency = -1;
// loop = -1;
// }
// }
// #endregion alutLoadWAVMemory([In] byte[] memory, out int format, out byte[] data, out int size, out int frequency, out int loop)
//
// #region alutUnloadWAV(int format, out byte[] data, int size, int frequency)
// /// <summary>
// /// Unloads a WAV file.
// /// </summary>
// /// <param name="format">
// /// The format of the WAV file.
// /// </param>
// /// <param name="data">
// /// The data of the WAV file.
// /// </param>
// /// <param name="size">
// /// The size of the WAV file's data.
// /// </param>
// /// <param name="frequency">
// /// The frequency of the WAV file.
// /// </param>
// // ALUTAPI ALvoid ALUTAPIENTRY alutUnloadWAV(ALenum format, ALvoid *data, ALsizei size, ALsizei freq);
// public static void alutUnloadWAV(int format, out byte[] data, int size, int frequency)
// {
// data = null;
// }
// #endregion alutUnloadWAV(int format, out byte[] data, int size, int frequency)
#endregion DEPRECATED
}
}
|