Audio-DSP
view release on metacpan or search on metacpan
456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/soundcard.h>
#define AUDIO_FILE_BUFFER_SIZE 4096
static
int
not_here(char
*s
)
{
croak(
"%s not implemented on this architecture"
, s);
return
-1;
}
static double
constant(char
*name
,
int
arg)
{
errno = 0;
switch (
*name
) {
case
'A'
:
if
(strEQ(name,
"AFMT_A_LAW"
))
#ifdef AFMT_A_LAW
return
AFMT_A_LAW;
#else
goto
not_there;
#endif
if
(strEQ(name,
"AFMT_IMA_ADPCM"
))
#ifdef AFMT_IMA_ADPCM
return
AFMT_IMA_ADPCM;
#else
goto
not_there;
#endif
if
(strEQ(name,
"AFMT_MPEG"
))
#ifdef AFMT_MPEG
return
AFMT_MPEG;
#else
goto
not_there;
#endif
if
(strEQ(name,
"AFMT_MU_LAW"
))
#ifdef AFMT_MU_LAW
return
AFMT_MU_LAW;
#else
goto
not_there;
#endif
if
(strEQ(name,
"AFMT_QUERY"
))
#ifdef AFMT_QUERY
return
AFMT_QUERY;
#else
goto
not_there;
#endif
if
(strEQ(name,
"AFMT_S16_BE"
))
#ifdef AFMT_S16_BE
return
AFMT_S16_BE;
#else
goto
not_there;
#endif
if
(strEQ(name,
"AFMT_S16_LE"
))
#ifdef AFMT_S16_LE
return
AFMT_S16_LE;
#else
goto
not_there;
#endif
if
(strEQ(name,
"AFMT_S16_NE"
))
#ifdef AFMT_S16_NE
return
AFMT_S16_NE;
#else
goto
not_there;
#endif
if
(strEQ(name,
"AFMT_S8"
))
#ifdef AFMT_S8
return
AFMT_S8;
#else
goto
not_there;
#endif
if
(strEQ(name,
"AFMT_U16_BE"
))
#ifdef AFMT_U16_BE
return
AFMT_U16_BE;
#else
goto
not_there;
#endif
if
(strEQ(name,
"AFMT_U16_LE"
))
#ifdef AFMT_U16_LE
return
AFMT_U16_LE;
#else
goto
not_there;
#endif
if
(strEQ(name,
"AFMT_U8"
))
#ifdef AFMT_U8
return
AFMT_U8;
#else
goto
not_there;
#endif
break;
}
errno = EINVAL;
return
0;
not_there:
errno = ENOENT;
return
0;
}
int
_audioformat (SV* fmt) {
char* val;
/*
format
specified as integer */
if
(SvIOK(fmt))
return
(SvIV(fmt));
( run in 0.239 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )