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