Hi,
Brian Cassidy wrote:
Hey All,
I've writing a little 8088 Corruption player [1] w/ SDL_Perl but I've
come across a few issues.
which release do you use ? With which perl ?
The data format is very much like an ANSI file where there's a
background color then a char on top of in another color. each
character in an 8x8 block needs to be checked against the bit mask of
the font to see if it writes a fg color to the screen or not.
I've attached my program + a required font data file to this message.
you can grab the original movie data file (8088_COR.DAT) from the
original zip [2].
I tried it, but it miss some data file to test maybe. no 8088_COR.DAT
found in archive, but a file with TMV extension instead, which has a
wrong size. (also web server report wrong content-type: audio/x-zipped-mod)
Also, you could use constant pragma.
You can see the section commented out in my program that does the fg
color calculations. Things slow to a crawl once you uncomment that
section.
If anyone has any ideas on how to speed this up, I'd love to hear them.
If you use an old release, the speed issue could be due to an
inefficient object use in perl (tak a look at CPAN bug tracker for old
sdl-perl)
My other question is that I can't for the life of me figure out how to
play the audio frame portion ($abuffer in the program) -- is it even
possible to play raw audio from a variable with SDL_Perl?
Don't forget SDL perl is just a link between SDL and Perl, so all SDL
can do, sdl-perl could do (sdl-perl is not sync'ed with sdl since David
spend less time on it and some contributors leave) so if SDL can play
RAW sound sample, sdl-perl could do it too.
Take a look at sdl audio reference (on sdl main website)
And, for playing audio, I'm not usre to understand what you want
clearly, so forgive me if I don't give you answer you expect, you'll
have to load sound data and launch playing, while doing something else,
cause mixer is an independant thread which is not locked while playing
sound, so if you do : load->play->exit program, you'll hear nothing at all.
taken from loopwave test program:
while (! $done && ( SDL::GetAudioStatus() == &SDL_AUDIO_PLAYING)) {
SDL::Delay(1000);
$done = 1;
}
another part of answer come from same program:
my ($data,$len) = @_;
$wav_ptr = $wav_buffer + $wav_pos;
$wav_remainder = $wav_len - $wav_pos;
while ( $wav_remainder <= $len ) {
SDL::MixAudio($data,$wav_ptr,$wav_remainder,&SDL_MIX_MAXVOLUME);
$data += $wav_remainder;
$len -= $wav_remainder;
$wav_ptr = $wav_buffer;
$wav_remainder = $wav_len;
$wav_pos = 0;
}
SDL::MixAudio($data,$wav_ptr,$len,&SDL_MIX_MAXVOLUME);
$wav_pos += $len;
I guess this could be helpfull on how to play only chunk of audio sample.
-Brian
Regards.