************************************************************************* MagiCMac Sound driver programmers documentation v0.96 from GSXB driver ************************************************************************* XBIOS Functions list: Locksound() XBIOS function 128. Unlocksound() XBIOS Function 129. Soundcmd() XBIOS Function 130. Setbuffer() XBIOS Function 131. Setmode() XBIOS Function 132. Settracks() XBIOS Function 133. Setmontracks() XBIOS Function 134. Setinterrupt() XBIOS Function 135. Buffoper() XBIOS Function 136. Dsptristate() XBIOS Function 137. Not yet implemented. Gpio() XBIOS Function 138. Just used for clock selection. Devconnect() XBIOS Function 139. Sndstatus() XBIOS Function 140. Buffptr() XBIOS Function 141. Some functions are not 100% compatible with GSXB/MilanBlaster because the way under MacOS with sound devices is different. ************************************************************************* Locksnd ************************************************************************* Opcode: XBIOS 128 Syntax: long Locksnd ( void ); Description: When one intends to use the soundsystem, Locksnd() should be called to prevent other clean applications from using the soundsystem. All cleanly written applications call Locksnd() before attempting to use the soundsystem, but unfortunately there exists some that just plunge ahead. So, ALWAYS call Locksnd() before using the sound XBIOS!!! Binding: move.w #128,-(sp) trap #14 addq.l #2,sp Return: Locksnd() will return 1 if soundsystem was sucessfully locked, or ESNDLOCKED if it is already locked by another application. ************************************************************************* Unlocksnd ************************************************************************* Opcode: XBIOS 129 Syntax: long Unlocksnd ( void ); Description: When done using the soundsystem, call Unlocksnd() to free the soundsystem. This will make other applications able to use it again. Binding: move.w #129,-(sp) trap #14 addq.l #2,sp Return: Unlocksnd() will return E_OK (0) if the soundsystem was successfully unlocked, or ESNDNOTLOCK if it wasn't locked. ************************************************************************* Soundcmd ************************************************************************* Opcode: XBIOS 130 Syntax: long Soundcmd ( word Mode, word DATA ); Description: Soundcmd() is the function used to control most of the things relating to PCM sound, like setting DAC/ADC sampling rate, selecting record sources, etc... Binding: move.w DATA,-(sp) move.w Mode,-(sp) move.w #130,-(sp) trap #14 addq.l #6,sp ------------------------------------------------------------------------- Mode 0 Set Left PCM attenuation (DAC) Mode 1 Set Right PCM attenuation (DAC) These modes sets the attenuation for the DAC's Left/Right channels. DATA: attenuation (0 - 255) If DATA = SND_INQUIRE (-1), the current setting will be returned without change. Return: Returns the value actually set, or ENODEV if installed driver does not have PCM sound. ------------------------------------------------------------------------- Mode 2 - Set Record Gain Left channel (ADC) Mode 3 - Set Record Gain Right channel (ADC These two modes set the record gain for the Left and Right ADC channels. DATA: Record Gain (0 - 255). If DATA = SND_INQUIRE (-1), the current setting will be returned without change. Return: Returns the value actualy set, or ENODEV if installed driver can't do recording. ------------------------------------------------------------------------- Mode 4 Enable/disable (unmute/mute) ADC and the Matrix on DAC. DATA: DATA is a bitmask specifying to Enable/Disable. A SET bit enables/unmutes and a CLEARED bit disables/Mutes : Bit 0 - ADC Bit 1 - Matrix Return: Returns the actual setting being done. This call does not return any errors if the hardware driver does not support a channel attempted enabled/disabled. Note: At this time, only ADC is used by the driver, and the driver forces bit 1 (Matrix) to enabled always. -------------------------------------------------------------------------- Mode 5 Record source select. This mode is used to select a input source for the ADC. DATA: DATA is a bit mask of record sources. If DATA = SND_INQUIRE (-1), no changes are made, and the current settings are returned. Originally, a SET bit will select Soundchip (Aux1 here), and a CLEARED bit will select Microphone. Under Mac, the driver select the current input source when the 2 bits are CLEARED and the source 1 when one or two bits are SET. Bit 0 - Right record channel source select. Bit 1 - Reft record channel source select. Return: Returns the actual setting being done. This call does not return any errors if the hardware driver does not support a channel attempted enabled/disabled. -------------------------------------------------------------------------- Mode 6 SETPRESCALE. This mode is only valid (that is, it does nothing) until after using Devconnect() to set the prescaler to TT030 compatibility mode. When that is done, DATA represents the TT030 compatible prescaler values as follow : Name Value Meaning CCLK_6K 0 Divide by 1280 (6.25 KHz) CCLK_12K 1 Divide by 640 (12.5 KHz) CCLK_25K 2 Divide by 320 (25 KHz) CCLK_50K 3 Divide by 160 (50 KHz) If DATA = SND_INQUIRE (-1), the current prescale setting is returned without any changes being done. Return: This mode returns the actual setting. -------------------------------------------------------------------------- Mode 7 Set Sample rate. This is a MilanBlaster/GSXB only mode, and is is available when bits 2 AND 5 in _SND cookie is SET. If this is true, always use this call to set desired sample rate. DATA: If DATA = SND_INQUIRE (-1), the current sample rate is returned without any changes. Otherwise DATA contains the desired sample rate, between 0 - 65533 Hz. NOTE: This call acutally sets the rate for both the DAC and the ADC. Return: Returns the sample rate acutally set for the ADC and the DAC. -------------------------------------------------------------------------- Mode 8 Set desired format for 8-bit samples. This is a MilanBlaster/GSXB only mode, and is is available when bits 2 AND 5 in _SND cookie is SET. This call is used to change the format on 8-bit samples. DATA: If DATA = SND_INQUIRE (-1), the sampleformat currently in use is returned. Otherwise DATA is a bitmask with the following meaning; Bit 0 - If set, Signed Bit 1 - If set, Unsigned Return: The driver always returns 1 (Signed). -------------------------------------------------------------------------- Mode 9 Set desired format for 16-bit samples. This is a MilanBlaster/GSXB only mode, and is is available when bits 2 AND 5 in _SND cookie is SET. This call is used to change the format on 16-bit samples. DATA: If DATA = SND_INQUIRE (-1), the sampleformat currently in use is returned. Otherwise DATA is a bitmask with the following meaning; Bit 0 - If set, Signed Bit 1 - If set, Unsigned Bit 2 - If set, Big endian (motorola byte order) Bit 3 - If set, Little Endian (Intel byte order) Return: The driver always returns 5 (Signed Big endian). -------------------------------------------------------------------------- Mode 10 Set desired format for 24-bit samples. This is a MilanBlaster/GSXB only mode, and is is available when bits 2 AND 5 in _SND cookie is SET. This call is used to change the format on 24-bit samples. The driver does not support 24-bit samples. DATA: If DATA = SND_INQUIRE (-1), the sampleformat currently in use is returned. Otherwise DATA is a bitmask with the following meaning : Bit 0 - If set, Signed Bit 1 - If set, Unsigned Bit 2 - If set, Big endian (motorola byte order) Bit 3 - If set, Little Endian (Intel byte order) Return: The driver always returns 0. -------------------------------------------------------------------------- Mode 11 Set desired format for 32-bit samples. This is a MilanBlaster/GSXB only mode, and is is available when bits 2 AND 5 in _SND cookie is SET. This call is used to change the format on 32-bit samples. The driver does not support 32-bit samples. DATA: If DATA = SND_INQUIRE (-1), the sampleformat currently in use is returned. Otherwise DATA is a bitmask with the following ...
wssmia