home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / amiga / 2614 < prev    next >
Encoding:
Internet Message Format  |  1992-12-28  |  3.0 KB

  1. Path: sparky!uunet!olivea!charnel!rat!ucselx!crash!yoda!ag
  2. From: ag@yoda.omnicron.com (Keith Gabryelski)
  3. Newsgroups: comp.unix.amiga
  4. Subject: Re: Working audio driver source.
  5. Message-ID: <1012@yoda.omnicron.com>
  6. Date: 28 Dec 92 05:02:11 GMT
  7. References: <1008@yoda.omnicron.com>
  8. Organization: Omnicron Data Systems
  9. Lines: 134
  10.  
  11. Here is a patch to the audio driver posted earlier this week
  12. that solves the problem I mentioned of skipping data if handed
  13. small data packets.
  14.  
  15. It required changes to the service procedure and postaudio()
  16. so that the initial play buffer is not written to the hardware until
  17. it is full or the stream is empty.
  18.  
  19. Pax, Keith
  20.  
  21. *** audio.c    Sun Dec 27 23:56:27 1992
  22. --- /usr/tmp/audio.c    Sun Dec 27 23:56:08 1992
  23. ***************
  24. *** 498,525 ****
  25.       mblk_t *mp;
  26.       struct audio_client *acl = (struct audio_client *)q->q_ptr;
  27.       int s = splaudio();
  28.   
  29.       /*
  30.        * Service all requests possible.
  31.        */
  32.   
  33.       while ((mp = getq(q, mp)))
  34.       {
  35. !     if (postaudio(acl, mp))
  36.       {
  37. !         /*
  38. !          * Couldn't service this request so places us on the
  39. !          * audio_clients list and we will be qenabled after
  40. !          * the next write interrupt.
  41. !          */
  42.   
  43. !         putbq(q, mp);
  44. !         break;
  45.       }
  46.   
  47.       freemsg(mp);
  48.       }
  49.   
  50.       splx(s);
  51.   
  52.       return 0;
  53. --- 498,539 ----
  54.       mblk_t *mp;
  55.       struct audio_client *acl = (struct audio_client *)q->q_ptr;
  56.       int s = splaudio();
  57. +     boolean_t needtoflush;
  58.   
  59.       /*
  60.        * Service all requests possible.
  61.        */
  62.   
  63. +     needtoflush = B_FALSE;
  64.       while ((mp = getq(q, mp)))
  65.       {
  66. !     int retval = postaudio(acl, mp);
  67. !     if (retval == -1)
  68. !         needtoflush = B_TRUE;
  69. !     else
  70.       {
  71. !         needtoflush = B_FALSE;
  72.   
  73. !         if (retval)
  74. !         {
  75. !         /*
  76. !          * Couldn't service this request so places us on the
  77. !          * audio_clients list and we will be qenabled after
  78. !          * the next write interrupt.
  79. !          */
  80. !         putbq(q, mp);
  81. !         break;
  82. !         }
  83.       }
  84.   
  85.       freemsg(mp);
  86.       }
  87.   
  88. +     if (needtoflush)
  89. +     (void) postaudio(acl, 0);
  90.       splx(s);
  91.   
  92.       return 0;
  93. ***************
  94. *** 561,569 ****
  95.       ach->filling->repeat = acl->repeat;
  96.       }
  97.   
  98. !     mp->b_rptr +=
  99. !     fill_buffer(ach->filling, (signed char *)mp->b_rptr, blklen(mp));
  100.   
  101.       if (!ach->playing)
  102.       {
  103.       /*
  104. --- 575,591 ----
  105.       ach->filling->repeat = acl->repeat;
  106.       }
  107.   
  108. !     if (mp)
  109. !     {
  110. !     int given = mp->b_wptr - mp->b_rptr;
  111.   
  112. +     mp->b_rptr +=
  113. +         fill_buffer(ach->filling, (signed char *)mp->b_rptr, blklen(mp));
  114. +     if (!ach->playing && given && !(mp->b_wptr - mp->b_rptr))
  115. +         return -1;
  116. +     }
  117.       if (!ach->playing)
  118.       {
  119.       /*
  120. ***************
  121. *** 598,604 ****
  122.       AMIGA->intena = AINTSET | ach->dmadone; /* Enable interupts */
  123.       }
  124.   
  125. !     return mp->b_wptr - mp->b_rptr;
  126.   }
  127.   
  128.   static struct audio_channel *grab_channel(struct audio_client *acl)
  129. --- 620,629 ----
  130.       AMIGA->intena = AINTSET | ach->dmadone; /* Enable interupts */
  131.       }
  132.   
  133. !     if (mp)
  134. !     return mp->b_wptr - mp->b_rptr;
  135. !     else
  136. !     return 0;
  137.   }
  138.   
  139.   static struct audio_channel *grab_channel(struct audio_client *acl)
  140.