GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
pods::SDLx::Sound(3) User Contributed Perl Documentation pods::SDLx::Sound(3)

SDLx::Sound

Extension

    use SDLx::Sound;

    my $snd = SDLx::Sound->new();
    
    # loads and plays a single sound now
    $snd->play('myfile.wav');

    # load a single file
    $snd->load('theSound.aif');

    # plays it or all loaded files
    $snd->play();

    # more sounds
    my %files = (
        channel_01 => "/my_sound1.wav",
        channel_02 => "/my_sound2.ogg"
    );

    # times sounds bangs
    my %times = (
        channel_01 => 0,      # start
        channel_01 => 1256,   # milliseconds
        channel_02 => 2345
    );
    
    # Load files in channels for realtime play
    $snd->load(%files);

    # sets sound channel_01 loudness
    $snd->loud('channel_01', 80);       # loud at 80%
    $snd->play(%times);                 # play loaded files at times
    $snd->play;                         # play again

    # plays sound channel_01 at 578 milliseconds from now
    $snd->play('channel_01', 578);

    # fades sound 
    $snd->fade('channel_02', 2345, 3456, -20);

    # in a single act do the whole Sound
    my $snd = SDLx::Sound->new(
        files => (
            channel_01 => "/my_sound1.wav",
            channel_02 => "/my_sound2.ogg"
 
        ), 
        loud  => (
            channel_01 => 80,
            channel_02 => 75
        ),
        times => (
            channel_01 => 0,      # start
            channel_01 => 1256,   # milliseconds
            channel_02 => 2345
        ),
        fade  => (
            channel_02 => [2345, 3456, -20]
        )
    )->play();

You can think about the SDLx::Sound at 2 approaches.
  • A simple sound or
  • The sound of your game or app.

Your application will say what the best approach.

In a taste that resembles to perl and to SDL, our SDLx:Sound hooks at SDL::Audio and SDL::Mixer with a graceful and simple interface that can offer to monks a modern perlish way to manage sounds.

An SDLx::Sound object can load sounds from filesystem, play it, adjust this loudness level or stops the sound.

Each sound will play in the next available channel, so it can be handled isolately.

Returns a new instance of SDLx::Sound

 $sdlx_sound->play('file.wav');

Play a file

See "AUTHORS" in SDL.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2022-06-07 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.