PageRenderTime 48ms CodeModel.GetById 43ms RepoModel.GetById 0ms 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
Possible License(s): AGPL-1.0, GPL-2.0
  1. =pod
  2. =head1 NAME
  3. SDL::Mixer::Samples - functions for loading sound samples
  4. =head1 CATEGORY
  5. Mixer
  6. =head1 METHODS
  7. =head2 get_num_chunk_decoders
  8. my $num_decoders = SDL::Mixer::Samples::get_num_chunk_decoders();
  9. Returns the number of available decoders.
  10. =head2 get_chunk_decoder
  11. my $decoder = SDL::Mixer::Samples::get_chunk_decoder( $num_decoder );
  12. Returns the decoder for the given id.
  13. =head2 load_WAV
  14. my $mix_chunk = SDL::Mixer::Samples::load_WAV( $file );
  15. C<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.
  16. Example:
  17. my $chunk = SDL::Mixer::Samples::load_WAV('sample.wav');
  18. SDL::Mixer::Channels::play_channel(-1, $chunk, -1);
  19. SDL::delay(2000);
  20. =head2 load_WAV_RW
  21. my $mix_chunk = SDL::Mixer::Samples::load_WAV_RW( $rwops, $free );
  22. C<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
  23. 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
  24. free the source memory after loading is complete or not.
  25. Returns a Mix_Chunk containing the whole sample on success, or C<undef> on error.
  26. B<Note>: Do not reuse the RWops-object for another call to this function!
  27. Example:
  28. my $rwops = SDL::RWOps->new_file('sample.wav', 'r');
  29. my $chunk = SDL::Mixer::Samples::load_WAV_RW($rwops, 0);
  30. SDL::Mixer::Channels::play_channel(-1, $chunk, -1);
  31. SDL::delay(2000);
  32. =head2 quick_load_WAV
  33. SDL::Mixer::Samples::quick_load_WAV( $buf );
  34. to be documented.
  35. =head2 quick_load_RAW
  36. SDL::Mixer::Samples::quick_load_RAW( $buf, $len );
  37. to be documented.
  38. =head2 volume_chunk
  39. my $volume_before = SDL::Mixer::Samples::volume_chunk( $chunk, $new_volume );
  40. C<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>).
  41. If you pass C<-1> as C<$new_volume> you just get its volume without changing it.
  42. =head1 AUTHORS
  43. See L<SDL/AUTHORS>.
  44. =cut