3 <!-- This HTML file has been created by texi2html 1.51
4 from ahidev.texinfo on 27 December 2000 -->
6 <TITLE>Ahi Developers's Guide
</TITLE>
10 <H2>Hardware independent audio for Amiga
</H2>
11 <H2>AHI Developer's Guide for AHI release
</H2>
12 <H2>Document version
</H2>
13 <ADDRESS>Martin 'Leviticus' Blom
</ADDRESS>
16 <H1>Table of Contents
</H1>
18 <LI><A NAME=
"TOC1" HREF=
"ahidev.html#SEC1">Overview
</A>
19 <LI><A NAME=
"TOC2" HREF=
"ahidev.html#SEC2">Distribution
</A>
20 <LI><A NAME=
"TOC3" HREF=
"ahidev.html#SEC3">The Author
</A>
21 <LI><A NAME=
"TOC4" HREF=
"ahidev.html#SEC4">Definitions
</A>
22 <LI><A NAME=
"TOC5" HREF=
"ahidev.html#SEC5">Function Interface
</A>
24 <LI><A NAME=
"TOC6" HREF=
"ahidev.html#SEC6">Guidelines
</A>
26 <LI><A NAME=
"TOC7" HREF=
"ahidev.html#SEC7">Follow The Rules
</A>
27 <LI><A NAME=
"TOC8" HREF=
"ahidev.html#SEC8">The Library Base
</A>
28 <LI><A NAME=
"TOC9" HREF=
"ahidev.html#SEC9">The Audio Database
</A>
29 <LI><A NAME=
"TOC10" HREF=
"ahidev.html#SEC10">User Hooks
</A>
30 <LI><A NAME=
"TOC11" HREF=
"ahidev.html#SEC11">Function Calls From Other Tasks, Interrupts Or User Hooks
</A>
31 <LI><A NAME=
"TOC12" HREF=
"ahidev.html#SEC12">Multitasking
</A>
33 <LI><A NAME=
"TOC13" HREF=
"ahidev.html#SEC13">Opening And Closing
<CODE>ahi.device
</CODE> For Low-level Access
</A>
35 <LI><A NAME=
"TOC14" HREF=
"ahidev.html#SEC14"><CODE>Assembler
</CODE></A>
36 <LI><A NAME=
"TOC15" HREF=
"ahidev.html#SEC15"><CODE>C
</CODE></A>
38 <LI><A NAME=
"TOC16" HREF=
"ahidev.html#SEC16">Obtaining The Hardware
</A>
40 <LI><A NAME=
"TOC17" HREF=
"ahidev.html#SEC17"><CODE>AHI_AllocAudioA()
</CODE> Tags
</A>
42 <LI><A NAME=
"TOC18" HREF=
"ahidev.html#SEC18">Declaring Sounds
</A>
43 <LI><A NAME=
"TOC19" HREF=
"ahidev.html#SEC19">Making Noise
</A>
45 <LI><A NAME=
"TOC20" HREF=
"ahidev.html#SEC20">Playing A Sound
</A>
46 <LI><A NAME=
"TOC21" HREF=
"ahidev.html#SEC21">Playing One-shot Sounds And Advanced Loops
</A>
47 <LI><A NAME=
"TOC22" HREF=
"ahidev.html#SEC22">Tricks With The Volume
</A>
50 <LI><A NAME=
"TOC23" HREF=
"ahidev.html#SEC23">Device Interface
</A>
52 <LI><A NAME=
"TOC24" HREF=
"ahidev.html#SEC24">Opening And Closing
<CODE>ahi.device
</CODE> For High-level Access
</A>
53 <LI><A NAME=
"TOC25" HREF=
"ahidev.html#SEC25">Reading From The Device
</A>
55 <LI><A NAME=
"TOC26" HREF=
"ahidev.html#SEC26">Double Buffering
</A>
56 <LI><A NAME=
"TOC27" HREF=
"ahidev.html#SEC27">Distortion
</A>
58 <LI><A NAME=
"TOC28" HREF=
"ahidev.html#SEC28">Writing To The Device
</A>
60 <LI><A NAME=
"TOC29" HREF=
"ahidev.html#SEC29">Double Buffering
</A>
61 <LI><A NAME=
"TOC30" HREF=
"ahidev.html#SEC30">Distortion
</A>
62 <LI><A NAME=
"TOC31" HREF=
"ahidev.html#SEC31">Playing multiple sounds at the same time
</A>
63 <LI><A NAME=
"TOC32" HREF=
"ahidev.html#SEC32">Suggested precedences
</A>
66 <LI><A NAME=
"TOC33" HREF=
"ahidev.html#SEC33">Data Types And Structures
</A>
68 <LI><A NAME=
"TOC34" HREF=
"ahidev.html#SEC34">Data Types
</A>
70 <LI><A NAME=
"TOC35" HREF=
"ahidev.html#SEC35"><CODE>Fixed
</CODE></A>
71 <LI><A NAME=
"TOC36" HREF=
"ahidev.html#SEC36"><CODE>sposition
</CODE></A>
73 <LI><A NAME=
"TOC37" HREF=
"ahidev.html#SEC37">Structures
</A>
75 <LI><A NAME=
"TOC38" HREF=
"ahidev.html#SEC38"><CODE>AHIUnitPrefs
</CODE> And
<CODE>AHIGlobalPrefs
</CODE></A>
78 <LI><A NAME=
"TOC39" HREF=
"ahidev.html#SEC39">GNU GENERAL PUBLIC LICENSE
</A>
80 <LI><A NAME=
"TOC40" HREF=
"ahidev.html#SEC40">Preamble
</A>
81 <LI><A NAME=
"TOC41" HREF=
"ahidev.html#SEC41">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
</A>
82 <LI><A NAME=
"TOC42" HREF=
"ahidev.html#SEC42">How to Apply These Terms to Your New Programs
</A>
84 <LI><A NAME=
"TOC43" HREF=
"ahidev.html#SEC43">GNU LIBRARY GENERAL PUBLIC LICENSE
</A>
86 <LI><A NAME=
"TOC44" HREF=
"ahidev.html#SEC44">Preamble
</A>
87 <LI><A NAME=
"TOC45" HREF=
"ahidev.html#SEC45">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
</A>
88 <LI><A NAME=
"TOC46" HREF=
"ahidev.html#SEC46">How to Apply These Terms to Your New Libraries
</A>
90 <LI><A NAME=
"TOC47" HREF=
"ahidev.html#SEC47">Concept Index
</A>
91 <LI><A NAME=
"TOC48" HREF=
"ahidev.html#SEC48">Data Type Index
</A>
92 <LI><A NAME=
"TOC49" HREF=
"ahidev.html#SEC49">Function Index
</A>
93 <LI><A NAME=
"TOC50" HREF=
"ahidev.html#SEC50">Variable Index
</A>
97 <H1>AHI Developer's Guide
</H1>
100 For AHI release . Document version .
104 Copyright (C)
1994-
1999 Martin Blom
108 The latest release of AHI can always be found at
109 @url{http://www.lysator.liu.se/~lcs/ahi.html}.
115 <H1><A NAME=
"SEC1" HREF=
"ahidev.html#TOC1">Overview
</A></H1>
122 This document was written in order to make it easier for developers to
123 understand and use AHI in their own productions, and write Software
128 <CODE>ahi.device
</CODE> has two different API's; one library-like function
129 interface (low-level), and one
"normal" device interface (high-level).
130 Each of them serves different purposes. The low-level interface is
131 targeting music players, games and real-time applications. The high-level
132 interface is targeting applications that just want to have a sample played,
133 play audio streams or record samples as easily as possible.
137 As with everything else, it is important that you chose the right tool for
138 the job--you'll only get frustrated otherwise.
142 Not everything about AHI is documented here; for more information, see
143 <CITE>AHI User's Guide
</CITE> and the autodocs.
149 <H1><A NAME=
"SEC2" HREF=
"ahidev.html#TOC2">Distribution
</A></H1>
161 Copyright (C)
1994-
1999 Martin Blom
165 AHI is available under a dual license. The device itself is under
166 the
"GNU Library General Public License" (see section
<A HREF=
"ahidev.html#SEC43">GNU LIBRARY GENERAL PUBLIC LICENSE
</A>), while the
167 utility programs and the
<CODE>AUDIO:
</CODE> device is covered by the
"GNU General
168 Public License" (see section
<A HREF=
"ahidev.html#SEC39">GNU GENERAL PUBLIC LICENSE
</A>).
172 If you use this software in a commercial or shareware product, please
173 consider giving the author (see section
<A HREF=
"ahidev.html#SEC3">The Author
</A>)---and preferably each one
174 of the contributors too (see
<CITE>AHI User's Guide
</CITE>)---an original or
175 registered copy or sample of your work. Should you want to distribute the
176 AHI software with your own product, there is really nothing to
183 <H1><A NAME=
"SEC3" HREF=
"ahidev.html#TOC3">The Author
</A></H1>
191 The author can be reached at the following addresses:
198 @email{martin@blom.org}
203 <BR>Alsättersgatan
15A:
24
204 <BR>SE-
584 35 Linköping
209 @url{http://martin.blom.org}
215 <H1><A NAME=
"SEC4" HREF=
"ahidev.html#TOC4">Definitions
</A></H1>
222 Following are some general definitions of terms that are used in this
228 <DT><STRONG>Sample
</STRONG>
232 A sample is one binary number, representing the amplitude at a fixed point
233 in time. A sample is often stored as an
8 bit signed integer, a
16 bit
234 signed integer, a
32 bit floating point number etc. AHI only
239 <DT><STRONG>Sample frame
</STRONG>
241 In mono environments, a sample frame is the same as a sample. In stereo
242 environments, a sample frame is a tuple of two samples. The first member
243 is for the left channel, the second for the right.
247 <DT><STRONG>Sound
</STRONG>
249 Many sample frames stored in sequence as an array can be called a sound. A
250 sound is, however, not limited to being formed by samples, it can also be
251 parameters to an analog synth or a MIDI instrument, or be white noise.
252 AHI only supports sounds formed by samples.
258 <H1><A NAME=
"SEC5" HREF=
"ahidev.html#TOC5">Function Interface
</A></H1>
265 The device has, in addition to the usual I/O request protocol, a set of
266 functions that allows the programmer to gain full control (at least as much
267 as possible with device independence) over the audio hardware. The
268 advantages are low overhead and much more advanced control over the playing
269 sounds. The disadvantages are greater complexity and only one user per
283 If you want to play music or sound effects for a game, record in high
284 quality or want to do realtime effects, this is the API to use.
290 <H2><A NAME=
"SEC6" HREF=
"ahidev.html#TOC6">Guidelines
</A></H2>
300 <H3><A NAME=
"SEC7" HREF=
"ahidev.html#TOC7">Follow The Rules
</A></H3>
303 It's really simple. If I tell you to check return values, check sample
304 types when recording, not to trash d2-d7/a2-a6 in hooks, or not to call
305 <CODE>AHI_ControlAudio()
</CODE> with the
<CODE>AHIC_Play
</CODE> tag from interrupts or
306 hooks, you do as you are told.
312 <H3><A NAME=
"SEC8" HREF=
"ahidev.html#TOC8">The Library Base
</A></H3>
320 The
<CODE>AHIBase
</CODE> structure is private, so are the sub libraries' library
321 base structures. Don't try to be clever.
327 <H3><A NAME=
"SEC9" HREF=
"ahidev.html#TOC9">The Audio Database
</A></H3>
340 The implementation of the database is private, and may change any time.
341 <CODE>ahi.device
</CODE> provides functions access the information in the database
342 (
<CODE>AHI_NextAudioID()
</CODE>,
<CODE>AHI_GetAudioAttrsA()
</CODE> and
343 <CODE>AHI_BestAudioIDA()
</CODE>).
349 <H3><A NAME=
"SEC10" HREF=
"ahidev.html#TOC10">User Hooks
</A></H3>
356 All user hooks must follow normal register conventions, which means that
357 d2-d7 and a2-a6 must be preserved. They may be called from an interrupt,
358 but you cannot count on that; it can be your own process or another
359 process. Don't assume the system is in single-thread mode. Never spend
360 much time in a hook, get the work done as quick as possible and then
367 <H3><A NAME=
"SEC11" HREF=
"ahidev.html#TOC11">Function Calls From Other Tasks, Interrupts Or User Hooks
</A></H3>
370 The
<CODE>AHIAudioCtrl
</CODE> structure may not be shared with other
371 tasks/threads. The task that called
<CODE>AHI_AllocAudioA()
</CODE> must do all
372 other calls too (except those callable from interrupts).
376 Only calls specifically said to be callable from interrupts may be called
377 from user hooks or interrupts. Note that
<CODE>AHI_ControlAudioA()
</CODE> has
378 some tags that must not be present when called from an interrupt.
384 <H3><A NAME=
"SEC12" HREF=
"ahidev.html#TOC12">Multitasking
</A></H3>
391 Most audio drivers need multitasking to be turned on to function properly.
392 Don't turn it off while using the device.
398 <H2><A NAME=
"SEC13" HREF=
"ahidev.html#TOC13">Opening And Closing
<CODE>ahi.device
</CODE> For Low-level Access
</A></H2>
401 Not too hard. Just open
<CODE>ahi.device
</CODE> unit
<CODE>AHI_NO_UNIT
</CODE> and
402 initialize
<CODE>AHIBase
</CODE>. After that you can access all the functions of
403 the device just as if you had opened a standard shared library.
409 <H3><A NAME=
"SEC14" HREF=
"ahidev.html#TOC14"><CODE>Assembler
</CODE></A></H3>
412 For the assembler programmer there are two handy macros:
<CODE>OPENAHI
</CODE>
413 and
<CODE>CLOSEAHI
</CODE>. Here is a small example how to use them:
418 OPENAHI
4 ;Open at least version
4.
423 ; AHI's functions can now be called as normal library functions:
424 move.l _AHIBase(pc),a6
425 moveq #AHI_INVALID_ID,d0
426 jsr _LVOAHI_NextAudioID(a6)
434 Note that you
<STRONG>have
</STRONG> to execute the
<CODE>CLOSEAHI
</CODE> macro even if
435 <CODE>OPENAHI
</CODE> failed!
441 <H3><A NAME=
"SEC15" HREF=
"ahidev.html#TOC15"><CODE>C
</CODE></A></H3>
444 For the C programmer, here is how it should be done:
450 struct Library *AHIBase;
451 struct MsgPort *AHImp=NULL;
452 struct AHIRequest *AHIio=NULL;
455 if(AHImp = CreateMsgPort())
457 if(AHIio = (struct AHIRequest *) CreateIORequest(
458 AHImp, sizeof(struct AHIRequest)))
460 AHIio-
>ahir_Version =
4; /* Open at least version
4. */
461 if(!(AHIDevice = OpenDevice(AHINAME, AHI_NO_UNIT,
462 (struct IORequest *) AHIio, NULL)))
464 AHIBase = (struct Library *) AHIio-
>ahir_Std.io_Device;
466 // AHI's functions can now be called as normal library functions:
467 AHI_NextAudioID(AHI_INVALID_ID);
469 CloseDevice((struct IORequest *) AHIio);
472 DeleteIORequest((struct IORequest *) AHIio);
475 DeleteMsgPort(AHImp);
482 <H2><A NAME=
"SEC16" HREF=
"ahidev.html#TOC16">Obtaining The Hardware
</A></H2>
485 If you wish to call any other function than
493 <CODE>AHI_AllocAudioRequestA()
</CODE>
497 <CODE>AHI_AudioRequestA()
</CODE>
501 <CODE>AHI_BestAudioIDA()
</CODE>
505 <CODE>AHI_FreeAudioRequest()
</CODE>
509 <CODE>AHI_GetAudioAttrsA()
</CODE>
513 <CODE>AHI_NextAudioID()
</CODE>
517 <CODE>AHI_SampleFrameSize()
</CODE>
528 ...you have to allocate the actual sound hardware. This is done with
529 <CODE>AHI_AllocAudioA()
</CODE>.
<CODE>AHI_AllocAudioA()
</CODE> returns an
530 <CODE>AHIAudioCtrl
</CODE> structure, or
<CODE>NULL
</CODE> if the hardware could not be
531 allocated. The
<CODE>AHIAudioCtrl
</CODE> structure has only one public field,
532 <CODE>ahiac_UserData
</CODE>. This is unused by AHI and you may store
533 anything you like here.
537 If
<CODE>AHI_AllocAudioA()
</CODE> fails it is important that you handle the
538 situation gracefully.
546 When you are finished playing or recording, call
<CODE>AHI_FreeAudio()
</CODE> to
547 deallocate the hardware and other resources allocated by
548 <CODE>AHI_AllocAudioA()
</CODE>.
<CODE>AHI_FreeAudio()
</CODE> also deallocates all
549 loaded sounds (see section
<A HREF=
"ahidev.html#SEC18">Declaring Sounds
</A>).
555 <H3><A NAME=
"SEC17" HREF=
"ahidev.html#TOC17"><CODE>AHI_AllocAudioA()
</CODE> Tags
</A></H3>
558 <CODE>AHI_AllocAudioA()
</CODE> takes several tags as input.
563 <DT><CODE>AHIA_AudioID
</CODE>
568 This is the audio mode to be used. You must not use any hardcoded values
569 other than
<CODE>AHI_DEFAULT_ID
</CODE>, which is the user's default fallback ID.
570 In most cases you should ask the user for an ID code (with
571 <CODE>AHI_AudioRequestA()
</CODE>) and then store the value in your settings file.
575 <DT><CODE>AHIA_MixFreq
</CODE>
578 This is the mixing frequency to be used. The actual frequency will be
579 rounded to the nearest frequency supported by the sound hardware. To find
580 the actual frequency, use
<CODE>AHI_GetAudioAttrsA()
</CODE>. If omitted or
581 <CODE>AHI_DEFAULT_FREQ
</CODE>, the user's preferred fallback frequency will be
582 used. In most cases you should ask the user for a frequency (with
583 <CODE>AHI_AudioRequestA()
</CODE>) and then store the value in your settings file.
585 <DT><CODE>AHIA_Channels
</CODE>
588 All sounds are played on a
<STRONG>channel
</STRONG>, and this tag selects how many you
589 wish to use. In general it takes more CPU power the more channels you use
590 and the volume gets lower and lower.
592 <DT><CODE>AHIA_Sounds
</CODE>
595 You must tell AHI how many different sounds you are going to play.
596 See section
<A HREF=
"ahidev.html#SEC18">Declaring Sounds
</A> for more information.
601 <DT><CODE>AHIA_SoundFunc
</CODE>
604 With this tag you tell AHI to call a hook when a sound has been
605 started. It works just like Paula's audio interrupts. The hook receives an
606 <CODE>AHISoundMessage
</CODE> structure as message.
607 <CODE>AHISoundMessage-
>ahism_Channel
</CODE> indicates which channel the sound
608 that caused the hook to be called is played on.
610 <DT><CODE>AHIA_PlayerFunc
</CODE>
613 If you are going to play a musical score, you should use this
"interrupt"
614 source instead of VBLANK or CIA timers in order to get the best result with
615 all audio drivers. If you cannot use this, you must not use any
616 "non-realtime" modes (see
<CODE>AHI_GetAudioAttrsA()
</CODE> in the autodocs,
617 the
<CODE>AHIDB_Realtime
</CODE> tag).
619 <DT><CODE>AHIA_PlayerFreq
</CODE>
622 If non-zero, it enables timing and specifies how many times per second
623 <CODE>PlayerFunc
</CODE> will be called. This must be specified if
624 <CODE>AHIA_PlayerFunc
</CODE> is! It is suggested that you keep the frequency
625 below
100-
200 Hz. Since the frequency is a fixpoint number
626 <CODE>AHIA_PlayerFreq
</CODE> should be less than
13107200 (that's
200 Hz).
628 <DT><CODE>AHIA_MinPlayerFreq
</CODE>
631 The minimum frequency (
<CODE>AHIA_PlayerFreq
</CODE>) you will use. You should
632 always supply this if you are using the device's interrupt feature!
634 <DT><CODE>AHIA_MaxPlayerFreq
</CODE>
637 The maximum frequency (
<CODE>AHIA_PlayerFreq
</CODE>) you will use. You should
638 always supply this if you are using the device's interrupt feature!
640 <DT><CODE>AHIA_RecordFunc
</CODE>
643 This hook will be called regularly when sampling is turned on (see
644 <CODE>AHI_ControlAudioA()
</CODE>). It is important that you always check the
645 format of the sampled data, and ignore it if you can't parse it. Since
646 this hook may be called from an interrupt, it is not legal to directly
647 <CODE>Write()
</CODE> the buffer to disk. To record directly to harddisk you
648 have to copy the samples to another buffer and signal a process to save it.
649 To find out the required size of the buffer, see
650 <CODE>AHI_GetAudioAttrsA()
</CODE> in the autodocs, the
651 <CODE>AHIDB_MaxRecordSamples
</CODE> tag.
655 <DT><CODE>AHIA_UserData
</CODE>
658 Can be used to initialize the
<CODE>ahiac_UserData
</CODE> field. You do not have
659 to use this tag to change
<CODE>ahiac_UserData
</CODE>, you may write to it
666 <H2><A NAME=
"SEC18" HREF=
"ahidev.html#TOC18">Declaring Sounds
</A></H2>
678 Before you can play a sample array, you must
<CODE>AHI_LoadSound()
</CODE> it.
679 Why? Because if AHI knows what kind of sounds that will be played
680 later, tables and stuff can be set up in advance. Some drivers may even
681 upload the samples to the sound cards local RAM and play all samples from
682 there, drastically reducing CPU and bus load.
686 You should
<CODE>AHI_LoadSound()
</CODE> the most important sounds first, since
687 the sound cards RAM may not be large enough to hold all your sounds.
691 <CODE>AHI_LoadSound()
</CODE> also associates each sound or sample array with a
692 number, which is later used to refer to that particular sound.
696 There are
2 types of sounds, namely
<CODE>AHIST_SAMPLE
</CODE> and
697 <CODE>AHIST_DYNAMICSAMPLE
</CODE>.
703 <DT><CODE>AHIST_SAMPLE
</CODE>
706 This is used for static samples. Most sounds that will be played are of
707 this type. Once the samples have been
"loaded", you may not alter the
708 memory where the samples are located. You may, however, read from it.
710 <DT><CODE>AHIST_DYNAMICSAMPLE
</CODE>
713 If you wish to play samples that you calculate in realtime, or load in
714 portions from disk, you must use this type. These samples will never be
715 uploaded to a sound cards local RAM, but always played from the normal
716 memory. There is a catch, however. Because of the fact that the sound is
717 mixed in chunks, you must have a certain number of samples in memory before
718 you start a sound of this type. To calculate the size of the buffer (in
719 samples), use the following formula:
723 @math{size = samples * Fs / Fm}
726 where samples is the value returned from
<CODE>AHI_GetAudioAttrsA()
</CODE> when
727 called with the
<CODE>AHIDB_MaxPlaySamples
</CODE> tag, Fs is the highest
728 frequency the sound will be played at and Fm is the actual mixing frequency
729 (
<CODE>AHI_ControlAudioA()/AHIC_MixFreq_Query
</CODE>).
734 The samples can be in one of four different formats, named
<CODE>AHIST_M8S
</CODE>,
735 <CODE>AHIST_S8S
</CODE>,
<CODE>AHIST_M16S
</CODE>, and
<CODE>AHIST_S16S
</CODE>.
740 <DT><CODE>AHIST_M8S
</CODE>
743 This is an
8 bit mono sound. Each sample frame is just one signed byte.
745 <DT><CODE>AHIST_S8S
</CODE>
748 This is an
8 bit stereo sound. Each sample frame is one signed byte representing
749 the left channel, followed by another one for the right channel.
751 <DT><CODE>AHIST_M16S
</CODE>
754 This is a
16 bit mono sound. Each sample frame is just one signed
16 bit
755 word, in big endian/network order format (most significant byte first).
757 <DT><CODE>AHIST_S16S
</CODE>
760 This is a
16 bit stereo sound. Each sample frame is one signed
16 bit
761 word, in big endian/network order format (most significant byte first)
762 representing the left channel, followed by another one for the right
772 If you know that you won't use a sound anymore, call
773 <CODE>AHI_UnloadSound()
</CODE>.
<CODE>AHI_FreeAudio()
</CODE> will also do that for you
774 for any sounds left when called.
778 There is no need to place a sample array in
<STRONG>Chip memory
</STRONG>, but it
779 <STRONG>must not
</STRONG> be swapped out! Allocate your sample memory with the
780 <CODE>MEMF_PUBLIC
</CODE> flag set. If you wish to have your samples in virtual
781 memory, you have to write a double-buffer routine that copies a chunk of
782 memory to a
<CODE>MEMF_PUBLIC
</CODE> buffer. The
<STRONG>SoundFunc
</STRONG> should signal a
783 task to do the transfer, since it may run in supervisor mode (see
784 <CODE>AHI_AllocAudioA()
</CODE>).
790 <H2><A NAME=
"SEC19" HREF=
"ahidev.html#TOC19">Making Noise
</A></H2>
798 After you have allocated the sound hardware and declared all your sounds,
799 you're ready to start playback. This is done with a call to
800 <CODE>AHI_ControlAudioA()
</CODE>, with the
<CODE>AHIC_Play
</CODE> tag set to
801 <CODE>TRUE
</CODE>. When this function returns the
<STRONG>PlayerFunc
</STRONG> (see
802 <CODE>AHI_AllocAudioA()
</CODE>) is active, and the audio driver is feeding
803 silence to the sound hardware.
808 <H3><A NAME=
"SEC20" HREF=
"ahidev.html#TOC20">Playing A Sound
</A></H3>
817 All you have to do now is to set the desired sound, it's frequency and
818 volume. This is done with
<CODE>AHI_SetSound()
</CODE>,
<CODE>AHI_SetFreq()
</CODE> and
819 <CODE>AHI_SetVol()
</CODE>. Make sure the
<CODE>AHISF_IMM
</CODE> flag is set for all
820 these function's
<VAR>flag
</VAR> argument. And don't try to modify a channel
821 that is out of range! If you have allocated
4 channels you may only modify
826 The sound will not start until both
<CODE>AHI_SetSound()
</CODE> and
827 <CODE>AHI_SetFreq()
</CODE> have been called. The sound will play even if
828 <CODE>AHI_SetVol()
</CODE> was not called, but it will play completely silent. If
829 you wish to temporary stop a sound, set its frequency to
0. When you
830 change the frequency again, the sound will continue where it was.
838 When the sound has been started it will play to the end and then repeat.
839 In order to play a one-shot sound you have use the
<CODE>AHI_PlayA()
</CODE>
840 function, or install a sound interrupt using the
<CODE>AHIA_SoundFunc
</CODE> tag
841 with
<CODE>AHI_AllocAudioA()
</CODE>. For more information about using sound
842 interrupts, see below.
846 A little note regarding
<CODE>AHI_SetSound()
</CODE>:
<VAR>Offset
</VAR> is the first
847 sample frame that will be played, both when playing backwards and forwards.
848 This means that if you call
<CODE>AHI_SetSound()
</CODE> with
<VAR>offset
</VAR> 0 and
849 <VAR>length
</VAR> 4, sample fram
0,
1,
2 and
3 will be played. If you call
850 <CODE>AHI_SetSound()
</CODE> with
<VAR>offset
</VAR> 3 and
<VAR>length
</VAR> -
4,
851 sample frame
3,
2,
1 and
0 will be played.
855 Also note that playing very short sounds will be very CPU intensive, since
856 there are many tasks that must be done each time a sound has reached its
857 end (like starting the next one, calling the
<STRONG>SoundFunc
</STRONG>, etc.).
858 Therefore, it is recommended that you
"unroll" short sounds a couple of
859 times before you play them. How many times you should unroll? Well, it
860 depends on the situation, of course, but try making the sound a thousand
861 samples long if you can. Naturally, if you need your
<STRONG>SoundFunc
</STRONG> to
862 be called, you cannot unroll.
867 <H3><A NAME=
"SEC21" HREF=
"ahidev.html#TOC21">Playing One-shot Sounds And Advanced Loops
</A></H3>
874 In version
4, some changes have been made since earlier releases.
875 One-shot sounds and sounds with only one loop segment can now be played
876 without using sample interrupts. This is possible because one of the
877 restrictions regarding the
<CODE>AHISF_IMM
</CODE> flag has been removed.
881 The
<CODE>AHISF_IMM
</CODE> flag determines if
<CODE>AHI_SetSound()
</CODE>,
882 <CODE>AHI_SetFreq()
</CODE> and
<CODE>AHI_SetVol()
</CODE> should take effect immediately
883 or when the current sound has reached its end. The rules for this flags
892 If used inside a sample interrupt (
<STRONG>SoundFunc
</STRONG>): Must be cleared.
896 If used inside a player interrupt (
<STRONG>PlayerFunc
</STRONG>): May be set or
901 If used elsewhere: Must be set.
906 What does this mean? It means that if all you want to do is to play a
907 one-shot sound from inside a
<STRONG>PlayerFunc
</STRONG>, you can do that by first
908 calling
<CODE>AHI_SetSound()
</CODE>,
<CODE>AHI_SetFreq()
</CODE> and
<CODE>AHI_SetVol()
</CODE>
909 with
<CODE>AHISF_IMM
</CODE> set, and then use
<CODE>AHI_SetSound(ch, AHI_NOSOUND,
910 0,
0, actrl,
0L)
</CODE> to stop the sound when it has reached the end. You can
911 also set one loop segment this way.
915 <CODE>AHI_PlayA()
</CODE> was added in AHI version
4, and combines
916 <CODE>AHI_SetSound()
</CODE>,
<CODE>AHI_SetFreq()
</CODE> and
<CODE>AHI_SetVol()
</CODE> into
917 one tag-based function. It also allows you to set one loop and play
922 To play a sound with more than one loop segment or ping-pong looping, a
923 sample interrupt needs to be used. AHI's
<STRONG>SoundFunc
</STRONG> works like Paula's
924 interrupts and is very easy to use.
928 The
<STRONG>SoundFunc
</STRONG> hook will be called with an
<CODE>AHIAudioCtrl
</CODE>
929 structure as object and an
<CODE>AHISoundMessage
</CODE> structure as message.
930 <CODE>ahism_Channel
</CODE> indicates which channel caused the hook to be called.
934 An example
<STRONG>SoundFunc
</STRONG> which handles the repeat part of an instrument
935 can look like this (SAS/C code):
940 __asm __saveds ULONG SoundFunc(register __a0 struct Hook *hook,
941 register __a2 struct AHIAudioCtrl *actrl,
942 register __a1 struct AHISoundMessage *chan)
944 if(ChannelDatas[chan-
>ahism_Channel].Length)
945 AHI_SetSound(chan-
>ahism_Channel,
0,
946 (ULONG) ChannelDatas[chan-
>ahism_Channel].Address,
947 ChannelDatas[chan-
>ahism_Channel].Length,
950 AHI_SetSound(chan-
>ahism_Channel, AHI_NOSOUND,
951 NULL, NULL, actrl, NULL);
957 This example is from an old version of the AHI NotePlayer for
958 <STRONG>DeliTracker
2</STRONG>.
<CODE>ChannelDatas
</CODE> is an array where the start and
959 length of the repeat part is stored. Here, a repeat length of zero
960 indicates a one-shot sound. Note that this particular example only uses
961 one sound (
0). For applications using multiple sounds, the sound number
962 would have to be stored in the array as well.
966 Once again, note that the
<CODE>AHISF_IMM
</CODE> flag should
<STRONG>never
</STRONG> be
967 set in a
<STRONG>SoundFunc
</STRONG> hook!
973 <H3><A NAME=
"SEC22" HREF=
"ahidev.html#TOC22">Tricks With The Volume
</A></H3>
980 Starting with V4,
<CODE>AHI_SetVol()
</CODE> can take both negative volume and
981 pan parameters. If you set the volume to a negative value, the sample
982 will, if the audio mode supports it, invert each sample before playing. If
983 pan is negative, the sample will be encoded to go to the surround speakers.
989 <H1><A NAME=
"SEC23" HREF=
"ahidev.html#TOC23">Device Interface
</A></H1>
1000 The I/O request protocol makes it very easy to play audio streams, sounds
1001 from disk and non time-critical sound effects in a multitasking friendly
1002 way. Recoding is just as easy, on behalf of quality. Several programs can
1003 play sounds at the same time, and even record at the same time if your
1004 hardware is full duplex.
1008 If you want to write a sample player, play (warning?) sounds in your
1009 applications, play an audio stream from a CD via the SCSI/IDE bus, write a
1010 voice command utility etc., this is the API to use.
1014 Note that while all the low-level functions (see section
<A HREF=
"ahidev.html#SEC5">Function Interface
</A>)
1015 count lengths and offsets in sample frames, the device interface--like all
1016 Amiga devices--uses bytes.
1022 <H2><A NAME=
"SEC24" HREF=
"ahidev.html#TOC24">Opening And Closing
<CODE>ahi.device
</CODE> For High-level Access
</A></H2>
1025 Four primary steps are required to open ahi.device:
1033 Create a message port using
<CODE>CreateMsgPort()
</CODE>. Reply messages from
1034 the device must be directed to a message port.
1036 <A NAME=
"IDX74"></A>
1040 Create an extended I/O request structure of type
<CODE>AHIRequest
</CODE> using
1041 <CODE>CreateIORequest()
</CODE>.
<CODE>CreateIORequest()
</CODE> will initialize the I/O
1042 request to point to your reply port.
1046 Specify which version of the device you need. The lowest supported version
1047 is
4. Version
1 and
3 are obsolete, and version
2 only has the low-level
1050 <A NAME=
"IDX75"></A>
1054 Open
<CODE>ahi.device
</CODE> unit
<CODE>AHI_DEFAULT_UNIT
</CODE> or any other unit the
1055 user has specified with, for example, a
<VAR>UNIT
</VAR> tooltype. Call
1056 <CODE>OpenDevice()
</CODE>, passing the I/O request.
1061 Each
<CODE>OpenDevice()
</CODE> must eventually be matched by a call to
1062 <CODE>CloseDevice()
</CODE>. When the last close is performed, the device will
1063 deallocate all resources.
1067 All I/O requests must be completed before
<CODE>CloseDevice()
</CODE>. Abort any
1068 pending requests with
<CODE>AbortIO()
</CODE>.
1077 struct MsgPort *AHImp = NULL;
1078 struct AHIRequest *AHIio = NULL;
1079 BYTE AHIDevice = -
1;
1080 UBYTE unit = AHI_DEFAULT_UNIT;
1082 /* Check if user wants another unit here... */
1084 if(AHImp = CreateMsgPort())
1086 if(AHIio = (struct AHIRequest *)
1087 CreateIORequest(AHImp, sizeof(struct AHIRequest)))
1089 AHIio-
>ahir_Version =
4;
1090 if(!(AHIDevice = OpenDevice(AHINAME, unit,
1091 (struct IORequest *) AHIio, NULL)))
1094 /* Send commands to the device here... */
1096 if(! CheckIO((struct IORequest *) AHIio))
1098 AbortIO((struct IORequest *) AHIio);
1101 WaitIO((struct IORequest *) AHIio);
1103 CloseDevice((struct IORequest *) AHIio);
1106 DeleteIORequest((struct IORequest *) AHIio);
1109 DeleteMsgPort(AHImp);
1116 <H2><A NAME=
"SEC25" HREF=
"ahidev.html#TOC25">Reading From The Device
</A></H2>
1119 <A NAME=
"IDX76"></A>
1120 <A NAME=
"IDX77"></A>
1124 <A NAME=
"IDX78"></A>
1125 <A NAME=
"IDX79"></A>
1126 <A NAME=
"IDX80"></A>
1127 <A NAME=
"IDX81"></A>
1128 <A NAME=
"IDX82"></A>
1129 <A NAME=
"IDX83"></A>
1130 <A NAME=
"IDX84"></A>
1131 <A NAME=
"IDX85"></A>
1135 You read from
<CODE>ahi.device
</CODE> by passing an
<CODE>AHIRequest
</CODE> to the
1136 device with
<CODE>CMD_READ
</CODE> set in
<CODE>io_Command
</CODE>, the number of bytes
1137 to be read set in
<CODE>io_Length
</CODE>, the address of the read buffer set in
1138 <CODE>io_Data
</CODE>, the desired sample format set in
<CODE>ahir_Type
</CODE> and the
1139 desired sample frequency set in
<CODE>ahir_Frequency
</CODE>. The first read
1140 command in a sequence should also have
<CODE>io_Offset
</CODE> set to
0.
1141 <CODE>io_Length
</CODE> must be an even multiple of the sample frame size.
1146 <H3><A NAME=
"SEC26" HREF=
"ahidev.html#TOC26">Double Buffering
</A></H3>
1149 <A NAME=
"IDX86"></A>
1153 To do double buffering, just fill the first buffer with
<CODE>DoIO()
</CODE> and
1154 <CODE>io_Offset
</CODE> set to
0, then start filling the second buffer with
1155 <CODE>SendIO()
</CODE> using the same I/O request (but don't clear
1156 <CODE>io_Offset
</CODE>!). After you have processed the first buffer, wait until
1157 the I/O request is finished and start over with
<CODE>SendIO()
</CODE> on the
1163 <H3><A NAME=
"SEC27" HREF=
"ahidev.html#TOC27">Distortion
</A></H3>
1166 <A NAME=
"IDX87"></A>
1170 The samples will automatically be converted to the sample format set in
1171 <CODE>ahir_Type
</CODE> and to the sample frequency set in
<CODE>ahir_Frequency
</CODE>.
1172 Because it is quite unlikely that you ask for the same sample frequency the
1173 user has chosen in the preference program, chances that the quality is
1174 lower than expected are pretty high. The worst problem is probably the
1175 anti-aliasing filter before the A/D converter. If the user has selected a
1176 higher sampling/mixing frequency than you request, the signal will be
1177 distorted according to the Nyquist sampling theorem. If, on the other
1178 hand, the user has selected a lower sampling/mixing frequency than you
1179 request, the signal will not be distorted but rather bandlimited more than
1186 <H2><A NAME=
"SEC28" HREF=
"ahidev.html#TOC28">Writing To The Device
</A></H2>
1189 <A NAME=
"IDX88"></A>
1190 <A NAME=
"IDX89"></A>
1194 <A NAME=
"IDX90"></A>
1195 <A NAME=
"IDX91"></A>
1196 <A NAME=
"IDX92"></A>
1197 <A NAME=
"IDX93"></A>
1198 <A NAME=
"IDX94"></A>
1199 <A NAME=
"IDX95"></A>
1200 <A NAME=
"IDX96"></A>
1201 <A NAME=
"IDX97"></A>
1202 <A NAME=
"IDX98"></A>
1203 <A NAME=
"IDX99"></A>
1204 <A NAME=
"IDX100"></A>
1209 You write to the device by passing an
<CODE>AHIRequest
</CODE> to the device with
1210 <CODE>CMD_WRITE
</CODE> set in
<CODE>io_Command
</CODE>, the precedence in
1211 <CODE>io_Message.mn_Node.ln_Pri
</CODE>, the number of bytes to be written in
1212 <CODE>io_Length
</CODE>, the address of the write buffer set in
<CODE>io_Data
</CODE>,
1213 the sample format set in
<CODE>ahir_Type
</CODE>, the desired sample frequency set
1214 in
<CODE>ahir_Frequency
</CODE>, the desired volume set in
<CODE>ahir_Volume
</CODE> and
1215 the desired stereo position set in
<CODE>ahir_Position
</CODE>. Unless you are
1216 doing double buffering,
<CODE>ahir_Link
</CODE> should be set to
<CODE>NULL
</CODE>.
1217 <CODE>io_Length
</CODE> must be an even multiple of the sample frame size.
1222 <H3><A NAME=
"SEC29" HREF=
"ahidev.html#TOC29">Double Buffering
</A></H3>
1225 <A NAME=
"IDX101"></A>
1229 To do double buffering, you need two I/O requests. Create the second one
1230 by making a copy of the request you used in
<CODE>OpenDevice()
</CODE>. Start the
1231 first with
<CODE>SendIO()
</CODE>. Set
<CODE>ahir_Link
</CODE> in the second request to
1232 the address of the first request, and
<CODE>SendIO()
</CODE> it. Wait on the
1233 first, fill the first buffer again and repeat, this time with
1234 <CODE>ahir_Link
</CODE> of the first buffer set to the address of the second I/O
1240 <H3><A NAME=
"SEC30" HREF=
"ahidev.html#TOC30">Distortion
</A></H3>
1243 <A NAME=
"IDX102"></A>
1247 The problems with aliasing are present but not as obvious as with reading.
1248 Just make sure your source data is bandlimited correctly, and do not play
1249 samples at a lower frequency than they were recorded.
1254 <H3><A NAME=
"SEC31" HREF=
"ahidev.html#TOC31">Playing multiple sounds at the same time
</A></H3>
1257 If you want to play several sounds at the same time, just make a new copy
1258 of the I/O request you used in
<CODE>OpenDevice()
</CODE>, and
<CODE>CMD_WRITE
</CODE>
1259 it. The user has set the number of channels available in the preference
1260 tool, and if too many requests are sent to the device the one with lowest
1261 precedence will be muted. When a request is finished, the muted request
1262 with the highest precedence will be played. Note that all muted requests
1263 continue to play silently, so the programmer will not have to worry if
1264 there are enough channels or not.
1269 <H3><A NAME=
"SEC32" HREF=
"ahidev.html#TOC32">Suggested precedences
</A></H3>
1272 <A NAME=
"IDX103"></A>
1276 The precedences to use depend on what kind of sound you are playing. The
1277 recommended precedences are the same as for
<CODE>audio.device
</CODE>, listed in
1278 <CITE>AMIGA ROM Kernel Reference manual -- Devices
</CITE>. Reprinted without
1279 permission. So sue me.
1284 Precedences | Type of sound
1285 -------------+----------------------------------------------------------
1286 127 | Unstoppable. Sounds first allocated at lower
1287 | precedencies, then set to this highest level.
1288 90 -
100 | Emergencies. Alert, urgent situation that requires
1290 80 -
90 | Annunciators. Attention, bell (CTRL-G).
1291 75 | Speech. Synthesized or recorded speech
1292 | (narrator.device).
1293 50 -
70 | Sonic cues. Sounds that provide information that is not
1294 | provided by graphics. Only the beginning of of each sound
1295 | should be at this level; the rest should ne set to sound
1297 -
50 -
50 | Music program. Musical notes in a music-oriented program.
1298 | The higher levels should be used for the attack portions
1300 -
70 - -
50 | Sound effects. Sounds used in conjunction with graphics.
1301 | More important sounds should use higher levels.
1302 -
100 - -
80 | Background. Theme music and restartable background sounds.
1303 -
128 | Silence. Lowest level (freeing the channel completely is
1308 Right. As you can see, some things do not apply to
<CODE>ahi.device
</CODE>.
1309 First, there is no way to change the precedence of a playing sound, so the
1310 precedences should be set from the beginning. Second, it is not
1311 recommended to use the device interface to play music. However, playing an
1312 audio stream from CD or disk comes very close. Third, there are no channels
1313 to free in AHI since they are dynamically allocated by the device.
1319 <H1><A NAME=
"SEC33" HREF=
"ahidev.html#TOC33">Data Types And Structures
</A></H1>
1322 <A NAME=
"IDX104"></A>
1326 In this chapter some of the data types and structures used will be
1327 explained. For more information, please consult the autodocs and the
1334 <H2><A NAME=
"SEC34" HREF=
"ahidev.html#TOC34">Data Types
</A></H2>
1337 <A NAME=
"IDX105"></A>
1342 <H3><A NAME=
"SEC35" HREF=
"ahidev.html#TOC35"><CODE>Fixed
</CODE></A></H3>
1345 <A NAME=
"IDX106"></A>
1349 <CODE>Fixed
</CODE> is a signed long integer. It is used to represent decimal
1350 numbers without using floating point arithmetics. The decimal point is
1351 assumed to be in the middle of the
32 bit integer, thus giving
16 bits for
1352 the integer part of the number and
16 bits for the fraction. The largest
1353 number that can be stored in a
<CODE>Fixed
</CODE> is +
32767.999984741, and the
1354 lowest number is -
32768.
1376 <H3><A NAME=
"SEC36" HREF=
"ahidev.html#TOC36"><CODE>sposition
</CODE></A></H3>
1379 <A NAME=
"IDX107"></A>
1383 <CODE>sposition
</CODE> (stereo position) is a
<CODE>Fixed
</CODE>, and is used to
1384 represent the stereo position of a sound.
0 is far left,
0.5 is center and
1391 <H2><A NAME=
"SEC37" HREF=
"ahidev.html#TOC37">Structures
</A></H2>
1394 <A NAME=
"IDX108"></A>
1399 <H3><A NAME=
"SEC38" HREF=
"ahidev.html#TOC38"><CODE>AHIUnitPrefs
</CODE> And
<CODE>AHIGlobalPrefs
</CODE></A></H3>
1402 <A NAME=
"IDX109"></A>
1403 <A NAME=
"IDX110"></A>
1407 These structures are used in the
<CODE>AHIU
</CODE> and
<CODE>AHIG
</CODE> chunks,
1408 respective, which are part of the settings file (
<TT>`ENV:Sys/ahi.prefs'
</TT>),
1409 The file is read by AHI on each call to
<CODE>OpenDevice()
</CODE>, just
1410 before the audio hardware is allocated.
1414 <CODE>AHIUnitPrefs
</CODE> specifies the audio mode and its parameters to use for
1415 each device unit (currently
0-
3 and
<CODE>AHI_NO_UNIT
</CODE>; unit
0 is also called
1416 <CODE>AHI_DEFAULT_UNIT
</CODE>).
1420 <CODE>AHIGlobalPrefs
</CODE> contains some global options that can be used to
1421 gain speed on slow CPUs, the global debug level and a protection against
1422 CPU overload. The debug level specifies which of the functions in AHI
1423 should print debugging information to the serial port (the output can be
1424 redirected to a console window or a file with tools like
<STRONG>Sushi
</STRONG>
1425 <A NAME=
"DOCF1" HREF=
"ahidev.html#FOOT1">(
1)
</A>.}).
1431 <H1><A NAME=
"SEC39" HREF=
"ahidev.html#TOC39">GNU GENERAL PUBLIC LICENSE
</A></H1>
1433 Version
2, June
1991
1438 Copyright (C)
1989,
1991 Free Software Foundation, Inc.
1439 59 Temple Place, Suite
330, Boston, MA
02111-
1307 USA
1441 Everyone is permitted to copy and distribute verbatim copies
1442 of this license document, but changing it is not allowed.
1447 <H2><A NAME=
"SEC40" HREF=
"ahidev.html#TOC40">Preamble
</A></H2>
1450 The licenses for most software are designed to take away your
1451 freedom to share and change it. By contrast, the GNU General Public
1452 License is intended to guarantee your freedom to share and change free
1453 software--to make sure the software is free for all its users. This
1454 General Public License applies to most of the Free Software
1455 Foundation's software and to any other program whose authors commit to
1456 using it. (Some other Free Software Foundation software is covered by
1457 the GNU Library General Public License instead.) You can apply it to
1462 When we speak of free software, we are referring to freedom, not
1463 price. Our General Public Licenses are designed to make sure that you
1464 have the freedom to distribute copies of free software (and charge for
1465 this service if you wish), that you receive source code or can get it
1466 if you want it, that you can change the software or use pieces of it
1467 in new free programs; and that you know you can do these things.
1471 To protect your rights, we need to make restrictions that forbid
1472 anyone to deny you these rights or to ask you to surrender the rights.
1473 These restrictions translate to certain responsibilities for you if you
1474 distribute copies of the software, or if you modify it.
1478 For example, if you distribute copies of such a program, whether
1479 gratis or for a fee, you must give the recipients all the rights that
1480 you have. You must make sure that they, too, receive or can get the
1481 source code. And you must show them these terms so they know their
1486 We protect your rights with two steps: (
1) copyright the software, and
1487 (
2) offer you this license which gives you legal permission to copy,
1488 distribute and/or modify the software.
1492 Also, for each author's protection and ours, we want to make certain
1493 that everyone understands that there is no warranty for this free
1494 software. If the software is modified by someone else and passed on, we
1495 want its recipients to know that what they have is not the original, so
1496 that any problems introduced by others will not reflect on the original
1497 authors' reputations.
1501 Finally, any free program is threatened constantly by software
1502 patents. We wish to avoid the danger that redistributors of a free
1503 program will individually obtain patent licenses, in effect making the
1504 program proprietary. To prevent this, we have made it clear that any
1505 patent must be licensed for everyone's free use or not licensed at all.
1509 The precise terms and conditions for copying, distribution and
1510 modification follow.
1515 <H2><A NAME=
"SEC41" HREF=
"ahidev.html#TOC41">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
</A></H2>
1521 This License applies to any program or other work which contains
1522 a notice placed by the copyright holder saying it may be distributed
1523 under the terms of this General Public License. The
"Program", below,
1524 refers to any such program or work, and a
"work based on the Program"
1525 means either the Program or any derivative work under copyright law:
1526 that is to say, a work containing the Program or a portion of it,
1527 either verbatim or with modifications and/or translated into another
1528 language. (Hereinafter, translation is included without limitation in
1529 the term
"modification".) Each licensee is addressed as
"you".
1531 Activities other than copying, distribution and modification are not
1532 covered by this License; they are outside its scope. The act of
1533 running the Program is not restricted, and the output from the Program
1534 is covered only if its contents constitute a work based on the
1535 Program (independent of having been made by running the Program).
1536 Whether that is true depends on what the Program does.
1540 You may copy and distribute verbatim copies of the Program's
1541 source code as you receive it, in any medium, provided that you
1542 conspicuously and appropriately publish on each copy an appropriate
1543 copyright notice and disclaimer of warranty; keep intact all the
1544 notices that refer to this License and to the absence of any warranty;
1545 and give any other recipients of the Program a copy of this License
1546 along with the Program.
1548 You may charge a fee for the physical act of transferring a copy, and
1549 you may at your option offer warranty protection in exchange for a fee.
1553 You may modify your copy or copies of the Program or any portion
1554 of it, thus forming a work based on the Program, and copy and
1555 distribute such modifications or work under the terms of Section
1
1556 above, provided that you also meet all of these conditions:
1562 You must cause the modified files to carry prominent notices
1563 stating that you changed the files and the date of any change.
1567 You must cause any work that you distribute or publish, that in
1568 whole or in part contains or is derived from the Program or any
1569 part thereof, to be licensed as a whole at no charge to all third
1570 parties under the terms of this License.
1574 If the modified program normally reads commands interactively
1575 when run, you must cause it, when started running for such
1576 interactive use in the most ordinary way, to print or display an
1577 announcement including an appropriate copyright notice and a
1578 notice that there is no warranty (or else, saying that you provide
1579 a warranty) and that users may redistribute the program under
1580 these conditions, and telling the user how to view a copy of this
1581 License. (Exception: if the Program itself is interactive but
1582 does not normally print such an announcement, your work based on
1583 the Program is not required to print an announcement.)
1586 These requirements apply to the modified work as a whole. If
1587 identifiable sections of that work are not derived from the Program,
1588 and can be reasonably considered independent and separate works in
1589 themselves, then this License, and its terms, do not apply to those
1590 sections when you distribute them as separate works. But when you
1591 distribute the same sections as part of a whole which is a work based
1592 on the Program, the distribution of the whole must be on the terms of
1593 this License, whose permissions for other licensees extend to the
1594 entire whole, and thus to each and every part regardless of who wrote it.
1596 Thus, it is not the intent of this section to claim rights or contest
1597 your rights to work written entirely by you; rather, the intent is to
1598 exercise the right to control the distribution of derivative or
1599 collective works based on the Program.
1601 In addition, mere aggregation of another work not based on the Program
1602 with the Program (or with a work based on the Program) on a volume of
1603 a storage or distribution medium does not bring the other work under
1604 the scope of this License.
1608 You may copy and distribute the Program (or a work based on it,
1609 under Section
2) in object code or executable form under the terms of
1610 Sections
1 and
2 above provided that you also do one of the following:
1616 Accompany it with the complete corresponding machine-readable
1617 source code, which must be distributed under the terms of Sections
1618 1 and
2 above on a medium customarily used for software interchange; or,
1622 Accompany it with a written offer, valid for at least three
1623 years, to give any third party, for a charge no more than your
1624 cost of physically performing source distribution, a complete
1625 machine-readable copy of the corresponding source code, to be
1626 distributed under the terms of Sections
1 and
2 above on a medium
1627 customarily used for software interchange; or,
1631 Accompany it with the information you received as to the offer
1632 to distribute corresponding source code. (This alternative is
1633 allowed only for noncommercial distribution and only if you
1634 received the program in object code or executable form with such
1635 an offer, in accord with Subsection b above.)
1638 The source code for a work means the preferred form of the work for
1639 making modifications to it. For an executable work, complete source
1640 code means all the source code for all modules it contains, plus any
1641 associated interface definition files, plus the scripts used to
1642 control compilation and installation of the executable. However, as a
1643 special exception, the source code distributed need not include
1644 anything that is normally distributed (in either source or binary
1645 form) with the major components (compiler, kernel, and so on) of the
1646 operating system on which the executable runs, unless that component
1647 itself accompanies the executable.
1649 If distribution of executable or object code is made by offering
1650 access to copy from a designated place, then offering equivalent
1651 access to copy the source code from the same place counts as
1652 distribution of the source code, even though third parties are not
1653 compelled to copy the source along with the object code.
1657 You may not copy, modify, sublicense, or distribute the Program
1658 except as expressly provided under this License. Any attempt
1659 otherwise to copy, modify, sublicense or distribute the Program is
1660 void, and will automatically terminate your rights under this License.
1661 However, parties who have received copies, or rights, from you under
1662 this License will not have their licenses terminated so long as such
1663 parties remain in full compliance.
1667 You are not required to accept this License, since you have not
1668 signed it. However, nothing else grants you permission to modify or
1669 distribute the Program or its derivative works. These actions are
1670 prohibited by law if you do not accept this License. Therefore, by
1671 modifying or distributing the Program (or any work based on the
1672 Program), you indicate your acceptance of this License to do so, and
1673 all its terms and conditions for copying, distributing or modifying
1674 the Program or works based on it.
1678 Each time you redistribute the Program (or any work based on the
1679 Program), the recipient automatically receives a license from the
1680 original licensor to copy, distribute or modify the Program subject to
1681 these terms and conditions. You may not impose any further
1682 restrictions on the recipients' exercise of the rights granted herein.
1683 You are not responsible for enforcing compliance by third parties to
1688 If, as a consequence of a court judgment or allegation of patent
1689 infringement or for any other reason (not limited to patent issues),
1690 conditions are imposed on you (whether by court order, agreement or
1691 otherwise) that contradict the conditions of this License, they do not
1692 excuse you from the conditions of this License. If you cannot
1693 distribute so as to satisfy simultaneously your obligations under this
1694 License and any other pertinent obligations, then as a consequence you
1695 may not distribute the Program at all. For example, if a patent
1696 license would not permit royalty-free redistribution of the Program by
1697 all those who receive copies directly or indirectly through you, then
1698 the only way you could satisfy both it and this License would be to
1699 refrain entirely from distribution of the Program.
1701 If any portion of this section is held invalid or unenforceable under
1702 any particular circumstance, the balance of the section is intended to
1703 apply and the section as a whole is intended to apply in other
1706 It is not the purpose of this section to induce you to infringe any
1707 patents or other property right claims or to contest validity of any
1708 such claims; this section has the sole purpose of protecting the
1709 integrity of the free software distribution system, which is
1710 implemented by public license practices. Many people have made
1711 generous contributions to the wide range of software distributed
1712 through that system in reliance on consistent application of that
1713 system; it is up to the author/donor to decide if he or she is willing
1714 to distribute software through any other system and a licensee cannot
1717 This section is intended to make thoroughly clear what is believed to
1718 be a consequence of the rest of this License.
1722 If the distribution and/or use of the Program is restricted in
1723 certain countries either by patents or by copyrighted interfaces, the
1724 original copyright holder who places the Program under this License
1725 may add an explicit geographical distribution limitation excluding
1726 those countries, so that distribution is permitted only in or among
1727 countries not thus excluded. In such case, this License incorporates
1728 the limitation as if written in the body of this License.
1732 The Free Software Foundation may publish revised and/or new versions
1733 of the General Public License from time to time. Such new versions will
1734 be similar in spirit to the present version, but may differ in detail to
1735 address new problems or concerns.
1737 Each version is given a distinguishing version number. If the Program
1738 specifies a version number of this License which applies to it and
"any
1739 later version", you have the option of following the terms and conditions
1740 either of that version or of any later version published by the Free
1741 Software Foundation. If the Program does not specify a version number of
1742 this License, you may choose any version ever published by the Free Software
1747 If you wish to incorporate parts of the Program into other free
1748 programs whose distribution conditions are different, write to the author
1749 to ask for permission. For software which is copyrighted by the Free
1750 Software Foundation, write to the Free Software Foundation; we sometimes
1751 make exceptions for this. Our decision will be guided by the two goals
1752 of preserving the free status of all derivatives of our free software and
1753 of promoting the sharing and reuse of software generally.
1757 <P><STRONG>NO WARRANTY
</STRONG></P>
1761 BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
1762 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
1763 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
1764 PROVIDE THE PROGRAM
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
1765 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1766 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
1767 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
1768 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
1769 REPAIR OR CORRECTION.
1773 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
1774 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
1775 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
1776 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
1777 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
1778 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
1779 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
1780 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
1781 POSSIBILITY OF SUCH DAMAGES.
1785 <H2>END OF TERMS AND CONDITIONS
</H2>
1789 <H2><A NAME=
"SEC42" HREF=
"ahidev.html#TOC42">How to Apply These Terms to Your New Programs
</A></H2>
1792 If you develop a new program, and you want it to be of the greatest
1793 possible use to the public, the best way to achieve this is to make it
1794 free software which everyone can redistribute and change under these terms.
1798 To do so, attach the following notices to the program. It is safest
1799 to attach them to the start of each source file to most effectively
1800 convey the exclusion of warranty; and each file should have at least
1801 the
"copyright" line and a pointer to where the full notice is found.
1806 <VAR>one line to give the program's name and an idea of what it does.
</VAR>
1807 Copyright (C)
19<VAR>yy
</VAR> <VAR>name of author
</VAR>
1809 This program is free software; you can redistribute it and/or
1810 modify it under the terms of the GNU General Public License
1811 as published by the Free Software Foundation; either version
2
1812 of the License, or (at your option) any later version.
1814 This program is distributed in the hope that it will be useful,
1815 but WITHOUT ANY WARRANTY; without even the implied warranty of
1816 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1817 GNU General Public License for more details.
1819 You should have received a copy of the GNU General Public License along
1820 with this program; if not, write to the Free Software Foundation, Inc.,
1821 59 Temple Place, Suite
330, Boston, MA
02111-
1307, USA.
1825 Also add information on how to contact you by electronic and paper mail.
1829 If the program is interactive, make it output a short notice like this
1830 when it starts in an interactive mode:
1835 Gnomovision version
69, Copyright (C)
19<VAR>yy
</VAR> <VAR>name of author
</VAR>
1836 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
1837 type `show w'. This is free software, and you are welcome
1838 to redistribute it under certain conditions; type `show c'
1843 The hypothetical commands
<SAMP>`show w'
</SAMP> and
<SAMP>`show c'
</SAMP> should show
1844 the appropriate parts of the General Public License. Of course, the
1845 commands you use may be called something other than
<SAMP>`show w'
</SAMP> and
1846 <SAMP>`show c'
</SAMP>; they could even be mouse-clicks or menu items--whatever
1851 You should also get your employer (if you work as a programmer) or your
1852 school, if any, to sign a
"copyright disclaimer" for the program, if
1853 necessary. Here is a sample; alter the names:
1858 Yoyodyne, Inc., hereby disclaims all copyright
1859 interest in the program `Gnomovision'
1860 (which makes passes at compilers) written
1863 <VAR>signature of Ty Coon
</VAR>,
1 April
1989
1864 Ty Coon, President of Vice
1868 This General Public License does not permit incorporating your program into
1869 proprietary programs. If your program is a subroutine library, you may
1870 consider it more useful to permit linking proprietary applications with the
1871 library. If this is what you want to do, use the GNU Library General
1872 Public License instead of this License.
1878 <H1><A NAME=
"SEC43" HREF=
"ahidev.html#TOC43">GNU LIBRARY GENERAL PUBLIC LICENSE
</A></H1>
1881 Version
2, June
1991
1886 Copyright (C)
1991 Free Software Foundation, Inc.
1887 675 Mass Ave, Cambridge, MA
02139, USA
1888 Everyone is permitted to copy and distribute verbatim copies
1889 of this license document, but changing it is not allowed.
1891 [This is the first released version of the library GPL. It is
1892 numbered
2 because it goes with version
2 of the ordinary GPL.]
1897 <H2><A NAME=
"SEC44" HREF=
"ahidev.html#TOC44">Preamble
</A></H2>
1900 The licenses for most software are designed to take away your
1901 freedom to share and change it. By contrast, the GNU General Public
1902 Licenses are intended to guarantee your freedom to share and change
1903 free software--to make sure the software is free for all its users.
1907 This license, the Library General Public License, applies to some
1908 specially designated Free Software Foundation software, and to any
1909 other libraries whose authors decide to use it. You can use it for
1910 your libraries, too.
1914 When we speak of free software, we are referring to freedom, not
1915 price. Our General Public Licenses are designed to make sure that you
1916 have the freedom to distribute copies of free software (and charge for
1917 this service if you wish), that you receive source code or can get it
1918 if you want it, that you can change the software or use pieces of it
1919 in new free programs; and that you know you can do these things.
1923 To protect your rights, we need to make restrictions that forbid
1924 anyone to deny you these rights or to ask you to surrender the rights.
1925 These restrictions translate to certain responsibilities for you if
1926 you distribute copies of the library, or if you modify it.
1930 For example, if you distribute copies of the library, whether gratis
1931 or for a fee, you must give the recipients all the rights that we gave
1932 you. You must make sure that they, too, receive or can get the source
1933 code. If you link a program with the library, you must provide
1934 complete object files to the recipients so that they can relink them
1935 with the library, after making changes to the library and recompiling
1936 it. And you must show them these terms so they know their rights.
1940 Our method of protecting your rights has two steps: (
1) copyright
1941 the library, and (
2) offer you this license which gives you legal
1942 permission to copy, distribute and/or modify the library.
1946 Also, for each distributor's protection, we want to make certain
1947 that everyone understands that there is no warranty for this free
1948 library. If the library is modified by someone else and passed on, we
1949 want its recipients to know that what they have is not the original
1950 version, so that any problems introduced by others will not reflect on
1951 the original authors' reputations.
1955 Finally, any free program is threatened constantly by software
1956 patents. We wish to avoid the danger that companies distributing free
1957 software will individually obtain patent licenses, thus in effect
1958 transforming the program into proprietary software. To prevent this,
1959 we have made it clear that any patent must be licensed for everyone's
1960 free use or not licensed at all.
1964 Most GNU software, including some libraries, is covered by the ordinary
1965 GNU General Public License, which was designed for utility programs. This
1966 license, the GNU Library General Public License, applies to certain
1967 designated libraries. This license is quite different from the ordinary
1968 one; be sure to read it in full, and don't assume that anything in it is
1969 the same as in the ordinary license.
1973 The reason we have a separate public license for some libraries is that
1974 they blur the distinction we usually make between modifying or adding to a
1975 program and simply using it. Linking a program with a library, without
1976 changing the library, is in some sense simply using the library, and is
1977 analogous to running a utility program or application program. However, in
1978 a textual and legal sense, the linked executable is a combined work, a
1979 derivative of the original library, and the ordinary General Public License
1984 Because of this blurred distinction, using the ordinary General
1985 Public License for libraries did not effectively promote software
1986 sharing, because most developers did not use the libraries. We
1987 concluded that weaker conditions might promote sharing better.
1991 However, unrestricted linking of non-free programs would deprive the
1992 users of those programs of all benefit from the free status of the
1993 libraries themselves. This Library General Public License is intended to
1994 permit developers of non-free programs to use free libraries, while
1995 preserving your freedom as a user of such programs to change the free
1996 libraries that are incorporated in them. (We have not seen how to achieve
1997 this as regards changes in header files, but we have achieved it as regards
1998 changes in the actual functions of the Library.) The hope is that this
1999 will lead to faster development of free libraries.
2003 The precise terms and conditions for copying, distribution and
2004 modification follow. Pay close attention to the difference between a
2005 "work based on the library" and a
"work that uses the library". The
2006 former contains code derived from the library, while the latter only
2007 works together with the library.
2011 Note that it is possible for a library to be covered by the ordinary
2012 General Public License rather than by this special one.
2017 <H2><A NAME=
"SEC45" HREF=
"ahidev.html#TOC45">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
</A></H2>
2023 This License Agreement applies to any software library which
2024 contains a notice placed by the copyright holder or other authorized
2025 party saying it may be distributed under the terms of this Library
2026 General Public License (also called
"this License"). Each licensee is
2029 A
"library" means a collection of software functions and/or data
2030 prepared so as to be conveniently linked with application programs
2031 (which use some of those functions and data) to form executables.
2033 The
"Library", below, refers to any such software library or work
2034 which has been distributed under these terms. A
"work based on the
2035 Library" means either the Library or any derivative work under
2036 copyright law: that is to say, a work containing the Library or a
2037 portion of it, either verbatim or with modifications and/or translated
2038 straightforwardly into another language. (Hereinafter, translation is
2039 included without limitation in the term
"modification".)
2041 "Source code" for a work means the preferred form of the work for
2042 making modifications to it. For a library, complete source code means
2043 all the source code for all modules it contains, plus any associated
2044 interface definition files, plus the scripts used to control compilation
2045 and installation of the library.
2047 Activities other than copying, distribution and modification are not
2048 covered by this License; they are outside its scope. The act of
2049 running a program using the Library is not restricted, and output from
2050 such a program is covered only if its contents constitute a work based
2051 on the Library (independent of the use of the Library in a tool for
2052 writing it). Whether that is true depends on what the Library does
2053 and what the program that uses the Library does.
2057 You may copy and distribute verbatim copies of the Library's
2058 complete source code as you receive it, in any medium, provided that
2059 you conspicuously and appropriately publish on each copy an
2060 appropriate copyright notice and disclaimer of warranty; keep intact
2061 all the notices that refer to this License and to the absence of any
2062 warranty; and distribute a copy of this License along with the
2065 You may charge a fee for the physical act of transferring a copy,
2066 and you may at your option offer warranty protection in exchange for a
2071 You may modify your copy or copies of the Library or any portion
2072 of it, thus forming a work based on the Library, and copy and
2073 distribute such modifications or work under the terms of Section
1
2074 above, provided that you also meet all of these conditions:
2080 The modified work must itself be a software library.
2084 You must cause the files modified to carry prominent notices
2085 stating that you changed the files and the date of any change.
2089 You must cause the whole of the work to be licensed at no
2090 charge to all third parties under the terms of this License.
2094 If a facility in the modified Library refers to a function or a
2095 table of data to be supplied by an application program that uses
2096 the facility, other than as an argument passed when the facility
2097 is invoked, then you must make a good faith effort to ensure that,
2098 in the event an application does not supply such function or
2099 table, the facility still operates, and performs whatever part of
2100 its purpose remains meaningful.
2102 (For example, a function in a library to compute square roots has
2103 a purpose that is entirely well-defined independent of the
2104 application. Therefore, Subsection
2d requires that any
2105 application-supplied function or table used by this function must
2106 be optional: if the application does not supply it, the square
2107 root function must still compute square roots.)
2110 These requirements apply to the modified work as a whole. If
2111 identifiable sections of that work are not derived from the Library,
2112 and can be reasonably considered independent and separate works in
2113 themselves, then this License, and its terms, do not apply to those
2114 sections when you distribute them as separate works. But when you
2115 distribute the same sections as part of a whole which is a work based
2116 on the Library, the distribution of the whole must be on the terms of
2117 this License, whose permissions for other licensees extend to the
2118 entire whole, and thus to each and every part regardless of who wrote
2121 Thus, it is not the intent of this section to claim rights or contest
2122 your rights to work written entirely by you; rather, the intent is to
2123 exercise the right to control the distribution of derivative or
2124 collective works based on the Library.
2126 In addition, mere aggregation of another work not based on the Library
2127 with the Library (or with a work based on the Library) on a volume of
2128 a storage or distribution medium does not bring the other work under
2129 the scope of this License.
2133 You may opt to apply the terms of the ordinary GNU General Public
2134 License instead of this License to a given copy of the Library. To do
2135 this, you must alter all the notices that refer to this License, so
2136 that they refer to the ordinary GNU General Public License, version
2,
2137 instead of to this License. (If a newer version than version
2 of the
2138 ordinary GNU General Public License has appeared, then you can specify
2139 that version instead if you wish.) Do not make any other change in
2142 Once this change is made in a given copy, it is irreversible for
2143 that copy, so the ordinary GNU General Public License applies to all
2144 subsequent copies and derivative works made from that copy.
2146 This option is useful when you wish to copy part of the code of
2147 the Library into a program that is not a library.
2151 You may copy and distribute the Library (or a portion or
2152 derivative of it, under Section
2) in object code or executable form
2153 under the terms of Sections
1 and
2 above provided that you accompany
2154 it with the complete corresponding machine-readable source code, which
2155 must be distributed under the terms of Sections
1 and
2 above on a
2156 medium customarily used for software interchange.
2158 If distribution of object code is made by offering access to copy
2159 from a designated place, then offering equivalent access to copy the
2160 source code from the same place satisfies the requirement to
2161 distribute the source code, even though third parties are not
2162 compelled to copy the source along with the object code.
2166 A program that contains no derivative of any portion of the
2167 Library, but is designed to work with the Library by being compiled or
2168 linked with it, is called a
"work that uses the Library". Such a
2169 work, in isolation, is not a derivative work of the Library, and
2170 therefore falls outside the scope of this License.
2172 However, linking a
"work that uses the Library" with the Library
2173 creates an executable that is a derivative of the Library (because it
2174 contains portions of the Library), rather than a
"work that uses the
2175 library". The executable is therefore covered by this License.
2176 Section
6 states terms for distribution of such executables.
2178 When a
"work that uses the Library" uses material from a header file
2179 that is part of the Library, the object code for the work may be a
2180 derivative work of the Library even though the source code is not.
2181 Whether this is true is especially significant if the work can be
2182 linked without the Library, or if the work is itself a library. The
2183 threshold for this to be true is not precisely defined by law.
2185 If such an object file uses only numerical parameters, data
2186 structure layouts and accessors, and small macros and small inline
2187 functions (ten lines or less in length), then the use of the object
2188 file is unrestricted, regardless of whether it is legally a derivative
2189 work. (Executables containing this object code plus portions of the
2190 Library will still fall under Section
6.)
2192 Otherwise, if the work is a derivative of the Library, you may
2193 distribute the object code for the work under the terms of Section
6.
2194 Any executables containing that work also fall under Section
6,
2195 whether or not they are linked directly with the Library itself.
2199 As an exception to the Sections above, you may also compile or
2200 link a
"work that uses the Library" with the Library to produce a
2201 work containing portions of the Library, and distribute that work
2202 under terms of your choice, provided that the terms permit
2203 modification of the work for the customer's own use and reverse
2204 engineering for debugging such modifications.
2206 You must give prominent notice with each copy of the work that the
2207 Library is used in it and that the Library and its use are covered by
2208 this License. You must supply a copy of this License. If the work
2209 during execution displays copyright notices, you must include the
2210 copyright notice for the Library among them, as well as a reference
2211 directing the user to the copy of this License. Also, you must do one
2218 Accompany the work with the complete corresponding
2219 machine-readable source code for the Library including whatever
2220 changes were used in the work (which must be distributed under
2221 Sections
1 and
2 above); and, if the work is an executable linked
2222 with the Library, with the complete machine-readable
"work that
2223 uses the Library", as object code and/or source code, so that the
2224 user can modify the Library and then relink to produce a modified
2225 executable containing the modified Library. (It is understood
2226 that the user who changes the contents of definitions files in the
2227 Library will not necessarily be able to recompile the application
2228 to use the modified definitions.)
2232 Accompany the work with a written offer, valid for at
2233 least three years, to give the same user the materials
2234 specified in Subsection
6a, above, for a charge no more
2235 than the cost of performing this distribution.
2239 If distribution of the work is made by offering access to copy
2240 from a designated place, offer equivalent access to copy the above
2241 specified materials from the same place.
2245 Verify that the user has already received a copy of these
2246 materials or that you have already sent this user a copy.
2249 For an executable, the required form of the
"work that uses the
2250 Library" must include any data and utility programs needed for
2251 reproducing the executable from it. However, as a special exception,
2252 the source code distributed need not include anything that is normally
2253 distributed (in either source or binary form) with the major
2254 components (compiler, kernel, and so on) of the operating system on
2255 which the executable runs, unless that component itself accompanies
2258 It may happen that this requirement contradicts the license
2259 restrictions of other proprietary libraries that do not normally
2260 accompany the operating system. Such a contradiction means you cannot
2261 use both them and the Library together in an executable that you
2266 You may place library facilities that are a work based on the
2267 Library side-by-side in a single library together with other library
2268 facilities not covered by this License, and distribute such a combined
2269 library, provided that the separate distribution of the work based on
2270 the Library and of the other library facilities is otherwise
2271 permitted, and provided that you do these two things:
2277 Accompany the combined library with a copy of the same work
2278 based on the Library, uncombined with any other library
2279 facilities. This must be distributed under the terms of the
2284 Give prominent notice with the combined library of the fact
2285 that part of it is a work based on the Library, and explaining
2286 where to find the accompanying uncombined form of the same work.
2291 You may not copy, modify, sublicense, link with, or distribute
2292 the Library except as expressly provided under this License. Any
2293 attempt otherwise to copy, modify, sublicense, link with, or
2294 distribute the Library is void, and will automatically terminate your
2295 rights under this License. However, parties who have received copies,
2296 or rights, from you under this License will not have their licenses
2297 terminated so long as such parties remain in full compliance.
2301 You are not required to accept this License, since you have not
2302 signed it. However, nothing else grants you permission to modify or
2303 distribute the Library or its derivative works. These actions are
2304 prohibited by law if you do not accept this License. Therefore, by
2305 modifying or distributing the Library (or any work based on the
2306 Library), you indicate your acceptance of this License to do so, and
2307 all its terms and conditions for copying, distributing or modifying
2308 the Library or works based on it.
2312 Each time you redistribute the Library (or any work based on the
2313 Library), the recipient automatically receives a license from the
2314 original licensor to copy, distribute, link with or modify the Library
2315 subject to these terms and conditions. You may not impose any further
2316 restrictions on the recipients' exercise of the rights granted herein.
2317 You are not responsible for enforcing compliance by third parties to
2322 If, as a consequence of a court judgment or allegation of patent
2323 infringement or for any other reason (not limited to patent issues),
2324 conditions are imposed on you (whether by court order, agreement or
2325 otherwise) that contradict the conditions of this License, they do not
2326 excuse you from the conditions of this License. If you cannot
2327 distribute so as to satisfy simultaneously your obligations under this
2328 License and any other pertinent obligations, then as a consequence you
2329 may not distribute the Library at all. For example, if a patent
2330 license would not permit royalty-free redistribution of the Library by
2331 all those who receive copies directly or indirectly through you, then
2332 the only way you could satisfy both it and this License would be to
2333 refrain entirely from distribution of the Library.
2335 If any portion of this section is held invalid or unenforceable under any
2336 particular circumstance, the balance of the section is intended to apply,
2337 and the section as a whole is intended to apply in other circumstances.
2339 It is not the purpose of this section to induce you to infringe any
2340 patents or other property right claims or to contest validity of any
2341 such claims; this section has the sole purpose of protecting the
2342 integrity of the free software distribution system which is
2343 implemented by public license practices. Many people have made
2344 generous contributions to the wide range of software distributed
2345 through that system in reliance on consistent application of that
2346 system; it is up to the author/donor to decide if he or she is willing
2347 to distribute software through any other system and a licensee cannot
2350 This section is intended to make thoroughly clear what is believed to
2351 be a consequence of the rest of this License.
2355 If the distribution and/or use of the Library is restricted in
2356 certain countries either by patents or by copyrighted interfaces, the
2357 original copyright holder who places the Library under this License may add
2358 an explicit geographical distribution limitation excluding those countries,
2359 so that distribution is permitted only in or among countries not thus
2360 excluded. In such case, this License incorporates the limitation as if
2361 written in the body of this License.
2365 The Free Software Foundation may publish revised and/or new
2366 versions of the Library General Public License from time to time.
2367 Such new versions will be similar in spirit to the present version,
2368 but may differ in detail to address new problems or concerns.
2370 Each version is given a distinguishing version number. If the Library
2371 specifies a version number of this License which applies to it and
2372 "any later version", you have the option of following the terms and
2373 conditions either of that version or of any later version published by
2374 the Free Software Foundation. If the Library does not specify a
2375 license version number, you may choose any version ever published by
2376 the Free Software Foundation.
2380 If you wish to incorporate parts of the Library into other free
2381 programs whose distribution conditions are incompatible with these,
2382 write to the author to ask for permission. For software which is
2383 copyrighted by the Free Software Foundation, write to the Free
2384 Software Foundation; we sometimes make exceptions for this. Our
2385 decision will be guided by the two goals of preserving the free status
2386 of all derivatives of our free software and of promoting the sharing
2387 and reuse of software generally.
2391 <P><STRONG>NO WARRANTY
</STRONG></P>
2395 BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
2396 WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
2397 EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
2398 OTHER PARTIES PROVIDE THE LIBRARY
"AS IS" WITHOUT WARRANTY OF ANY
2399 KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
2400 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2401 PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
2402 LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
2403 THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
2407 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
2408 WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
2409 AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
2410 FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
2411 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
2412 LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
2413 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
2414 FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
2415 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
2420 <H2>END OF TERMS AND CONDITIONS
</H2>
2424 <H2><A NAME=
"SEC46" HREF=
"ahidev.html#TOC46">How to Apply These Terms to Your New Libraries
</A></H2>
2427 If you develop a new library, and you want it to be of the greatest
2428 possible use to the public, we recommend making it free software that
2429 everyone can redistribute and change. You can do so by permitting
2430 redistribution under these terms (or, alternatively, under the terms of the
2431 ordinary General Public License).
2435 To apply these terms, attach the following notices to the library. It is
2436 safest to attach them to the start of each source file to most effectively
2437 convey the exclusion of warranty; and each file should have at least the
2438 "copyright" line and a pointer to where the full notice is found.
2443 <VAR>one line to give the library's name and an idea of what it does.
</VAR>
2444 Copyright (C)
<VAR>year
</VAR> <VAR>name of author
</VAR>
2446 This library is free software; you can redistribute it and/or modify it
2447 under the terms of the GNU Library General Public License as published
2448 by the Free Software Foundation; either version
2 of the License, or (at
2449 your option) any later version.
2451 This library is distributed in the hope that it will be useful, but
2452 WITHOUT ANY WARRANTY; without even the implied warranty of
2453 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2454 Library General Public License for more details.
2456 You should have received a copy of the GNU Library General Public
2457 License along with this library; if not, write to the Free Software
2458 Foundation, Inc.,
675 Mass Ave, Cambridge, MA
02139, USA.
2462 Also add information on how to contact you by electronic and paper mail.
2466 You should also get your employer (if you work as a programmer) or your
2467 school, if any, to sign a
"copyright disclaimer" for the library, if
2468 necessary. Here is a sample; alter the names:
2473 Yoyodyne, Inc., hereby disclaims all copyright interest in the library
2474 `Frob' (a library for tweaking knobs) written by James Random Hacker.
2476 <VAR>signature of Ty Coon
</VAR>,
1 April
1990
2477 Ty Coon, President of Vice
2481 That's all there is to it!
2487 <H1><A NAME=
"SEC47" HREF=
"ahidev.html#TOC47">Concept Index
</A></H1>
2490 <A NAME=
"IDX111"></A>
2496 <LI><A HREF=
"ahidev.html#IDX71">Audio streams, playing
</A>
2497 <LI><A HREF=
"ahidev.html#IDX9">Author of AHI
</A>
2501 <LI><A HREF=
"ahidev.html#IDX7">Copyright
</A>
2505 <LI><A HREF=
"ahidev.html#IDX105">Data Types
</A>
2506 <LI><A HREF=
"ahidev.html#IDX104">Data Types And Structures
</A>
2507 <LI><A HREF=
"ahidev.html#IDX10">Definitions
</A>
2508 <LI><A HREF=
"ahidev.html#IDX3">Disclaimer
</A>
2509 <LI><A HREF=
"ahidev.html#IDX102">Distortion, playing
</A>
2510 <LI><A HREF=
"ahidev.html#IDX87">Distortion, recording
</A>
2511 <LI><A HREF=
"ahidev.html#IDX2">Distribution
</A>
2512 <LI><A HREF=
"ahidev.html#IDX86">Double Buffering, reading
</A>
2513 <LI><A HREF=
"ahidev.html#IDX101">Double Buffering, writing
</A>
2517 <LI><A HREF=
"ahidev.html#IDX14">Function Interface
</A>
2521 <LI><A HREF=
"ahidev.html#IDX17">Games, music
</A>
2522 <LI><A HREF=
"ahidev.html#IDX18">Games, sound effects
</A>
2523 <LI><A HREF=
"ahidev.html#IDX21">Guidelines
</A>
2527 <LI><A HREF=
"ahidev.html#IDX29">Hooks
</A>
2531 <LI><A HREF=
"ahidev.html#IDX5">Legal nonsense
</A>
2532 <LI><A HREF=
"ahidev.html#IDX23">Library base
</A>
2533 <LI><A HREF=
"ahidev.html#IDX4">License
</A>
2534 <LI><A HREF=
"ahidev.html#IDX51">Loading Sounds
</A>
2538 <LI><A HREF=
"ahidev.html#IDX30">Multitasking
</A>
2539 <LI><A HREF=
"ahidev.html#IDX15">Music, games
</A>
2540 <LI><A HREF=
"ahidev.html#IDX69">Music, streams from disk
</A>
2544 <LI><A HREF=
"ahidev.html#IDX1">Overview
</A>
2548 <LI><A HREF=
"ahidev.html#IDX89">Playing
</A>
2549 <LI><A HREF=
"ahidev.html#IDX70">Playing audio streams
</A>
2550 <LI><A HREF=
"ahidev.html#IDX103">Precedences
</A>
2551 <LI><A HREF=
"ahidev.html#IDX22">Programming guidelines
</A>
2555 <LI><A HREF=
"ahidev.html#IDX76">Reading
</A>
2556 <LI><A HREF=
"ahidev.html#IDX19">Realtime effects
</A>
2557 <LI><A HREF=
"ahidev.html#IDX77">Recording
</A>
2558 <LI><A HREF=
"ahidev.html#IDX20">Recording, high quality
</A>
2559 <LI><A HREF=
"ahidev.html#IDX73">Recording, quick and easy
</A>
2560 <LI><A HREF=
"ahidev.html#IDX111">Recursion
</A>
2564 <LI><A HREF=
"ahidev.html#IDX11">Sample
</A>
2565 <LI><A HREF=
"ahidev.html#IDX12">Sample frame
</A>
2566 <LI><A HREF=
"ahidev.html#IDX6">Software license
</A>
2567 <LI><A HREF=
"ahidev.html#IDX13">Sound
</A>
2568 <LI><A HREF=
"ahidev.html#IDX16">Sound effects, games
</A>
2569 <LI><A HREF=
"ahidev.html#IDX72">Sound effects, system
</A>
2570 <LI><A HREF=
"ahidev.html#IDX108">Structures
</A>
2571 <LI><A HREF=
"ahidev.html#IDX68">Surround sound
</A>
2575 <LI><A HREF=
"ahidev.html#IDX25">The Audio Database
</A>
2576 <LI><A HREF=
"ahidev.html#IDX8">The Author
</A>
2580 <LI><A HREF=
"ahidev.html#IDX52">Unloading Sounds
</A>
2584 <LI><A HREF=
"ahidev.html#IDX88">Writing
</A>
2591 <H1><A NAME=
"SEC48" HREF=
"ahidev.html#TOC48">Data Type Index
</A></H1>
2596 <LI><A HREF=
"ahidev.html#IDX32">AHIAudioCtrl
</A>
2597 <LI><A HREF=
"ahidev.html#IDX24">AHIBase
</A>
2598 <LI><A HREF=
"ahidev.html#IDX110">AHIGlobalPrefs
</A>
2599 <LI><A HREF=
"ahidev.html#IDX74">AHIRequest
</A>
2600 <LI><A HREF=
"ahidev.html#IDX41">AHISoundMessage
</A>
2601 <LI><A HREF=
"ahidev.html#IDX109">AHIUnitPrefs
</A>
2605 <LI><A HREF=
"ahidev.html#IDX106">Fixed
</A>
2609 <LI><A HREF=
"ahidev.html#IDX107">sposition
</A>
2616 <H1><A NAME=
"SEC49" HREF=
"ahidev.html#TOC49">Function Index
</A></H1>
2621 <LI><A HREF=
"ahidev.html#IDX31">AHI_AllocAudioA()
</A>
2622 <LI><A HREF=
"ahidev.html#IDX28">AHI_BestAudioIDA()
</A>
2623 <LI><A HREF=
"ahidev.html#IDX61">AHI_ControlAudioA()
</A>
2624 <LI><A HREF=
"ahidev.html#IDX34">AHI_FreeAudio()
</A>
2625 <LI><A HREF=
"ahidev.html#IDX27">AHI_GetAudioAttrsA()
</A>
2626 <LI><A HREF=
"ahidev.html#IDX53">AHI_LoadSound()
</A>
2627 <LI><A HREF=
"ahidev.html#IDX26">AHI_NextAudioID()
</A>
2628 <LI><A HREF=
"ahidev.html#IDX66">AHI_PlayA()
</A>
2629 <LI><A HREF=
"ahidev.html#IDX64">AHI_SetFreq()
</A>
2630 <LI><A HREF=
"ahidev.html#IDX63">AHI_SetSound()
</A>
2631 <LI><A HREF=
"ahidev.html#IDX65">AHI_SetVol()
</A>
2632 <LI><A HREF=
"ahidev.html#IDX60">AHI_UnloadSound()
</A>
2639 <H1><A NAME=
"SEC50" HREF=
"ahidev.html#TOC50">Variable Index
</A></H1>
2644 <LI><A HREF=
"ahidev.html#IDX37">AHI_DEFAULT_FREQ
</A>
2645 <LI><A HREF=
"ahidev.html#IDX35">AHI_DEFAULT_ID
</A>
2646 <LI><A HREF=
"ahidev.html#IDX75">AHI_DEFAULT_UNIT
</A>
2647 <LI><A HREF=
"ahidev.html#IDX36">AHIA_AudioID
</A>
2648 <LI><A HREF=
"ahidev.html#IDX39">AHIA_Channels
</A>
2649 <LI><A HREF=
"ahidev.html#IDX47">AHIA_MaxPlayerFreq
</A>
2650 <LI><A HREF=
"ahidev.html#IDX46">AHIA_MinPlayerFreq
</A>
2651 <LI><A HREF=
"ahidev.html#IDX38">AHIA_MixFreq
</A>
2652 <LI><A HREF=
"ahidev.html#IDX45">AHIA_PlayerFreq
</A>
2653 <LI><A HREF=
"ahidev.html#IDX44">AHIA_PlayerFunc
</A>
2654 <LI><A HREF=
"ahidev.html#IDX48">AHIA_RecordFunc
</A>
2655 <LI><A HREF=
"ahidev.html#IDX43">AHIA_SoundFunc
</A>
2656 <LI><A HREF=
"ahidev.html#IDX40">AHIA_Sounds
</A>
2657 <LI><A HREF=
"ahidev.html#IDX50">AHIA_UserData
</A>
2658 <LI><A HREF=
"ahidev.html#IDX33">ahiac_UserData
</A>,
<A HREF=
"ahidev.html#IDX49">ahiac_UserData
</A>
2659 <LI><A HREF=
"ahidev.html#IDX62">AHIC_Play
</A>
2660 <LI><A HREF=
"ahidev.html#IDX83">ahir_Frequency
</A>,
<A HREF=
"ahidev.html#IDX96">ahir_Frequency
</A>
2661 <LI><A HREF=
"ahidev.html#IDX99">ahir_Link
</A>
2662 <LI><A HREF=
"ahidev.html#IDX98">ahir_Position
</A>
2663 <LI><A HREF=
"ahidev.html#IDX82">ahir_Type
</A>,
<A HREF=
"ahidev.html#IDX95">ahir_Type
</A>
2664 <LI><A HREF=
"ahidev.html#IDX97">ahir_Volume
</A>
2665 <LI><A HREF=
"ahidev.html#IDX67">AHISF_IMM
</A>
2666 <LI><A HREF=
"ahidev.html#IDX42">ahism_Channel
</A>
2667 <LI><A HREF=
"ahidev.html#IDX55">AHIST_DYNAMICSAMPLE
</A>
2668 <LI><A HREF=
"ahidev.html#IDX58">AHIST_M16S
</A>
2669 <LI><A HREF=
"ahidev.html#IDX56">AHIST_M8S
</A>
2670 <LI><A HREF=
"ahidev.html#IDX59">AHIST_S16S
</A>
2671 <LI><A HREF=
"ahidev.html#IDX57">AHIST_S8S
</A>
2672 <LI><A HREF=
"ahidev.html#IDX54">AHIST_SAMPLE
</A>
2676 <LI><A HREF=
"ahidev.html#IDX78">CMD_READ
</A>
2677 <LI><A HREF=
"ahidev.html#IDX90">CMD_WRITE
</A>
2681 <LI><A HREF=
"ahidev.html#IDX79">io_Command
</A>,
<A HREF=
"ahidev.html#IDX91">io_Command
</A>
2682 <LI><A HREF=
"ahidev.html#IDX81">io_Data
</A>,
<A HREF=
"ahidev.html#IDX94">io_Data
</A>
2683 <LI><A HREF=
"ahidev.html#IDX80">io_Length
</A>,
<A HREF=
"ahidev.html#IDX84">io_Length
</A>,
<A HREF=
"ahidev.html#IDX93">io_Length
</A>,
<A HREF=
"ahidev.html#IDX100">io_Length
</A>
2684 <LI><A HREF=
"ahidev.html#IDX85">io_Offset
</A>
2688 <LI><A HREF=
"ahidev.html#IDX92">ln_Pri
</A>
2695 <H3><A NAME=
"FOOT1" HREF=
"ahidev.html#DOCF1">(
1)
</A></H3>
2696 <P>Available from AmiNet, for example
<BR>
2697 @url{ftp://ftp.germany.aminet.org/pub/aminet/dev/debug/Sushi.lha
2699 This document was generated on
27 December
2000 using the
2700 <A HREF=
"http://wwwcn.cern.ch/dci/texi2html/">texi2html
</A>
2701 translator version
1.51.
</P>