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
6d865e10
Commit
6d865e10
authored
Feb 10, 1993
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added new audio library functionality (getstatus, float sample fmts)
parent
244d9e6c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
172 additions
and
4 deletions
+172
-4
Lib/irix5/AL.py
Lib/irix5/AL.py
+22
-2
Lib/plat-irix5/AL.py
Lib/plat-irix5/AL.py
+22
-2
Modules/almodule.c
Modules/almodule.c
+128
-0
No files found.
Lib/irix5/AL.py
View file @
6d865e10
...
...
@@ -6,6 +6,10 @@ RATE_16000 = 16000
RATE_11025
=
11025
RATE_8000
=
8000
SAMPFMT_TWOSCOMP
=
1
SAMPFMT_FLOAT
=
32
SAMPFMT_DOUBLE
=
64
SAMPLE_8
=
1
SAMPLE_16
=
2
# SAMPLE_24 is the low 24 bits of a long, sign extended to 32 bits
...
...
@@ -18,8 +22,21 @@ INPUT_LINE = 0
INPUT_MIC
=
1
INPUT_DIGITAL
=
2
HOLD
,
RELEASE
=
0
,
1
ATTAIL
,
ATHEAD
,
ATMARK
,
ATTIME
=
0
,
1
,
2
,
3
MONITOR_OFF
=
0
MONITOR_ON
=
1
ERROR_NUMBER
=
0
ERROR_TYPE
=
1
ERROR_LOCATION_LSP
=
2
ERROR_LOCATION_MSP
=
3
ERROR_LENGTH
=
4
ERROR_INPUT_UNDERFLOW
=
0
ERROR_OUTPUT_OVERFLOW
=
1
# These seem to be not supported anymore:
##HOLD, RELEASE = 0, 1
##ATTAIL, ATHEAD, ATMARK, ATTIME = 0, 1, 2, 3
DEFAULT_DEVICE
=
1
...
...
@@ -35,6 +52,9 @@ OUTPUT_COUNT = 8
UNUSED_COUNT
=
9
SYNC_INPUT_TO_AES
=
10
SYNC_OUTPUT_TO_AES
=
11
MONITOR_CTL
=
12
LEFT_MONITOR_ATTEN
=
13
RIGHT_MONITOR_ATTEN
=
14
ENUM_VALUE
=
0
# only certain values are valid
RANGE_VALUE
=
1
# any value in range is valid
Lib/plat-irix5/AL.py
View file @
6d865e10
...
...
@@ -6,6 +6,10 @@ RATE_16000 = 16000
RATE_11025
=
11025
RATE_8000
=
8000
SAMPFMT_TWOSCOMP
=
1
SAMPFMT_FLOAT
=
32
SAMPFMT_DOUBLE
=
64
SAMPLE_8
=
1
SAMPLE_16
=
2
# SAMPLE_24 is the low 24 bits of a long, sign extended to 32 bits
...
...
@@ -18,8 +22,21 @@ INPUT_LINE = 0
INPUT_MIC
=
1
INPUT_DIGITAL
=
2
HOLD
,
RELEASE
=
0
,
1
ATTAIL
,
ATHEAD
,
ATMARK
,
ATTIME
=
0
,
1
,
2
,
3
MONITOR_OFF
=
0
MONITOR_ON
=
1
ERROR_NUMBER
=
0
ERROR_TYPE
=
1
ERROR_LOCATION_LSP
=
2
ERROR_LOCATION_MSP
=
3
ERROR_LENGTH
=
4
ERROR_INPUT_UNDERFLOW
=
0
ERROR_OUTPUT_OVERFLOW
=
1
# These seem to be not supported anymore:
##HOLD, RELEASE = 0, 1
##ATTAIL, ATHEAD, ATMARK, ATTIME = 0, 1, 2, 3
DEFAULT_DEVICE
=
1
...
...
@@ -35,6 +52,9 @@ OUTPUT_COUNT = 8
UNUSED_COUNT
=
9
SYNC_INPUT_TO_AES
=
10
SYNC_OUTPUT_TO_AES
=
11
MONITOR_CTL
=
12
LEFT_MONITOR_ATTEN
=
13
RIGHT_MONITOR_ATTEN
=
14
ENUM_VALUE
=
0
# only certain values are valid
RANGE_VALUE
=
1
# any value in range is valid
Modules/almodule.c
View file @
6d865e10
...
...
@@ -26,6 +26,16 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "audio.h"
/* Check which version audio library we have: */
#ifdef AL_ERROR_NUMBER
#define AL_405
/* XXXX 4.0.5 libaudio also allows us to provide better error
** handling (with ALseterrorhandler). We should implement that
** sometime.
*/
#endif
#include "allobjects.h"
#include "import.h"
#include "modsupport.h"
...
...
@@ -127,6 +137,52 @@ al_setchannels (self, args)
return
(
setConfig
(
self
,
args
,
ALsetchannels
));
}
#ifdef AL_405
static
object
*
al_getsampfmt
(
self
,
args
)
configobject
*
self
;
object
*
args
;
{
return
(
getConfig
(
self
,
args
,
ALgetsampfmt
));
}
static
object
*
al_setsampfmt
(
self
,
args
)
configobject
*
self
;
object
*
args
;
{
return
(
setConfig
(
self
,
args
,
ALsetsampfmt
));
}
static
object
*
al_getfloatmax
(
self
,
args
)
configobject
*
self
;
object
*
args
;
{
double
arg
;
if
(
!
getnoarg
(
args
)
)
return
0
;
arg
=
ALgetfloatmax
(
self
->
ob_config
);
return
newfloatobject
(
arg
);
}
static
object
*
al_setfloatmax
(
self
,
args
)
configobject
*
self
;
object
*
args
;
{
double
arg
;
if
(
!
getargs
(
args
,
"d"
,
&
arg
)
)
return
0
;
ALsetfloatmax
(
self
->
ob_config
,
arg
);
INCREF
(
None
);
return
None
;
}
#endif
/* AL_405 */
static
struct
methodlist
config_methods
[]
=
{
{
"getqueuesize"
,
al_getqueuesize
},
{
"setqueuesize"
,
al_setqueuesize
},
...
...
@@ -134,6 +190,12 @@ static struct methodlist config_methods[] = {
{
"setwidth"
,
al_setwidth
},
{
"getchannels"
,
al_getchannels
},
{
"setchannels"
,
al_setchannels
},
#ifdef AL_405
{
"getsampfmt"
,
al_getsampfmt
},
{
"setsampfmt"
,
al_setsampfmt
},
{
"getfloatmax"
,
al_getfloatmax
},
{
"setfloatmax"
,
al_setfloatmax
},
#endif
/* AL_405 */
{
NULL
,
NULL
}
/* sentinel */
};
...
...
@@ -270,7 +332,17 @@ al_readsamps (self, args)
}
c
=
ALgetconfig
(
self
->
ob_port
);
#ifdef AL_405
width
=
ALgetsampfmt
(
c
);
if
(
width
==
AL_SAMPFMT_FLOAT
)
width
=
sizeof
(
float
);
else
if
(
width
==
AL_SAMPFMT_DOUBLE
)
width
=
sizeof
(
double
);
else
width
=
ALgetwidth
(
c
);
#else
width
=
ALgetwidth
(
c
);
#endif
/* AL_405 */
ALfreeconfig
(
c
);
v
=
newsizedstringobject
((
char
*
)
NULL
,
width
*
count
);
if
(
v
==
NULL
)
return
NULL
;
...
...
@@ -295,7 +367,17 @@ al_writesamps (self, args)
if
(
!
getargs
(
args
,
"s#"
,
&
buf
,
&
size
))
return
NULL
;
c
=
ALgetconfig
(
self
->
ob_port
);
#ifdef AL_405
width
=
ALgetsampfmt
(
c
);
if
(
width
==
AL_SAMPFMT_FLOAT
)
width
=
sizeof
(
float
);
else
if
(
width
==
AL_SAMPFMT_DOUBLE
)
width
=
sizeof
(
double
);
else
width
=
ALgetwidth
(
c
);
#else
width
=
ALgetwidth
(
c
);
#endif
/* AL_405 */
ALfreeconfig
(
c
);
BGN_SAVE
ALwritesamps
(
self
->
ob_port
,
(
void
*
)
buf
,
(
long
)
size
/
width
);
...
...
@@ -363,6 +445,49 @@ al_getconfig (self, args)
return
newconfigobject
(
config
);
}
#ifdef AL_405
static
object
*
al_getstatus
(
self
,
args
)
portobject
*
self
;
object
*
args
;
{
object
*
list
,
*
v
;
long
*
PVbuffer
;
long
length
;
int
i
;
if
(
!
getargs
(
args
,
"O"
,
&
list
))
return
NULL
;
if
(
!
is_listobject
(
list
))
{
err_badarg
();
return
NULL
;
}
length
=
getlistsize
(
list
);
PVbuffer
=
NEW
(
long
,
length
);
if
(
PVbuffer
==
NULL
)
return
err_nomem
();
for
(
i
=
0
;
i
<
length
;
i
++
)
{
v
=
getlistitem
(
list
,
i
);
if
(
!
is_intobject
(
v
))
{
DEL
(
PVbuffer
);
err_badarg
();
return
NULL
;
}
PVbuffer
[
i
]
=
getintvalue
(
v
);
}
ALgetstatus
(
self
->
ob_port
,
PVbuffer
,
length
);
for
(
i
=
0
;
i
<
length
;
i
++
)
setlistitem
(
list
,
i
,
newintobject
(
PVbuffer
[
i
]));
DEL
(
PVbuffer
);
INCREF
(
None
);
return
None
;
}
#endif
/* AL_405 */
static
struct
methodlist
port_methods
[]
=
{
{
"closeport"
,
al_closeport
},
{
"getfd"
,
al_getfd
},
...
...
@@ -375,6 +500,9 @@ static struct methodlist port_methods[] = {
{
"getfillpoint"
,
al_getfillpoint
},
{
"setconfig"
,
al_setconfig
},
{
"getconfig"
,
al_getconfig
},
#ifdef AL_405
{
"getstatus"
,
al_getstatus
},
#endif
/* AL_405 */
{
NULL
,
NULL
}
/* sentinel */
};
...
...
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