home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / audio / tracker / extern.h < prev    next >
C/C++ Source or Header  |  2014-05-19  |  6KB  |  232 lines

  1. /* extern.h */
  2.  
  3. /* $Author: espie $
  4.  * $Id: extern.h,v 2.9 1991/12/04 08:28:53 espie Exp espie $
  5.  * $Revision: 2.9 $
  6.  * $Log: extern.h,v $
  7.  * Revision 2.9  1991/12/04  08:28:53  espie
  8.  * Separated mix/stereo stuff.
  9.  *
  10.  * Revision 2.8  1991/12/03  20:43:46  espie
  11.  * Added possibility to get back to MONO for the sgi.
  12.  *
  13.  * Revision 2.7  1991/12/03  18:07:38  espie
  14.  * Added stereo capabilities to the indigo version.
  15.  *
  16.  * Revision 2.6  1991/12/03  17:10:11  espie
  17.  * Added some new song types to automatize the choice process.
  18.  *
  19.  * Revision 2.5  1991/11/19  16:07:19  espie
  20.  * Added comments, moved minor stuff around.
  21.  *
  22.  * Revision 2.4  1991/11/18  14:10:30  espie
  23.  * Moved resampling to audio, added prototype.
  24.  *
  25.  * Revision 2.3  1991/11/18  01:23:30  espie
  26.  * Added SAMPLE_FAULT, for trying to play
  27.  * a note without a sample (not really an error).
  28.  *
  29.  * Revision 2.2  1991/11/18  01:10:45  espie
  30.  * Added some prototypes.
  31.  *
  32.  * Revision 2.1  1991/11/17  23:07:58  espie
  33.  * Moved prototypes around, added new functions.
  34.  *
  35.  * Revision 2.0  1991/11/17  21:42:08  espie
  36.  * Added prototypes for new functions.
  37.  * Removed prototypes for some commands.
  38.  *
  39.  * Revision 1.7  1991/11/08  14:25:55  espie
  40.  * Modified audio prototype so that you can change
  41.  * frequency.
  42.  *
  43.  * Revision 1.6  1991/11/08  13:35:57  espie
  44.  * Added prototype for release_song.
  45.  *
  46.  * Revision 1.5  1991/11/07  21:40:16  espie
  47.  * Added arpeggio effect.
  48.  *
  49.  * Revision 1.4  1991/11/07  20:05:53  espie
  50.  * Added entries for new effects.
  51.  *
  52.  * Revision 1.3  1991/11/06  09:46:06  espie
  53.  * Added entries for commands.c.
  54.  *
  55.  * Revision 1.2  1991/11/04  13:23:59  espie
  56.  * Moved some definitions from str32.
  57.  * Added debug.
  58.  *
  59.  * Revision 1.1  1991/11/03  22:45:26  espie
  60.  * Initial revision
  61.  *
  62.  */
  63.  
  64. /* str32.c */
  65.  
  66. /* error types. Everything is centralized,
  67.  * and we check in some places (see read, player and str32)
  68.  * that there was no error. Additionnally signal traps work
  69.  * that way too.
  70.  */
  71.  
  72. /* normal state */
  73. #define NONE 0  
  74. /* read error */
  75. #define FILE_TOO_SHORT 1
  76. #define CORRUPT_FILE 2
  77. /* trap error: goto next song right now */
  78. #define NEXT_SONG 3
  79. /* run time problem */
  80. #define FAULT 4
  81. /* the song has ended */
  82. #define ENDED 5
  83. /* unrecoverable problem: typically, trying to 
  84.  * jump to nowhere land.
  85.  */
  86. #define UNRECOVERABLE 6
  87. /* Missing sample. Very common error, not too serious. */
  88. #define SAMPLE_FAULT 7
  89.  
  90. extern int error;
  91.  
  92.  
  93. /* xxx_audio.c */
  94.  
  95. /* real_freq = open_audio(ask_freq):
  96.  * try to open audio with a sampling rate of ask_freq.
  97.  * We get the real frequency back. If we ask for 0, we
  98.  * get the ``preferred'' frequency.
  99.  */
  100. extern int open_audio();
  101. /* close_audio():
  102.  * returns the audio to the system control, doing necessary
  103.  * cleanup
  104.  */
  105. extern void close_audio();
  106. /* set_mix(percent): set mix channels level.
  107.  * 0: spatial stereo. 100: mono.
  108.  */
  109. extern void set_mix();
  110. /* output_samples(l, r): outputs a pair of stereo samples.
  111.  * Samples are 15 bits signed.
  112.  */
  113. extern void output_samples();
  114. /* flush_buffer(): call from time to time, because buffering
  115.  * is done by the program to get better (?) performance.
  116.  */
  117. extern void flush_buffer();
  118.  
  119. /* automaton.c */
  120.  
  121. /* init_automaton(a, song):
  122.  * put the automaton a in the right state to play song.
  123.  */
  124. extern void init_automaton();
  125. /* next_tick(a):
  126.  * set up everything for the next tick.
  127.  */
  128. extern void next_tick();
  129.  
  130. /* read.c */
  131.  
  132. /* s = read_song(f, type):
  133.  * tries to read f as a song of type NEW/OLD.
  134.  * returns NULL (and an error) if it doesn't work.
  135.  * Returns a dynamic song structure if successful.
  136.  */
  137. extern struct song *read_song();
  138.  
  139. /* dump_song(s): 
  140.  * displays some information pertinent to the given 
  141.  * song s.
  142.  */
  143. extern void dump_song();
  144.  
  145. /* release_song(s):
  146.  * release all the memory song occupies.
  147.  */
  148. extern void release_song();
  149.  
  150.  
  151.  
  152.  
  153.  
  154. /* commands.c */
  155.  
  156. /* init_effects(): sets up all data for the effects */
  157. extern void init_effects();
  158. /* do_nothing: this is the default behavior for an effect.
  159.  */
  160. extern void do_nothing();
  161.  
  162.  
  163.  
  164.  
  165. /* audio.c */
  166.  
  167. /* init_tables(oversample, frequency):
  168.  * precomputes the step_table and the pitch_table
  169.  * according to the desired oversample and frequency.
  170.  * This is static, you can call it again whenever you want.
  171.  */
  172. extern void init_tables();
  173.  
  174. /* pitch of each and every note */
  175. extern int pitch_table[];
  176.  
  177. /* resample(chan, oversample, number):
  178.  * send number samples out computed according
  179.  * to the current state of chan[0:NUMBER_CHANNELS],
  180.  * and oversample.
  181.  */
  182. extern void resample();
  183.  
  184. /* reset_note(ch, note, pitch):
  185.  * set channel ch to play note at pitch pitch
  186.  */
  187. extern void reset_note();
  188.  
  189. /* set_current_pitch(ch, pitch):
  190.  * set channel ch to play at pitch pitch
  191.  */
  192. extern void set_current_pitch();
  193.  
  194.  
  195.  
  196. /* player.c */
  197.  
  198. /* init_player(oversample, frequency):
  199.  * sets up the player for a given oversample and
  200.  * output frequency.
  201.  */
  202. extern void init_player();
  203.  
  204. /* play_song(song, pref):
  205.  * plays the song according to the current pref.
  206.  */
  207. extern void play_song();
  208.  
  209.  
  210. #define ACCURACY 16
  211. #define fix_to_int(x) ((x) >> ACCURACY)
  212. #define int_to_fix(x) ((x) << ACCURACY)
  213.  
  214.  
  215. /* some definitions for being able to read song.h */
  216.  
  217. #define OLD 0
  218. #define NEW 1
  219. /* special new type: for when we try to read it as both types.
  220.  */
  221. #define BOTH 2
  222. /* special type: does not check the signature */
  223. #define NEW_NO_CHECK 3
  224.  
  225. #define NUMBER_NOTES 120
  226.  
  227. #define MIN(A,B) ((A)<(B) ? (A) : (B))
  228. #define MAX(A,B) ((A)>(B) ? (A) : (B))
  229.      
  230. #define D fprintf(stderr, "%d\n", __LINE__);
  231.  
  232.