2 \input texinfo @c -*-texinfo-*-
4 @setfilename ahidev.info
5 @settitle @sc{Ahi} Developers's Guide
14 @c Set ahiver and docver to current release version
18 @c Part 2: Summary Description and Copyright
19 @c ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
22 This file documents AHI release @value{ahiver}, a hardware independent
23 audio subsystem for Amiga. The version number of this document is
26 Copyright @copyright{} 1994-2005 Martin Blom.
28 Permission is granted to make and distribute verbatim copies of this manual
29 provided the copyright notice and this permission notice are preserved on
33 Permission is granted to process this file through TeX and print the
34 results, provided the printed document carries a copying permission notice
35 identical to this one except for the removal of this paragraph (this
36 paragraph not being relevant to the printed manual).
39 Permission is granted to copy and distribute modified versions of this
40 manual under the conditions for verbatim copying, provided also that the
41 sections entitled ``Distribution'', ``GPL'' and ``LGPL'' are included
42 exactly as in the original, and provided that the entire resulting
43 derived work is distributed under the terms of a permission notice
44 identical to this one.
46 Permission is granted to copy and distribute translations of this manual
47 into another language, under the above conditions for modified versions,
48 except that this permission notice may be stated in a translation approved
49 by the Free Software Foundation.
51 @sc{This publication is provided by the author ``as is'' and any express or
52 implied warranties, including, but not limited to, the implied warranties
53 of merchantability and fitness for a particular purpose are disclaimed. In
54 no event shall the author be liable for any direct, indirect, incidental,
55 special, exemplary, or consequential damages (including, but not limited
56 to, procurement of substitute goods or services; loss of use, data, or
57 profits; or business interruption) however caused and on any theory of
58 liability, whether in contract, strict liability, or tort (including
59 negligence or otherwise) arising in any way out of the use of this
60 publication, even if advised of the possibility of such damage.}
65 $Log: ahidev.texinfo,v $
66 Revision 5.3.2.3 2005/02/02 21:49:52 martin
67 * Updated all copyright years to 2005.
69 * Bumped all version numbers to 6.0.
71 * Docs/ahidev.texinfo (The Author): Updated the authors address (5
74 Revision 5.3.2.2 2004/11/02 13:18:53 martin
75 Updated copyright year and removed almost all CVS/RCS tags from the
78 Revision 5.3.2.1 2004/06/08 21:16:16 martin
79 Added 7.1 multichannel support.
81 Revision 5.3 2003/01/19 16:15:40 martin
82 Added descriptions of AHIA_AntiClickSamples and AHISF_NODELAY.
84 Revision 5.2 2003/01/19 14:24:45 martin
85 Added support for playing 32 bit samples.
87 Revision 5.1 2003/01/19 12:22:41 martin
88 Another year, another copyright update.
89 ... which seems to have caused the translation files to change slightly.
91 Revision 5.0 2000/11/28 00:16:18 lcs
92 Bumped CVS revision to 5.0.
94 Revision 4.15 1999/09/19 14:05:03 lcs
97 Revision 4.12 1999/09/19 13:10:18 lcs
101 Revision 4.11 1999/03/28 22:32:46 lcs
102 AHI is now GPL/LGPL software.
103 Make target bindist work correctly when using a separate build directory.
104 Small first steps towards a WarpOS PPC version.
106 Revision 4.10 1999/01/10 19:27:46 lcs
107 The move to GNU make is done.
109 Revision 4.9 1999/01/10 16:07:56 lcs
110 Moved to GNU make (still moving...)
112 Revision 4.8 1998/01/18 19:50:42 lcs
115 Revision 4.7 1997/10/21 01:33:40 lcs
116 The version number is now the AHI release version, not the documents version.
118 Revision 4.6 1997/08/21 01:11:30 lcs
119 Added description of the samle formats AHI_LoadSound() understands
121 Revision 4.5 1997/08/10 15:38:57 lcs
123 Added note about LoadSound:ing the most important sounds first
125 Revision 4.4 1997/07/27 00:13:32 lcs
126 Fixed a mistypeing: was SetFreq() instead of AHI_SetFreq().
128 Revision 4.3 1997/07/15 00:50:40 lcs
129 This is the second bugfix release of AHI 4.
131 Revision 4.2 1997/05/11 12:38:39 lcs
132 Added note about unrolling short sounds.
134 Revision 4.1 1997/05/04 15:52:15 lcs
141 @c Part 3: Titlepage and Copyright
142 @c ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
146 @subtitle Hardware independent audio for Amiga
147 @subtitle AHI Developer's Guide for AHI release @value{ahiver}
148 @subtitle Document version @value{docver}
149 @author Martin 'Leviticus' Blom
153 @vskip 0pt plus 1filll
155 Copyright @copyright{} 1994-2005 Martin Blom.
157 Permission is granted to make and distribute verbatim copies of this manual
158 provided the copyright notice and this permission notice are preserved on
161 Permission is granted to copy and distribute modified versions of this
162 manual under the conditions for verbatim copying, provided also that the
163 sections entitled ``Distribution'', ``GPL'' and ``LGPL'' are included
164 exactly as in the original, and provided that the entire resulting
165 derived work is distributed under the terms of a permission notice
166 identical to this one.
168 Permission is granted to copy and distribute translations of this manual
169 into another language, under the above conditions for modified versions,
170 except that this permission notice may be stated in a translation approved
171 by the Free Software Foundation.
173 @sc{This publication is provided by the author ``as is'' and any express or
174 implied warranties, including, but not limited to, the implied warranties
175 of merchantability and fitness for a particular purpose are disclaimed. In
176 no event shall the author be liable for any direct, indirect, incidental,
177 special, exemplary, or consequential damages (including, but not limited
178 to, procurement of substitute goods or services; loss of use, data, or
179 profits; or business interruption) however caused and on any theory of
180 liability, whether in contract, strict liability, or tort (including
181 negligence or otherwise) arising in any way out of the use of this
182 publication, even if advised of the possibility of such damage.}
187 @c Part 4: `Top' Node and Master Menu
188 @c ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
190 @node Top, Overview, (dir), (dir)
194 @majorheading @sc{Ahi} Developer's Guide
196 For @sc{Ahi} release @value{ahiver}. Document version @value{docver}.
198 Copyright @copyright{} 1994-2005 Martin Blom
200 The latest release of @sc{Ahi} can always be found at
201 @url{http://www.lysator.liu.se/~lcs/ahi.html}.
204 * Overview:: Brief introduction
205 * Distribution:: What you are allowed to do and not
206 * The Author:: Who designed it?
208 * Definitions:: Terms used in this document
209 * Function Interface:: The low-level API
210 * Device Interface:: The high-level API
211 * Data Types And Structures:: The structures explained
213 * GPL:: The main license
214 * LGPL:: The @code{ahi.device} license
216 * Concept Index:: Concept Index
217 * Data Type Index:: Data Type Index
218 * Function Index:: Function Index
219 * Variable Index:: Variable Index
222 --- The Detailed Node Listing ---
227 * Opening And Closing ahi.device For Low-level Access::
228 * Obtaining The Hardware::
234 * Opening And Closing ahi.device For High-level Access::
235 * Reading From The Device::
236 * Writing To The Device::
238 Data Types And Structures
249 @c Part 5: The Body of the Document
250 @c ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
253 @c ***********************************************************************
254 @c **** Overview *********************************************************
255 @c ***********************************************************************
257 @node Overview, Distribution, Top, Top
258 @comment node-name, next, previous, up
263 This document was written in order to make it easier for developers to
264 understand and use @sc{Ahi} in their own productions, and write Software
267 @code{ahi.device} has two different API's; one library-like function
268 interface (low-level), and one ``normal'' device interface (high-level).
269 Each of them serves different purposes. The low-level interface is
270 targeting music players, games and real-time applications. The high-level
271 interface is targeting applications that just want to have a sample played,
272 play audio streams or record samples as easily as possible.
274 As with everything else, it is important that you chose the right tool for
275 the job---you'll only get frustrated otherwise.
277 Not everything about @sc{Ahi} is documented here; for more information, see
278 @cite{@sc{Ahi} User's Guide} and the autodocs.
281 @c ***********************************************************************
282 @c **** Distribution *****************************************************
283 @c ***********************************************************************
285 @node Distribution, The Author, Overview, Top
286 @comment node-name, next, previous, up
287 @chapter Distribution
292 @cindex Legal nonsense
293 @cindex Software license
296 Copyright @copyright{} 1994-2005 Martin Blom
298 @sc{Ahi} is available under a dual license. The device itself is under
299 the ``GNU Library General Public License'' (@pxref{LGPL}), while the
300 utility programs and the @code{AUDIO:} device is covered by the ``GNU General
301 Public License'' (@pxref{GPL}).
303 If you use this software in a commercial or shareware product, please
304 consider giving the author (@pxref{The Author})---and preferably each one
305 of the contributors too (see @cite{@sc{Ahi} User's Guide})---an original or
306 registered copy or sample of your work. Should you want to distribute the
307 @sc{Ahi} software with your own product, there is really nothing to
311 @c ***********************************************************************
312 @c **** The Author *******************************************************
313 @c ***********************************************************************
315 @node The Author, Definitions, Distribution, Top
316 @comment node-name, next, previous, up
320 @cindex Author of @sc{Ahi}
322 The author can be reached at the following addresses:
326 @item Electronic mail
327 @email{martin@@blom.org}
332 @*SE-587 34 Linköping
336 @url{http://martin.blom.org}
341 @c ***********************************************************************
342 @c **** Definitions *****************************************************
343 @c ***********************************************************************
345 @node Definitions, Function Interface, The Author, Top
346 @comment node-name, next, previous, up
351 Following are some general definitions of terms that are used in this
359 A sample is one binary number, representing the amplitude at a fixed point
360 in time. A sample is often stored as an 8 bit signed integer, a 16 bit
361 signed integer, a 32 bit floating point number etc. @sc{Ahi} only
367 In mono environments, a sample frame is the same as a sample. In stereo
368 environments, a sample frame is a tuple of two samples. The first member
369 is for the left channel, the second for the right.
374 Many sample frames stored in sequence as an array can be called a sound. A
375 sound is, however, not limited to being formed by samples, it can also be
376 parameters to an analog synth or a MIDI instrument, or be white noise.
377 @sc{Ahi} only supports sounds formed by samples.
382 @c ***********************************************************************
383 @c ***********************************************************************
384 @c **** Function Interface ***********************************************
385 @c ***********************************************************************
386 @c ***********************************************************************
388 @node Function Interface, Device Interface, Definitions, Top
389 @comment node-name, next, previous, up
390 @chapter Function Interface
392 @cindex Function Interface
394 The device has, in addition to the usual I/O request protocol, a set of
395 functions that allows the programmer to gain full control (at least as much
396 as possible with device independence) over the audio hardware. The
397 advantages are low overhead and much more advanced control over the playing
398 sounds. The disadvantages are greater complexity and only one user per
402 @cindex Sound effects, games
404 @cindex Games, sound effects
405 @cindex Realtime effects
406 @cindex Recording, high quality
408 If you want to play music or sound effects for a game, record in high
409 quality or want to do realtime effects, this is the API to use.
415 * Opening And Closing ahi.device For Low-level Access::
416 * Obtaining The Hardware::
422 @c ***********************************************************************
423 @c **** Guidelines *******************************************************
424 @c ***********************************************************************
426 @node Guidelines, Opening And Closing ahi.device For Low-level Access, Function Interface, Function Interface
427 @comment node-name, next, previous, up
431 @cindex Programming guidelines
434 @subsection Follow The Rules
436 It's really simple. If I tell you to check return values, check sample
437 types when recording, not to trash d2-d7/a2-a6 in hooks, or not to call
438 @code{AHI_ControlAudio()} with the @code{AHIC_Play} tag from interrupts or
439 hooks, you do as you are told.
442 @subsection The Library Base
447 The @code{AHIBase} structure is private, so are the sub libraries' library
448 base structures. Don't try to be clever.
451 @subsection The Audio Database
453 @cindex The Audio Database
455 @findex AHI_NextAudioID()
456 @findex AHI_GetAudioAttrsA()
457 @findex AHI_BestAudioIDA()
459 The implementation of the database is private, and may change any time.
460 @code{ahi.device} provides functions access the information in the database
461 (@code{AHI_NextAudioID()}, @code{AHI_GetAudioAttrsA()} and
462 @code{AHI_BestAudioIDA()}).
465 @subsection User Hooks
469 All user hooks must follow normal register conventions, which means that
470 d2-d7 and a2-a6 must be preserved. They may be called from an interrupt,
471 but you cannot count on that; it can be your own process or another
472 process. Don't assume the system is in single-thread mode. Never spend
473 much time in a hook, get the work done as quick as possible and then
477 @subsection Function Calls From Other Tasks, Interrupts Or User Hooks
479 The @code{AHIAudioCtrl} structure may not be shared with other
480 tasks/threads. The task that called @code{AHI_AllocAudioA()} must do all
481 other calls too (except those callable from interrupts).
483 Only calls specifically said to be callable from interrupts may be called
484 from user hooks or interrupts. Note that @code{AHI_ControlAudioA()} has
485 some tags that must not be present when called from an interrupt.
488 @subsection Multitasking
492 Most audio drivers need multitasking to be turned on to function properly.
493 Don't turn it off while using the device.
497 @c ***********************************************************************
498 @c **** Opening And Closing ahi.device For Low-level Access **************
499 @c ***********************************************************************
501 @node Opening And Closing ahi.device For Low-level Access, Obtaining The Hardware, Guidelines, Function Interface
502 @comment node-name, next, previous, up
503 @section Opening And Closing @code{ahi.device} For Low-level Access
506 Not too hard. Just open @code{ahi.device} unit @code{AHI_NO_UNIT} and
507 initialize @code{AHIBase}. After that you can access all the functions of
508 the device just as if you had opened a standard shared library.
511 @subsection @code{Assembler}
513 For the assembler programmer there are two handy macros: @code{OPENAHI}
514 and @code{CLOSEAHI}. Here is a small example how to use them:
517 OPENAHI 4 ;Open at least version 4.
522 ; AHI's functions can now be called as normal library functions:
523 move.l _AHIBase(pc),a6
524 moveq #AHI_INVALID_ID,d0
525 jsr _LVOAHI_NextAudioID(a6)
533 Note that you @strong{have} to execute the @code{CLOSEAHI} macro even if
534 @code{OPENAHI} failed!
539 For the C programmer, here is how it should be done:
543 struct Library *AHIBase;
544 struct MsgPort *AHImp=NULL;
545 struct AHIRequest *AHIio=NULL;
548 if(AHImp = CreateMsgPort())
550 if(AHIio = (struct AHIRequest *) CreateIORequest(
551 AHImp, sizeof(struct AHIRequest)))
553 AHIio->ahir_Version = 4; /* Open at least version 4. */
554 if(!(AHIDevice = OpenDevice(AHINAME, AHI_NO_UNIT,
555 (struct IORequest *) AHIio, NULL)))
557 AHIBase = (struct Library *) AHIio->ahir_Std.io_Device;
559 // AHI's functions can now be called as normal library functions:
560 AHI_NextAudioID(AHI_INVALID_ID);
562 CloseDevice((struct IORequest *) AHIio);
565 DeleteIORequest((struct IORequest *) AHIio);
568 DeleteMsgPort(AHImp);
575 @c ***********************************************************************
576 @c **** Obtaining The Hardware *******************************************
577 @c ***********************************************************************
579 @node Obtaining The Hardware, Declaring Sounds, Opening And Closing ahi.device For Low-level Access, Function Interface
580 @comment node-name, next, previous, up
581 @section Obtaining The Hardware
583 If you wish to call any other function than
588 @code{AHI_AllocAudioRequestA()}
591 @code{AHI_AudioRequestA()}
594 @code{AHI_BestAudioIDA()}
597 @code{AHI_FreeAudioRequest()}
600 @code{AHI_GetAudioAttrsA()}
603 @code{AHI_NextAudioID()}
606 @code{AHI_SampleFrameSize()}
610 @findex AHI_AllocAudioA()
612 @vindex ahiac_UserData
614 @dots{}you have to allocate the actual sound hardware. This is done with
615 @code{AHI_AllocAudioA()}. @code{AHI_AllocAudioA()} returns an
616 @code{AHIAudioCtrl} structure, or @code{NULL} if the hardware could not be
617 allocated. The @code{AHIAudioCtrl} structure has only one public field,
618 @code{ahiac_UserData}. This is unused by @sc{Ahi} and you may store
619 anything you like here.
621 If @code{AHI_AllocAudioA()} fails it is important that you handle the
622 situation gracefully.
624 @findex AHI_FreeAudio()
626 When you are finished playing or recording, call @code{AHI_FreeAudio()} to
627 deallocate the hardware and other resources allocated by
628 @code{AHI_AllocAudioA()}. @code{AHI_FreeAudio()} also deallocates all
629 loaded sounds (@pxref{Declaring Sounds}).
632 @subsection @code{AHI_AllocAudioA()} Tags
634 @code{AHI_AllocAudioA()} takes several tags as input.
638 @vindex AHI_DEFAULT_ID
641 This is the audio mode to be used. You must not use any hardcoded values
642 other than @code{AHI_DEFAULT_ID}, which is the user's default fallback ID.
643 In most cases you should ask the user for an ID code (with
644 @code{AHI_AudioRequestA()}) and then store the value in your settings file.
646 @vindex AHI_DEFAULT_FREQ
649 This is the mixing frequency to be used. The actual frequency will be
650 rounded to the nearest frequency supported by the sound hardware. To find
651 the actual frequency, use @code{AHI_GetAudioAttrsA()}. If omitted or
652 @code{AHI_DEFAULT_FREQ}, the user's preferred fallback frequency will be
653 used. In most cases you should ask the user for a frequency (with
654 @code{AHI_AudioRequestA()}) and then store the value in your settings file.
657 All sounds are played on a @dfn{channel}, and this tag selects how many you
658 wish to use. In general it takes more CPU power the more channels you use
659 and the volume gets lower and lower.
662 You must tell @sc{Ahi} how many different sounds you are going to play.
663 @xref{Declaring Sounds} for more information.
665 @tindex AHISoundMessage
666 @vindex ahism_Channel
669 With this tag you tell @sc{Ahi} to call a hook when a sound has been
670 started. It works just like Paula's audio interrupts. The hook receives an
671 @code{AHISoundMessage} structure as message.
672 @code{AHISoundMessage->ahism_Channel} indicates which channel the sound
673 that caused the hook to be called is played on.
675 @item AHIA_PlayerFunc
676 If you are going to play a musical score, you should use this ``interrupt''
677 source instead of VBLANK or CIA timers in order to get the best result with
678 all audio drivers. If you cannot use this, you must not use any
679 ``non-realtime'' modes (see @code{AHI_GetAudioAttrsA()} in the autodocs,
680 the @code{AHIDB_Realtime} tag).
682 @item AHIA_PlayerFreq
683 If non-zero, it enables timing and specifies how many times per second
684 @code{PlayerFunc} will be called. This must be specified if
685 @code{AHIA_PlayerFunc} is! It is suggested that you keep the frequency
686 below 100-200 Hz. Since the frequency is a fixpoint number
687 @code{AHIA_PlayerFreq} should be less than 13107200 (that's 200 Hz).
689 @item AHIA_MinPlayerFreq
690 The minimum frequency (@code{AHIA_PlayerFreq}) you will use. You should
691 always supply this if you are using the device's interrupt feature!
693 @item AHIA_MaxPlayerFreq
694 The maximum frequency (@code{AHIA_PlayerFreq}) you will use. You should
695 always supply this if you are using the device's interrupt feature!
697 @item AHIA_RecordFunc
698 This hook will be called regularly when sampling is turned on (see
699 @code{AHI_ControlAudioA()}). It is important that you always check the
700 format of the sampled data, and ignore it if you can't parse it. Since
701 this hook may be called from an interrupt, it is not legal to directly
702 @code{Write()} the buffer to disk. To record directly to harddisk you
703 have to copy the samples to another buffer and signal a process to save it.
704 To find out the required size of the buffer, see
705 @code{AHI_GetAudioAttrsA()} in the autodocs, the
706 @code{AHIDB_MaxRecordSamples} tag.
708 @vindex ahiac_UserData
711 Can be used to initialize the @code{ahiac_UserData} field. You do not have
712 to use this tag to change @code{ahiac_UserData}, you may write to it
715 @item AHIA_AntiClickSamples
716 New for version 6, this tag specifies how many sample frames a sound
717 may be delayed when started in order to reduce clicking. In practice,
718 the currently playing sound will continue until a zero-crossing is
719 found or @code{AHIA_AntiClickSamples} samples have been
720 processed. After that, the new sound will be started.
722 The default for this tag can be set by the user in the preferences
723 program. Set it to 0 to disable this feature.
727 @c ***********************************************************************
728 @c **** Declaring Sounds *************************************************
729 @c ***********************************************************************
731 @node Declaring Sounds, Making Noise, Obtaining The Hardware, Function Interface
732 @comment node-name, next, previous, up
733 @section Declaring Sounds
735 @cindex Loading Sounds
736 @cindex Unloading Sounds
738 @findex AHI_LoadSound()
740 Before you can play a sample array, you must @code{AHI_LoadSound()} it.
741 Why? Because if @sc{Ahi} knows what kind of sounds that will be played
742 later, tables and stuff can be set up in advance. Some drivers may even
743 upload the samples to the sound cards local RAM and play all samples from
744 there, drastically reducing CPU and bus load.
746 You should @code{AHI_LoadSound()} the most important sounds first, since
747 the sound cards RAM may not be large enough to hold all your sounds.
749 @code{AHI_LoadSound()} also associates each sound or sample array with a
750 number, which is later used to refer to that particular sound.
752 There are 2 types of sounds, namely @code{AHIST_SAMPLE} and
753 @code{AHIST_DYNAMICSAMPLE}.
755 @c and @code{AHIST_INPUT}.
760 This is used for static samples. Most sounds that will be played are of
761 this type. Once the samples have been ``loaded'', you may not alter the
762 memory where the samples are located. You may, however, read from it.
764 @item AHIST_DYNAMICSAMPLE
765 If you wish to play samples that you calculate in realtime, or load in
766 portions from disk, you must use this type. These samples will never be
767 uploaded to a sound cards local RAM, but always played from the normal
768 memory. There is a catch, however. Because of the fact that the sound is
769 mixed in chunks, you must have a certain number of samples in memory before
770 you start a sound of this type. To calculate the size of the buffer (in
771 samples), use the following formula:
774 @math{size = samples * Fs / Fm}
777 where samples is the value returned from @code{AHI_GetAudioAttrsA()} when
778 called with the @code{AHIDB_MaxPlaySamples} tag, Fs is the highest
779 frequency the sound will be played at and Fm is the actual mixing frequency
780 (@code{AHI_ControlAudioA()/AHIC_MixFreq_Query}).
784 @c This sound type is used to use @sc{Ahi}'s DSP-effects in real-time. [It
785 @c does not work yet. FIXIT]
789 The samples can be in one of seven different formats, named @code{AHIST_M8S},
790 @code{AHIST_S8S}, @code{AHIST_M16S}, @code{AHIST_S16S}, @code{AHIST_M32S},
791 @code{AHIST_S32S} and @code{AHIST_L7_1}
796 This is an 8 bit mono sound. Each sample frame is just one signed byte.
799 This is an 8 bit stereo sound. Each sample frame is one signed byte representing
800 the left channel, followed by another one for the right channel.
803 This is a 16 bit mono sound. Each sample frame is just one signed 16 bit
804 word, in big endian/network order format (most significant byte first).
807 This is a 16 bit stereo sound. Each sample frame is one signed 16 bit
808 word, in big endian/network order format (most significant byte first)
809 representing the left channel, followed by another one for the right
813 This is a 32 bit mono sound. Each sample frame is just one signed 32
814 bit word, in big endian/network order format (most significant byte
815 first). Note that only the 24 most significant bits are guaranteed to
816 be processed correctly! Support for this sample format was added in
820 This is a 32 bit stereo sound. Each sample frame is one signed 32 bit
821 word, in big endian/network order format (most significant byte first)
822 representing the left channel, followed by another one for the right
823 channel. Note that only the 24 most significant bits are guaranteed to
824 be processed correctly! Support for this sample format was added in
828 This is a 32 bit 7.1 sound. @strong{It will currently only work with
829 7.1 audio modes!} Each sample frame is one signed 32 bit word, in big
830 endian/network order format (most significant byte first) representing
831 the left front channel, followed by six other words for the right
832 front, left back, right back, left surround, right surround, front
833 center and the LFE channel. Note that only the 24 most significant
834 bits are guaranteed to be processed correctly! ``Support'' for this
835 sample format was added in V6.
839 @findex AHI_UnloadSound()
841 If you know that you won't use a sound anymore, call
842 @code{AHI_UnloadSound()}. @code{AHI_FreeAudio()} will also do that for you
843 for any sounds left when called.
845 There is no need to place a sample array in @dfn{Chip memory}, but it
846 @strong{must not} be swapped out! Allocate your sample memory with the
847 @code{MEMF_PUBLIC} flag set. If you wish to have your samples in virtual
848 memory, you have to write a double-buffer routine that copies a chunk of
849 memory to a @code{MEMF_PUBLIC} buffer. The @dfn{SoundFunc} should signal a
850 task to do the transfer, since it may run in supervisor mode (see
851 @code{AHI_AllocAudioA()}).
854 @c ***********************************************************************
855 @c **** Making Noise *****************************************************
856 @c ***********************************************************************
858 @node Making Noise, , Declaring Sounds, Function Interface
859 @comment node-name, next, previous, up
860 @section Making Noise
862 @findex AHI_ControlAudioA()
865 After you have allocated the sound hardware and declared all your sounds,
866 you're ready to start playback. This is done with a call to
867 @code{AHI_ControlAudioA()}, with the @code{AHIC_Play} tag set to
868 @code{TRUE}. When this function returns the @dfn{PlayerFunc} (see
869 @code{AHI_AllocAudioA()}) is active, and the audio driver is feeding
870 silence to the sound hardware.
872 @subsection Playing A Sound
874 @findex AHI_SetSound()
875 @findex AHI_SetFreq()
878 All you have to do now is to set the desired sound, it's frequency and
879 volume. This is done with @code{AHI_SetSound()}, @code{AHI_SetFreq()} and
880 @code{AHI_SetVol()}. Make sure the @code{AHISF_IMM} flag is set for all
881 these function's @var{flag} argument. And don't try to modify a channel
882 that is out of range! If you have allocated 4 channels you may only modify
885 The sound will not start until both @code{AHI_SetSound()} and
886 @code{AHI_SetFreq()} have been called. The sound will play even if
887 @code{AHI_SetVol()} was not called, but it will play completely silent. If
888 you wish to temporary stop a sound, set its frequency to 0. When you
889 change the frequency again, the sound will continue where it was.
891 @vindex AHISF_NODELAY
893 The actual beginning of sound might be delayed slightly, depending on
894 the value of the @code{AHIA_AntiClickSamples} tag passed to
895 @code{AHI_AllocAudioA()}. Should you wish to override this, set the
896 @code{AHISF_NODELAY} in addition to @code{AHISF_IMM}.
901 When the sound has been started it will play to the end and then repeat.
902 In order to play a one-shot sound you have use the @code{AHI_PlayA()}
903 function, or install a sound interrupt using the @code{AHIA_SoundFunc} tag
904 with @code{AHI_AllocAudioA()}. For more information about using sound
905 interrupts, see below.
907 A little note regarding @code{AHI_SetSound()}: @var{Offset} is the first
908 sample frame that will be played, both when playing backwards and forwards.
909 This means that if you call @code{AHI_SetSound()} with @var{offset} 0 and
910 @var{length} 4, sample fram 0, 1, 2 and 3 will be played. If you call
911 @code{AHI_SetSound()} with @var{offset} 3 and @var{length} @minus{}4,
912 sample frame 3, 2, 1 and 0 will be played.
914 Also note that playing very short sounds will be very CPU intensive, since
915 there are many tasks that must be done each time a sound has reached its
916 end (like starting the next one, calling the @dfn{SoundFunc}, etc.).
917 Therefore, it is recommended that you ``unroll'' short sounds a couple of
918 times before you play them. How many times you should unroll? Well, it
919 depends on the situation, of course, but try making the sound a thousand
920 samples long if you can. Naturally, if you need your @dfn{SoundFunc} to
921 be called, you cannot unroll.
923 @subsection Playing One-shot Sounds And Advanced Loops
927 In version 4, some changes have been made since earlier releases.
928 One-shot sounds and sounds with only one loop segment can now be played
929 without using sample interrupts. This is possible because one of the
930 restrictions regarding the @code{AHISF_IMM} flag has been removed.
932 The @code{AHISF_IMM} flag determines if @code{AHI_SetSound()},
933 @code{AHI_SetFreq()} and @code{AHI_SetVol()} should take effect immediately
934 or when the current sound has reached its end. The rules for this flags
940 If used inside a sample interrupt (@dfn{SoundFunc}): Must be cleared.
943 If used inside a player interrupt (@dfn{PlayerFunc}): May be set or
947 If used elsewhere: Must be set.
951 What does this mean? It means that if all you want to do is to play a
952 one-shot sound from inside a @dfn{PlayerFunc}, you can do that by first
953 calling @code{AHI_SetSound()}, @code{AHI_SetFreq()} and @code{AHI_SetVol()}
954 with @code{AHISF_IMM} set, and then use @code{AHI_SetSound(ch, AHI_NOSOUND,
955 0, 0, actrl, 0L)} to stop the sound when it has reached the end. You can
956 also set one loop segment this way.
958 @code{AHI_PlayA()} was added in @sc{Ahi} version 4, and combines
959 @code{AHI_SetSound()}, @code{AHI_SetFreq()} and @code{AHI_SetVol()} into
960 one tag-based function. It also allows you to set one loop and play
963 To play a sound with more than one loop segment or ping-pong looping, a
964 sample interrupt needs to be used. @sc{Ahi}'s @dfn{SoundFunc} works like Paula's
965 interrupts and is very easy to use.
967 The @dfn{SoundFunc} hook will be called with an @code{AHIAudioCtrl}
968 structure as object and an @code{AHISoundMessage} structure as message.
969 @code{ahism_Channel} indicates which channel caused the hook to be called.
971 An example @dfn{SoundFunc} which handles the repeat part of an instrument
972 can look like this (SAS/C code):
975 __asm __saveds ULONG SoundFunc(register __a0 struct Hook *hook,
976 register __a2 struct AHIAudioCtrl *actrl,
977 register __a1 struct AHISoundMessage *chan)
979 if(ChannelDatas[chan->ahism_Channel].Length)
980 AHI_SetSound(chan->ahism_Channel, 0,
981 (ULONG) ChannelDatas[chan->ahism_Channel].Address,
982 ChannelDatas[chan->ahism_Channel].Length,
985 AHI_SetSound(chan->ahism_Channel, AHI_NOSOUND,
986 NULL, NULL, actrl, NULL);
992 This example is from an old version of the @sc{Ahi} NotePlayer for
993 @dfn{DeliTracker 2}. @code{ChannelDatas} is an array where the start and
994 length of the repeat part is stored. Here, a repeat length of zero
995 indicates a one-shot sound. Note that this particular example only uses
996 one sound (0). For applications using multiple sounds, the sound number
997 would have to be stored in the array as well.
999 Once again, note that the @code{AHISF_IMM} flag should @strong{never} be
1000 set in a @dfn{SoundFunc} hook!
1003 @subsection Tricks With The Volume
1005 @cindex Surround sound
1007 Starting with V4, @code{AHI_SetVol()} can take both negative volume and
1008 pan parameters. If you set the volume to a negative value, the sample
1009 will, if the audio mode supports it, invert each sample before playing. If
1010 pan is negative, the sample will be encoded to go to the surround speakers.
1014 @c ***********************************************************************
1015 @c ***********************************************************************
1016 @c **** Device Interface *************************************************
1017 @c ***********************************************************************
1018 @c ***********************************************************************
1020 @node Device Interface, Data Types And Structures, Function Interface, Top
1021 @comment node-name, next, previous, up
1022 @chapter Device Interface
1024 @cindex Music, streams from disk
1025 @cindex Playing audio streams
1026 @cindex Audio streams, playing
1027 @cindex Sound effects, system
1028 @cindex Recording, quick and easy
1030 The I/O request protocol makes it very easy to play audio streams, sounds
1031 from disk and non time-critical sound effects in a multitasking friendly
1032 way. Recoding is just as easy, on behalf of quality. Several programs can
1033 play sounds at the same time, and even record at the same time if your
1034 hardware is full duplex.
1036 If you want to write a sample player, play (warning?) sounds in your
1037 applications, play an audio stream from a CD via the SCSI/IDE bus, write a
1038 voice command utility etc., this is the API to use.
1040 Note that while all the low-level functions (@pxref{Function Interface})
1041 count lengths and offsets in sample frames, the device interface---like all
1042 Amiga devices---uses bytes.
1045 @c ***********************************************************************
1046 @c **** Opening And Closing ahi.device For High-level Access *************
1047 @c ***********************************************************************
1050 * Opening And Closing ahi.device For High-level Access::
1051 * Reading From The Device::
1052 * Writing To The Device::
1055 @node Opening And Closing ahi.device For High-level Access, Reading From The Device, Device Interface, Device Interface
1056 @comment node-name, next, previous, up
1057 @section Opening And Closing @code{ahi.device} For High-level Access
1059 Four primary steps are required to open ahi.device:
1064 Create a message port using @code{CreateMsgPort()}. Reply messages from
1065 the device must be directed to a message port.
1070 Create an extended I/O request structure of type @code{AHIRequest} using
1071 @code{CreateIORequest()}. @code{CreateIORequest()} will initialize the I/O
1072 request to point to your reply port.
1075 Specify which version of the device you need. The lowest supported version
1076 is 4. Version 1 and 3 are obsolete, and version 2 only has the low-level
1079 @vindex AHI_DEFAULT_UNIT
1082 Open @code{ahi.device} unit @code{AHI_DEFAULT_UNIT} or any other unit the
1083 user has specified with, for example, a @var{UNIT} tooltype. Call
1084 @code{OpenDevice()}, passing the I/O request.
1088 Each @code{OpenDevice()} must eventually be matched by a call to
1089 @code{CloseDevice()}. When the last close is performed, the device will
1090 deallocate all resources.
1092 All I/O requests must be completed before @code{CloseDevice()}. Abort any
1093 pending requests with @code{AbortIO()}.
1098 struct MsgPort *AHImp = NULL;
1099 struct AHIRequest *AHIio = NULL;
1100 BYTE AHIDevice = -1;
1101 UBYTE unit = AHI_DEFAULT_UNIT;
1103 /* Check if user wants another unit here... */
1105 if(AHImp = CreateMsgPort())
1107 if(AHIio = (struct AHIRequest *)
1108 CreateIORequest(AHImp, sizeof(struct AHIRequest)))
1110 AHIio->ahir_Version = 4;
1111 if(!(AHIDevice = OpenDevice(AHINAME, unit,
1112 (struct IORequest *) AHIio, NULL)))
1116 /* Send commands to the device here... */
1119 if(! CheckIO((struct IORequest *) AHIio))
1121 AbortIO((struct IORequest *) AHIio);
1124 WaitIO((struct IORequest *) AHIio);
1126 CloseDevice((struct IORequest *) AHIio);
1129 DeleteIORequest((struct IORequest *) AHIio);
1132 DeleteMsgPort(AHImp);
1139 @c ***********************************************************************
1140 @c **** Reading From The Device ******************************************
1141 @c ***********************************************************************
1143 @node Reading From The Device, Writing To The Device, Opening And Closing ahi.device For High-level Access, Device Interface
1144 @comment node-name, next, previous, up
1145 @section Reading From The Device
1155 @vindex ahir_Frequency
1159 You read from @code{ahi.device} by passing an @code{AHIRequest} to the
1160 device with @code{CMD_READ} set in @code{io_Command}, the number of bytes
1161 to be read set in @code{io_Length}, the address of the read buffer set in
1162 @code{io_Data}, the desired sample format set in @code{ahir_Type} and the
1163 desired sample frequency set in @code{ahir_Frequency}. The first read
1164 command in a sequence should also have @code{io_Offset} set to 0.
1165 @code{io_Length} must be an even multiple of the sample frame size.
1167 @subsection Double Buffering
1169 @cindex Double Buffering, reading
1171 To do double buffering, just fill the first buffer with @code{DoIO()} and
1172 @code{io_Offset} set to 0, then start filling the second buffer with
1173 @code{SendIO()} using the same I/O request (but don't clear
1174 @code{io_Offset}!). After you have processed the first buffer, wait until
1175 the I/O request is finished and start over with @code{SendIO()} on the
1178 @subsection Distortion
1180 @cindex Distortion, recording
1182 The samples will automatically be converted to the sample format set in
1183 @code{ahir_Type} and to the sample frequency set in @code{ahir_Frequency}.
1184 Because it is quite unlikely that you ask for the same sample frequency the
1185 user has chosen in the preference program, chances that the quality is
1186 lower than expected are pretty high. The worst problem is probably the
1187 anti-aliasing filter before the A/D converter. If the user has selected a
1188 higher sampling/mixing frequency than you request, the signal will be
1189 distorted according to the Nyquist sampling theorem. If, on the other
1190 hand, the user has selected a lower sampling/mixing frequency than you
1191 request, the signal will not be distorted but rather bandlimited more than
1195 @c ***********************************************************************
1196 @c **** Writing To The Device ********************************************
1197 @c ***********************************************************************
1199 @node Writing To The Device, , Reading From The Device, Device Interface
1200 @comment node-name, next, previous, up
1201 @section Writing To The Device
1212 @vindex ahir_Frequency
1214 @vindex ahir_Position
1219 You write to the device by passing an @code{AHIRequest} to the device with
1220 @code{CMD_WRITE} set in @code{io_Command}, the precedence in
1221 @code{io_Message.mn_Node.ln_Pri}, the number of bytes to be written in
1222 @code{io_Length}, the address of the write buffer set in @code{io_Data},
1223 the sample format set in @code{ahir_Type}, the desired sample frequency set
1224 in @code{ahir_Frequency}, the desired volume set in @code{ahir_Volume} and
1225 the desired stereo position set in @code{ahir_Position}. Unless you are
1226 doing double buffering, @code{ahir_Link} should be set to @code{NULL}.
1227 @code{io_Length} must be an even multiple of the sample frame size.
1229 @subsection Double Buffering
1231 @cindex Double Buffering, writing
1233 To do double buffering, you need two I/O requests. Create the second one
1234 by making a copy of the request you used in @code{OpenDevice()}. Start the
1235 first with @code{SendIO()}. Set @code{ahir_Link} in the second request to
1236 the address of the first request, and @code{SendIO()} it. Wait on the
1237 first, fill the first buffer again and repeat, this time with
1238 @code{ahir_Link} of the first buffer set to the address of the second I/O
1241 @subsection Distortion
1243 @cindex Distortion, playing
1245 The problems with aliasing are present but not as obvious as with reading.
1246 Just make sure your source data is bandlimited correctly, and do not play
1247 samples at a lower frequency than they were recorded.
1249 @subsection Playing multiple sounds at the same time
1251 If you want to play several sounds at the same time, just make a new copy
1252 of the I/O request you used in @code{OpenDevice()}, and @code{CMD_WRITE}
1253 it. The user has set the number of channels available in the preference
1254 tool, and if too many requests are sent to the device the one with lowest
1255 precedence will be muted. When a request is finished, the muted request
1256 with the highest precedence will be played. Note that all muted requests
1257 continue to play silently, so the programmer will not have to worry if
1258 there are enough channels or not.
1260 @subsection Suggested precedences
1264 The precedences to use depend on what kind of sound you are playing. The
1265 recommended precedences are the same as for @code{audio.device}, listed in
1266 @cite{AMIGA ROM Kernel Reference manual -- Devices}. Reprinted without
1267 permission. So sue me.
1270 Precedences | Type of sound
1271 -------------+----------------------------------------------------------
1272 127 | Unstoppable. Sounds first allocated at lower
1273 | precedencies, then set to this highest level.
1274 90 - 100 | Emergencies. Alert, urgent situation that requires
1276 80 - 90 | Annunciators. Attention, bell (CTRL-G).
1277 75 | Speech. Synthesized or recorded speech
1278 | (narrator.device).
1279 50 - 70 | Sonic cues. Sounds that provide information that is not
1280 | provided by graphics. Only the beginning of of each sound
1281 | should be at this level; the rest should ne set to sound
1283 -50 - 50 | Music program. Musical notes in a music-oriented program.
1284 | The higher levels should be used for the attack portions
1286 -70 - -50 | Sound effects. Sounds used in conjunction with graphics.
1287 | More important sounds should use higher levels.
1288 -100 - -80 | Background. Theme music and restartable background sounds.
1289 -128 | Silence. Lowest level (freeing the channel completely is
1293 @c @multitable @columnfractions .15 .75
1295 @c @item Precedences @tab Type of sound
1298 @c @tab Unstoppable. Sounds first allocated at lower precendencies, then set
1299 @c to this highest level.
1302 @c @tab Emergencies. Alert, urgent situation that requires immediate action.
1305 @c @tab Annunciators. Attention, bell (CTRL-G).
1308 @c @tab Speech. Synthesized or recorded speech (narrator.device).
1311 @c @tab Sonic cues. Sounds that provide information that is not
1312 @c provided by graphics. Only the beginning of of each sound
1313 @c should be at this level; the rest should ne set to sound
1316 @c @item @minus{}50 - 50
1317 @c @tab Music program. Musical notes in a music-oriented program. The higher
1318 @c levels should be used for the attack portions of each note.
1320 @c @item @minus{}70 - @minus{}50
1321 @c @tab Sound effects. Sounds used in conjunction with graphics. More
1322 @c important sounds should use higher levels.
1324 @c @item @minus{}100 - @minus{}80
1325 @c @tab Background. Theme music and restartable background sounds.
1327 @c @item @minus{}128
1328 @c @tab Silence. Lowest level (freeing the channel completely is preferred).
1332 Right. As you can see, some things do not apply to @code{ahi.device}.
1333 First, there is no way to change the precedence of a playing sound, so the
1334 precedences should be set from the beginning. Second, it is not
1335 recommended to use the device interface to play music. However, playing an
1336 audio stream from CD or disk comes very close. Third, there are no channels
1337 to free in @sc{Ahi} since they are dynamically allocated by the device.
1340 @c ***********************************************************************
1341 @c ***********************************************************************
1342 @c **** Data Types And Structures ****************************************
1343 @c ***********************************************************************
1344 @c ***********************************************************************
1346 @node Data Types And Structures, GPL, Device Interface, Top
1347 @comment node-name, next, previous, up
1348 @chapter Data Types And Structures
1350 @cindex Data Types And Structures
1352 In this chapter some of the data types and structures used will be
1353 explained. For more information, please consult the autodocs and the
1362 @c ***********************************************************************
1363 @c **** Data Types *******************************************************
1364 @c ***********************************************************************
1366 @node Data Types, Structures, Data Types And Structures, Data Types And Structures
1367 @comment node-name, next, previous, up
1372 @subsection @code{Fixed}
1376 @code{Fixed} is a signed long integer. It is used to represent decimal
1377 numbers without using floating point arithmetics. The decimal point is
1378 assumed to be in the middle of the 32 bit integer, thus giving 16 bits for
1379 the integer part of the number and 16 bits for the fraction. The largest
1380 number that can be stored in a @code{Fixed} is +32767.999984741, and the
1381 lowest number is @minus{}32768.
1397 @subsection @code{sposition}
1401 @code{sposition} (stereo position) is a @code{Fixed}, and is used to
1402 represent the stereo position of a sound. 0 is far left, 0.5 is center and
1406 @c ***********************************************************************
1407 @c **** Structures *******************************************************
1408 @c ***********************************************************************
1410 @node Structures, , Data Types, Data Types And Structures
1411 @comment node-name, next, previous, up
1416 @subsection @code{AHIUnitPrefs} And @code{AHIGlobalPrefs}
1418 @tindex AHIUnitPrefs
1419 @tindex AHIGlobalPrefs
1421 These structures are used in the @code{AHIU} and @code{AHIG} chunks,
1422 respective, which are part of the settings file (@file{ENV:Sys/ahi.prefs}),
1423 The file is read by @sc{Ahi} on each call to @code{OpenDevice()}, just
1424 before the audio hardware is allocated.
1426 @code{AHIUnitPrefs} specifies the audio mode and its parameters to use for
1427 each device unit (currently 0-3 and @code{AHI_NO_UNIT}; unit 0 is also called
1428 @code{AHI_DEFAULT_UNIT}).
1430 @code{AHIGlobalPrefs} contains some global options that can be used to
1431 gain speed on slow CPUs, the global debug level and a protection against
1432 CPU overload. The debug level specifies which of the functions in @sc{Ahi}
1433 should print debugging information to the serial port (the output can be
1434 redirected to a console window or a file with tools like @dfn{Sushi}
1435 @footnote{Available from AmiNet, for example @*
1436 @url{ftp://ftp.germany.aminet.org/pub/aminet/dev/debug/Sushi.lha}.}).
1439 @c ***********************************************************************
1440 @c **** GNU General Public License ***************************************
1441 @c ***********************************************************************
1443 @node GPL, LGPL, Data Types And Structures, Top
1444 @comment node-name, next, previous, up
1445 @unnumbered GNU GENERAL PUBLIC LICENSE
1446 @center Version 2, June 1991
1449 Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
1450 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1452 Everyone is permitted to copy and distribute verbatim copies
1453 of this license document, but changing it is not allowed.
1456 @unnumberedsec Preamble
1458 The licenses for most software are designed to take away your
1459 freedom to share and change it. By contrast, the GNU General Public
1460 License is intended to guarantee your freedom to share and change free
1461 software---to make sure the software is free for all its users. This
1462 General Public License applies to most of the Free Software
1463 Foundation's software and to any other program whose authors commit to
1464 using it. (Some other Free Software Foundation software is covered by
1465 the GNU Library General Public License instead.) You can apply it to
1468 When we speak of free software, we are referring to freedom, not
1469 price. Our General Public Licenses are designed to make sure that you
1470 have the freedom to distribute copies of free software (and charge for
1471 this service if you wish), that you receive source code or can get it
1472 if you want it, that you can change the software or use pieces of it
1473 in new free programs; and that you know you can do these things.
1475 To protect your rights, we need to make restrictions that forbid
1476 anyone to deny you these rights or to ask you to surrender the rights.
1477 These restrictions translate to certain responsibilities for you if you
1478 distribute copies of the software, or if you modify it.
1480 For example, if you distribute copies of such a program, whether
1481 gratis or for a fee, you must give the recipients all the rights that
1482 you have. You must make sure that they, too, receive or can get the
1483 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.
1490 Also, for each author's protection and ours, we want to make certain
1491 that everyone understands that there is no warranty for this free
1492 software. If the software is modified by someone else and passed on, we
1493 want its recipients to know that what they have is not the original, so
1494 that any problems introduced by others will not reflect on the original
1495 authors' reputations.
1497 Finally, any free program is threatened constantly by software
1498 patents. We wish to avoid the danger that redistributors of a free
1499 program will individually obtain patent licenses, in effect making the
1500 program proprietary. To prevent this, we have made it clear that any
1501 patent must be licensed for everyone's free use or not licensed at all.
1503 The precise terms and conditions for copying, distribution and
1504 modification follow.
1507 @unnumberedsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
1510 @center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
1515 This License applies to any program or other work which contains
1516 a notice placed by the copyright holder saying it may be distributed
1517 under the terms of this General Public License. The ``Program'', below,
1518 refers to any such program or work, and a ``work based on the Program''
1519 means either the Program or any derivative work under copyright law:
1520 that is to say, a work containing the Program or a portion of it,
1521 either verbatim or with modifications and/or translated into another
1522 language. (Hereinafter, translation is included without limitation in
1523 the term ``modification''.) Each licensee is addressed as ``you''.
1525 Activities other than copying, distribution and modification are not
1526 covered by this License; they are outside its scope. The act of
1527 running the Program is not restricted, and the output from the Program
1528 is covered only if its contents constitute a work based on the
1529 Program (independent of having been made by running the Program).
1530 Whether that is true depends on what the Program does.
1533 You may copy and distribute verbatim copies of the Program's
1534 source code as you receive it, in any medium, provided that you
1535 conspicuously and appropriately publish on each copy an appropriate
1536 copyright notice and disclaimer of warranty; keep intact all the
1537 notices that refer to this License and to the absence of any warranty;
1538 and give any other recipients of the Program a copy of this License
1539 along with the Program.
1541 You may charge a fee for the physical act of transferring a copy, and
1542 you may at your option offer warranty protection in exchange for a fee.
1545 You may modify your copy or copies of the Program or any portion
1546 of it, thus forming a work based on the Program, and copy and
1547 distribute such modifications or work under the terms of Section 1
1548 above, provided that you also meet all of these conditions:
1552 You must cause the modified files to carry prominent notices
1553 stating that you changed the files and the date of any change.
1556 You must cause any work that you distribute or publish, that in
1557 whole or in part contains or is derived from the Program or any
1558 part thereof, to be licensed as a whole at no charge to all third
1559 parties under the terms of this License.
1562 If the modified program normally reads commands interactively
1563 when run, you must cause it, when started running for such
1564 interactive use in the most ordinary way, to print or display an
1565 announcement including an appropriate copyright notice and a
1566 notice that there is no warranty (or else, saying that you provide
1567 a warranty) and that users may redistribute the program under
1568 these conditions, and telling the user how to view a copy of this
1569 License. (Exception: if the Program itself is interactive but
1570 does not normally print such an announcement, your work based on
1571 the Program is not required to print an announcement.)
1574 These requirements apply to the modified work as a whole. If
1575 identifiable sections of that work are not derived from the Program,
1576 and can be reasonably considered independent and separate works in
1577 themselves, then this License, and its terms, do not apply to those
1578 sections when you distribute them as separate works. But when you
1579 distribute the same sections as part of a whole which is a work based
1580 on the Program, the distribution of the whole must be on the terms of
1581 this License, whose permissions for other licensees extend to the
1582 entire whole, and thus to each and every part regardless of who wrote it.
1584 Thus, it is not the intent of this section to claim rights or contest
1585 your rights to work written entirely by you; rather, the intent is to
1586 exercise the right to control the distribution of derivative or
1587 collective works based on the Program.
1589 In addition, mere aggregation of another work not based on the Program
1590 with the Program (or with a work based on the Program) on a volume of
1591 a storage or distribution medium does not bring the other work under
1592 the scope of this License.
1595 You may copy and distribute the Program (or a work based on it,
1596 under Section 2) in object code or executable form under the terms of
1597 Sections 1 and 2 above provided that you also do one of the following:
1601 Accompany it with the complete corresponding machine-readable
1602 source code, which must be distributed under the terms of Sections
1603 1 and 2 above on a medium customarily used for software interchange; or,
1606 Accompany it with a written offer, valid for at least three
1607 years, to give any third party, for a charge no more than your
1608 cost of physically performing source distribution, a complete
1609 machine-readable copy of the corresponding source code, to be
1610 distributed under the terms of Sections 1 and 2 above on a medium
1611 customarily used for software interchange; or,
1614 Accompany it with the information you received as to the offer
1615 to distribute corresponding source code. (This alternative is
1616 allowed only for noncommercial distribution and only if you
1617 received the program in object code or executable form with such
1618 an offer, in accord with Subsection b above.)
1621 The source code for a work means the preferred form of the work for
1622 making modifications to it. For an executable work, complete source
1623 code means all the source code for all modules it contains, plus any
1624 associated interface definition files, plus the scripts used to
1625 control compilation and installation of the executable. However, as a
1626 special exception, the source code distributed need not include
1627 anything that is normally distributed (in either source or binary
1628 form) with the major components (compiler, kernel, and so on) of the
1629 operating system on which the executable runs, unless that component
1630 itself accompanies the executable.
1632 If distribution of executable or object code is made by offering
1633 access to copy from a designated place, then offering equivalent
1634 access to copy the source code from the same place counts as
1635 distribution of the source code, even though third parties are not
1636 compelled to copy the source along with the object code.
1639 You may not copy, modify, sublicense, or distribute the Program
1640 except as expressly provided under this License. Any attempt
1641 otherwise to copy, modify, sublicense or distribute the Program is
1642 void, and will automatically terminate your rights under this License.
1643 However, parties who have received copies, or rights, from you under
1644 this License will not have their licenses terminated so long as such
1645 parties remain in full compliance.
1648 You are not required to accept this License, since you have not
1649 signed it. However, nothing else grants you permission to modify or
1650 distribute the Program or its derivative works. These actions are
1651 prohibited by law if you do not accept this License. Therefore, by
1652 modifying or distributing the Program (or any work based on the
1653 Program), you indicate your acceptance of this License to do so, and
1654 all its terms and conditions for copying, distributing or modifying
1655 the Program or works based on it.
1658 Each time you redistribute the Program (or any work based on the
1659 Program), the recipient automatically receives a license from the
1660 original licensor to copy, distribute or modify the Program subject to
1661 these terms and conditions. You may not impose any further
1662 restrictions on the recipients' exercise of the rights granted herein.
1663 You are not responsible for enforcing compliance by third parties to
1667 If, as a consequence of a court judgment or allegation of patent
1668 infringement or for any other reason (not limited to patent issues),
1669 conditions are imposed on you (whether by court order, agreement or
1670 otherwise) that contradict the conditions of this License, they do not
1671 excuse you from the conditions of this License. If you cannot
1672 distribute so as to satisfy simultaneously your obligations under this
1673 License and any other pertinent obligations, then as a consequence you
1674 may not distribute the Program at all. For example, if a patent
1675 license would not permit royalty-free redistribution of the Program by
1676 all those who receive copies directly or indirectly through you, then
1677 the only way you could satisfy both it and this License would be to
1678 refrain entirely from distribution of the Program.
1680 If any portion of this section is held invalid or unenforceable under
1681 any particular circumstance, the balance of the section is intended to
1682 apply and the section as a whole is intended to apply in other
1685 It is not the purpose of this section to induce you to infringe any
1686 patents or other property right claims or to contest validity of any
1687 such claims; this section has the sole purpose of protecting the
1688 integrity of the free software distribution system, which is
1689 implemented by public license practices. Many people have made
1690 generous contributions to the wide range of software distributed
1691 through that system in reliance on consistent application of that
1692 system; it is up to the author/donor to decide if he or she is willing
1693 to distribute software through any other system and a licensee cannot
1696 This section is intended to make thoroughly clear what is believed to
1697 be a consequence of the rest of this License.
1700 If the distribution and/or use of the Program is restricted in
1701 certain countries either by patents or by copyrighted interfaces, the
1702 original copyright holder who places the Program under this License
1703 may add an explicit geographical distribution limitation excluding
1704 those countries, so that distribution is permitted only in or among
1705 countries not thus excluded. In such case, this License incorporates
1706 the limitation as if written in the body of this License.
1709 The Free Software Foundation may publish revised and/or new versions
1710 of the General Public License from time to time. Such new versions will
1711 be similar in spirit to the present version, but may differ in detail to
1712 address new problems or concerns.
1714 Each version is given a distinguishing version number. If the Program
1715 specifies a version number of this License which applies to it and ``any
1716 later version'', you have the option of following the terms and conditions
1717 either of that version or of any later version published by the Free
1718 Software Foundation. If the Program does not specify a version number of
1719 this License, you may choose any version ever published by the Free Software
1723 If you wish to incorporate parts of the Program into other free
1724 programs whose distribution conditions are different, write to the author
1725 to ask for permission. For software which is copyrighted by the Free
1726 Software Foundation, write to the Free Software Foundation; we sometimes
1727 make exceptions for this. Our decision will be guided by the two goals
1728 of preserving the free status of all derivatives of our free software and
1729 of promoting the sharing and reuse of software generally.
1732 @heading NO WARRANTY
1739 BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
1740 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW@. EXCEPT WHEN
1741 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
1742 PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
1743 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1744 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE@. THE ENTIRE RISK AS
1745 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU@. SHOULD THE
1746 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
1747 REPAIR OR CORRECTION.
1750 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
1751 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
1752 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
1753 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
1754 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
1755 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
1756 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
1757 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
1758 POSSIBILITY OF SUCH DAMAGES.
1762 @heading END OF TERMS AND CONDITIONS
1765 @center END OF TERMS AND CONDITIONS
1769 @unnumberedsec How to Apply These Terms to Your New Programs
1771 If you develop a new program, and you want it to be of the greatest
1772 possible use to the public, the best way to achieve this is to make it
1773 free software which everyone can redistribute and change under these terms.
1775 To do so, attach the following notices to the program. It is safest
1776 to attach them to the start of each source file to most effectively
1777 convey the exclusion of warranty; and each file should have at least
1778 the ``copyright'' line and a pointer to where the full notice is found.
1781 @var{one line to give the program's name and an idea of what it does.}
1782 Copyright (C) 19@var{yy} @var{name of author}
1784 This program is free software; you can redistribute it and/or
1785 modify it under the terms of the GNU General Public License
1786 as published by the Free Software Foundation; either version 2
1787 of the License, or (at your option) any later version.
1789 This program is distributed in the hope that it will be useful,
1790 but WITHOUT ANY WARRANTY; without even the implied warranty of
1791 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE@. See the
1792 GNU General Public License for more details.
1794 You should have received a copy of the GNU General Public License along
1795 with this program; if not, write to the Free Software Foundation, Inc.,
1796 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
1799 Also add information on how to contact you by electronic and paper mail.
1801 If the program is interactive, make it output a short notice like this
1802 when it starts in an interactive mode:
1805 Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author}
1806 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
1807 type `show w'. This is free software, and you are welcome
1808 to redistribute it under certain conditions; type `show c'
1812 The hypothetical commands @samp{show w} and @samp{show c} should show
1813 the appropriate parts of the General Public License. Of course, the
1814 commands you use may be called something other than @samp{show w} and
1815 @samp{show c}; they could even be mouse-clicks or menu items---whatever
1818 You should also get your employer (if you work as a programmer) or your
1819 school, if any, to sign a ``copyright disclaimer'' for the program, if
1820 necessary. Here is a sample; alter the names:
1824 Yoyodyne, Inc., hereby disclaims all copyright
1825 interest in the program `Gnomovision'
1826 (which makes passes at compilers) written
1829 @var{signature of Ty Coon}, 1 April 1989
1830 Ty Coon, President of Vice
1834 This General Public License does not permit incorporating your program into
1835 proprietary programs. If your program is a subroutine library, you may
1836 consider it more useful to permit linking proprietary applications with the
1837 library. If this is what you want to do, use the GNU Library General
1838 Public License instead of this License.
1840 @c ***********************************************************************
1841 @c **** GNU Library General Public License *******************************
1842 @c ***********************************************************************
1844 @node LGPL, Concept Index, GPL, Top
1845 @comment node-name, next, previous, up
1846 @unnumbered GNU LIBRARY GENERAL PUBLIC LICENSE
1848 @center Version 2, June 1991
1851 Copyright @copyright{} 1991 Free Software Foundation, Inc.
1852 675 Mass Ave, Cambridge, MA 02139, USA
1853 Everyone is permitted to copy and distribute verbatim copies
1854 of this license document, but changing it is not allowed.
1856 [This is the first released version of the library GPL. It is
1857 numbered 2 because it goes with version 2 of the ordinary GPL.]
1860 @unnumberedsec Preamble
1862 The licenses for most software are designed to take away your
1863 freedom to share and change it. By contrast, the GNU General Public
1864 Licenses are intended to guarantee your freedom to share and change
1865 free software---to make sure the software is free for all its users.
1867 This license, the Library General Public License, applies to some
1868 specially designated Free Software Foundation software, and to any
1869 other libraries whose authors decide to use it. You can use it for
1870 your libraries, too.
1872 When we speak of free software, we are referring to freedom, not
1873 price. Our General Public Licenses are designed to make sure that you
1874 have the freedom to distribute copies of free software (and charge for
1875 this service if you wish), that you receive source code or can get it
1876 if you want it, that you can change the software or use pieces of it
1877 in new free programs; and that you know you can do these things.
1879 To protect your rights, we need to make restrictions that forbid
1880 anyone to deny you these rights or to ask you to surrender the rights.
1881 These restrictions translate to certain responsibilities for you if
1882 you distribute copies of the library, or if you modify it.
1884 For example, if you distribute copies of the library, whether gratis
1885 or for a fee, you must give the recipients all the rights that we gave
1886 you. You must make sure that they, too, receive or can get the source
1887 code. If you link a program with the library, you must provide
1888 complete object files to the recipients so that they can relink them
1889 with the library, after making changes to the library and recompiling
1890 it. And you must show them these terms so they know their rights.
1892 Our method of protecting your rights has two steps: (1) copyright
1893 the library, and (2) offer you this license which gives you legal
1894 permission to copy, distribute and/or modify the library.
1896 Also, for each distributor's protection, we want to make certain
1897 that everyone understands that there is no warranty for this free
1898 library. If the library is modified by someone else and passed on, we
1899 want its recipients to know that what they have is not the original
1900 version, so that any problems introduced by others will not reflect on
1901 the original authors' reputations.
1903 Finally, any free program is threatened constantly by software
1904 patents. We wish to avoid the danger that companies distributing free
1905 software will individually obtain patent licenses, thus in effect
1906 transforming the program into proprietary software. To prevent this,
1907 we have made it clear that any patent must be licensed for everyone's
1908 free use or not licensed at all.
1910 Most GNU software, including some libraries, is covered by the ordinary
1911 GNU General Public License, which was designed for utility programs. This
1912 license, the GNU Library General Public License, applies to certain
1913 designated libraries. This license is quite different from the ordinary
1914 one; be sure to read it in full, and don't assume that anything in it is
1915 the same as in the ordinary license.
1917 The reason we have a separate public license for some libraries is that
1918 they blur the distinction we usually make between modifying or adding to a
1919 program and simply using it. Linking a program with a library, without
1920 changing the library, is in some sense simply using the library, and is
1921 analogous to running a utility program or application program. However, in
1922 a textual and legal sense, the linked executable is a combined work, a
1923 derivative of the original library, and the ordinary General Public License
1926 Because of this blurred distinction, using the ordinary General
1927 Public License for libraries did not effectively promote software
1928 sharing, because most developers did not use the libraries. We
1929 concluded that weaker conditions might promote sharing better.
1931 However, unrestricted linking of non-free programs would deprive the
1932 users of those programs of all benefit from the free status of the
1933 libraries themselves. This Library General Public License is intended to
1934 permit developers of non-free programs to use free libraries, while
1935 preserving your freedom as a user of such programs to change the free
1936 libraries that are incorporated in them. (We have not seen how to achieve
1937 this as regards changes in header files, but we have achieved it as regards
1938 changes in the actual functions of the Library.) The hope is that this
1939 will lead to faster development of free libraries.
1941 The precise terms and conditions for copying, distribution and
1942 modification follow. Pay close attention to the difference between a
1943 ``work based on the library'' and a ``work that uses the library''. The
1944 former contains code derived from the library, while the latter only
1945 works together with the library.
1947 Note that it is possible for a library to be covered by the ordinary
1948 General Public License rather than by this special one.
1951 @unnumberedsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
1954 @center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
1959 This License Agreement applies to any software library which
1960 contains a notice placed by the copyright holder or other authorized
1961 party saying it may be distributed under the terms of this Library
1962 General Public License (also called ``this License''). Each licensee is
1963 addressed as ``you''.
1965 A ``library'' means a collection of software functions and/or data
1966 prepared so as to be conveniently linked with application programs
1967 (which use some of those functions and data) to form executables.
1969 The ``Library'', below, refers to any such software library or work
1970 which has been distributed under these terms. A ``work based on the
1971 Library'' means either the Library or any derivative work under
1972 copyright law: that is to say, a work containing the Library or a
1973 portion of it, either verbatim or with modifications and/or translated
1974 straightforwardly into another language. (Hereinafter, translation is
1975 included without limitation in the term ``modification''.)
1977 ``Source code'' for a work means the preferred form of the work for
1978 making modifications to it. For a library, complete source code means
1979 all the source code for all modules it contains, plus any associated
1980 interface definition files, plus the scripts used to control compilation
1981 and installation of the library.
1983 Activities other than copying, distribution and modification are not
1984 covered by this License; they are outside its scope. The act of
1985 running a program using the Library is not restricted, and output from
1986 such a program is covered only if its contents constitute a work based
1987 on the Library (independent of the use of the Library in a tool for
1988 writing it). Whether that is true depends on what the Library does
1989 and what the program that uses the Library does.
1992 You may copy and distribute verbatim copies of the Library's
1993 complete source code as you receive it, in any medium, provided that
1994 you conspicuously and appropriately publish on each copy an
1995 appropriate copyright notice and disclaimer of warranty; keep intact
1996 all the notices that refer to this License and to the absence of any
1997 warranty; and distribute a copy of this License along with the
2000 You may charge a fee for the physical act of transferring a copy,
2001 and you may at your option offer warranty protection in exchange for a
2005 You may modify your copy or copies of the Library or any portion
2006 of it, thus forming a work based on the Library, and copy and
2007 distribute such modifications or work under the terms of Section 1
2008 above, provided that you also meet all of these conditions:
2012 The modified work must itself be a software library.
2015 You must cause the files modified to carry prominent notices
2016 stating that you changed the files and the date of any change.
2019 You must cause the whole of the work to be licensed at no
2020 charge to all third parties under the terms of this License.
2023 If a facility in the modified Library refers to a function or a
2024 table of data to be supplied by an application program that uses
2025 the facility, other than as an argument passed when the facility
2026 is invoked, then you must make a good faith effort to ensure that,
2027 in the event an application does not supply such function or
2028 table, the facility still operates, and performs whatever part of
2029 its purpose remains meaningful.
2031 (For example, a function in a library to compute square roots has
2032 a purpose that is entirely well-defined independent of the
2033 application. Therefore, Subsection 2d requires that any
2034 application-supplied function or table used by this function must
2035 be optional: if the application does not supply it, the square
2036 root function must still compute square roots.)
2039 These requirements apply to the modified work as a whole. If
2040 identifiable sections of that work are not derived from the Library,
2041 and can be reasonably considered independent and separate works in
2042 themselves, then this License, and its terms, do not apply to those
2043 sections when you distribute them as separate works. But when you
2044 distribute the same sections as part of a whole which is a work based
2045 on the Library, the distribution of the whole must be on the terms of
2046 this License, whose permissions for other licensees extend to the
2047 entire whole, and thus to each and every part regardless of who wrote
2050 Thus, it is not the intent of this section to claim rights or contest
2051 your rights to work written entirely by you; rather, the intent is to
2052 exercise the right to control the distribution of derivative or
2053 collective works based on the Library.
2055 In addition, mere aggregation of another work not based on the Library
2056 with the Library (or with a work based on the Library) on a volume of
2057 a storage or distribution medium does not bring the other work under
2058 the scope of this License.
2061 You may opt to apply the terms of the ordinary GNU General Public
2062 License instead of this License to a given copy of the Library. To do
2063 this, you must alter all the notices that refer to this License, so
2064 that they refer to the ordinary GNU General Public License, version 2,
2065 instead of to this License. (If a newer version than version 2 of the
2066 ordinary GNU General Public License has appeared, then you can specify
2067 that version instead if you wish.) Do not make any other change in
2070 Once this change is made in a given copy, it is irreversible for
2071 that copy, so the ordinary GNU General Public License applies to all
2072 subsequent copies and derivative works made from that copy.
2074 This option is useful when you wish to copy part of the code of
2075 the Library into a program that is not a library.
2078 You may copy and distribute the Library (or a portion or
2079 derivative of it, under Section 2) in object code or executable form
2080 under the terms of Sections 1 and 2 above provided that you accompany
2081 it with the complete corresponding machine-readable source code, which
2082 must be distributed under the terms of Sections 1 and 2 above on a
2083 medium customarily used for software interchange.
2085 If distribution of object code is made by offering access to copy
2086 from a designated place, then offering equivalent access to copy the
2087 source code from the same place satisfies the requirement to
2088 distribute the source code, even though third parties are not
2089 compelled to copy the source along with the object code.
2092 A program that contains no derivative of any portion of the
2093 Library, but is designed to work with the Library by being compiled or
2094 linked with it, is called a ``work that uses the Library''. Such a
2095 work, in isolation, is not a derivative work of the Library, and
2096 therefore falls outside the scope of this License.
2098 However, linking a ``work that uses the Library'' with the Library
2099 creates an executable that is a derivative of the Library (because it
2100 contains portions of the Library), rather than a ``work that uses the
2101 library''. The executable is therefore covered by this License.
2102 Section 6 states terms for distribution of such executables.
2104 When a ``work that uses the Library'' uses material from a header file
2105 that is part of the Library, the object code for the work may be a
2106 derivative work of the Library even though the source code is not.
2107 Whether this is true is especially significant if the work can be
2108 linked without the Library, or if the work is itself a library. The
2109 threshold for this to be true is not precisely defined by law.
2111 If such an object file uses only numerical parameters, data
2112 structure layouts and accessors, and small macros and small inline
2113 functions (ten lines or less in length), then the use of the object
2114 file is unrestricted, regardless of whether it is legally a derivative
2115 work. (Executables containing this object code plus portions of the
2116 Library will still fall under Section 6.)
2118 Otherwise, if the work is a derivative of the Library, you may
2119 distribute the object code for the work under the terms of Section 6.
2120 Any executables containing that work also fall under Section 6,
2121 whether or not they are linked directly with the Library itself.
2124 As an exception to the Sections above, you may also compile or
2125 link a ``work that uses the Library'' with the Library to produce a
2126 work containing portions of the Library, and distribute that work
2127 under terms of your choice, provided that the terms permit
2128 modification of the work for the customer's own use and reverse
2129 engineering for debugging such modifications.
2131 You must give prominent notice with each copy of the work that the
2132 Library is used in it and that the Library and its use are covered by
2133 this License. You must supply a copy of this License. If the work
2134 during execution displays copyright notices, you must include the
2135 copyright notice for the Library among them, as well as a reference
2136 directing the user to the copy of this License. Also, you must do one
2141 Accompany the work with the complete corresponding
2142 machine-readable source code for the Library including whatever
2143 changes were used in the work (which must be distributed under
2144 Sections 1 and 2 above); and, if the work is an executable linked
2145 with the Library, with the complete machine-readable ``work that
2146 uses the Library'', as object code and/or source code, so that the
2147 user can modify the Library and then relink to produce a modified
2148 executable containing the modified Library. (It is understood
2149 that the user who changes the contents of definitions files in the
2150 Library will not necessarily be able to recompile the application
2151 to use the modified definitions.)
2154 Accompany the work with a written offer, valid for at
2155 least three years, to give the same user the materials
2156 specified in Subsection 6a, above, for a charge no more
2157 than the cost of performing this distribution.
2160 If distribution of the work is made by offering access to copy
2161 from a designated place, offer equivalent access to copy the above
2162 specified materials from the same place.
2165 Verify that the user has already received a copy of these
2166 materials or that you have already sent this user a copy.
2169 For an executable, the required form of the ``work that uses the
2170 Library'' must include any data and utility programs needed for
2171 reproducing the executable from it. However, as a special exception,
2172 the source code distributed need not include anything that is normally
2173 distributed (in either source or binary form) with the major
2174 components (compiler, kernel, and so on) of the operating system on
2175 which the executable runs, unless that component itself accompanies
2178 It may happen that this requirement contradicts the license
2179 restrictions of other proprietary libraries that do not normally
2180 accompany the operating system. Such a contradiction means you cannot
2181 use both them and the Library together in an executable that you
2185 You may place library facilities that are a work based on the
2186 Library side-by-side in a single library together with other library
2187 facilities not covered by this License, and distribute such a combined
2188 library, provided that the separate distribution of the work based on
2189 the Library and of the other library facilities is otherwise
2190 permitted, and provided that you do these two things:
2194 Accompany the combined library with a copy of the same work
2195 based on the Library, uncombined with any other library
2196 facilities. This must be distributed under the terms of the
2200 Give prominent notice with the combined library of the fact
2201 that part of it is a work based on the Library, and explaining
2202 where to find the accompanying uncombined form of the same work.
2206 You may not copy, modify, sublicense, link with, or distribute
2207 the Library except as expressly provided under this License. Any
2208 attempt otherwise to copy, modify, sublicense, link with, or
2209 distribute the Library is void, and will automatically terminate your
2210 rights under this License. However, parties who have received copies,
2211 or rights, from you under this License will not have their licenses
2212 terminated so long as such parties remain in full compliance.
2215 You are not required to accept this License, since you have not
2216 signed it. However, nothing else grants you permission to modify or
2217 distribute the Library or its derivative works. These actions are
2218 prohibited by law if you do not accept this License. Therefore, by
2219 modifying or distributing the Library (or any work based on the
2220 Library), you indicate your acceptance of this License to do so, and
2221 all its terms and conditions for copying, distributing or modifying
2222 the Library or works based on it.
2225 Each time you redistribute the Library (or any work based on the
2226 Library), the recipient automatically receives a license from the
2227 original licensor to copy, distribute, link with or modify the Library
2228 subject to these terms and conditions. You may not impose any further
2229 restrictions on the recipients' exercise of the rights granted herein.
2230 You are not responsible for enforcing compliance by third parties to
2234 If, as a consequence of a court judgment or allegation of patent
2235 infringement or for any other reason (not limited to patent issues),
2236 conditions are imposed on you (whether by court order, agreement or
2237 otherwise) that contradict the conditions of this License, they do not
2238 excuse you from the conditions of this License. If you cannot
2239 distribute so as to satisfy simultaneously your obligations under this
2240 License and any other pertinent obligations, then as a consequence you
2241 may not distribute the Library at all. For example, if a patent
2242 license would not permit royalty-free redistribution of the Library by
2243 all those who receive copies directly or indirectly through you, then
2244 the only way you could satisfy both it and this License would be to
2245 refrain entirely from distribution of the Library.
2247 If any portion of this section is held invalid or unenforceable under any
2248 particular circumstance, the balance of the section is intended to apply,
2249 and the section as a whole is intended to apply in other circumstances.
2251 It is not the purpose of this section to induce you to infringe any
2252 patents or other property right claims or to contest validity of any
2253 such claims; this section has the sole purpose of protecting the
2254 integrity of the free software distribution system which is
2255 implemented by public license practices. Many people have made
2256 generous contributions to the wide range of software distributed
2257 through that system in reliance on consistent application of that
2258 system; it is up to the author/donor to decide if he or she is willing
2259 to distribute software through any other system and a licensee cannot
2262 This section is intended to make thoroughly clear what is believed to
2263 be a consequence of the rest of this License.
2266 If the distribution and/or use of the Library is restricted in
2267 certain countries either by patents or by copyrighted interfaces, the
2268 original copyright holder who places the Library under this License may add
2269 an explicit geographical distribution limitation excluding those countries,
2270 so that distribution is permitted only in or among countries not thus
2271 excluded. In such case, this License incorporates the limitation as if
2272 written in the body of this License.
2275 The Free Software Foundation may publish revised and/or new
2276 versions of the Library General Public License from time to time.
2277 Such new versions will be similar in spirit to the present version,
2278 but may differ in detail to address new problems or concerns.
2280 Each version is given a distinguishing version number. If the Library
2281 specifies a version number of this License which applies to it and
2282 ``any later version'', you have the option of following the terms and
2283 conditions either of that version or of any later version published by
2284 the Free Software Foundation. If the Library does not specify a
2285 license version number, you may choose any version ever published by
2286 the Free Software Foundation.
2289 If you wish to incorporate parts of the Library into other free
2290 programs whose distribution conditions are incompatible with these,
2291 write to the author to ask for permission. For software which is
2292 copyrighted by the Free Software Foundation, write to the Free
2293 Software Foundation; we sometimes make exceptions for this. Our
2294 decision will be guided by the two goals of preserving the free status
2295 of all derivatives of our free software and of promoting the sharing
2296 and reuse of software generally.
2299 @heading NO WARRANTY
2306 BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
2307 WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
2308 EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
2309 OTHER PARTIES PROVIDE THE LIBRARY ``AS IS'' WITHOUT WARRANTY OF ANY
2310 KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
2311 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2312 PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
2313 LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
2314 THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
2317 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
2318 WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
2319 AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
2320 FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
2321 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
2322 LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
2323 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
2324 FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
2325 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
2330 @heading END OF TERMS AND CONDITIONS
2333 @center END OF TERMS AND CONDITIONS
2337 @unnumberedsec How to Apply These Terms to Your New Libraries
2339 If you develop a new library, and you want it to be of the greatest
2340 possible use to the public, we recommend making it free software that
2341 everyone can redistribute and change. You can do so by permitting
2342 redistribution under these terms (or, alternatively, under the terms of the
2343 ordinary General Public License).
2345 To apply these terms, attach the following notices to the library. It is
2346 safest to attach them to the start of each source file to most effectively
2347 convey the exclusion of warranty; and each file should have at least the
2348 ``copyright'' line and a pointer to where the full notice is found.
2351 @var{one line to give the library's name and an idea of what it does.}
2352 Copyright (C) @var{year} @var{name of author}
2354 This library is free software; you can redistribute it and/or modify it
2355 under the terms of the GNU Library General Public License as published
2356 by the Free Software Foundation; either version 2 of the License, or (at
2357 your option) any later version.
2359 This library is distributed in the hope that it will be useful, but
2360 WITHOUT ANY WARRANTY; without even the implied warranty of
2361 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2362 Library General Public License for more details.
2364 You should have received a copy of the GNU Library General Public
2365 License along with this library; if not, write to the Free Software
2366 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2369 Also add information on how to contact you by electronic and paper mail.
2371 You should also get your employer (if you work as a programmer) or your
2372 school, if any, to sign a ``copyright disclaimer'' for the library, if
2373 necessary. Here is a sample; alter the names:
2376 Yoyodyne, Inc., hereby disclaims all copyright interest in the library
2377 `Frob' (a library for tweaking knobs) written by James Random Hacker.
2379 @var{signature of Ty Coon}, 1 April 1990
2380 Ty Coon, President of Vice
2383 That's all there is to it!
2386 @c Part 6: The End of the Document
2387 @c ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
2389 @c ***********************************************************************
2390 @c **** Concept Index ****************************************************
2391 @c ***********************************************************************
2393 @node Concept Index, Data Type Index, LGPL, Top
2394 @comment node-name, next, previous, up
2395 @unnumbered Concept Index
2402 @c ***********************************************************************
2403 @c **** Data Type Index **************************************************
2404 @c ***********************************************************************
2406 @node Data Type Index, Function Index, Concept Index, Top
2407 @unnumbered Data Type Index
2412 @c ***********************************************************************
2413 @c **** Function Index ***************************************************
2414 @c ***********************************************************************
2416 @node Function Index, Variable Index, Data Type Index, Top
2417 @unnumbered Function Index
2422 @c ***********************************************************************
2423 @c **** Variable Index ***************************************************
2424 @c ***********************************************************************
2426 @node Variable Index, , Function Index, Top
2427 @unnumbered Variable Index
2432 @c ***********************************************************************
2433 @c **** Contents *********************************************************
2434 @c ***********************************************************************