mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Trying again to check it in. Changes to:
- Use Universal Headers as input - Change addpack calls to not depend on Guido's disklayout - Checkge testprograms to use new names for some functions
This commit is contained in:
parent
ae8a68f40c
commit
b81cf9d61c
31 changed files with 1231 additions and 599 deletions
|
@ -244,12 +244,12 @@ static PyObject *SndCh_SndStopFilePlay(_self, _args)
|
|||
{
|
||||
PyObject *_res = NULL;
|
||||
OSErr _err;
|
||||
Boolean async;
|
||||
Boolean quietNow;
|
||||
if (!PyArg_ParseTuple(_args, "b",
|
||||
&async))
|
||||
&quietNow))
|
||||
return NULL;
|
||||
_err = SndStopFilePlay(_self->ob_itself,
|
||||
async);
|
||||
quietNow);
|
||||
if (_err != noErr) return PyMac_Error(_err);
|
||||
Py_INCREF(Py_None);
|
||||
_res = Py_None;
|
||||
|
@ -289,7 +289,7 @@ static PyMethodDef SndCh_methods[] = {
|
|||
{"SndPauseFilePlay", (PyCFunction)SndCh_SndPauseFilePlay, 1,
|
||||
"() -> None"},
|
||||
{"SndStopFilePlay", (PyCFunction)SndCh_SndStopFilePlay, 1,
|
||||
"(Boolean async) -> None"},
|
||||
"(Boolean quietNow) -> None"},
|
||||
{"SndChannelStatus", (PyCFunction)SndCh_SndChannelStatus, 1,
|
||||
"(short theLength) -> (SCStatus theStatus)"},
|
||||
{NULL, NULL, 0}
|
||||
|
@ -322,6 +322,35 @@ staticforward PyTypeObject SndChannel_Type = {
|
|||
/* ------------------- End object type SndChannel ------------------- */
|
||||
|
||||
|
||||
static PyObject *Snd_SetSoundVol(_self, _args)
|
||||
PyObject *_self;
|
||||
PyObject *_args;
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
short level;
|
||||
if (!PyArg_ParseTuple(_args, "h",
|
||||
&level))
|
||||
return NULL;
|
||||
SetSoundVol(level);
|
||||
Py_INCREF(Py_None);
|
||||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
|
||||
static PyObject *Snd_GetSoundVol(_self, _args)
|
||||
PyObject *_self;
|
||||
PyObject *_args;
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
short level;
|
||||
if (!PyArg_ParseTuple(_args, ""))
|
||||
return NULL;
|
||||
GetSoundVol(&level);
|
||||
_res = Py_BuildValue("h",
|
||||
level);
|
||||
return _res;
|
||||
}
|
||||
|
||||
static PyObject *Snd_SndNewChannel(_self, _args)
|
||||
PyObject *_self;
|
||||
PyObject *_args;
|
||||
|
@ -642,7 +671,96 @@ static PyObject *Snd_Exp1to6(_self, _args)
|
|||
return _res;
|
||||
}
|
||||
|
||||
static PyObject *Snd_GetSysBeepVolume(_self, _args)
|
||||
PyObject *_self;
|
||||
PyObject *_args;
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
OSErr _err;
|
||||
long level;
|
||||
if (!PyArg_ParseTuple(_args, ""))
|
||||
return NULL;
|
||||
_err = GetSysBeepVolume(&level);
|
||||
if (_err != noErr) return PyMac_Error(_err);
|
||||
_res = Py_BuildValue("l",
|
||||
level);
|
||||
return _res;
|
||||
}
|
||||
|
||||
static PyObject *Snd_SetSysBeepVolume(_self, _args)
|
||||
PyObject *_self;
|
||||
PyObject *_args;
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
OSErr _err;
|
||||
long level;
|
||||
if (!PyArg_ParseTuple(_args, "l",
|
||||
&level))
|
||||
return NULL;
|
||||
_err = SetSysBeepVolume(level);
|
||||
if (_err != noErr) return PyMac_Error(_err);
|
||||
Py_INCREF(Py_None);
|
||||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
|
||||
static PyObject *Snd_GetDefaultOutputVolume(_self, _args)
|
||||
PyObject *_self;
|
||||
PyObject *_args;
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
OSErr _err;
|
||||
long level;
|
||||
if (!PyArg_ParseTuple(_args, ""))
|
||||
return NULL;
|
||||
_err = GetDefaultOutputVolume(&level);
|
||||
if (_err != noErr) return PyMac_Error(_err);
|
||||
_res = Py_BuildValue("l",
|
||||
level);
|
||||
return _res;
|
||||
}
|
||||
|
||||
static PyObject *Snd_SetDefaultOutputVolume(_self, _args)
|
||||
PyObject *_self;
|
||||
PyObject *_args;
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
OSErr _err;
|
||||
long level;
|
||||
if (!PyArg_ParseTuple(_args, "l",
|
||||
&level))
|
||||
return NULL;
|
||||
_err = SetDefaultOutputVolume(level);
|
||||
if (_err != noErr) return PyMac_Error(_err);
|
||||
Py_INCREF(Py_None);
|
||||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
|
||||
static PyObject *Snd_GetSoundHeaderOffset(_self, _args)
|
||||
PyObject *_self;
|
||||
PyObject *_args;
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
OSErr _err;
|
||||
SndListHandle sndHandle;
|
||||
long offset;
|
||||
if (!PyArg_ParseTuple(_args, "O&",
|
||||
ResObj_Convert, &sndHandle))
|
||||
return NULL;
|
||||
_err = GetSoundHeaderOffset(sndHandle,
|
||||
&offset);
|
||||
if (_err != noErr) return PyMac_Error(_err);
|
||||
_res = Py_BuildValue("l",
|
||||
offset);
|
||||
return _res;
|
||||
}
|
||||
|
||||
static PyMethodDef Snd_methods[] = {
|
||||
{"SetSoundVol", (PyCFunction)Snd_SetSoundVol, 1,
|
||||
"(short level) -> None"},
|
||||
{"GetSoundVol", (PyCFunction)Snd_GetSoundVol, 1,
|
||||
"() -> (short level)"},
|
||||
{"SndNewChannel", (PyCFunction)Snd_SndNewChannel, 1,
|
||||
"(short synth, long init, PyObject* userRoutine) -> (SndChannelPtr chan)"},
|
||||
{"SndControl", (PyCFunction)Snd_SndControl, 1,
|
||||
|
@ -665,6 +783,16 @@ static PyMethodDef Snd_methods[] = {
|
|||
"(Buffer buffer, Buffer state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, Buffer state)"},
|
||||
{"Exp1to6", (PyCFunction)Snd_Exp1to6, 1,
|
||||
"(Buffer buffer, Buffer state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, Buffer state)"},
|
||||
{"GetSysBeepVolume", (PyCFunction)Snd_GetSysBeepVolume, 1,
|
||||
"() -> (long level)"},
|
||||
{"SetSysBeepVolume", (PyCFunction)Snd_SetSysBeepVolume, 1,
|
||||
"(long level) -> None"},
|
||||
{"GetDefaultOutputVolume", (PyCFunction)Snd_GetDefaultOutputVolume, 1,
|
||||
"() -> (long level)"},
|
||||
{"SetDefaultOutputVolume", (PyCFunction)Snd_SetDefaultOutputVolume, 1,
|
||||
"(long level) -> None"},
|
||||
{"GetSoundHeaderOffset", (PyCFunction)Snd_GetSoundHeaderOffset, 1,
|
||||
"(SndListHandle sndHandle) -> (long offset)"},
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Sound.h'
|
||||
# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:Sound.h'
|
||||
|
||||
f = SndFunction(void, 'SetSoundVol',
|
||||
(short, 'level', InMode),
|
||||
)
|
||||
functions.append(f)
|
||||
|
||||
f = SndFunction(void, 'GetSoundVol',
|
||||
(short, 'level', OutMode),
|
||||
)
|
||||
functions.append(f)
|
||||
|
||||
f = SndMethod(OSErr, 'SndDoCommand',
|
||||
(SndChannelPtr, 'chan', InMode),
|
||||
|
@ -17,7 +27,7 @@ f = SndFunction(OSErr, 'SndNewChannel',
|
|||
(SndChannelPtr, 'chan', OutMode),
|
||||
(short, 'synth', InMode),
|
||||
(long, 'init', InMode),
|
||||
(SndCallBackProcPtr, 'userRoutine', InMode),
|
||||
(SndCallBackUPP, 'userRoutine', InMode),
|
||||
)
|
||||
functions.append(f)
|
||||
|
||||
|
@ -34,16 +44,6 @@ f = SndFunction(OSErr, 'SndControl',
|
|||
)
|
||||
functions.append(f)
|
||||
|
||||
f = SndFunction(void, 'SetSoundVol',
|
||||
(short, 'level', InMode),
|
||||
)
|
||||
functions.append(f)
|
||||
|
||||
f = SndFunction(void, 'GetSoundVol',
|
||||
(short, 'level', OutMode),
|
||||
)
|
||||
functions.append(f)
|
||||
|
||||
f = SndFunction(NumVersion, 'SndSoundManagerVersion',
|
||||
)
|
||||
functions.append(f)
|
||||
|
@ -55,7 +55,7 @@ f = SndMethod(OSErr, 'SndStartFilePlay',
|
|||
(long, 'bufferSize', InMode),
|
||||
(FakeType('0'), 'theBuffer', InMode),
|
||||
(AudioSelectionPtr, 'theSelection', InMode),
|
||||
(ProcPtr, 'theCompletion', InMode),
|
||||
(FilePlayCompletionUPP, 'theCompletion', InMode),
|
||||
(Boolean, 'async', InMode),
|
||||
)
|
||||
sndmethods.append(f)
|
||||
|
@ -67,7 +67,7 @@ sndmethods.append(f)
|
|||
|
||||
f = SndMethod(OSErr, 'SndStopFilePlay',
|
||||
(SndChannelPtr, 'chan', InMode),
|
||||
(Boolean, 'async', InMode),
|
||||
(Boolean, 'quietNow', InMode),
|
||||
)
|
||||
sndmethods.append(f)
|
||||
|
||||
|
@ -130,3 +130,29 @@ f = SndFunction(void, 'Exp1to6',
|
|||
)
|
||||
functions.append(f)
|
||||
|
||||
f = SndFunction(OSErr, 'GetSysBeepVolume',
|
||||
(long, 'level', OutMode),
|
||||
)
|
||||
functions.append(f)
|
||||
|
||||
f = SndFunction(OSErr, 'SetSysBeepVolume',
|
||||
(long, 'level', InMode),
|
||||
)
|
||||
functions.append(f)
|
||||
|
||||
f = SndFunction(OSErr, 'GetDefaultOutputVolume',
|
||||
(long, 'level', OutMode),
|
||||
)
|
||||
functions.append(f)
|
||||
|
||||
f = SndFunction(OSErr, 'SetDefaultOutputVolume',
|
||||
(long, 'level', InMode),
|
||||
)
|
||||
functions.append(f)
|
||||
|
||||
f = SndFunction(OSErr, 'GetSoundHeaderOffset',
|
||||
(SndListHandle, 'sndHandle', InMode),
|
||||
(long, 'offset', OutMode),
|
||||
)
|
||||
functions.append(f)
|
||||
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
# Then import sndsupport (which execs sndgen.py) to generate Sndmodule.c.
|
||||
# (Should learn how to tell the compiler to compile it as well.)
|
||||
|
||||
import addpack
|
||||
addpack.addpack(':Tools:bgen:bgen')
|
||||
|
||||
from scantools import Scanner
|
||||
|
||||
def main():
|
||||
|
@ -36,6 +39,10 @@ class SoundScanner(Scanner):
|
|||
'StartSound',
|
||||
'StopSound',
|
||||
'SoundDone',
|
||||
# These are soundMgr 3.0 routines that I can't seem to find...
|
||||
'GetSoundPreference',
|
||||
'SetSoundPreference',
|
||||
'GetCompressionInfo',
|
||||
|
||||
]
|
||||
|
||||
|
@ -43,6 +50,7 @@ class SoundScanner(Scanner):
|
|||
return [
|
||||
"GetSoundVol",
|
||||
"SetSoundVol",
|
||||
"UnsignedFixed",
|
||||
]
|
||||
|
||||
def makerepairinstructions(self):
|
||||
|
@ -62,6 +70,9 @@ class SoundScanner(Scanner):
|
|||
|
||||
([("SMStatusPtr", "*", "InMode")],
|
||||
[("SMStatus", "*", "OutMode")]),
|
||||
|
||||
([("CompressionInfoPtr", "*", "InMode")],
|
||||
[("CompressionInfo", "*", "OutMode")]),
|
||||
|
||||
# For SndPlay's SndListHandle argument
|
||||
([("Handle", "sndHdl", "InMode")],
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
# It execs the file sndgen.py which contain the function definitions
|
||||
# (sndgen.py was generated by sndscan.py, scanning the <Sound.h> header file).
|
||||
|
||||
import addpack
|
||||
addpack.addpack(':Tools:bgen:bgen')
|
||||
|
||||
from macsupport import *
|
||||
|
||||
|
||||
|
@ -71,8 +74,10 @@ class SndCallBackType(InputOnlyType):
|
|||
IndentLevel()
|
||||
|
||||
SndCallBackProcPtr = SndCallBackType()
|
||||
SndCallBackUPP = SndCallBackProcPtr
|
||||
|
||||
SndCompletionProcPtr = FakeType('(SndCompletionProcPtr)0') # XXX
|
||||
SndCompletionUPP = SndCompletionProcPtr
|
||||
|
||||
NumVersion = OpaqueByValueType('NumVersion', 'NumVer')
|
||||
|
||||
|
@ -81,9 +86,11 @@ InOutBuf128 = FixedInputOutputBufferType(128)
|
|||
AudioSelectionPtr = FakeType('0') # XXX
|
||||
|
||||
ProcPtr = FakeType('0') # XXX
|
||||
FilePlayCompletionUPP = FakeType('0') # XXX
|
||||
|
||||
SCStatus = StructOutputBufferType('SCStatus')
|
||||
SMStatus = StructOutputBufferType('SMStatus')
|
||||
CompressionInfo = StructOutputBufferType('CompressionInfo')
|
||||
|
||||
includestuff = includestuff + """
|
||||
#include <OSUtils.h> /* for Set(Current)A5 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue