Audio-Mad
view release on metacpan or search on metacpan
Audio_Mad_Frame FRAME
CODE:
mad_synth_frame(THIS, FRAME);
XSRETURN(1);
void
samples(THIS)
Audio_Mad_Synth THIS
PREINIT:
struct mad_pcm *pcm;
PPCODE:
pcm = &THIS->pcm;
if (!(pcm->length > 0)) {
XSRETURN_UNDEF;
}
EXTEND(SP, 2);
PUSHs(sv_2mortal(newSVpvn((char *)pcm->samples[0], sizeof(mad_fixed_t) * pcm->length)));
if (pcm->channels == 2) {
PUSHs(sv_2mortal(newSVpvn((char *)pcm->samples[1], sizeof(mad_fixed_t) * pcm->length)));
}
void
resample(THIS, left, right=&PL_sv_undef)
Audio_Mad_Resample THIS
SV *left
SV *right
PREINIT:
unsigned int length, old_length, bufsize;
mad_fixed_t *resampled, *data;
double fscale;
PPCODE:
if (!SvPOK(left)) {
XSRETURN_UNDEF;
}
/* this scale value, and the following calculation
based upon it are gross displays of my infantile
C programming abilities. basically, I found out
the buffer _grows_ when you _upscale_ -- imagine
that (*smacks self*). */
fscale = mad_f_todouble(THIS->ratio);
void
dither(THIS, leftsv, rightsv=&PL_sv_undef)
Audio_Mad_Dither THIS
SV *leftsv
SV *rightsv
PREINIT:
STRLEN old_length, length;
mad_fixed_t *left, *right = NULL;
unsigned char *cooked;
PPCODE:
if (THIS->pcmfunc == NULL) {
XSRETURN_UNDEF;
}
if (!SvPOK(leftsv)) {
XSRETURN_UNDEF;
}
old_length = SvLEN(leftsv) / sizeof(mad_fixed_t);
left = (mad_fixed_t *)SvPV_nolen(leftsv);
( run in 2.301 seconds using v1.01-cache-2.11-cpan-71847e10f99 )