PageRenderTime 23ms CodeModel.GetById 18ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/lib/pods/SDL/Mixer/Samples.pod

http://github.com/PerlGameDev/SDL
Unknown | 84 lines | 44 code | 40 blank | 0 comment | 0 complexity | 44971741a53ec30300f273032d4d2f3c MD5 | raw file
 1
 2=pod
 3
 4=head1 NAME
 5
 6SDL::Mixer::Samples - functions for loading sound samples
 7
 8=head1 CATEGORY
 9
10Mixer
11
12=head1 METHODS
13
14=head2 get_num_chunk_decoders
15
16 my $num_decoders = SDL::Mixer::Samples::get_num_chunk_decoders();
17
18Returns the number of available decoders.
19
20=head2 get_chunk_decoder
21
22 my $decoder = SDL::Mixer::Samples::get_chunk_decoder( $num_decoder );
23
24Returns the decoder for the given id.
25
26=head2 load_WAV
27
28 my $mix_chunk = SDL::Mixer::Samples::load_WAV( $file );
29
30C<load_WAV> reads a file and passes it to L<SDL::Mixer::Samples::load_WAV_RW>. SO this is a quick way to load a file into a chunk.
31
32Example:
33
34 my $chunk = SDL::Mixer::Samples::load_WAV('sample.wav');
35 
36 SDL::Mixer::Channels::play_channel(-1, $chunk, -1);
37 SDL::delay(2000);
38
39=head2 load_WAV_RW
40
41 my $mix_chunk = SDL::Mixer::Samples::load_WAV_RW( $rwops, $free );
42
43C<load_WAV_RW> is a macro that loads a sound sample from a a block of memory. It supports WAVE-, MOD-, MIDI-, OGG- and MP3 files (sometimes 
44depends on compilation options). It accepts two arguments, the first being a RWops object from which to read and the second being a flag to 
45free the source memory after loading is complete or not.
46
47Returns a Mix_Chunk containing the whole sample on success, or C<undef> on error.
48
49B<Note>: Do not reuse the RWops-object for another call to this function!
50
51Example:
52
53 my $rwops = SDL::RWOps->new_file('sample.wav', 'r');
54 
55 my $chunk = SDL::Mixer::Samples::load_WAV_RW($rwops, 0);
56 
57 SDL::Mixer::Channels::play_channel(-1, $chunk, -1);
58 SDL::delay(2000);
59
60=head2 quick_load_WAV
61
62 SDL::Mixer::Samples::quick_load_WAV( $buf );
63
64to be documented.
65
66=head2 quick_load_RAW
67
68 SDL::Mixer::Samples::quick_load_RAW( $buf, $len );
69
70to be documented.
71
72=head2 volume_chunk
73
74 my $volume_before = SDL::Mixer::Samples::volume_chunk( $chunk, $new_volume );
75
76C<volume_chunk> let you set and get the volume of a chunk. When a chunk is created is volume is C<MIX_MAX_VOLUME> (C<128>).
77
78If you pass C<-1> as C<$new_volume> you just get its volume without changing it.
79
80=head1 AUTHORS
81
82See L<SDL/AUTHORS>.
83
84=cut