Thanks for thinking about it, and in the process, nudging me in the right direction. I've now found what was the original problem in my initial module code, I've fixed it, and I've gotten it to work as I thought it should. Hence, I have no need for the Inline::C approximation. You can expect to see the first module giving perl the ability to do real time, cross platform, sound I/O on CPAN in a few weeks. If you think SDL::Sound satisfies this (it doesn't--it's broken), go ahead, try...
I also don't do OO in XS (or anywhere else, generally) so I'm not sure what you're referring to. I made a struct to pass in static globals because I wasn't sure if there was a problem being caused by one thread not being able to access the globals in another thread. There's nothing OO about structs, or well, any code I write for fun. :)
In case you're curious, the problem was that the portaudio callback thread didn't have the context for the perl interpreter. Perl uses some poorly documented dirty global variables in nearly all perlapi calls. When the portaudio rendering thread called the C callback function, it didn't have the perl global variables anymore. I fixed this by using the Perl_get_context() function (which is *not* documented in perlapi and is only mentioned IN PASSING in perlguts.) to get a pointer to the PerlInterpreter, which I pass to the callback and use PERL_SET_CONTEXT to reinitialize.
It's been a long journey but I'm just glad I can finally do what I initially set out to do: Have a framework in which I can move data from the microphone input to the speaker output, while being modified by a regular expression in real time. :)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.