Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
660222f9
Commit
660222f9
authored
May 28, 2006
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert audioop over to METH_VARARGS.
parent
fbef5888
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
60 deletions
+66
-60
Modules/audioop.c
Modules/audioop.c
+66
-60
No files found.
Modules/audioop.c
View file @
660222f9
...
...
@@ -302,7 +302,7 @@ audioop_getsample(PyObject *self, PyObject *args)
int
len
,
size
,
val
=
0
;
int
i
;
if
(
!
PyArg_Parse
(
args
,
"(s#ii)
"
,
&
cp
,
&
len
,
&
size
,
&
i
)
)
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#ii:getsample
"
,
&
cp
,
&
len
,
&
size
,
&
i
)
)
return
0
;
if
(
size
!=
1
&&
size
!=
2
&&
size
!=
4
)
{
PyErr_SetString
(
AudioopError
,
"Size should be 1, 2 or 4"
);
...
...
@@ -326,7 +326,7 @@ audioop_max(PyObject *self, PyObject *args)
int
i
;
int
max
=
0
;
if
(
!
PyArg_Parse
(
args
,
"(s#i)
"
,
&
cp
,
&
len
,
&
size
)
)
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#i:max
"
,
&
cp
,
&
len
,
&
size
)
)
return
0
;
if
(
size
!=
1
&&
size
!=
2
&&
size
!=
4
)
{
PyErr_SetString
(
AudioopError
,
"Size should be 1, 2 or 4"
);
...
...
@@ -350,7 +350,7 @@ audioop_minmax(PyObject *self, PyObject *args)
int
i
;
int
min
=
0x7fffffff
,
max
=
-
0x7fffffff
;
if
(
!
PyArg_Parse
(
args
,
"(s#i)
"
,
&
cp
,
&
len
,
&
size
))
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#i:minmax
"
,
&
cp
,
&
len
,
&
size
))
return
NULL
;
if
(
size
!=
1
&&
size
!=
2
&&
size
!=
4
)
{
PyErr_SetString
(
AudioopError
,
"Size should be 1, 2 or 4"
);
...
...
@@ -374,7 +374,7 @@ audioop_avg(PyObject *self, PyObject *args)
int
i
;
double
avg
=
0
.
0
;
if
(
!
PyArg_Parse
(
args
,
"(s#i)
"
,
&
cp
,
&
len
,
&
size
)
)
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#i:avg
"
,
&
cp
,
&
len
,
&
size
)
)
return
0
;
if
(
size
!=
1
&&
size
!=
2
&&
size
!=
4
)
{
PyErr_SetString
(
AudioopError
,
"Size should be 1, 2 or 4"
);
...
...
@@ -401,7 +401,7 @@ audioop_rms(PyObject *self, PyObject *args)
int
i
;
double
sum_squares
=
0
.
0
;
if
(
!
PyArg_Parse
(
args
,
"(s#i)
"
,
&
cp
,
&
len
,
&
size
)
)
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#i:rms
"
,
&
cp
,
&
len
,
&
size
)
)
return
0
;
if
(
size
!=
1
&&
size
!=
2
&&
size
!=
4
)
{
PyErr_SetString
(
AudioopError
,
"Size should be 1, 2 or 4"
);
...
...
@@ -472,7 +472,8 @@ audioop_findfit(PyObject *self, PyObject *args)
double
aj_m1
,
aj_lm1
;
double
sum_ri_2
,
sum_aij_2
,
sum_aij_ri
,
result
,
best_result
,
factor
;
if
(
!
PyArg_Parse
(
args
,
"(s#s#)"
,
&
cp1
,
&
len1
,
&
cp2
,
&
len2
)
)
if
(
!
PyArg_ParseTuple
(
args
,
"s#s#:findfit"
,
&
cp1
,
&
len1
,
&
cp2
,
&
len2
)
)
return
0
;
if
(
len1
&
1
||
len2
&
1
)
{
PyErr_SetString
(
AudioopError
,
"Strings should be even-sized"
);
...
...
@@ -528,7 +529,8 @@ audioop_findfactor(PyObject *self, PyObject *args)
int
len1
,
len2
;
double
sum_ri_2
,
sum_aij_ri
,
result
;
if
(
!
PyArg_Parse
(
args
,
"(s#s#)"
,
&
cp1
,
&
len1
,
&
cp2
,
&
len2
)
)
if
(
!
PyArg_ParseTuple
(
args
,
"s#s#:findfactor"
,
&
cp1
,
&
len1
,
&
cp2
,
&
len2
)
)
return
0
;
if
(
len1
&
1
||
len2
&
1
)
{
PyErr_SetString
(
AudioopError
,
"Strings should be even-sized"
);
...
...
@@ -560,7 +562,7 @@ audioop_findmax(PyObject *self, PyObject *args)
double
aj_m1
,
aj_lm1
;
double
result
,
best_result
;
if
(
!
PyArg_Parse
(
args
,
"(s#i)
"
,
&
cp1
,
&
len1
,
&
len2
)
)
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#i:findmax
"
,
&
cp1
,
&
len1
,
&
len2
)
)
return
0
;
if
(
len1
&
1
)
{
PyErr_SetString
(
AudioopError
,
"Strings should be even-sized"
);
...
...
@@ -605,7 +607,7 @@ audioop_avgpp(PyObject *self, PyObject *args)
double
avg
=
0
.
0
;
int
diff
,
prevdiff
,
extremediff
,
nextreme
=
0
;
if
(
!
PyArg_Parse
(
args
,
"(s#i)
"
,
&
cp
,
&
len
,
&
size
)
)
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#i:avgpp
"
,
&
cp
,
&
len
,
&
size
)
)
return
0
;
if
(
size
!=
1
&&
size
!=
2
&&
size
!=
4
)
{
PyErr_SetString
(
AudioopError
,
"Size should be 1, 2 or 4"
);
...
...
@@ -662,7 +664,7 @@ audioop_maxpp(PyObject *self, PyObject *args)
int
max
=
0
;
int
diff
,
prevdiff
,
extremediff
;
if
(
!
PyArg_Parse
(
args
,
"(s#i)
"
,
&
cp
,
&
len
,
&
size
)
)
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#i:maxpp
"
,
&
cp
,
&
len
,
&
size
)
)
return
0
;
if
(
size
!=
1
&&
size
!=
2
&&
size
!=
4
)
{
PyErr_SetString
(
AudioopError
,
"Size should be 1, 2 or 4"
);
...
...
@@ -713,7 +715,7 @@ audioop_cross(PyObject *self, PyObject *args)
int
i
;
int
prevval
,
ncross
;
if
(
!
PyArg_Parse
(
args
,
"(s#i)
"
,
&
cp
,
&
len
,
&
size
)
)
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#i:cross
"
,
&
cp
,
&
len
,
&
size
)
)
return
0
;
if
(
size
!=
1
&&
size
!=
2
&&
size
!=
4
)
{
PyErr_SetString
(
AudioopError
,
"Size should be 1, 2 or 4"
);
...
...
@@ -741,7 +743,7 @@ audioop_mul(PyObject *self, PyObject *args)
PyObject
*
rv
;
int
i
;
if
(
!
PyArg_Parse
(
args
,
"(s#id)
"
,
&
cp
,
&
len
,
&
size
,
&
factor
)
)
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#id:mul
"
,
&
cp
,
&
len
,
&
size
,
&
factor
)
)
return
0
;
if
(
size
==
1
)
maxval
=
(
double
)
0x7f
;
...
...
@@ -782,7 +784,8 @@ audioop_tomono(PyObject *self, PyObject *args)
PyObject
*
rv
;
int
i
;
if
(
!
PyArg_Parse
(
args
,
"(s#idd)"
,
&
cp
,
&
len
,
&
size
,
&
fac1
,
&
fac2
)
)
if
(
!
PyArg_ParseTuple
(
args
,
"s#idd:tomono"
,
&
cp
,
&
len
,
&
size
,
&
fac1
,
&
fac2
)
)
return
0
;
if
(
size
==
1
)
maxval
=
(
double
)
0x7f
;
...
...
@@ -826,7 +829,8 @@ audioop_tostereo(PyObject *self, PyObject *args)
PyObject
*
rv
;
int
i
;
if
(
!
PyArg_Parse
(
args
,
"(s#idd)"
,
&
cp
,
&
len
,
&
size
,
&
fac1
,
&
fac2
)
)
if
(
!
PyArg_ParseTuple
(
args
,
"s#idd:tostereo"
,
&
cp
,
&
len
,
&
size
,
&
fac1
,
&
fac2
)
)
return
0
;
if
(
size
==
1
)
maxval
=
(
double
)
0x7f
;
...
...
@@ -877,7 +881,7 @@ audioop_add(PyObject *self, PyObject *args)
PyObject
*
rv
;
int
i
;
if
(
!
PyArg_Parse
(
args
,
"(s#s#i)
"
,
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#s#i:add
"
,
&
cp1
,
&
len1
,
&
cp2
,
&
len2
,
&
size
)
)
return
0
;
...
...
@@ -931,7 +935,7 @@ audioop_bias(PyObject *self, PyObject *args)
int
i
;
int
bias
;
if
(
!
PyArg_Parse
(
args
,
"(s#ii)
"
,
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#ii:bias
"
,
&
cp
,
&
len
,
&
size
,
&
bias
)
)
return
0
;
...
...
@@ -967,7 +971,7 @@ audioop_reverse(PyObject *self, PyObject *args)
PyObject
*
rv
;
int
i
,
j
;
if
(
!
PyArg_Parse
(
args
,
"(s#i)
"
,
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#i:reverse
"
,
&
cp
,
&
len
,
&
size
)
)
return
0
;
...
...
@@ -1004,7 +1008,7 @@ audioop_lin2lin(PyObject *self, PyObject *args)
PyObject
*
rv
;
int
i
,
j
;
if
(
!
PyArg_Parse
(
args
,
"(s#ii)
"
,
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#ii:lin2lin
"
,
&
cp
,
&
len
,
&
size
,
&
size2
)
)
return
0
;
...
...
@@ -1053,8 +1057,9 @@ audioop_ratecv(PyObject *self, PyObject *args)
weightA
=
1
;
weightB
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"s#iiiiO|ii:ratecv"
,
&
cp
,
&
len
,
&
size
,
&
nchannels
,
&
inrate
,
&
outrate
,
&
state
,
&
weightA
,
&
weightB
))
if
(
!
PyArg_ParseTuple
(
args
,
"s#iiiiO|ii:ratecv"
,
&
cp
,
&
len
,
&
size
,
&
nchannels
,
&
inrate
,
&
outrate
,
&
state
,
&
weightA
,
&
weightB
))
return
NULL
;
if
(
size
!=
1
&&
size
!=
2
&&
size
!=
4
)
{
PyErr_SetString
(
AudioopError
,
"Size should be 1, 2 or 4"
);
...
...
@@ -1117,7 +1122,8 @@ audioop_ratecv(PyObject *self, PyObject *args)
}
for
(
chan
=
0
;
chan
<
nchannels
;
chan
++
)
{
if
(
!
PyArg_ParseTuple
(
PyTuple_GetItem
(
samps
,
chan
),
"ii:ratecv"
,
&
prev_i
[
chan
],
&
cur_i
[
chan
]))
"ii:ratecv"
,
&
prev_i
[
chan
],
&
cur_i
[
chan
]))
goto
exit
;
}
}
...
...
@@ -1235,9 +1241,9 @@ audioop_lin2ulaw(PyObject *self, PyObject *args)
PyObject
*
rv
;
int
i
;
if
(
!
PyArg_Parse
(
args
,
"(s#i)
"
,
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#i:lin2ulaw
"
,
&
cp
,
&
len
,
&
size
)
)
return
0
;
return
0
;
if
(
size
!=
1
&&
size
!=
2
&&
size
!=
4
)
{
PyErr_SetString
(
AudioopError
,
"Size should be 1, 2 or 4"
);
...
...
@@ -1269,7 +1275,7 @@ audioop_ulaw2lin(PyObject *self, PyObject *args)
PyObject
*
rv
;
int
i
;
if
(
!
PyArg_Parse
(
args
,
"(s#i)
"
,
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#i:ulaw2lin
"
,
&
cp
,
&
len
,
&
size
)
)
return
0
;
...
...
@@ -1303,7 +1309,7 @@ audioop_lin2alaw(PyObject *self, PyObject *args)
PyObject
*
rv
;
int
i
;
if
(
!
PyArg_Parse
(
args
,
"(s#i)
"
,
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#i:lin2alaw
"
,
&
cp
,
&
len
,
&
size
)
)
return
0
;
...
...
@@ -1337,7 +1343,7 @@ audioop_alaw2lin(PyObject *self, PyObject *args)
PyObject
*
rv
;
int
i
;
if
(
!
PyArg_Parse
(
args
,
"(s#i)
"
,
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#i:alaw2lin
"
,
&
cp
,
&
len
,
&
size
)
)
return
0
;
...
...
@@ -1372,7 +1378,7 @@ audioop_lin2adpcm(PyObject *self, PyObject *args)
PyObject
*
rv
,
*
state
,
*
str
;
int
i
,
outputbuffer
=
0
,
bufferstep
;
if
(
!
PyArg_Parse
(
args
,
"(s#iO)
"
,
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#iO:lin2adpcm
"
,
&
cp
,
&
len
,
&
size
,
&
state
)
)
return
0
;
...
...
@@ -1393,7 +1399,7 @@ audioop_lin2adpcm(PyObject *self, PyObject *args)
valpred
=
0
;
step
=
7
;
index
=
0
;
}
else
if
(
!
PyArg_Parse
(
state
,
"(ii)
"
,
&
valpred
,
&
index
)
)
}
else
if
(
!
PyArg_Parse
Tuple
(
state
,
"ii
"
,
&
valpred
,
&
index
)
)
return
0
;
step
=
stepsizeTable
[
index
];
...
...
@@ -1480,7 +1486,7 @@ audioop_adpcm2lin(PyObject *self, PyObject *args)
PyObject
*
rv
,
*
str
,
*
state
;
int
i
,
inputbuffer
=
0
,
bufferstep
;
if
(
!
PyArg_Parse
(
args
,
"(s#iO)
"
,
if
(
!
PyArg_Parse
Tuple
(
args
,
"s#iO:adpcm2lin
"
,
&
cp
,
&
len
,
&
size
,
&
state
)
)
return
0
;
...
...
@@ -1495,7 +1501,7 @@ audioop_adpcm2lin(PyObject *self, PyObject *args)
valpred
=
0
;
step
=
7
;
index
=
0
;
}
else
if
(
!
PyArg_Parse
(
state
,
"(ii)
"
,
&
valpred
,
&
index
)
)
}
else
if
(
!
PyArg_Parse
Tuple
(
state
,
"ii
"
,
&
valpred
,
&
index
)
)
return
0
;
str
=
PyString_FromStringAndSize
(
NULL
,
len
*
size
*
2
);
...
...
@@ -1562,30 +1568,30 @@ audioop_adpcm2lin(PyObject *self, PyObject *args)
}
static
PyMethodDef
audioop_methods
[]
=
{
{
"max"
,
audioop_max
,
METH_
OLD
ARGS
},
{
"minmax"
,
audioop_minmax
,
METH_
OLD
ARGS
},
{
"avg"
,
audioop_avg
,
METH_
OLD
ARGS
},
{
"maxpp"
,
audioop_maxpp
,
METH_
OLD
ARGS
},
{
"avgpp"
,
audioop_avgpp
,
METH_
OLD
ARGS
},
{
"rms"
,
audioop_rms
,
METH_
OLD
ARGS
},
{
"findfit"
,
audioop_findfit
,
METH_
OLD
ARGS
},
{
"findmax"
,
audioop_findmax
,
METH_
OLD
ARGS
},
{
"findfactor"
,
audioop_findfactor
,
METH_
OLD
ARGS
},
{
"cross"
,
audioop_cross
,
METH_
OLD
ARGS
},
{
"mul"
,
audioop_mul
,
METH_
OLD
ARGS
},
{
"add"
,
audioop_add
,
METH_
OLD
ARGS
},
{
"bias"
,
audioop_bias
,
METH_
OLD
ARGS
},
{
"ulaw2lin"
,
audioop_ulaw2lin
,
METH_
OLD
ARGS
},
{
"lin2ulaw"
,
audioop_lin2ulaw
,
METH_
OLD
ARGS
},
{
"alaw2lin"
,
audioop_alaw2lin
,
METH_
OLD
ARGS
},
{
"lin2alaw"
,
audioop_lin2alaw
,
METH_
OLD
ARGS
},
{
"lin2lin"
,
audioop_lin2lin
,
METH_
OLD
ARGS
},
{
"adpcm2lin"
,
audioop_adpcm2lin
,
METH_
OLD
ARGS
},
{
"lin2adpcm"
,
audioop_lin2adpcm
,
METH_
OLD
ARGS
},
{
"tomono"
,
audioop_tomono
,
METH_
OLD
ARGS
},
{
"tostereo"
,
audioop_tostereo
,
METH_
OLD
ARGS
},
{
"getsample"
,
audioop_getsample
,
METH_
OLD
ARGS
},
{
"reverse"
,
audioop_reverse
,
METH_
OLD
ARGS
},
{
"max"
,
audioop_max
,
METH_
VAR
ARGS
},
{
"minmax"
,
audioop_minmax
,
METH_
VAR
ARGS
},
{
"avg"
,
audioop_avg
,
METH_
VAR
ARGS
},
{
"maxpp"
,
audioop_maxpp
,
METH_
VAR
ARGS
},
{
"avgpp"
,
audioop_avgpp
,
METH_
VAR
ARGS
},
{
"rms"
,
audioop_rms
,
METH_
VAR
ARGS
},
{
"findfit"
,
audioop_findfit
,
METH_
VAR
ARGS
},
{
"findmax"
,
audioop_findmax
,
METH_
VAR
ARGS
},
{
"findfactor"
,
audioop_findfactor
,
METH_
VAR
ARGS
},
{
"cross"
,
audioop_cross
,
METH_
VAR
ARGS
},
{
"mul"
,
audioop_mul
,
METH_
VAR
ARGS
},
{
"add"
,
audioop_add
,
METH_
VAR
ARGS
},
{
"bias"
,
audioop_bias
,
METH_
VAR
ARGS
},
{
"ulaw2lin"
,
audioop_ulaw2lin
,
METH_
VAR
ARGS
},
{
"lin2ulaw"
,
audioop_lin2ulaw
,
METH_
VAR
ARGS
},
{
"alaw2lin"
,
audioop_alaw2lin
,
METH_
VAR
ARGS
},
{
"lin2alaw"
,
audioop_lin2alaw
,
METH_
VAR
ARGS
},
{
"lin2lin"
,
audioop_lin2lin
,
METH_
VAR
ARGS
},
{
"adpcm2lin"
,
audioop_adpcm2lin
,
METH_
VAR
ARGS
},
{
"lin2adpcm"
,
audioop_lin2adpcm
,
METH_
VAR
ARGS
},
{
"tomono"
,
audioop_tomono
,
METH_
VAR
ARGS
},
{
"tostereo"
,
audioop_tostereo
,
METH_
VAR
ARGS
},
{
"getsample"
,
audioop_getsample
,
METH_
VAR
ARGS
},
{
"reverse"
,
audioop_reverse
,
METH_
VAR
ARGS
},
{
"ratecv"
,
audioop_ratecv
,
METH_VARARGS
},
{
0
,
0
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment