Is it possible these days to write perl code and then turn it in to C++ that one could then put in to a C++ program?
I am writing a c++ program that will deal with PCM audio and alsa sound functions which are good at managing sound cards so that one can get a stream of binary audio from the card at the rate and format for the job at hand. C++ and gcc are both very good at this with c++ being a little more useful in compiling routines that access the right libraries. Perl, on the other hand is wonderful at munching and crunching text such as text-based configuration files in which one usually reads a string and splits it based on delimiters to assign values to one's program. The hope, here, is to use the strengths of perl to write code that does what I want for handling configuration files and then use c++ for the logic of the sound handler where it really shines. In c++, one certainly can write code to open and read text files but making something good happen in c++ takes longer and what one ends up with is not nearly as nice as what one gets with the string handling functions that are part of perl. What is ironic is that perl uses these functions in C so basically, I am trying to find a lazier way to get past the opening part of my program. The configuration part happens right as the program starts and is never needed after that point. The C++ part, on the other hand runs after all the values are set until one kills the program. Unless I am missing something, there don't seem to be many sound modules in perl because they would have to work in unix and Windows environments so I am not complaining but perl also can do bit-wise binary operations so I looked in to seeing if my sound handler could be written in perl but you'd have to use system calls to aplay and arecord or start from bare metal to get the same function that aplay and arecord give you. You can do that but aplay and arecord are already there and work fine so there is no reason to reinvent the wheel. I could be wrong about everything I have just written so I am looking for ideas. The C programming for handling the sound is nothing fancy, mainly splitting the left and right channels from the standard 32-bit int that sound cards generate with each sample. Also, the samples are 16 bits and communications-grade sound can work with 8-bit samples so all one has to do there is just use the upper 8 bits for the actual PCM audio. I am interested in any constructive ideas as to how to take advantage of the easier text handling of perl but use the binary features of c for the actual engine that reads the sound and stores it in files. Many thanks. Martin McCormick -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/