summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/snd
diff options
context:
space:
mode:
Diffstat (limited to 'Mac/Modules/snd')
-rw-r--r--Mac/Modules/snd/Sndmodule.c136
-rw-r--r--Mac/Modules/snd/sndgen.py54
-rw-r--r--Mac/Modules/snd/sndscan.py11
-rw-r--r--Mac/Modules/snd/sndsupport.py7
4 files changed, 190 insertions, 18 deletions
diff --git a/Mac/Modules/snd/Sndmodule.c b/Mac/Modules/snd/Sndmodule.c
index 9f5c24d..62e9d85 100644
--- a/Mac/Modules/snd/Sndmodule.c
+++ b/Mac/Modules/snd/Sndmodule.c
@@ -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}
};
diff --git a/Mac/Modules/snd/sndgen.py b/Mac/Modules/snd/sndgen.py
index 8e02f29..a980338 100644
--- a/Mac/Modules/snd/sndgen.py
+++ b/Mac/Modules/snd/sndgen.py
@@ -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)
+
diff --git a/Mac/Modules/snd/sndscan.py b/Mac/Modules/snd/sndscan.py
index 02c9177..8201b2c 100644
--- a/Mac/Modules/snd/sndscan.py
+++ b/Mac/Modules/snd/sndscan.py
@@ -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")],
diff --git a/Mac/Modules/snd/sndsupport.py b/Mac/Modules/snd/sndsupport.py
index fb561e8..af1908a 100644
--- a/Mac/Modules/snd/sndsupport.py
+++ b/Mac/Modules/snd/sndsupport.py
@@ -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 */