home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!charnel!rat!ucselx!crash!yoda!ag
- From: ag@yoda.omnicron.com (Keith Gabryelski)
- Newsgroups: comp.unix.amiga
- Subject: Re: Working audio driver source.
- Message-ID: <1012@yoda.omnicron.com>
- Date: 28 Dec 92 05:02:11 GMT
- References: <1008@yoda.omnicron.com>
- Organization: Omnicron Data Systems
- Lines: 134
-
- Here is a patch to the audio driver posted earlier this week
- that solves the problem I mentioned of skipping data if handed
- small data packets.
-
- It required changes to the service procedure and postaudio()
- so that the initial play buffer is not written to the hardware until
- it is full or the stream is empty.
-
- Pax, Keith
-
- *** audio.c Sun Dec 27 23:56:27 1992
- --- /usr/tmp/audio.c Sun Dec 27 23:56:08 1992
- ***************
- *** 498,525 ****
- mblk_t *mp;
- struct audio_client *acl = (struct audio_client *)q->q_ptr;
- int s = splaudio();
-
- /*
- * Service all requests possible.
- */
-
- while ((mp = getq(q, mp)))
- {
- ! if (postaudio(acl, mp))
- {
- ! /*
- ! * Couldn't service this request so places us on the
- ! * audio_clients list and we will be qenabled after
- ! * the next write interrupt.
- ! */
-
- ! putbq(q, mp);
- ! break;
- }
-
- freemsg(mp);
- }
-
- splx(s);
-
- return 0;
- --- 498,539 ----
- mblk_t *mp;
- struct audio_client *acl = (struct audio_client *)q->q_ptr;
- int s = splaudio();
- + boolean_t needtoflush;
-
- /*
- * Service all requests possible.
- */
-
- + needtoflush = B_FALSE;
- while ((mp = getq(q, mp)))
- {
- ! int retval = postaudio(acl, mp);
- !
- ! if (retval == -1)
- ! needtoflush = B_TRUE;
- ! else
- {
- ! needtoflush = B_FALSE;
-
- ! if (retval)
- ! {
- ! /*
- ! * Couldn't service this request so places us on the
- ! * audio_clients list and we will be qenabled after
- ! * the next write interrupt.
- ! */
- !
- ! putbq(q, mp);
- ! break;
- ! }
- }
-
- freemsg(mp);
- }
-
- + if (needtoflush)
- + (void) postaudio(acl, 0);
- +
- splx(s);
-
- return 0;
- ***************
- *** 561,569 ****
- ach->filling->repeat = acl->repeat;
- }
-
- ! mp->b_rptr +=
- ! fill_buffer(ach->filling, (signed char *)mp->b_rptr, blklen(mp));
-
- if (!ach->playing)
- {
- /*
- --- 575,591 ----
- ach->filling->repeat = acl->repeat;
- }
-
- ! if (mp)
- ! {
- ! int given = mp->b_wptr - mp->b_rptr;
-
- + mp->b_rptr +=
- + fill_buffer(ach->filling, (signed char *)mp->b_rptr, blklen(mp));
- +
- + if (!ach->playing && given && !(mp->b_wptr - mp->b_rptr))
- + return -1;
- + }
- +
- if (!ach->playing)
- {
- /*
- ***************
- *** 598,604 ****
- AMIGA->intena = AINTSET | ach->dmadone; /* Enable interupts */
- }
-
- ! return mp->b_wptr - mp->b_rptr;
- }
-
- static struct audio_channel *grab_channel(struct audio_client *acl)
- --- 620,629 ----
- AMIGA->intena = AINTSET | ach->dmadone; /* Enable interupts */
- }
-
- ! if (mp)
- ! return mp->b_wptr - mp->b_rptr;
- ! else
- ! return 0;
- }
-
- static struct audio_channel *grab_channel(struct audio_client *acl)
-