Audio-DSP

 view release on metacpan or  search on metacpan

DSP.xs  view on Meta::CPAN

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#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 )