home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / linux / 20882 < prev    next >
Encoding:
Text File  |  1992-12-18  |  6.4 KB  |  163 lines

  1. Newsgroups: comp.os.linux
  2. Path: sparky!uunet!mcsun!news.funet.fi!hydra!klaava!klaava!liljeber
  3. From: liljeber@hydra.Helsinki.FI (Mika Liljeberg)
  4. Subject: Re: ANNOUNCE: Sound for Linux 0.99 (Sound driver v 0.4)
  5. In-Reply-To: kenc@sol.acs.unt.edu's message of Mon, 14 Dec 1992 02: 10:40 GMT
  6. Message-ID: <LILJEBER.92Dec18001016@hydra.Helsinki.FI>
  7. Lines: 150
  8. Sender: news@klaava.Helsinki.FI (Uutis Ankka)
  9. Organization: Department of Computer Science, University of Helsinki, Finland
  10. References: <1ggj9cINNkmc@hydra.Helsinki.FI> <kenc.724299040@sol>
  11. Date: Thu, 17 Dec 1992 22:10:16 GMT
  12.  
  13. In article <kenc.724299040@sol> kenc@sol.acs.unt.edu (Ken Corey - Operator) wrote:
  14. > hsavolai@cs.Helsinki.FI (Hannu Savolainen) writes:
  15. >>The version 0.4 of the Sound Card Driver is available at nic.funet.fi
  16. >>(pub/OS/Linux/xtra/snd-kit/snd-driv-0.4.tar.Z)
  17. > Pardon me if my stupidity is hanging out here...but what exactly can a Sound 
  18. > Blaster Pro be used for when running linux?  Are there programs to let us 
  19. > play SunOS sounds (Whatever the format they're in is called)?
  20.  
  21. Sure, just pluck in the following patch. :-) I took a few moments to
  22. write it, since the capability was still missing from 0.4 (/dev/audio
  23. is there, mind you, just the conversion code was absent).
  24.  
  25. I have a weird (latency?) problem with my modem, though. DTR and RTS
  26. go down almost immediately, when I copy something to /dev/audio (only
  27. with my patch). I'd like to hear, if everyone has this problem. I
  28. don't understand this behaviour at all. Oh, consider this a WARNING!
  29. Don't try to play Sun audio files, while using the modem :-)
  30.  
  31. The patch should also support digitizing Sun-style samples. I haven't
  32. been able to test this, though.
  33.  
  34. Have fun,
  35.  
  36.     Mika
  37.  
  38. ------------------------------------------------------------------------------
  39. --- audio.c.org    Tue Dec 15 00:02:00 1992
  40. +++ audio.c    Tue Dec 15 03:11:02 1992
  41. @@ -23,6 +23,8 @@
  42.  
  43.  #ifdef CONFIGURE_SOUNDCARD
  44.  
  45. +#include "ulaw.h"
  46. +
  47.  #define OUTB outb
  48.  #define DEB(WHAT)        /* (WHAT) */
  49.  #define DEB1(WHAT)        /* (WHAT) */
  50. @@ -68,6 +70,16 @@
  51.    DMAbuf_release (dev, mode);
  52.  }
  53.  
  54. +extern inline void translate_bytes(const void *table, void *buff, unsigned long n)
  55. +{
  56. +  __asm__("cld\n"
  57. +      "1:\tlodsb\n\t"
  58. +      "xlatb\n\t"
  59. +      "stosb\n\t"
  60. +      "loop 1b\n\t"
  61. +      ::"b" ((long)table), "c" (n), "D" ((long)buff), "S" ((long)buff)
  62. +      :"bx","cx","di","si");
  63. +}
  64.  
  65.  int
  66.  audio_write (struct inode *inode, struct file *file, char *buf, int count)
  67. @@ -107,7 +119,8 @@
  68.  
  69.        memcpy_fromfs (&wr_dma_buf[wr_buff_ptr], &buf[p], l);
  70.  
  71. -      /* Insert local processing here      */
  72. +      /* Insert local processing here */
  73. +      translate_bytes(ulaw_dsp, &wr_dma_buf[wr_buff_ptr], l);
  74.  
  75.        c -= l;
  76.        p += l;
  77. @@ -148,6 +161,7 @@
  78.      l = c;
  79.  
  80.        /* Insert any local processing here. */
  81. +      translate_bytes(dsp_ulaw, dmabuf, l);
  82.  
  83.        memcpy_tofs (buf, dmabuf, l);
  84.  
  85. --- /dev/null    Fri Aug  7 22:53:49 1992
  86. +++ ulaw.h    Tue Dec 15 01:51:44 1992
  87. @@ -0,0 +1,69 @@
  88. +static unsigned char ulaw_dsp[] = {
  89. +     0,    0,    0,    0,    0,    0,    0,    0, 
  90. +     0,    0,    0,    0,    0,    0,    0,    0, 
  91. +     0,    0,    0,    0,    0,    0,    0,    0, 
  92. +     0,    0,    0,    0,    0,    0,    0,    2, 
  93. +     5,    9,   13,   17,   21,   25,   29,   33, 
  94. +    37,   41,   45,   49,   53,   57,   61,   65, 
  95. +    68,   70,   72,   74,   76,   78,   80,   82, 
  96. +    84,   86,   88,   90,   92,   94,   96,   98, 
  97. +   100,  101,  102,  103,  104,  105,  106,  107, 
  98. +   108,  109,  110,  111,  112,  113,  114,  115, 
  99. +   115,  116,  116,  117,  117,  118,  118,  119, 
  100. +   119,  120,  120,  121,  121,  122,  122,  123, 
  101. +   123,  123,  124,  124,  124,  124,  125,  125, 
  102. +   125,  125,  126,  126,  126,  126,  127,  127, 
  103. +   127,  127,  127,  127,  128,  128,  128,  128, 
  104. +   128,  128,  128,  128,  128,  128,  128,  128, 
  105. +   255,  255,  255,  255,  255,  255,  255,  255, 
  106. +   255,  255,  255,  255,  255,  255,  255,  255, 
  107. +   255,  255,  255,  255,  255,  255,  255,  255, 
  108. +   255,  255,  255,  255,  255,  255,  255,  255, 
  109. +   252,  248,  244,  240,  236,  232,  228,  224, 
  110. +   220,  216,  212,  208,  204,  200,  196,  192, 
  111. +   189,  187,  185,  183,  181,  179,  177,  175, 
  112. +   173,  171,  169,  167,  165,  163,  161,  159, 
  113. +   157,  156,  155,  154,  153,  152,  151,  150, 
  114. +   149,  148,  147,  146,  145,  144,  143,  142, 
  115. +   142,  141,  141,  140,  140,  139,  139,  138, 
  116. +   138,  137,  137,  136,  136,  135,  135,  134, 
  117. +   134,  134,  133,  133,  133,  133,  132,  132, 
  118. +   132,  132,  131,  131,  131,  131,  130,  130, 
  119. +   130,  130,  130,  130,  129,  129,  129,  129, 
  120. +   129,  129,  129,  129,  128,  128,  128,  128, 
  121. +};
  122. +
  123. +static unsigned char dsp_ulaw[] = {
  124. +    31,   31,   31,   32,   32,   32,   32,   33, 
  125. +    33,   33,   33,   34,   34,   34,   34,   35, 
  126. +    35,   35,   35,   36,   36,   36,   36,   37, 
  127. +    37,   37,   37,   38,   38,   38,   38,   39, 
  128. +    39,   39,   39,   40,   40,   40,   40,   41, 
  129. +    41,   41,   41,   42,   42,   42,   42,   43, 
  130. +    43,   43,   43,   44,   44,   44,   44,   45, 
  131. +    45,   45,   45,   46,   46,   46,   46,   47, 
  132. +    47,   47,   47,   48,   48,   49,   49,   50, 
  133. +    50,   51,   51,   52,   52,   53,   53,   54, 
  134. +    54,   55,   55,   56,   56,   57,   57,   58, 
  135. +    58,   59,   59,   60,   60,   61,   61,   62, 
  136. +    62,   63,   63,   64,   65,   66,   67,   68, 
  137. +    69,   70,   71,   72,   73,   74,   75,   76, 
  138. +    77,   78,   79,   81,   83,   85,   87,   89, 
  139. +    91,   93,   95,   99,  103,  107,  111,  119, 
  140. +   255,  247,  239,  235,  231,  227,  223,  221, 
  141. +   219,  217,  215,  213,  211,  209,  207,  206, 
  142. +   205,  204,  203,  202,  201,  200,  199,  198, 
  143. +   197,  196,  195,  194,  193,  192,  191,  191, 
  144. +   190,  190,  189,  189,  188,  188,  187,  187, 
  145. +   186,  186,  185,  185,  184,  184,  183,  183, 
  146. +   182,  182,  181,  181,  180,  180,  179,  179, 
  147. +   178,  178,  177,  177,  176,  176,  175,  175, 
  148. +   175,  175,  174,  174,  174,  174,  173,  173, 
  149. +   173,  173,  172,  172,  172,  172,  171,  171, 
  150. +   171,  171,  170,  170,  170,  170,  169,  169, 
  151. +   169,  169,  168,  168,  168,  168,  167,  167, 
  152. +   167,  167,  166,  166,  166,  166,  165,  165, 
  153. +   165,  165,  164,  164,  164,  164,  163,  163, 
  154. +   163,  163,  162,  162,  162,  162,  161,  161, 
  155. +   161,  161,  160,  160,  160,  160,  159,  159, 
  156. +};
  157.  
  158. --
  159. Mika Liljeberg            Email:    liljeber@hydra.Helsinki.FI
  160. Helsinki University            Mika.Liljeberg@Helsinki.FI
  161. Dept. of Computer Science
  162.