Copyright (c) Hyperion Entertainment and contributors.
Difference between revisions of "AHI Device"
Line 33: | Line 33: | ||
== Device Interface == |
== Device Interface == |
||
+ | <syntaxhighlight> |
||
+ | struct AHIRequest |
||
+ | { |
||
+ | struct IOStdReq ahir_Std; /* Standard IO request */ |
||
+ | UWORD ahir_Version; /* Needed version */ |
||
+ | UWORD ahir_Pad1; |
||
+ | ULONG ahir_Private[2]; /* Hands off! */ |
||
+ | ULONG ahir_Type; /* Sample format */ |
||
+ | ULONG ahir_Frequency; /* Sample/Record frequency */ |
||
+ | Fixed ahir_Volume; /* Sample volume */ |
||
+ | Fixed ahir_Position; /* Stereo position */ |
||
+ | struct AHIRequest *ahir_Link; /* For double buffering */ |
||
+ | }; |
||
+ | </syntaxhighlight> |
||
=== Opening the AHI Device === |
=== Opening the AHI Device === |
||
=== Reading from the AHI Device === |
=== Reading from the AHI Device === |
||
=== Writing to the AHI Device === |
=== Writing to the AHI Device === |
||
=== Closing the AHI Device === |
=== Closing the AHI Device === |
||
+ | |||
== Function Interface == |
== Function Interface == |
||
=== Opening the AHI Device for Low-level Access === |
=== Opening the AHI Device for Low-level Access === |
Revision as of 20:33, 16 March 2017
Contents
About AHI
AHI is a retargetable audio subsystem which provides standardized operating system support for wide range of audio hardware. AHI offers improved functionality not available through the AmigaOS audio device driver, such as seamless audio playback from a user selected audio device, standardized functionality for audio recording and efficient software mixing routines for combining multiple sound channels.
Definitions
Terms used in the following discussions may be unfamiliar. Some of the more important ones are defined below.
- Sample
- A sample is one binary number, representing the amplitude at a fixed point in time. A sample is often stored as an 8 bit signed integer, a 16 bit signed integer, a 32 bit floating point number etc. AHI supports only integers.
- Sample frame
- In mono environment, a sample frame is the same as a sample. In stereo environment, a sample frame is a tuple of two samples. The first member is for the left channel and the second member is for the right channel.
- Sound
Many sample frames stored in sequence as an array can be called a sound. A sound is, however, not limited to being formed by samples. It can also be parameters to an analog synth or a MIDI instrument, or be white noise. AHI supports only sounds formed by samples.
AHI Device
AHI device has two APIs: a library-like function interface for low-level access and device interface for high-level access.
AHI Device Commands and Functions
Command | Command Operation |
---|---|
CMD_FLUSH | Abort all current requests, both active and waiting, even other programs requests! |
CMD_READ | Read raw samples from audio input. |
CMD_RESET | Restore device to a known state. |
CMD_START | Start device processing (like ^Q). |
CMD_STOP | Stop device processing (like ^S). |
CMD_WRITE | Write raw samples to audio output. |
NSCMD_DEVICEQUERY | Query the device for its capabilities. |
Device Interface
struct AHIRequest { struct IOStdReq ahir_Std; /* Standard IO request */ UWORD ahir_Version; /* Needed version */ UWORD ahir_Pad1; ULONG ahir_Private[2]; /* Hands off! */ ULONG ahir_Type; /* Sample format */ ULONG ahir_Frequency; /* Sample/Record frequency */ Fixed ahir_Volume; /* Sample volume */ Fixed ahir_Position; /* Stereo position */ struct AHIRequest *ahir_Link; /* For double buffering */ };