home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-07-12 | 45.6 KB | 1,415 lines |
- TABLE OF CONTENTS
- 0001 ahi.device/--background--
- 0002 ahi.device/AHI_AllocAudioA
- 0003 ahi.device/AHI_AllocAudioRequestA
- 0004 ahi.device/AHI_AudioRequestA
- 0005 ahi.device/AHI_BestAudioIDA
- 0006 ahi.device/AHI_ControlAudioA
- 0007 ahi.device/AHI_FreeAudio
- 0008 ahi.device/AHI_FreeAudioRequest
- 0009 ahi.device/AHI_GetAudioAttrsA
- 0010 ahi.device/AHI_KillAudio
- 0011 ahi.device/AHI_LoadSound
- 0012 ahi.device/AHI_NextAudioID
- 0013 ahi.device/AHI_SetEffect
- 0014 ahi.device/AHI_SetFreq
- 0015 ahi.device/AHI_SetSound
- 0016 ahi.device/AHI_SetVol
- 0017 ahi.device/AHI_UnloadSound
-
- ahi.device/--background--
-
- PURPOSE
-
- The 'ahi.device' was first created because the lack of standards
- when it comes to sound cards on the Amiga. Another reason was to
- make it easier to write multi-channel music programs.
-
- This device is by no means the final and perfect solution. But
- hopefully, it can evolve into something useful until AT brings you
- The Real Thing (TM).
-
-
- OVERVIEW
-
- * Driver based
-
- Each supported sound card is controlled by a library-based audio
- driver. For a 'dumb' sound card, a new driver should be written in
- a few hours. For a 'smart' sound card, it is possible to utilize an
- on-board DSP, for example, to maximize performance and sound
- quality. For sound cards with own DSP but little or no memory, it is
- possible to use the main CPU to mix channels and do the post-
- processing with the DSP.
-
- * Fast, powerful mixing routines (yeah, right... haha)
-
- The device's mixing routines mix 8- or 16-bit signed samples
- located in Fast-RAM and outputs 16-bit mono or stereo (with stereo
- panning if desired) data, using any number of channels (as long as
- 'any' means less than 128...). Tables can be used speed the mixing
- up (especially when using 8-bit samples). The samples can have any
- length (including odd) and can have any number of loops.
-
- * Support for non-realtime mixing
-
- By providing a timing feature, it is possible to create high-
- quality output even if the processing power is lacking, by saving
- the output to disk, for example as an IFF AIFF or 8SXV file.
-
- * Audio database
-
- Uses ID codes, much like Screenmode IDs, to select the many
- parameters that can be set. The functions to access the audio
- database are not too different from those in 'graphics.library'.
- Audio modes are added to the database with the tool 'AddAudioModes',
- which either takes IFF-AHIM file(s) as argument or scans
- 'DEVS:AudioModes/' and adds all files found there. The device also
- features a requester to get an ID code from the user.
-
- * Future Compatible
-
- When AmigaOS gets device-independent audio worth it's name, it should
- not be too difficult to write a driver for AHI, allowing applications
- using 'ahi.device' to automatically use the new OS interface. At
- least I hope it wont.
-
-
- PROGRAMMING GUIDELINES
-
- * Follow the rules
-
- It's really simple. If I tell you to check return values, check
- sample types when recording, don't trash d2-d7/a2-a6 in Hooks, or
- don't call AHI_ControlAudio() with the AHIC_Play tag from interrups
- or Hooks, you do as you are told.
-
- * The library base
-
- The AHIBase structure is private, so are the sub libraries' library
- base structures. Don't try to be clever.
-
- * The Audio Database
-
- The implementation of the database is private, and may change any
- time. 'ahi.device' provides functions access the information in
- the database (AHI_NextAudioID(), AHI_GetAudioAttrsA() and
- AHI_BestAudioIDA()).
-
- * User Hooks
-
- All user Hooks must follow normal register conventions, which means
- that d2-d7 and a2-a6 must be presered. They may be called from an
- interrupt, but you cannot count on that, it can be your own process
- or another process. Don't assume system is in single-thread mode.
- Never spend much time in a Hook, get the work done as quick as
- possible and then return.
-
- * Function calls from other tasks, interrupts or user Hooks
-
- The AHIAudioCtrl structure may not be shared with other tasks/
- threads. The task that called AHI_AllocAudioA() must do all other
- calls too (except those callable from interrupts).
-
- Only calls specifically said to be callable from interrups may be
- called from user Hooks or interrupts. Note that AHI_ControlAudioA()
- have some tags that must not be present when called from an
- interrupt.
-
- * AHI_SetVol(), AHI_SetFreq() and AHI_SetSound() Flags
-
- These function calls take some flags as arguments. Currently, only
- one flag is defined, AHISB_IMM, which causes the changes to take
- effecy immediately. THIS FLAG SHOULD *NEVER* BE SET when you call
- these routines _from_ a SoundFunc. Likewise, THIS FLAG SHOULD
- *ALWAYS* BE SET, when calling these routines _outside_ a SoundFunc,
- for example from the PlayerFunc. This is very important.
-
- * System requirements
-
- V37 of the system libraries are required.
-
- 'ahi.device', or rather most audio drivers, need multitasking to be
- turned on to function properly. Don't turn it off when using the
- device.
-
- Some drivers use 'realtime.library', which must be present for those
- drivers to work. 'realtime.library' needs a free CIA timer. If your
- application uses a CIA timer, it is strongly recommended that you
- use the PlayerFunc in 'ahi.device' instead.
-
-
-
-
- ahi.device/AHI_AllocAudioA
-
- NAME
- AHI_AllocAudioA -- allocates and initializes the audio hardware
- AHI_AllocAudio -- varargs stub for AHI_AllocAudioA()
-
-
- SYNOPSIS
- audioctrl = AHI_AllocAudioA( tags );
- D0 A1
-
- struct AHIAudioCtrl *AHI_AllocAudioA( struct TagItem * );
-
- audioctrl = AHI_AllocAudio( tag1, ... );
-
- struct AHIAudioCtrl *AHI_AllocAudio( Tag, ... );
-
-
- FUNCTION
- Allocates and initializes the audio hardware, selects the best
- mixing routine (if neccessary) according to the supplied tags.
- To start playing you first need to call AHI_ControlAudioA().
-
-
- INPUTS
- tags - A pointer to a tag list.
-
-
- TAGS
-
- AHIA_AudioID (ULONG) - The audio mode to use.
-
- AHIA_MixFreq (ULONG) - Desired mixing frequency. The actual
- mixing rate may or may not be exactly what you asked for.
-
- AHIA_Channels (UWORD) - Number of channel to use. The actual
- number of channels used will be equal or grater than the
- requested. If too many channels were requested, this function
- will fail. This tag must be supplied.
-
- AHIA_Sounds (UWORD) - Number of sounds to use. This tag must be
- supplied.
-
- AHIA_SoundFunc (struct Hook *) - A function to call each time
- when a sound has been started. The function receives the
- following parameters:
- A0 - (struct Hook *)
- A2 - (struct AHIAudioCtrl *)
- A1 - (struct AHISoundMessage *)
- The hook may be called from an interrupt, so normal interrupt
- restrictions apply.
- The called function should follow normal register conventions,
- which means that d2-d7 and a2-a6 must be preserved.
-
- AHIA_PlayerFunc (struct Hook *) - A function to be called at regular
- intervals. By using this hook there is no need for music players
- to use other timing, such as VBLANK or CIA timers. But the real
- reason it's present is that it makes it possible to do non-
- realtime mixing to disk.
- Using this interrupt source is currently the only supported way
- to ensure that no mixing occurs between calls to AHI_SetVol(),
- AHI_SetFreq() or AHI_SetSound().
- If the sound playback is done without mixing, 'realtime.library'
- is used to provide timing. The function receives the following
- parameters:
- A0 - (struct Hook *)
- A2 - (struct AHIAudioCtrl *)
- A1 - Undefined.
- Do not assume A1 contains any particular value!
- The hook may be called from an interrupt, so normal interrupt
- restrictions apply.
- The called function should follow normal register conventions,
- which means that d2-d7 and a2-a6 must be preserved.
-
- AHIA_PlayerFreq (Fixed) - If non-zero, enables timing and specifies
- how many times per second PlayerFunc will be called. This must
- be specified if AHIA_PlayerFunc is! Do not use any extreme
- frequences. The result of MixFreq/PlayerFreq must fit an UWORD,
- ie it must be less or equal to 65535. It is also suggested that
- you keep the result over 80. For normal use this should not be a
- problem.
-
- AHIA_MinsPlayerFreq (Fixed) - The minimum frequency (AHIA_PlayerFreq)
- you will use. You should always supply this if you are using the
- device's interrupt feature!
-
- AHIA_MaxPlayerFreq (Fixed) - The maximum frequency (AHIA_PlayerFreq)
- you will use. You should always supply this if you are using the
- device's interrupt feature!
-
- AHIA_RecordFunc (struct Hook *) - This function will be called
- regulary when sampling is turned on (see AHI_ControlAudioA())
- with the following parameters:
- A0 - (struct Hook *)
- A2 - (struct AHIAudioCtrl *)
- A1 - (struct AHIRecordMessage *)
- The message (AHIRecordMessage) is filled as follows:
- ahirm_Buffer - Pointer to the samples. The buffer is valid
- until next time the Hook is called.
- ahiim_Length - Number of sample FRAMES in buffer.
- To get the size in bytes, multiply by 4 if ahiim_Type is
- AHIST_S16S.
- ahiim_Type - Always AHIST_S16S at the moment, but you *must*
- check this, since it may change in the future!
- The hook may be called from an interrupt, so normal interrupt
- restrictions apply. Signal a process if you wish to save the
- buffer to disk. The called function should follow normal register
- conventions, which means that d2-d7 and a2-a6 must be preserved.
- *** NOTE: The function MUST return NULL (in d0). This was previously
- not documented. Now you know.
-
- AHIA_UserData (APTR) - Can be used to initialise the ahiac_UserData
- field.
-
-
- RESULT
- A pointer to an AHIAudioCtrl structure or NULL if an error occured.
-
-
- EXAMPLE
-
-
- NOTES
- The AHIA_RecordFunc function must return NULL!
-
- AHIA_PlayerFreq, AHIA_MinsPlayerFreq and AHIA_MaxPlayerFreq used to
- be ULONGs. Now they have been redefined as Fixed. In order not to
- break old programs, all values below 65536 (i.e. below 1.0 Hz) will
- be treated as ULONGs. This klude will be removed later.
-
- BUGS
-
-
- SEE ALSO
- AHI_FreeAudio(), AHI_ControlAudioA()
-
-
-
-
- ahi.device/AHI_AllocAudioRequestA
-
- NAME
- AHI_AllocAudioRequestA -- allocate an audio mode requester.
- AHI_AllocAudioRequest -- varargs stub for AHI_AllocAudioRequestA()
-
-
- SYNOPSIS
- requester = AHI_AllocAudioRequestA( tags );
- D0 A0
-
- struct AHIAudioModeRequester *AHI_AllocAudioRequestA(
- struct TagItem * );
-
- requester = AHI_AllocAudioRequest( tag1, ... );
-
- struct AHIAudioModeRequester *AHI_AllocAudioRequest( Tag, ... );
-
-
- FUNCTION
- Allocates an audio mode requester data structure.
-
-
- INPUTS
- tags - A pointer to an optional tag list specifying how to initialize
- the data structure returned by this function. See the
- documentation for AHI_AudioRequestA() for an explanation of how
- to use the currently defined tags.
-
-
- RESULT
- requester - An initialized requester data structure, or NULL on
- failure.
-
-
- EXAMPLE
-
-
- NOTES
- The requester data structure is READ-ONLY and can only be modified
- by using tags!
-
-
- BUGS
-
-
- SEE ALSO
- AHI_AudioRequestA(), AHI_FreeAudioRequest()
-
-
-
-
- ahi.device/AHI_AudioRequestA
-
- NAME
- AHI_AudioRequestA -- get an audio mode from user using an requester.
- AHI_AudioRequest -- varargs stub for AHI_AudioRequestA()
-
-
- SYNOPSIS
- result = AHI_AudioRequestA( requester, tags );
- D0 A0 A1
-
- BOOL AHI_AudioRequestA( struct AHIAudioModeRequester *,
- struct TagItem * );
-
- result = AHI_AudioRequest( requester, tag1, ... );
-
- BOOL AHI_AudioRequest( struct AHIAudioModeRequester *, Tag, ... );
-
-
- FUNCTION
- Prompts the user for an audio mode, based on the modifying tags.
- If the user cancels or the system aborts the request, FALSE is
- returned, otherwise the requester's data structure relects the
- user input.
-
- Note that tag values stay in effect for each use of the requester
- until they are cleared or modified by passing the same tag with a
- new value.
-
-
- TAGS
- Tags used for the requester (they look remarkable similar to the
- screen mode requester in asl, don't they? ;-) )
-
- AHIR_Window (struct Window *) - Parent window of requester. If no
- AHIR_Screen tag is specified, the window structure is used to
- determine on which screen to open the requesting window.
-
- AHIR_PubScreenName (STRPTR) - Name of a public screen to open on.
- This overrides the screen used by AHIR_Window.
-
- AHIR_Screen (struct Screen *) - Screen on which to open the
- requester. This overrides the screen used by AHIR_Window or by
- AHIR_PubScreenName.
-
- AHIR_PrivateIDCMP (BOOL) - When set to TRUE, this tells AHI to
- allocate a new IDCMP port for the requesting window. If not
- specified or set to FALSE, and if AHIR_Window is provided, the
- requesting window will share AHIR_Window's IDCMP port.
-
- AHIR_IntuiMsgFunc (struct Hook *) - A function to call whenever an
- unknown Intuition message arrives at the message port being used
- by the requesting window. The function receives the following
- parameters:
- A0 - (struct Hook *)
- A1 - (struct IntuiMessage *)
- A2 - (struct AHIAudioModeRequester *)
-
- AHIR_SleepWindow (BOOL) - When set to TRUE, this tag will cause the
- window specified by AHIR_Window to be "put to sleep". That is, a
- busy pointer will be displayed in the parent window, and no
- gadget or menu activity will be allowed. This is done by opening
- an invisible Intuition Requester in the parent window.
-
- AHIR_UserData (APTR) - A 32-bit value that is simply copied in the
- ahiam_UserData field of the requester structure.
-
- AHIR_TextAttr (struct TextAttr *) - Font to be used for the
- requesting window's gadgets and menus. If this tag is not
- provided or its value is NULL, the default font of the screen
- on which the requesting window opens will be used. This font
- must already be in memory as AHI calls OpenFont() and not
- OpenDiskFont().
-
- AHIR_Locale (struct Locale *) - Locale to use for the requesting
- window. This determines the language used for the requester's
- gadgets and menus. If this tag is not provided or its value is
- NULL, the system's current default locale will be used.
- This tag does not work yet.
-
- AHIR_TitleText (STRPTR) - Title to use for the requesting window.
- Default is no title.
-
- AHIR_PositiveText (STRPTR) - Label of the positive gadget in the
- requester. English default is "OK".
-
- AHIR_NegativeText (STRPTR) - Label of the negative gadget in the
- requester. English default is "Cancel".
-
- AHIR_InitialLeftEdge (WORD) - Suggested left edge of requesting
- window.
-
- AHIR_InitialTopEdge (WORD) - Suggested top edge of requesting
- window.
-
- AHIR_InitialWidth (WORD) - Suggested width of requesting window.
-
- AHIR_InitialHeight (WORD) - Suggested height of requesting window.
-
- AHIR_InitialAudioID (ULONG) - Initial setting of the Mode list view
- gadget (ahiam_AudioID). Default is ~0 (AHI_INVALID_ID), which
- means that no mode will be selected.
-
- AHIR_InitialMixFreq (ULONG) - Initial setting of the frequency
- slider. Default is the lowest frequency supported.
-
- AHIR_InitialInfoOpened (BOOL) - Whether to open the property
- information window automatically. Default is FALSE.
- This tag does not work yet.
-
- AHIR_InitialInfoLeftEdge (WORD) - Initial left edge of information
- window.
- This tag does not work yet.
-
- AHIR_InitialInfoTopEdge (WORD) - Initial top edge of information
- window.
- This tag does not work yet.
-
- AHIR_DoMixFreq (BOOL) - Set this tag to TRUE to cause the requester
- to display the frequency slider gadget. Default is FALSE.
-
- AHIR_FilterFunc (struct Hook *) - A function to call for each mode
- encountered. If the function returns TRUE, the mode is included
- in the file list, otherwise it is rejected and not displayed. The
- function receives the following parameters:
- A0 - (struct Hook *)
- A1 - (ULONG) mode id
- A2 - (struct AHIAudioModeRequester *)
-
- AHIR_FilterTags (struct TagItem *) - A pointer to a tag list used to
- filter modes away, like AHIR_FilterFunc does. The tags are the
- same as AHI_BestAudioIDA() takes as arguments. See that function
- for an explanation of each tag.
-
-
- INPUTS
- requester - Requester structure allocated with
- AHI_AllocAudioRequestA(). If this parameter is NULL, this
- function will always return FALSE with a dos.library/IoErr()
- result of ERROR_NO_FREE_STORE.
- tags - Pointer to an optional tag list which may be used to control
- features of the requester.
-
-
- RESULT
- result - FALSE if the user cancelled the requester or if something
- prevented the requester from opening. If TRUE, values in the
- requester structure will be set.
-
- If the return value is FALSE, you can look at the result from the
- dos.library/IoErr() function to determine whether the requester
- was cancelled or simply failed to open. If dos.library/IoErr()
- returns 0, then the requester was cancelled, any other value
- indicates a failure to open. Current possible failure codes are
- ERROR_NO_FREE_STORE which indicates there was not enough memory,
- and ERROR_NO_MORE_ENTRIES which indicates no modes were available
- (usually because the application filter hook filtered them all
- away).
-
-
- EXAMPLE
-
-
- NOTES
- The requester data structure is READ-ONLY and can only be modified
- by using tags!
-
-
- BUGS
- AHIR_Locale and the information window is not inplemented.
-
-
- SEE ALSO
- AHI_AllocAudioRequestA(), AHI_FreeAudioRequest()
-
-
-
-
- ahi.device/AHI_BestAudioIDA
-
- NAME
- AHI_BestAudioIDA -- calculate the best ModeID with given parameters
- AHI_BestAudioID -- varargs stub for AHI_BestAudioIDA()
-
-
- SYNOPSIS
- ID = AHI_BestAudioIDA( tags );
- D0 A1
-
- ULONG AHI_BestAudioIDA( struct TagItem * );
-
- ID = AHI_BestAudioID( tag1, ... );
-
- ULONG AHI_BestAudioID( Tag, ... );
-
-
- FUNCTION
- Determines the best AudioID to fit the parameters set in the tag
- list.
-
-
- INPUTS
- tags - A pointer to a tag list. Only the tags present matter.
-
-
- TAGS
- Many combinations are probably stupid to ask for, like not supporting
- panning or recording.
-
- AHIDB_AudioID (ULONG) - The mode must use the same audio hardware
- as this mode does.
-
- AHIDB_Volume (BOOL) - If TRUE: mode must support volume changes.
- If FALSE: mode must not support volume changes.
-
- AHIDB_Stereo (BOOL) - If TRUE: mode must have stereo output.
- If FALSE: mode must not have stereo output (=mono).
-
- AHIDB_Panning (BOOL) - If TRUE: mode must support volume panning.
- If FALSE: mode must not support volume panning.
-
- AHIDB_HiFi (BOOL) - If TRUE: mode must have HiFi output.
- If FALSE: mode must not have HiFi output.
-
- AHIDB_PingPong (BOOL) - If TRUE: mode must support playing samples
- backwards. If FALSE: mode must not support playing samples
- backwards.
-
- AHIDB_Record (BOOL) - If TRUE: mode must support recording. If FALSE:
- mode must not support recording.
-
- AHIDB_Realtime (BOOL) - If TRUE: mode must be realtime. If FALSE:
- take a wild guess.
-
- AHIDB_FullDuplex (BOOL) - If TRUE: mode must be able to record and
- play at the same time.
-
- AHIDB_Bits (UBYTE) - Mode must have greater or equal number of bits.
-
- AHIDB_MaxChannels (UWORD) - Mode must have greater or equal number
- of channels.
-
- AHIDB_MinMixFreq (ULONG) - Lowest mixing frequency supported must be
- less or equal.
-
- AHIDB_MaxMixFreq (ULONG) - Highest mixing frequency must be greater
- or equal.
-
-
- RESULT
- ID - The best AudioID to use or AHI_INVALID_ID if none of the modes
- in the audio database could meet the requirements.
-
-
- EXAMPLE
-
-
- NOTES
-
-
- BUGS
-
-
- SEE ALSO
- AHI_NextAudioID(), AHI_GetAudioAttrsA()
-
-
-
-
- ahi.device/AHI_ControlAudioA
-
- NAME
- AHI_ControlAudioA -- change audio attributes
- AHI_ControlAudio -- varargs stub for AHI_ControlAudioA()
-
-
- SYNOPSIS
- error = AHI_ControlAudioA( audioctrl, tags );
- D0 A2 A1
-
- ULONG AHI_ControlAudioA( struct AHIAudioCtrl *, struct TagItem * );
-
- error = AHI_ControlAudio( AudioCtrl, tag1, ...);
-
- ULONG AHI_ControlAudio( struct AHIAudioCtrl *, Tag, ... );
-
-
- FUNCTION
- This function should be used to change attributes for a given
- AHIAudioCtrl structure. It is also used to start and stop playback,
- and to control special hardware found on some sound cards.
-
-
- INPUTS
- audioctrl - A pointer to an AHIAudioCtrl structure.
- tags - A pointer to a tag list.
-
-
- TAGS
- AHIC_Play (BOOL) - Starts (TRUE) and stops (FALSE) playback and
- PlayerFunc.
-
- AHIC_Record (BOOL) - Starts (TRUE) and stops (FALSE) sampling and
- RecordFunc. NOTE: If the audio hardware cannot record at the same
- time as playing samples, the PLAYBACK WILL BE STOPPED.
-
- AHIC_MonitorVolume (Fixed) - Sets the input monitor volume, i.e. how
- much of the input signal is mixed with the output signal while
- recording. Use AHI_GetAudioAttrsA() to find the available range.
- The default is muted, i.e. 0.0.
-
- AHIC_MonitorVolume_Query (Fixed *) - Get the current input monitor
- volume. ti_Data is a pointer to a Fixed variable, where the result
- will be stored.
-
- AHIC_MixFreq_Query (ULONG *) - Get the current mixing frequency.
- ti_Data is a pointer to an ULONG variable, where the result will
- be stored.
-
- AHIC_InputGain (Fixed) - Set the input gain. Use AHI_GetAudioAttrsA()
- to find the available range. Default is no gain, i.e. 1.0. (V2)
-
- AHIC_InputGain_Query (Fixed *) - Get current input gain. (V2)
-
- AHIC_OutputVolume (Fixed) - Set the output volume. Use
- AHI_GetAudioAttrsA() to find the available range. Default is full
- volume, i.e. 1.0. (V2)
-
- AHIC_OutputVolume_Query (Fixed *) - Get current output volume. (V2)
-
- AHIC_Input (ULONG) - Select input source. See AHI_GetAudioAttrsA().
- (V2)
-
- AHIC_Input_Query (ULONG *) - Get current input source. (V2)
-
- AHIC_Output (ULONG) - Select destination for output. See
- AHI_GetAudioAttrsA(). (V2)
-
- AHIC_Output_Query (ULONG *) - Get destination for output. (V2)
-
- The following tags are also recognized by AHI_ControlAudioA(). See
- AHI_AllocAudioA() for what they do. They may be used from interrupts.
-
- AHIA_SoundFunc (struct Hook *)
- AHIA_PlayerFunc (struct Hook *)
- AHIA_PlayerFreq (ULONG)
- AHIA_RecordFunc (struct Hook *)
- AHIA_UserData (APTR)
-
- Note that AHIA_PlayerFreq must never be outside the limits specified
- with AHIA_MinPlayerFreq and AHIA_MaxPlayerFreq!
-
-
- RESULT
- An error code, defined in <devices/ahi.h>.
-
-
- EXAMPLE
-
-
- NOTES
- The AHIC_Play and AHIC_Record tags *must not* be used from
- interrupts.
-
-
- BUGS
-
-
- SEE ALSO
- AHI_AllocAudioA(), AHI_GetAudioAttrsA(), <devices/ahi.h>
-
-
-
-
-
- ahi.device/AHI_FreeAudio
-
- NAME
- AHI_FreeAudio -- deallocates the audio hardware
-
-
- SYNOPSIS
- AHI_FreeAudio( audioctrl );
- A2
-
- void AHI_FreeAudio( struct AHIAudioCtrl * );
-
-
- FUNCTION
- Deallocates the AHIAudioCtrl structure and any other resources
- allocated by AHI_AllocAudioA(). After this call it must not be used
- by any other functions anymore. AHI_UnloadSound() is automatically
- called for every sound.
-
-
- INPUTS
- audioctrl - A pointer to an AHIAudioCtrl structure obtained from
- AHI_AllocAudioA(). If NULL, this function does nothing.
-
-
- EXAMPLE
-
-
- NOTES
-
-
- BUGS
-
-
- SEE ALSO
- AHI_AllocAudioA(), AHI_KillAudio(), AHI_UnloadSound()
-
-
-
-
-
- ahi.device/AHI_FreeAudioRequest
-
- NAME
- AHI_FreeAudioRequest -- frees requester resources
-
-
- SYNOPSIS
- AHI_FreeAudioRequest( requester );
- A0
-
- void AHI_FreeAudioRequest( struct AHIAudioModeRequester * );
-
-
- FUNCTION
- Frees any resources allocated by AHI_AllocAudioRequestA(). Once a
- requester has been freed, it can no longer be used with other calls to
- AHI_AudioRequestA().
-
-
- INPUTS
- requester - Requester obtained from AHI_AllocAudioRequestA(), or NULL
- in which case this function does nothing.
-
-
- RESULT
-
-
- EXAMPLE
-
-
- NOTES
-
-
- BUGS
-
-
- SEE ALSO
- AHI_AllocAudioRequestA()
-
-
-
-
- ahi.device/AHI_GetAudioAttrsA
-
- NAME
- AHI_GetAudioAttrsA -- examine an audio mode via a tag list
- AHI_GetAudioAttrs -- varargs stub for AHI_GetAudioAttrsA()
-
-
- SYNOPSIS
- success = AHI_GetAudioAttrsA( ID, [audioctrl], tags );
- D0 D0 A2 A1
-
- BOOL AHI_GetAudioAttrsA( ULONG, struct AHIAudioCtrl *,
- struct TagItem * );
-
- success = AHI_GetAudioAttrs( ID, [audioctrl], attr1, &result1, ...);
-
- BOOL AHI_GetAudioAttrs( ULONG, struct AHIAudioCtrl *, Tag, ... );
-
-
- FUNCTION
- Retrieve information about an audio mode specified by ID or audioctrl
- according to the tags in the tag list. For each entry in the tag
- list, ti_Tag identifies the attribute, and ti_Data is mostly a
- pointer to a LONG (4 bytes) variable where you wish the result to be
- stored.
-
-
- INPUTS
- ID - An audio mode identifier or AHI_INVALID_ID.
- audioctrl - A pointer to an AHIAudioCtrl structure, only used if
- ID equals AHI_INVALID_ID. Set to NULL if not used. If set to
- NULL when used, this function returns immediately.
- tags - A pointer to a tag list.
-
-
- TAGS
- AHIDB_Volume (ULONG *) - TRUE if this mode supports volume changes.
-
- AHIDB_Stereo (ULONG *) - TRUE if output is in stereo. Unless
- AHIDB_Panning (see below) is TRUE, all even channels are played
- to the left and all odd to the right.
-
- AHIDB_Panning (ULONG *) - TRUE if this mode supports stereo panning.
-
- AHIDB_HiFi (ULONG *) - TRUE if no shortcuts, like predivision, is
- used by the mixing routines.
-
- AHIDB_PingPong (ULONG *) - TRUE if this mode can play samples backwards.
-
- AHIDB_Record (ULONG *) - TRUE if this mode can record samples.
-
- AHIDB_FullDuplex (ULONG *) - TRUE if this mode can record and play at
- the same time.
-
- AHIDB_Realtime (ULONG *) - Modes which return TRUE for this fulfils
- two criteria:
- 1) Calls to AHI_SetVol(), AHI_SetFreq() or AHI_SetSound() will be
- preformed within (about) 10 ms if called from a PlayFunc Hook.
- 2) The PlayFunc Hook will be called at the specifed frequency.
- If you don't use AHI's PlayFunc Hook, you must not use modes that
- are not realtime. (Criterium 2 is not that obvious if you consider
- a mode that renders the output to disk as a sample.)
-
- AHIDB_Bits (ULONG *) - The number of output bits (8, 12, 14, 16 etc).
-
- AHIDB_MaxChannels (ULONG *) - The maximum number of channels this mode
- can handle.
-
- AHIDB_MinMixFreq (ULONG *) - The minimum mixing frequency supported.
-
- AHIDB_MaxMixFreq (ULONG *) - The maximum mixing frequency supported.
-
- AHIDB_Frequencies (ULONG *) - The number of different sample rates
- available.
-
- AHIDB_FrequencyArg (ULONG) - Specifies which frequency
- AHIDB_Frequency should return (see below). Range is 0 to
- AHIDB_Frequencies-1 (including).
- NOTE: ti_Data is NOT a pointer, but an ULONG.
-
- AHIDB_Frequency (ULONG *) - Return the frequency associated with the
- index number specified with AHIDB_FrequencyArg (see above).
-
- AHIDB_IndexArg (ULONG) - AHIDB_Index will return the index which
- gives the closest frequency to AHIDB_IndexArg
- NOTE: ti_Data is NOT a pointer, but an ULONG.
-
- AHIDB_Index (ULONG *) - Return the index associated with the frequency
- specified with AHIDB_IndexArg (see above).
-
- AHIDB_MaxPlaySamples (ULONG *) - Return the lowest number of sample
- frames that must be present in memory when AHIST_DYNAMICSAMPLE
- sounds are used. This number must then be scaled by Fs/Fm, where
- Fs is the frequency of the sound and Fm is the mixing frequency.
-
- AHIDB_MaxRecordSamples (ULONG *) - Return the number of sample frames
- you will recieve each time the RecordFunc is called.
-
- AHIDB_BufferLen (ULONG) - Specifies how many characters will be
- copyed when requesting text attributes. Default is 0, which
- means that AHIDB_Driver, AHIDB_Name, AHIDB_Author,
- AHIDB_Copyright, AHIDB_Version and AHIDB_Annotation,
- AHIDB_Input and AHIDB_Output will do nothing.
-
- AHIDB_Driver (STRPTR) - Name of driver (excluding path and
- extention).
- NOTE: ti_Data is a pointer to an UBYTE array where the name
- will be stored. See AHIDB_BufferLen.
-
- AHIDB_Name (STRPTR) - Human readable name of this mode.
- NOTE: ti_Data is a pointer to an UBYTE array where the name
- will be stored. See AHIDB_BufferLen.
-
- AHIDB_Author (STRPTR) - Name of driver author.
- NOTE: ti_Data is a pointer to an UBYTE array where the name
- will be stored. See AHIDB_BufferLen.
-
- AHIDB_Copyright (STRPTR) - Driver copyright notice.
- NOTE: ti_Data is a pointer to an UBYTE array where the name
- will be stored. See AHIDB_BufferLen
-
- AHIDB_Version (STRPTR) - Driver version string.
- NOTE: ti_Data is a pointer to an UBYTE array where the name
- will be stored. See AHIDB_BufferLen.
-
- AHIDB_Annotation (STRPTR) - Annotation by driver author.
- NOTE: ti_Data is a pointer to an UBYTE array where the name
- will be stored. See AHIDB_BufferLen.
-
- AHIDB_MinMonitorVolume (Fixed *)
- AHIDB_MaxMonitorVolume (Fixed *) - Lower/upper limit for input
- monitor volume, see AHI_ControlAudioA(). If both are 0.0,
- the sound hardware does not have an input monitor feature.
- If both are same, but not 0.0, the hardware always sends the
- recorded sound to the outputs (at the given volume). (V2)
-
- AHIDB_MinInputGain (Fixed *)
- AHIDB_MaxInputGain (Fixed *) - Lower/upper limit for input gain,
- see AHI_ControlAudioA(). If both are same, there is no input
- gain hardware. (V2)
-
- AHIDB_MinOutputVolume (Fixed *)
- AHIDB_MaxOutputVolume (Fixed *) - Lower/upper limit for output
- volume, see AHI_ControlAudioA(). If both are same, the sound
- card does not have volume control. (V2)
-
- AHIDB_Inputs (ULONG *) - The number of inputs the sound card has.
- (V2)
-
- AHIDB_InputArg (ULONG) - Specifies what AHIDB_Input should return
- (see below). Range is 0 to AHIDB_Inputs-1 (including).
- NOTE: ti_Data is NOT a pointer, but an ULONG. (V2)
-
- AHIDB_Input (STRPTR) - Gives a human readable string describing the
- input associated with the index specified with AHIDB_InputArg
- (see above). See AHI_ControlAudioA() for how to select one.
- NOTE: ti_Data is a pointer to an UBYTE array where the name
- will be stored. See AHIDB_BufferLen. (V2)
-
- AHIDB_Outputs (ULONG *) - The number of outputs the sound card
- has. (V2)
-
- AHIDB_OutputArg (ULONG) - Specifies what AHIDB_Output should return
- (see below). Range is 0 to AHIDB_Outputs-1 (including)
- NOTE: ti_Data is NOT a pointer, but an ULONG. (V2)
-
- AHIDB_Output (STRPTR) - Gives a human readable string describing the
- output associated with the index specified with AHIDB_OutputArg
- (see above). See AHI_ControlAudioA() for how to select one.
- NOTE: ti_Data is a pointer to an UBYTE array where the name
- will be stored. See AHIDB_BufferLen. (V2)
-
- If the requested information cannot be found, the variable will be not
- be touched.
-
-
- RESULT
- TRUE if everything went well.
-
-
- EXAMPLE
-
-
- NOTES
-
-
- BUGS
-
-
- SEE ALSO
- AHI_NextAudioID(), AHI_BestAudioIDA()
-
-
-
-
- ahi.device/AHI_LoadSound
-
- NAME
- AHI_LoadSound -- prepare a sound for playback
-
-
- SYNOPSIS
- error = AHI_LoadSound( sound, type, info, audioctrl );
- D0 D0:16 D1 A0 A2
-
- ULONG AHI_LoadSound( UWORD, ULONG, APTR, struct AHIAudioCtrl * );
-
-
- FUNCTION
- Defines an ID number for the sound and prepares it for playback.
-
-
- INPUTS
- sound - The numeric ID to be used as a reference to this sound.
- The ID is a number greater or equal to 0 and less than what you
- specified with AHIA_Sounds when you called AHI_AllocAudioA().
- type - The type of the sound. Currently four types are supported:
- AHIST_SAMPLE - array of 8 or 16 bit samples. Note that the
- portion of memory where the sample is stored must NOT be
- altered until AHI_UnloadSound() has been called! This is
- because some audio drivers may wish to upload the sample
- to local RAM, or even change format of the sample data!
-
- AHIST_DYNAMICSAMPLE - array of 8 or 16 bit samples, which can be
- updated dynamically. Typically used to play data that is
- loaded from disk or calculated realtime.
- Avoid using this sound type as much as possible; it will
- use much more CPU power than AHIST_SAMPLE on a DMA/DSP
- sound card.
-
- AHIST_INPUT - The input from your sampler (not fully functional
- yet).
-
- AHIST_LOOP - Please don't use this type. I'm trying to decide if
- I should keep the loop support or not. For now, use
- AHIA_SoundFunc (see AHI_AllocAudioA()) and handle the loops
- yourself.
-
- info - Depends on type:
- AHIST_SAMPLE - A pointer to a struct AHISampleInfo, filled with:
- ahisi_Type - Format of samples (only two supported).
- AHIST_M8S: Mono, 8 bit signed (BYTEs).
- AHIST_M8U: Mono, 8 bit unsigned (UBYTEs). Avoid using
- this type if possible!
- AHIST_M16S: Mono, 16 bit signed (WORDs).
- ahisi_Address - Address to the sample array.
- ahisi_Length - The size of the array, in samples.
- Don't even think of setting ahisi_Address to 0 and
- ahisi_Length to 0xffffffff as you can do with
- AHIST_DYNAMICSAMPLE! Very few DMA/DSP cards has 4 GB onboard
- RAM...
-
- AHIST_DYNAMICSAMPLE A pointer to a struct AHISampleInfo, filled
- as described above (AHIST_SAMPLE).
- If ahisi_Address is 0 and ahisi_Length is 0xffffffff
- AHI_SetSound() can take the real address of an 8 bit sample
- to be played as offset argument. Unfortunately, this does not
- work for 16 bit samples.
-
- AHIST_INPUT - Allways set info to NULL.
- Note that AHI_SetFreq() may only be called with AHI_MIXFREQ
- for this sample type.
-
- AHIST_LOOP - Temporary (?) removed.
-
- audioctrl - A pointer to an AHIAudioCtrl structure.
-
-
- RESULT
- An error code, defined in <devices/ahi.h>.
-
-
- EXAMPLE
-
-
- NOTES
- There is no need to place a sample array in Chip memory.
- SoundFunc will be called in the same manner as Paula interrups
- occur; when the device has updated its internal variables and can
- accept new commands. Note that SoundFunc will be called for every
- loop played in a multi-loop sound.
-
-
- BUGS
- AHIST_INPUT does not fully work yet.
-
-
- SEE ALSO
- AHI_UnloadSound(), AHI_SetEffect(), AHI_SetFreq(), AHI_SetSound(),
- AHI_SetVol(), <devices/ahi.h>
-
-
-
-
- ahi.device/AHI_NextAudioID
-
- NAME
- AHI_NextAudioID -- iterate current audio mode identifiers
-
-
- SYNOPSIS
- next_ID = AHI_NextAudioID( last_ID );
- D0 D0
-
- ULONG AHI_NextAudioID( ULONG );
-
-
- FUNCTION
- This function is used to itereate through all current AudioIDs in
- the audio database.
-
-
- INPUTS
- last_ID - previous AudioID or AHI_INVALID_ID if beginning iteration.
-
-
- RESULT
- next_ID - subsequent AudioID or AHI_INVALID_ID if no more IDs.
-
-
- EXAMPLE
-
-
- NOTES
-
-
- BUGS
-
-
- SEE ALSO
- AHI_GetAudioAttrsA(), AHI_BestAudioIDA()
-
-
-
-
- ahi.device/AHI_SetEffect
-
- NAME
- AHI_SetEffect -- set effect
-
-
- SYNOPSIS
- AHI_SetEffect( effect, audioctrl );
- A0 A2
-
- void AHI_SetEffect( APTR, struct AHIAudioCtrl * );
-
-
- FUNCTION
- Selects an effect to be used, described by a structure.
-
-
- INPUTS
- effect - A pointer to an effect data structure, as defined in
- <devices/ahi.h>. The following effects are defined:
- AHIET_MASTERVOLUME - Changes the volume for all channels. Can
- also be used to boost volume over 100%.
- AHIET_OUTPUTBUFFER - Gives READ-ONLY access to the mixed output.
- audioctrl - A pointer to an AHIAudioCtrl structure.
-
-
- EFFECTS
- AHIET_MASTERVOLUME - Effect is a struct AHIEffMasterVolume, with
- ahiemv_Volume set to the desired volume. The range is 0 to
- (channels/hardware channel). Assume you have 4 channels in
- mono mode. The range is then 0.0 to 4.0. The range is the same
- if the mode is stereo with panning. However, assume you have 4
- channels with a stereo mode *without* panning. Then you have two
- channels to the left and two to the right => range is 0.0 - 2.0.
- Setting the volume outside the range will give an unpredictable
- result!
- Note that AHIET_MASTERVOLUME is digital master volume, which means
- that it does not affect AHIET_INPUTMONITORVOLUME at all.
-
- AHIET_OUTPUTBUFFER - Effect is a struct AHIEffOutputBuffer, with
- ahieob_Func pointing to a hook that will be called with the
- following parameters:
- A0 - (struct Hook *)
- A2 - (struct AHIAudioCtrl *)
- A1 - (struct AHIEffOutputBuffer *)
- The information you are looking for then is in ahieob_Type,
- ahieob_Buffer and ahieob_Length. Always check ahieob_Type!
- ahieob_Length is neither in bytes nor samples, but SAMPLE FRAMES.
-
- NOTE! To turn off an effect, call again with ahie_Effect OR:ed
- with AHIET_CANCEL. For example, it is NOT correct to disable
- the AHIET_MASTERVOLUME effect by setting ahiemv_Volume to 1.0!
-
-
- RESULT
-
-
- EXAMPLE
-
-
- NOTES
-
-
- BUGS
-
-
- SEE ALSO
- AHI_SetFreq(), AHI_SetSound(), AHI_SetVol(), AHI_LoadSound(),
- <devices/ahi.h>
-
-
-
-
- ahi.device/AHI_SetFreq
-
- NAME
- AHI_SetFreq -- set frequency for a channel
-
-
- SYNOPSIS
- AHI_SetFreq( channel, freq, audioctrl, flags );
- D0:16 D1 A2 D2
-
- void AHI_SetFreq( UWORD, ULONG, struct AHIAudioCtrl *, ULONG );
-
-
- FUNCTION
- Sets the playback frequency for a channel.
-
-
- INPUTS
- channel - The channel to set playback frequency for.
- freq - The playback frequency in Herz. Can also be AHI_MIXFREQ,
- is the current mixing frequency (only usable with AHIST_INPUT
- sounds), or 0 to temporary stop the sample (it will restart at
- the same point when its frequency changed).
- audioctrl - A pointer to an AHIAudioCtrl structure.
- flags - Only one flag is defined
- AHISB_IMM - Set this bit if this command should take effect
- immediately. If this bit is not set, the command will not
- take effect until the current sound is finished. MUST be
- set if not called from a SoundFunc.
-
-
- RESULT
-
-
- EXAMPLE
-
-
- NOTES
- It is safe to call this function from an interrupt.
-
-
- BUGS
- Freq is limited to 262143 Hz.
-
-
- SEE ALSO
- AHI_SetEffect(), AHI_SetSound(), AHI_SetVol(), AHI_LoadSound()
-
-
-
-
- ahi.device/AHI_SetSound
-
- NAME
- AHI_SetSound -- set what sound to play for a channel
-
-
- SYNOPSIS
- AHI_SetSound( channel, sound, offset, length, audioctrl, flags );
- D0:16 D1:16 D2 D3 A2 D4
-
- void AHI_SetSound( UWORD, UWORD, ULONG, LONG,
- struct AHIAudioCtrl *, ULONG );
-
-
- FUNCTION
- Sets a sound to be played on a channel.
-
-
- INPUTS
- channel - The channel to set sound for.
- sound - Sound to be played, or AHI_NOSOUND to turn the channel off.
- offset - Only available if the sound type is AHIST_SAMPLE or
- AHIST_DYNAMICSAMPLE. Must be 0 otherwise.
- Specifies an offset (in samples) where the playback will begin.
- If you wish to play the whole sound, set offset to 0.
- length - Only available if the sound type is AHIST_SAMPLE or
- AHIST_DYNAMICSAMPLE. Must be 0 otherwise.
- Specifies how many samples that should be played. If you
- wish to play the whole sound forwards, set offset to 0 and length
- to either 0 or the length of the sample array. You may not set
- length to 0 if offset is not 0! To play a sound backwards, just
- set length to a negative number.
- audioctrl - A pointer to an AHIAudioCtrl structure.
- flags - Only one flag is defined
- AHISB_IMM - Set this bit if this command should take effect
- immediately. If this bit is not set, the command will not
- take effect until the current sound is finished. MUST be
- set if not called from a SoundFunc.
-
-
- RESULT
-
-
- EXAMPLE
-
-
- NOTES
- It is safe to call this function from an interrupt.
- If offset or length is not zero, make sure you do not exceed the
- sample limits.
-
-
- BUGS
-
-
- SEE ALSO
- AHI_SetEffect(), AHI_SetFreq(), AHI_SetVol(), AHI_LoadSound()
-
-
-
-
-
- ahi.device/AHI_SetVol
-
- NAME
- AHI_SetVol -- set volume and stereo panning for a channel
-
-
- SYNOPSIS
- AHI_SetVol( channel, volume, pan, audioctrl, flags );
- D0:16 D1 D2 A2 D3
-
- void AHI_SetVol( UWORD, Fixed, sposition, struct AHIAudioCtrl *,
- ULONG );
-
-
- FUNCTION
- Changes the volume and stereo panning for a channel.
-
-
- INPUTS
- channel - The channel to set volume for.
- volume - The desired volume. Fixed is a LONG fixed-point value with
- 16 bits to the left of the point and 16 to the right
- (typedef LONG Fixed; from IFF-8SVX docs).
- Maximum volume is 1.0 (0x10000L) and 0.0 (0x0L) will turn off
- this channel. Note: The sound will continue to play, but you
- wont hear it. To stop a sound completely, use AHI_SetSound().
- pan - The desired panning. sposition is the same as Fixed
- (typedef Fixed sposition; from IFF-8SVX.PAN docs).
- 1.0 (0x10000L) means that the sound is panned all the way to
- the right, 0.5 (0x8000L) means the sound is centered and 0.0
- (0x0L) means that the sound is panned all the way to the left.
- Try to set Pan to the 'correct' value even if you know it has no
- effect. For example, if you know you use a mono mode, set pan to
- 0.5 even if it does not matter.
- audioctrl - A pointer to an AHIAudioCtrl structure.
- flags - Only one flag is defined
- AHISB_IMM - Set this bit if this command should take effect
- immediately. If this bit is not set, the command will not
- take effect until the current sound is finished. MUST be
- set if not called from a SoundFunc.
-
-
- RESULT
-
-
- EXAMPLE
-
-
- NOTES
- It is safe to call this function from an interrupt.
-
-
- BUGS
-
-
- SEE ALSO
- AHI_SetEffect(), AHI_SetFreq(), AHI_SetSound(), AHI_LoadSound()
-
-
-
-
-
- ahi.device/AHI_UnloadSound
-
- NAME
- AHI_UnloadSound -- discard a sound
-
-
- SYNOPSIS
- AHI_UnloadSound( sound, audioctrl );
- D0:16 A2
-
- void AHI_UnloadSound( UWORD, struct AHIAudioCtrl * );
-
-
- FUNCTION
- Tells 'ahi.device' that this sound will not be used anymore.
-
-
- INPUTS
- sound - The ID of the sound to unload.
- audioctrl - A pointer to an AHIAudioCtrl structure.
-
-
- RESULT
-
-
- EXAMPLE
-
-
- NOTES
-
-
- BUGS
-
-
- SEE ALSO
- AHI_LoadSound()
-
-
-
-