.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "pods::SDL::Mixer::Samples 3pm" .TH pods::SDL::Mixer::Samples 3pm 2024-01-10 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME SDL::Mixer::Samples \- functions for loading sound samples .SH CATEGORY .IX Header "CATEGORY" Mixer .SH METHODS .IX Header "METHODS" .SS get_num_chunk_decoders .IX Subsection "get_num_chunk_decoders" .Vb 1 \& my $num_decoders = SDL::Mixer::Samples::get_num_chunk_decoders(); .Ve .PP Returns the number of available decoders. .SS get_chunk_decoder .IX Subsection "get_chunk_decoder" .Vb 1 \& my $decoder = SDL::Mixer::Samples::get_chunk_decoder( $num_decoder ); .Ve .PP Returns the decoder for the given id. .SS load_WAV .IX Subsection "load_WAV" .Vb 1 \& my $mix_chunk = SDL::Mixer::Samples::load_WAV( $file ); .Ve .PP \&\f(CW\*(C`load_WAV\*(C'\fR reads a file and passes it to SDL::Mixer::Samples::load_WAV_RW. SO this is a quick way to load a file into a chunk. .PP Example: .PP .Vb 1 \& my $chunk = SDL::Mixer::Samples::load_WAV(\*(Aqsample.wav\*(Aq); \& \& SDL::Mixer::Channels::play_channel(\-1, $chunk, \-1); \& SDL::delay(2000); .Ve .SS load_WAV_RW .IX Subsection "load_WAV_RW" .Vb 1 \& my $mix_chunk = SDL::Mixer::Samples::load_WAV_RW( $rwops, $free ); .Ve .PP \&\f(CW\*(C`load_WAV_RW\*(C'\fR is a macro that loads a sound sample from a a block of memory. It supports WAVE\-, MOD\-, MIDI\-, OGG\- and MP3 files (sometimes depends on compilation options). It accepts two arguments, the first being a RWops object from which to read and the second being a flag to free the source memory after loading is complete or not. .PP Returns a Mix_Chunk containing the whole sample on success, or \f(CW\*(C`undef\*(C'\fR on error. .PP \&\fBNote\fR: Do not reuse the RWops-object for another call to this function! .PP Example: .PP .Vb 1 \& my $rwops = SDL::RWOps\->new_file(\*(Aqsample.wav\*(Aq, \*(Aqr\*(Aq); \& \& my $chunk = SDL::Mixer::Samples::load_WAV_RW($rwops, 0); \& \& SDL::Mixer::Channels::play_channel(\-1, $chunk, \-1); \& SDL::delay(2000); .Ve .SS quick_load_WAV .IX Subsection "quick_load_WAV" .Vb 1 \& SDL::Mixer::Samples::quick_load_WAV( $buf ); .Ve .PP to be documented. .SS quick_load_RAW .IX Subsection "quick_load_RAW" .Vb 1 \& SDL::Mixer::Samples::quick_load_RAW( $buf, $len ); .Ve .PP to be documented. .SS volume_chunk .IX Subsection "volume_chunk" .Vb 1 \& my $volume_before = SDL::Mixer::Samples::volume_chunk( $chunk, $new_volume ); .Ve .PP \&\f(CW\*(C`volume_chunk\*(C'\fR let you set and get the volume of a chunk. When a chunk is created is volume is \f(CW\*(C`MIX_MAX_VOLUME\*(C'\fR (\f(CW128\fR). .PP If you pass \f(CW\-1\fR as \f(CW$new_volume\fR you just get its volume without changing it. .SH AUTHORS .IX Header "AUTHORS" See "AUTHORS" in SDL.