home *** CD-ROM | disk | FTP | other *** search
/ ST-Computer Leser-CD 2000 January / LCD_01_2000.iso / games / doom / sndserv / src / atari.c next >
Encoding:
C/C++ Source or Header  |  1999-08-16  |  2.6 KB  |  120 lines

  1. /*  Emacs style mode select   -*- C++ -*-  */
  2. /* ----------------------------------------------------------------------------- */
  3. /*  */
  4. /*  $Id: linux.c,v 1.3 1997/01/26 07:45:01 b1 Exp $ */
  5. /*  */
  6. /*  Copyright (C) 1993-1996 by id Software, Inc. */
  7. /*  */
  8. /*  This source is available for distribution and/or modification */
  9. /*  only under the terms of the DOOM Source Code License as */
  10. /*  published by id Software. All rights reserved. */
  11. /*  */
  12. /*  The source is distributed in the hope that it will be useful, */
  13. /*  but WITHOUT ANY WARRANTY; without even the implied warranty of */
  14. /*  FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License */
  15. /*  for more details. */
  16. /*  */
  17. /*  */
  18. /*  $Log: linux.c,v $ */
  19. /*  Revision 1.3  1997/01/26 07:45:01  b1 */
  20. /*  2nd formatting run, fixed a few warnings as well. */
  21. /*  */
  22. /*  Revision 1.2  1997/01/21 19:00:01  b1 */
  23. /*  First formatting run: */
  24. /*   using Emacs cc-mode.el indentation for C++ now. */
  25. /*  */
  26. /*  Revision 1.1  1997/01/19 17:22:45  b1 */
  27. /*  Initial check in DOOM sources as of Jan. 10th, 1997 */
  28. /*  */
  29. /*  */
  30. /*  DESCRIPTION: */
  31. /*     UNIX, soundserver for Linux i386. */
  32. /*  */
  33. /* ----------------------------------------------------------------------------- */
  34.  
  35. #include <stdlib.h>
  36. #include <stdio.h>
  37. #include <fcntl.h>
  38. #include <unistd.h>
  39.  
  40. #include <osbind.h>
  41. #include <falcon.h>
  42.  
  43. #include "soundsrv.h"
  44.  
  45. long dmabuffer[2][1024];    /* Doom send 512 samples */
  46. int    numbuffer=0;
  47.  
  48.  
  49. void I_InitMusic(void)
  50. {
  51. }
  52.  
  53. void
  54. I_InitSound
  55. ( int    samplerate,
  56.   int    samplesize )
  57. {
  58.     long *dest=&dmabuffer[0][0];
  59.     int i;
  60.  
  61.     /* Init son : 12292hz, 16 bits, stereo */
  62.  
  63.     Soundcmd(ADDERIN,ADCIN+MATIN);
  64.     Soundcmd(ADCINPUT,ADCRT+ADCLT);
  65.     Devconnect(DMAPLAY,DAC+DMAREC,CLK25M,CLKOLD,1);
  66.     Setinterrupt(SI_NONE,SI_PLAY);
  67.     Settracks(0,0);
  68.     Setmontracks(0);
  69.     Setmode(STEREO16);
  70.     Soundcmd(SETPRESCALE,PRE640);
  71.  
  72.     Buffoper(0);
  73.     Setbuffer(0,&dmabuffer[1][0],&dmabuffer[1][1023]);
  74.  
  75.     for (i=0;i<2*1024;i++)
  76.         *dest++=0;
  77. }
  78.  
  79. void
  80. I_SubmitOutputBuffer
  81. ( void*    samples,
  82.   int    samplecount )
  83. {
  84.     long *src=samples;
  85.     long *dest=&dmabuffer[numbuffer][0];
  86.     int    i,j;
  87.  
  88.     /* Jouer le son */
  89. /*
  90.     write(audio_fd, samples, samplecount*4);
  91. */
  92.  
  93.     /* Convertir de 11025 a 12292 */
  94.     for (i=0;i<(samplecount>>3);i++)
  95.     {
  96.         for (j=0;j<8;j++)
  97.         {
  98.             *dest++=*src++;
  99.         }
  100.         *dest++=*src;
  101.     }
  102.  
  103.     /* Jouer le son une fois */
  104.     Setbuffer(0,&dmabuffer[numbuffer][0],&dmabuffer[numbuffer][samplecount-1]);
  105.     numbuffer^=1;
  106.     Buffoper(SB_PLA_ENA);
  107. }
  108.  
  109. void I_ShutdownSound(void)
  110. {
  111.     /* Couper le son */
  112. /*
  113.     close(audio_fd);
  114. */
  115. }
  116.  
  117. void I_ShutdownMusic(void)
  118. {
  119. }
  120.