Hi, this feature will be officially released, yes. But I can't tell if
this will be already within december.
Cheers.
Am 01.12.2011 22:29, schrieb Alexander Becker:
>
> Wohoo! That's really great! Here is my current (OMG: it's SDL + Tk)
> proof-of-concept-script.
>
> It plays a file via start and stop buttons. In case anyone has
> suggestions, please don't hesitate to drop me an email.
>
>
>
> [code]
>
> #!perl
>
>
>
> use strict;
>
> use warnings;
>
> use utf8;
>
> use Tk;
>
> use DBI;
>
> use SQL::Abstract::Limit;
>
> use SDL;
>
> use SDL::Audio;
>
> use SDL::Mixer;
>
> use SDL::Mixer::Samples;
>
> use SDL::Mixer::Channels;
>
> use SDL::Mixer::Music;
>
> use SDL::RWOps;
>
> SDL::init(SDL_INIT_AUDIO);
>
> SDL::Mixer::init( MIX_INIT_MP3 | MUS_MP3 );
>
>
>
> my $mw = tkinit();
>
>
>
> unless( SDL::Mixer::open_audio( 44100, AUDIO_S16SYS, 2, 4096 ) == 0 ) {
>
> Carp::croak "Cannot open audio: ".SDL::get_error();
>
> }
>
>
>
> $mw->Button(
>
> -text => 'play',
>
> -command => sub{
>
> my $buffer = get_audio_buffer();
>
> my $rwops = SDL::RWOps->new_const_mem(
> $buffer );
>
> my $background_music =
> SDL::Mixer::Music::load_MUS_RW( $rwops );
>
>
>
> unless( $background_music ) {
>
> Carp::croak "Cannot
> load music file [buffer from DB]: " . SDL::get_error();
>
> }
>
>
>
> SDL::Mixer::Music::play_music(
> $background_music, 20 );
>
> },
>
> )->pack();
>
>
>
> $mw->Button(
>
> -text => 'stop',
>
> -command => sub{
>
> SDL::Mixer::Music::halt_music();
>
> },
>
> )->pack();
>
>
>
> $mw->MainLoop();
>
>
>
>
>
>
>
> sub get_audio_buffer {
>
> my $sql = SQL::Abstract::Limit->new( limit_dialect => 'LimitXY' );;
>
>
>
> my $table = 'words';
>
> my @fields = (qw/audio/);
>
> my %where = (
>
> id => 2,
>
> );
>
> my @order = ();
>
> my $limit = 1;
>
> my $offset = 0;
>
> my ( $stmt, @bind ) = $sql->select( $table, \@fields, \%where,
> \@order, $limit, $offset );
>
> my $database = 'test';
>
> my $db_host = '127.0.0.1';
>
> my $db_port = '3306';
>
> my $dsn = "DBI:mysql:database=$database;host=$db_host;port=$db_port";
>
> my $username = 'test';
>
> my $password = 'test';
>
> my $dbh = DBI->connect($dsn, $username, $password) or die('Cannot
> connect to DB: ' . DBI->errstr());
>
> my $sth = $dbh->prepare( $stmt );
>
> $sth->execute( @bind );
>
>
>
> my ($buffer) = $sth->fetchrow_array();
>
>
>
> return $buffer;
>
> } # /get_audio_buffer
>
> [/code]
>
>
>
> Here is the output of "perl Build.PL". There is an error for :
> execinfo.h, however, build, build test and build install runs fine.
>
>
>
> [snip]
>
> C:\zwischen\cpan\PerlGameDev-SDL-44c341f>perl Build.PL
>
> *************************** !!!WARNING!!! ********************************
>
> This Release breaks back compatibility support with versions 2.4x and
> below
>
> **************************************************************************
>
> Using 'My::Builder::Windows' class ...
>
> Detecting available libraries ...
>
> [Alien::SDL] Testing header(s): SDL.h
>
> [Alien::SDL] Testing header(s): SDL_mixer.h
>
> [Alien::SDL] Testing header(s): SDL_imageFilter.h
>
> [Alien::SDL] Testing header(s): SDL_image.h
>
> [Alien::SDL] Testing header(s): SDL_ttf.h
>
> [Alien::SDL] Testing header(s): SDL_framerate.h
>
> [Alien::SDL] Testing header(s): SDL_gfxBlitFunc.h
>
> [Alien::SDL] Testing header(s): SDL_gfxPrimitives.h
>
> [Alien::SDL] Testing header(s): SDL_rotozoom.h
>
> [Alien::SDL] Testing header(s): SDL_Pango.h
>
> Writing config_data ...
>
> Saving some info to 'notes' ...
>
> [Alien::SDL] Testing header(s): execinfo.h, signal.h NOK: (error:
> execinfo.h: No
>
> such file or directory)
>
> Can't find dist packages without a MANIFEST file
>
> Run 'Build manifest' to generate one
>
>
>
> WARNING: Possible missing or corrupt 'MANIFEST' file.
>
> Nothing to enter for 'provides' field in metafile.
>
> Created MYMETA.yml and MYMETA.json
>
> Creating new 'Build' script for 'SDL' version '2.535_01'
>
>
>
> C:\zwischen\cpan\PerlGameDev-SDL-44c341f>
>
> [/snip]
>
>
>
> Will this be in an official release of SDL? Because this would be a
> really nice feature, that could be advertised, e.g. via blogs entries
> etc.. I could write a german one.
>
>
>
> Best regards & thanks a lot,
>
> Alex
>
>
>
> *Von:*Tobias Leich [mailto:
em...@froggs.de]
> *Gesendet:* Donnerstag, 1. Dezember 2011 18:37
> *An:* Alexander Becker
> *Betreff:* Re: How to play an mp3 file from a database
>
>
>
> Hi Alex,
>
> You can checkout the c-sdl-rwops branch at github or download the
> zipfile if you are not experienced with git by using this link:
>
>
https://github.com/PerlGameDev/SDL/zipball/c-sdl-rwops
>
> Usage:
>
> my $music = SDL::Mixer::Music::load_MUS_RW( $rwops );
>
> |load_MUS_RW| does the same like |load_MUS| except that it accepts an
> SDL::RWOps <
http://search.cpan.org/perldoc?SDL%3A%3ARWOps>-object
> rather than a filename.
>
> Example for loading music from a variable:
>
> use SDL;
> use SDL::Mixer;
> use SDL::Mixer::Music;
> use SDL::RWOps;
>
> [...]
>
> my $rwops = SDL::RWOps->new_const_mem( $scalar_holding_music );
> my $music = SDL::Mixer::Music::load_MUS( $rwops );
>
> Cheers
>
> Am 30.11.2011 23:09, schrieb Alexander Becker:
>
> Hi!
>
> The example code in your link gives me version 1.2.11 on Win 7 x64 with
> strawberry perl 5.12.2 built for MSWin32-x64-multi-thread.
>
> HTH,
> Alex
>
> [code]
> use SDL::Mixer;
> use SDL::Version;
>
> my $version = SDL::Mixer::linked_version();
>
> printf("%d.%d.%d\n", $version->major, $version->minor, $version->patch); #
> prints "1.2.11" for me
> [/code]
>
> -----Ursprüngliche Nachricht-----
> Von: Tobias Leich [mailto:
em...@froggs.de]
> Gesendet: Mittwoch, 30. November 2011 13:18
> An: Alexander Becker
> Cc: 'breno';
sdl-...@perl.org <mailto:
sdl-...@perl.org>
> Cc:
sdl-...@perl.org <mailto:
sdl-...@perl.org>
> Von AVG überprüft -
www.avg.de <
http://www.avg.de>
>
> Version: 10.0.1411 / Virendatenbank: 2092/4046 - Ausgabedatum:
>
> 29.11.2011
>
>
>
>
> -----
> eMail ist virenfrei.
> Von AVG überprüft -
www.avg.de <
http://www.avg.de>
> Version: 10.0.1411 / Virendatenbank: 2102/4048 - Ausgabedatum: 30.11.2011
>
>
>
>
> ------------------------------------------------------------------------
>
> eMail ist virenfrei.
> Von AVG überprüft -
www.avg.de <
http://www.avg.de>