If you wish to call any other function than
AHI_AllocAudioRequestA()
AHI_AudioRequestA()
AHI_BestAudioIDA()
AHI_FreeAudioRequest()
AHI_GetAudioAttrsA()
AHI_NextAudioID()
AHI_SampleFrameSize()
...you have to allocate the actual sound hardware. This is done with
AHI_AllocAudioA()
. AHI_AllocAudioA()
returns an
AHIAudioCtrl
structure, or NULL
if the hardware could not be
allocated. The AHIAudioCtrl
structure has only one public field,
ahiac_UserData
. This is unused by AHI and you may store
anything you like here.
If AHI_AllocAudioA()
fails it is important that you handle the
situation gracefully.
When you are finished playing or recording, call AHI_FreeAudio()
to
deallocate the hardware and other resources allocated by
AHI_AllocAudioA()
. AHI_FreeAudio()
also deallocates all
loaded sounds (see section Declaring Sounds).
AHI_AllocAudioA()
Tags
AHI_AllocAudioA()
takes several tags as input.
AHIA_AudioID
AHI_DEFAULT_ID
, which is the user's default fallback ID.
In most cases you should ask the user for an ID code (with
AHI_AudioRequestA()
) and then store the value in your settings file.
AHIA_MixFreq
AHI_GetAudioAttrsA()
. If omitted or
AHI_DEFAULT_FREQ
, the user's preferred fallback frequency will be
used. In most cases you should ask the user for a frequency (with
AHI_AudioRequestA()
) and then store the value in your settings file.
AHIA_Channels
AHIA_Sounds
AHIA_SoundFunc
AHISoundMessage
structure as message.
AHISoundMessage->ahism_Channel
indicates which channel the sound
that caused the hook to be called is played on.
AHIA_PlayerFunc
AHI_GetAudioAttrsA()
in the autodocs,
the AHIDB_Realtime
tag).
AHIA_PlayerFreq
PlayerFunc
will be called. This must be specified if
AHIA_PlayerFunc
is! It is suggested that you keep the frequency
below 100-200 Hz. Since the frequency is a fixpoint number
AHIA_PlayerFreq
should be less than 13107200 (that's 200 Hz).
AHIA_MinPlayerFreq
AHIA_PlayerFreq
) you will use. You should
always supply this if you are using the device's interrupt feature!
AHIA_MaxPlayerFreq
AHIA_PlayerFreq
) you will use. You should
always supply this if you are using the device's interrupt feature!
AHIA_RecordFunc
AHI_ControlAudioA()
). It is important that you always check the
format of the sampled data, and ignore it if you can't parse it. Since
this hook may be called from an interrupt, it is not legal to directly
Write()
the buffer to disk. To record directly to harddisk you
have to copy the samples to another buffer and signal a process to save it.
To find out the required size of the buffer, see
AHI_GetAudioAttrsA()
in the autodocs, the
AHIDB_MaxRecordSamples
tag.
AHIA_UserData
ahiac_UserData
field. You do not have
to use this tag to change ahiac_UserData
, you may write to it
directly.
Go to the first, previous, next, last section, table of contents.