From: Tobias Leich
int SDL::Mixer::init(flags) +my $init_flags = SDL::Mixer::init( $flags );-Note: Only available for SDL::Mixer >= 1.2.10
+Loads dynamic libraries and prepares them for use. Flags should be one or more flags from init flags OR'd together. +It returns the flags successfully initialized, or 0 on failure.
+Example:
+use SDL::Mixer; + + my $init_flags = SDL::Mixer::init( MIX_INIT_MP3 | MIX_INIT_MOD | MIX_INIT_FLAC | MIX_INIT_OGG ); + + print("We have MP3 support!\n") if $init_flags & MIX_INIT_MP3; + print("We have MOD support!\n") if $init_flags & MIX_INIT_MOD; + print("We have FLAC support!\n") if $init_flags & MIX_INIT_FLAC; + print("We have OGG support!\n") if $init_flags & MIX_INIT_OGG; + ++Flags:
+
Note: Only available for SDL_mixer >= 1.2.10
void SDL::Mixer::quit() +SDL::Mixer::quit();-Note: Only available for SDL::Mixer >= 1.2.10
+This function unloads the liraries previously loaded with init().
+Note: Only available for SDL_mixer >= 1.2.10
const SDL_version * SDL::Mixer::linked_version () +$version = SDL::Mixer::linked_version(); + +++
linked_version
gives you the major-, minor-, and patchlevel for SDL_mixer. This way you can check if e.g. init() and quit() +are available.Example:
+use SDL::Mixer; + use SDL::Version; + + my $version = SDL::Mixer::linked_version(); + + printf("%d.%d.%d\n", $version->major, $version->minor, $version->patch); # prints "1.2.8" for me
int SDL::Mixer::open_audio ( frequency, format, channels, chunksize ) +my $audio_opened = SDL::Mixer::open_audio( $frequency, $format, $channels, $chunksize ); + +++
open_audio
will initialize SDL_mixer if it is not yet initialized, see note. SDL_mixer may not be able to provide the exact specifications +your provided, however it will automatically translate between the expected format and the real one. You can retrieve the real format using +query_spec.Returns 0 on success, -1 on error.
+Note: You must not use
+AUDIO_S16
,AUDIO_U16
,AUDIO_S16LSB
, orAUDIO_U16LSB.
They are not portable, and SDL will not return an +error code when they fail. The result will be a horrible staticy noise. You can usually useAUDIO_S16SYS
, though not always. Future versions +of SDL should take this parameter only as a hint, then read back the value that the OS (for example, OSS or ALSA) has chosen to use in case the +desired audio type is not supported.Note: When already initialized, this function will not re-initialize SDL_mixer, nor fail. It will merely increment the number of times +SDL::Mixer::close_audio must be called to actually get it to uninitialize. This serves as a very simplistic method for multiple application +components to use SDL_mixer without necessitating a great deal of inter-component awareness. Be warned however that in such a situation, the +latest components to initialize SDL_mixer will probably not get the SDL_mixer settings they're expecting.
+Example:
+use SDL; + use SDL::Mixer; + + printf("Error initializing SDL_mixer: %s\n", SDL::get_error()) unless SDL::Mixer::open_audio(44100, AUDIO_S16, 2, 1024) == 0;
void SDL::Mixer::close_audio () +SDL::Mixer::close_audio();+Close the mixer and halting all playing audio. This function does not return anything.
AV * SDL::Mixer::query_spec () - CODE: - int freq, channels, status; - Uint16 format; - status = Mix_QuerySpec(&freq,&format,&channels); - RETVAL = (AV*)sv_2mortal((SV*)newAV()); - av_push(RETVAL,newSViv(status)); - av_push(RETVAL,newSViv(freq)); - av_push(RETVAL,newSViv(format)); - av_push(RETVAL,newSViv(channels)); - OUTPUT: - RETVAL +my @query_spec = @{ SDL::Mixer::query_spec() }; + ++Find out what the actual audio device parameters are. +This function returns 1 as first array element (status) if the audio has been opened, 0 otherwise.
+Example:
+use SDL::Mixer; + + my ($status, $freq, $format, $channels) = @{ SDL::Mixer::query_spec() }; + + printf("%s, %s, %s, %s\n", $status, $freq, $format, $channels);@@ -102,7 +154,7 @@ in and out.
perl, SDL::Music and SDL::Sound.
+perl, SDL::Mixer::Channels, SDL::Mixer::Effects, SDL::Mixer::Groups, SDL::Mixer::Music.
Core | ||
SDL | - Simple DirectMedia Layer for Perl | |
SDL::Time | - a SDL perl extension for managing timers. |
Audio | ||
SDL::Audio | - SDL Bindings for Audio |
Structure | ||
SDL::AudioCVT | - Audio Conversion Structure | |
SDL::AudioSpec | - SDL Bindings for structure SDL::AudioSpec |
CDROM | ||
SDL::CDROM | - SDL Bindings for the CDROM device |
Structure | ||
SDL::CD | - SDL Bindings for structure SDL_CD | |
SDL::CDTrack | - SDL Bindings for structure SDL_CDTrack |
Events | ||
SDL::Events | - Bindings to the Events Category in SDL API |
Structure | ||
SDL::Event | - General event structure |
Joystick | ||
SDL::Joystick | - SDL Bindings for the Joystick device |
Mouse | ||
SDL::Mouse | - SDL Bindings for the Mouse device |
Structure | ||
SDL::Cursor | - Mouse cursor structure |
Structure | ||
SDL::Version | - SDL Bindings for structure SDL_Version |
Video | ||
SDL::Video | - Bindings to the video category in SDL API |
Structure | ||
SDL::Color | - Format independent color description | |
SDL::Overlay | - YUV Video overlay | |
SDL::Palette | - Color palette for 8-bit pixel formats | |
SDL::PixelFormat | - Stores surface format information | |
SDL::Rect | - Defines a rectangular area | |
SDL::Surface | - Graphic surface structure. | |
SDL::VideoInfo | - Video Target Information |
Cookbook | ||
SDL::Cookbook | ||
SDL::Cookbook::PDL |
Extension | ||
SDL::App | - a SDL perl extension |
GFX | ||
SDL::GFX::Framerate | - framerate calculating functions | |
SDL::GFX::Primitives | - basic drawing functions |
Structure | ||
SDL::GFX::FPSManager | - data structure used by SDL::GFX::Framerate |
Image | ||
SDL::Image | - Bindings for the SDL_Image library |
Mixer | ||
SDL::Mixer | - Sound and music functions | |
SDL::Mixer::Channels | - SDL::Mixer channel functions and bindings | |
SDL::Mixer::Effects | - SDL_Mixer sound effect functions and bindings | |
SDL::Mixer::Groups | - SDL_Mixer groups functions and bindings | |
SDL::Mixer::Music | - SDL_Mixer music functions and bindings |
Structure | ||
SDL::Mixer::MixChunk | - SDL Bindings for structure SDL_MixChunk | |
SDL::Mixer::MixMusic | - SDL Bindings for structure SDL_MixMusic |
TODO |
Core |
MultiThread | ||
SDL::MultiThread | - Bindings to the MultiThread category in SDL API |
Structure | ||
SDL::RWOps | - SDL Bindings to SDL_RWOPs |
GFX | ||
SDL::GFX::BlitFunc | - blitting functions | |
SDL::GFX::ImageFilter | - image filtering functions | |
SDL::GFX::Rotozoom | - rotation and zooming functions for surfaces |
Tutorials | ||
SDL::Tutorial | - introduction to Perl SDL | |
SDL::Tutorial::Animation | ||
SDL::Tutorial::Images | ||
SDL::Tutorial::LunarLander | - a small tutorial on Perl SDL | |
SDL::Tutorial::Pong | - Get started pong | |
SDL::Tutorial::Tetris | - Let's Make Tetris |
UNCATEGORIZED | ||
SDL::Font | - a SDL perl extension | |
SDL::Game::Palette | - a perl extension | |
SDL::MPEG | - a SDL perl extension | |
SDL::Music | - a perl extension | |
SDL::OpenGL | - a perl extension | |
SDL::SFont | - a perl extension | |
SDL::SMPEG | - a SDL perl extension | |
SDL::Sound | - a perl extension | |
SDL::TTFont | - a SDL perl extension | |
SDL::Tool::Font | - a perl extension | |
SDL::Tool::Graphic |
Core | ||
SDL | - Simple DirectMedia Layer for Perl | |
SDL::Time | - a SDL perl extension for managing timers. |
Audio | ||
SDL::Audio | - SDL Bindings for Audio |
Structure | ||
SDL::AudioCVT | - Audio Conversion Structure | |
SDL::AudioSpec | - SDL Bindings for structure SDL::AudioSpec |
CDROM | ||
SDL::CDROM | - SDL Bindings for the CDROM device |
Structure | ||
SDL::CD | - SDL Bindings for structure SDL_CD | |
SDL::CDTrack | - SDL Bindings for structure SDL_CDTrack |
Events | ||
SDL::Events | - Bindings to the Events Category in SDL API |
Structure | ||
SDL::Event | - General event structure |
Joystick | ||
SDL::Joystick | - SDL Bindings for the Joystick device |
Mouse | ||
SDL::Mouse | - SDL Bindings for the Mouse device |
Structure | ||
SDL::Cursor | - Mouse cursor structure |
Structure | ||
SDL::Version | - SDL Bindings for structure SDL_Version |
Video | ||
SDL::Video | - Bindings to the video category in SDL API |
Structure | ||
SDL::Color | - Format independent color description | |
SDL::Overlay | - YUV Video overlay | |
SDL::Palette | - Color palette for 8-bit pixel formats | |
SDL::PixelFormat | - Stores surface format information | |
SDL::Rect | - Defines a rectangular area | |
SDL::Surface | - Graphic surface structure. | |
SDL::VideoInfo | - Video Target Information |
Cookbook | ||
SDL::Cookbook | ||
SDL::Cookbook::PDL |
Extension | ||
SDL::App | - a SDL perl extension |
GFX | ||
SDL::GFX::Framerate | - framerate calculating functions | |
SDL::GFX::Primitives | - basic drawing functions |
Structure | ||
SDL::GFX::FPSManager | - data structure used by SDL::GFX::Framerate |
Image | ||
SDL::Image | - Bindings for the SDL_Image library |
Mixer | ||
SDL::Mixer | - Sound and music functions | |
SDL::Mixer::Channels | - SDL::Mixer channel functions and bindings | |
SDL::Mixer::Effects | - SDL_Mixer sound effect functions and bindings | |
SDL::Mixer::Groups | - SDL_Mixer groups functions and bindings | |
SDL::Mixer::Music | - SDL_Mixer music functions and bindings |
Structure | ||
SDL::Mixer::MixChunk | - SDL Bindings for structure SDL_MixChunk | |
SDL::Mixer::MixMusic | - SDL Bindings for structure SDL_MixMusic |
TODO |
Core |
MultiThread | ||
SDL::MultiThread | - Bindings to the MultiThread category in SDL API |
Structure | ||
SDL::RWOps | - SDL Bindings to SDL_RWOPs |
GFX | ||
SDL::GFX::BlitFunc | - blitting functions | |
SDL::GFX::ImageFilter | - image filtering functions | |
SDL::GFX::Rotozoom | - rotation and zooming functions for surfaces |
Tutorials | ||
SDL::Tutorial | - introduction to Perl SDL | |
SDL::Tutorial::Animation | ||
SDL::Tutorial::Images | ||
SDL::Tutorial::LunarLander | - a small tutorial on Perl SDL | |
SDL::Tutorial::Pong | - Get started pong | |
SDL::Tutorial::Tetris | - Let's Make Tetris |
UNCATEGORIZED | ||
SDL::Font | - a SDL perl extension | |
SDL::Game::Palette | - a perl extension | |
SDL::MPEG | - a SDL perl extension | |
SDL::Music | - a perl extension | |
SDL::OpenGL | - a perl extension | |
SDL::SFont | - a perl extension | |
SDL::SMPEG | - a SDL perl extension | |
SDL::Sound | - a perl extension | |
SDL::TTFont | - a SDL perl extension | |
SDL::Tool::Font | - a perl extension | |
SDL::Tool::Graphic |