Debian Codegraph @

PORTING

raw
1 rplay PORTING - How to port rplay to other systems.
2
3 Last updated: Mon Nov 7 13:13:50 PST 1994
4
5 0. PORTING OVERVIEW
6 --------------------
7 This file describes the following rplay porting topics:
8
9 AUTO CONFIGURATION(1), AUDIO CONFIGURATION(2)
10
11 Please email new audio configurations to [email protected].
12
13
14 1. AUTO CONFIGURATION
15 ---------------------
16 Starting with 3.2.0, all system audio specific code is located in
17 separate files in the rplayd/audio directory. GNU autoconf is used to
18 determine what type of system you have and therefore what audio code
19 to use. Currently the following systems are automatically determined:
20
21 sun, solaris, hpux, sgi, linux, 386bsd, Free_BSD
22
23 New systems should be added to configure.in using the following linux example:
24
25 dnl
26 dnl Check for Linux
27 dnl
28 if test -z "$RPLAY_TARGET"; then
29 AC_MSG_CHECKING(for linux)
30 AC_EGREP_CPP(yes,
31 [
32 #ifdef linux
33 yes
34 #endif
35 ], is_linux=yes, is_linux=no)
36 AC_MSG_RESULT($is_linux)
37 if test $is_linux = "yes"; then
38 RPLAY_TARGET="linux"
39 fi
40 fi
41
42 You will see the above in configure.in. The important line is "#ifdef
43 linux" which references a unique preprocessor symbol for the system.
44 You will have to find a unique symbol that your preprocessor defines
45 so your system type can be automatically determined. If you have gcc
46 you can probably find your system's preprocessor defines in the specs
47 file.
48
49 Assume you have a foobar system and it defines __foobar__. You would
50 then have to add the following to configure.in:
51
52 dnl
53 dnl Check for foobar
54 dnl
55 if test -z "$RPLAY_TARGET"; then
56 AC_MSG_CHECKING(for foobar)
57 AC_EGREP_CPP(yes,
58 [
59 #ifdef __foobar__
60 yes
61 #endif
62 ], is_foobar=yes, is_foobar=no)
63 AC_MSG_RESULT($is_foobar)
64 if test $is_foobar = "yes"; then
65 RPLAY_TARGET="foobar"
66 fi
67 fi
68
69 This assumes that the foobar audio files will be called audio_foobar.c
70 and audio_foobar.h in the rplayd/audio directory. Now that you have a
71 new configure.in, you will have to create a new configure script. For
72 this, you will need to get the GNU autoconf package from your favorite
73 GNU archive site (prep.ai.mit.edu:/pub/gnu). After installing
74 autoconf, execute `autoconf' and a new `configure' script will be
75 created.
76
77 If you do not want to deal with installing autoconf, email me the
78 unique preprocessor symbol for your system and I'll create a configure
79 script for you. You can also experiment with the generic audio
80 configuration files.
81
82
83 2. AUDIO CONFIGURATION
84 -----------------------
85 The audio configuration files are located in the rplayd/audio
86 directory. Each system should have its own audio configuration. The
87 system type is determined using GNU autoconf (see section 1).
88 audio_generic.c and audio_generic.h should be used as a template.
89
90 audio_<system>.h must define the following:
91
92 RPLAY_AUDIO_DEVICE <string> - the name of the audio device.
93 RPLAY_AUDIO_TIMEOUT <int> - close the audio device when it hasn't been
94 used for <int> seconds.
95 RPLAY_AUDIO_RATE <int> - number of times per second that the audio
96 data should be written to the audio device.
97 RPLAY_AUDIO_BYTE_ORDER <val> - <val> should be RPLAY_BIG_ENDIAN or
98 RPLAY_LITTLE_ENDIAN.
99 RPLAY_AUDIO_FLUSH_TIMEOUT <int> - flush audio device when it hasn't been
100 used for <int> seconds. There are the
101 following exceptions:
102 <int> == 0 : flushing is disabled
103 <int> == -1 : flush when spool is empty
104 (this should be the default)
105 <int> == -2 : flush after each audio write
106
107 audio_<system>.c has the following routines:
108
109 int rplay_audio_init()
110 int rplay_audio_open()
111 int rplay_audio_isopen()
112 int rplay_audio_flush()
113 int rplay_audio_write(char *buf, int nbytes)
114 int rplay_audio_close()
115 int rplay_audio_get_volume()
116 int rplay_audio_set_volume(int volume)
117
118 One of the most important routines is rplay_audio_init(). This
119 routine sets the sample rate, precision, channels, audio port(s), and
120 the format of the audio device. Generic defaults are 8000, 8, 1,
121 speaker, and RPLAY_FORMAT_ULAW (see rplay.h) respectively.
122
123 The audio_sun rplay_audio_init detects an external speakerbox which
124 supports 16-bit audio and high sample rates so it could be a good
125 example for other configurations.
126
127 Systems that don't have hardware volume control should enable software
128 volume control by defining `FAKE_VOLUME'. Look at rplay_get_volume
129 and rplay_set_volume in audio_linux.c to see how FAKE_VOLUME should be
130 used.
131
132 $Id: PORTING,v 1.2 1998/08/13 06:13:01 boyns Exp $