home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue4 / SDL / gcc346 / !SDL / man / SDL_LoadWAV.3 < prev    next >
Encoding:
Text File  |  2006-09-20  |  2.2 KB  |  72 lines

  1. <!-- manual page source format generated by PolyglotMan v3.0.8+X.Org, -->
  2. <!-- available at http://polyglotman.sourceforge.net/ -->
  3.  
  4. <html>
  5. <head>
  6. <title>"SDL_LoadWAV"("3") manual page</title>
  7. </head>
  8. <body bgcolor='#efefef' text='black' link='blue' vlink='#551A8B' alink='red'>
  9. <a href='#toc'>Table of Contents</a><p>
  10.  
  11. <h2><a name='sect0' href='#toc0'>Name</a></h2>
  12. SDL_LoadWAV- Load a WAVE file 
  13. <h2><a name='sect1' href='#toc1'>Synopsis</a></h2>
  14. <p>
  15. <b>#include "SDL.h" <p>
  16. </b><b>SDL_AudioSpec
  17. *<b>SDL_LoadWAV</b></b>(<b>const char *file, SDL_AudioSpec *spec, Uint8 **audio_buf,
  18. Uint32 *audio_len</b>); 
  19. <h2><a name='sect2' href='#toc2'>Description</a></h2>
  20. <p>
  21. <b>SDL_LoadWAV</b> This function loads a WAVE <b>file</b>
  22. into memory. <p>
  23. If this function succeeds, it returns the given <i><b>SDL_AudioSpec</b></i>,
  24. filled with the audio data format of the wave data, and sets <b>audio_buf</b>
  25. to a <b>malloc</b>'d buffer containing the audio data, and sets <b>audio_len</b> to the
  26. length of that audio buffer, in bytes. You need to free the audio buffer
  27. with <i><b>SDL_FreeWAV</b></i> when you are done with it. <p>
  28. This function returns <b>NULL</b> and
  29. sets the SDL error message if the wave file cannot be opened, uses an unknown
  30. data format, or is corrupt. Currently raw, MS-ADPCM and IMA-ADPCM WAVE files
  31. are supported. 
  32. <h2><a name='sect3' href='#toc3'>Example</a></h2>
  33. <p>
  34. <br>
  35. <pre>CWSDL_AudioSpec wav_spec;
  36. Uint32 wav_length;
  37. Uint8 *wav_buffer;
  38. /* Load the WAV */
  39. if( SDL_LoadWAV("test.wav", &wav_spec, &wav_buffer, &wav_length) == NULL ){
  40.   fprintf(stderr, "Could not open test.wav: %s
  41. ", SDL_GetError());
  42.   exit(-1);
  43. }
  44. .
  45. .
  46. .
  47. /* Do stuff with the WAV */
  48. .
  49. .
  50. /* Free It */
  51. SDL_FreeWAV(wav_buffer);
  52. </pre><p>
  53.  
  54. <h2><a name='sect4' href='#toc4'>See Also</a></h2>
  55. <p>
  56. <i><b>SDL_AudioSpec</b></i>, <i><b>SDL_OpenAudio</b></i>, <i><b>SDL_FreeWAV</b></i> 
  57. <!--
  58.   
  59.  <p>
  60.  
  61. <hr><p>
  62. <a name='toc'><b>Table of Contents</b></a><p>
  63. <ul>
  64. <li><a name='toc0' href='#sect0'>Name</a></li>
  65. <li><a name='toc1' href='#sect1'>Synopsis</a></li>
  66. <li><a name='toc2' href='#sect2'>Description</a></li>
  67. <li><a name='toc3' href='#sect3'>Example</a></li>
  68. <li><a name='toc4' href='#sect4'>See Also</a></li>
  69. </ul>
  70. </body>
  71. </html>
  72.