X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pages%2FSDL-Audio.html-inc;h=83581755420298c1686e55b5dbde3ad5ae394f7e;hb=fb2dc882f70d9eb7d03bb899d79e14f20a029c25;hp=22c2881201cd69d5dde2e356065a270bbf44cd23;hpb=eea3f4dea2d82d634fcf38639f71d71677caf546;p=sdlgit%2FSDL-Site.git diff --git a/pages/SDL-Audio.html-inc b/pages/SDL-Audio.html-inc index 22c2881..8358175 100644 --- a/pages/SDL-Audio.html-inc +++ b/pages/SDL-Audio.html-inc @@ -153,20 +153,21 @@

Converts audio data to a desired audio format.

-

convert_audio takes as first parameter cvt, which was previously initialized. Initializing a SDL::AudioCVT is a two step process. -First of all, the structure must be created via SDL::AudioCVT-build> along with source and destination format parameters. Secondly, +

convert takes as first parameter cvt, which was previously initialized. Initializing a SDL::AudioCVT is a two step process. +First of all, the structure must be created via SDL::AudioCVT->build along with source and destination format parameters. Secondly, the data and len fields must be setup. data should point to the audio data buffer beeing source and destination at once and len should be set to the buffer length in bytes. Remember, the length of the buffer pointed to by buf should be len*len_mult bytes in length.

-

Once the SDL::AudioCVT structure is initialized, we can pass it to convert_audio, which will convert the audio data pointed to -by data. If convert_audio fails undef is returned, otherwise the converted SDL::AudioCVT structure.

-

If the conversion completed successfully then the converted audio data can be read from cvt-buf>. The amount of valid, converted, -audio data in the buffer is equal to cvt-len*cvt->len_ratio>.

+

Once the SDL::AudioCVT structure is initialized, we can pass it to convert, which will convert the audio data pointed to +by data. If convert fails undef is returned, otherwise the converted SDL::AudioCVT structure.

+

If the conversion completed successfully then the converted audio data can be read from cvt->buf. The amount of valid, converted, +audio data in the buffer is equal to cvt->len*cvt->len_ratio.

Example:

 use SDL;
  use SDL::Audio;
  use SDL::AudioSpec;
  use SDL::AudioCVT;
+ use Devel::Peek;
 
  SDL::init(SDL_INIT_AUDIO);
 
@@ -218,18 +219,9 @@ audio data in the buffer is equal to cvt-len*cvt->len_ratio>.
  # And now we're ready to convert
  SDL::Audio::convert($wav_cvt, $wav_buf, $wav_len);
 
-
-
-
  # We can freeto original WAV data now
  SDL::Audio::free_wav($wav_buf);
 
- 
-
-
- 
-
-
 

TODO: What to do with it? How to use callback? See http://www.libsdl.org/cgi/docwiki.cgi/SDL_ConvertAudio