From: Tobias Leich Date: Thu, 26 Nov 2009 12:13:07 +0000 (+0100) Subject: docs for audio X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=sdlgit%2FSDL-Site.git;a=commitdiff_plain;h=fb2dc882f70d9eb7d03bb899d79e14f20a029c25 docs for audio --- 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

diff --git a/pages/documentation.html-inc b/pages/documentation.html-inc index 9dcbc53..36659e6 100644 --- a/pages/documentation.html-inc +++ b/pages/documentation.html-inc @@ -1,2 +1,2 @@
-

Documentation (latest development branch)

Core
thumbSDL Simple DirectMedia Layer for Perl
Structure
thumbSDL::AudioCVT- Audio Conversion Structure
thumbSDL::AudioSpec- SDL Bindings for structure SDL::AudioSpec
CDROM
thumbSDL::CDROM- SDL Bindings for the CDROM device
Structure
thumbSDL::CD- SDL Bindings for structure SDL_CD
thumbSDL::CDTrack- SDL Bindings for structure SDL_CDTrack
Events
thumbSDL::Events Bindings to the Events Category in SDL API
Structure
thumbSDL::Event General event structure
Joystick
thumbSDL::Joystick- SDL Bindings for the Joystick device
Structure
thumbSDL::Mixer::MixChunk- SDL Bindings for structure SDL_MixChunk
Mouse
thumbSDL::Mouse- SDL Bindings for the Mouse device
Structure
thumbSDL::Cursor- Mouse cursor structure
MultiThread
thumbSDL::MultiThread Bindings to the MultiThread category in SDL API
Structure
thumbSDL::Version- SDL Bindings for structure SDL_Version
Video
thumbSDL::Video Bindings to the video category in SDL API
Structure
thumbSDL::Color Format independent color description
thumbSDL::Overlay YUV Video overlay
thumbSDL::PixelFormat Stores surface format information
thumbSDL::Rect Defines a rectangular area
thumbSDL::Surface
thumbSDL::VideoInfo Video Target Information

Cookbook
thumbSDL::Cookbook
thumbSDL::Cookbook::PDL

Extension
thumbSDL::App a SDL perl extension

Mixer
thumbSDL::Mixer a SDL perl extension
TODO
Core
Audio
thumbSDL::Audio- SDL Bindings for Audio
Structure
thumbSDL::Mixer::MixMusic- SDL Bindings for structure SDL_MixMusic
Structure
thumbSDL::RWOps- SDL Bindings to SDL_RWOPs

Tutorials
thumbSDL::Tutorial introduction to Perl SDL
thumbSDL::Tutorial::Animation
thumbSDL::Tutorial::Images
thumbSDL::Tutorial::LunarLander a small tutorial on Perl SDL
thumbSDL::Tutorial::Pong
thumbSDL::Tutorial::Tetris

UNCATEGORIZED
thumbSDL::Font a SDL perl extension
thumbSDL::Game::Palette a perl extension
thumbSDL::MPEG a SDL perl extension
thumbSDL::Music a perl extension
thumbSDL::OpenGL a perl extension
thumbSDL::Palette a perl extension
thumbSDL::SFont a perl extension
thumbSDL::SMPEG a SDL perl extension
thumbSDL::Sound a perl extension
thumbSDL::TTFont a SDL perl extension
thumbSDL::Timer a SDL perl extension for managing timers.
thumbSDL::Tool::Font a perl extension
thumbSDL::Tool::Graphic
thumbSDL::old-cdrom a SDL perl extension for managing CD-ROM drives
+

Documentation (latest development branch)

Core
thumbSDL Simple DirectMedia Layer for Perl
Structure
thumbSDL::AudioCVT- Audio Conversion Structure
thumbSDL::AudioSpec- SDL Bindings for structure SDL::AudioSpec
CDROM
thumbSDL::CDROM- SDL Bindings for the CDROM device
Structure
thumbSDL::CD- SDL Bindings for structure SDL_CD
thumbSDL::CDTrack- SDL Bindings for structure SDL_CDTrack
Events
thumbSDL::Events Bindings to the Events Category in SDL API
Structure
thumbSDL::Event General event structure
Joystick
thumbSDL::Joystick- SDL Bindings for the Joystick device
Structure
thumbSDL::Mixer::MixChunk- SDL Bindings for structure SDL_MixChunk
Mouse
thumbSDL::Mouse- SDL Bindings for the Mouse device
Structure
thumbSDL::Cursor- Mouse cursor structure
MultiThread
thumbSDL::MultiThread Bindings to the MultiThread category in SDL API
Structure
thumbSDL::Version- SDL Bindings for structure SDL_Version
Video
thumbSDL::Video Bindings to the video category in SDL API
Structure
thumbSDL::Color Format independent color description
thumbSDL::Overlay YUV Video overlay
thumbSDL::PixelFormat Stores surface format information
thumbSDL::Rect Defines a rectangular area
thumbSDL::Surface
thumbSDL::VideoInfo Video Target Information

Cookbook
thumbSDL::Cookbook
thumbSDL::Cookbook::PDL

Extension
thumbSDL::App a SDL perl extension

Mixer
thumbSDL::Mixer a SDL perl extension
TODO
Core
Audio
thumbSDL::Audio- SDL Bindings for Audio
Structure
thumbSDL::Mixer::MixMusic- SDL Bindings for structure SDL_MixMusic
Structure
thumbSDL::RWOps- SDL Bindings to SDL_RWOPs

Tutorials
thumbSDL::Tutorial introduction to Perl SDL
thumbSDL::Tutorial::Animation
thumbSDL::Tutorial::Images
thumbSDL::Tutorial::LunarLander a small tutorial on Perl SDL
thumbSDL::Tutorial::Pong
thumbSDL::Tutorial::Tetris

UNCATEGORIZED
thumbSDL::Font a SDL perl extension
thumbSDL::Game::Palette a perl extension
thumbSDL::MPEG a SDL perl extension
thumbSDL::Music a perl extension
thumbSDL::OpenGL a perl extension
thumbSDL::Palette a perl extension
thumbSDL::SFont a perl extension
thumbSDL::SMPEG a SDL perl extension
thumbSDL::Sound a perl extension
thumbSDL::TTFont a SDL perl extension
thumbSDL::Timer a SDL perl extension for managing timers.
thumbSDL::Tool::Font a perl extension
thumbSDL::Tool::Graphic
thumbSDL::old-cdrom a SDL perl extension for managing CD-ROM drives