Changeset 2279

Show
Ignore:
Timestamp:
03/10/99 19:57:03 (15 years ago)
Author:
ucacoxh
Message:

- Now flush device after changing read parameters. Recommended in Sun
docs. Used to be in audio_open but must have got dropped when
re-implementing a while ago. Strange it only manifests itself now,
but maybe I have not been using machine since then. Oh well, it's gone
now, as are 3 hours for a 1 line fix :-)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • rat/trunk/auddev_sparc.c

    r2277 r2279  
    6565        ap->precision   = fmt->bits_per_sample; 
    6666#ifdef Solaris 
    67         ap->buffer_size   = DEVICE_BUF_UNIT * (fmt->sample_rate / 8000) * (fmt->bits_per_sample / 8); 
     67        ap->buffer_size   = 160 * fmt->channels * (fmt->sample_rate / 8000) * (fmt->bits_per_sample / 8); 
    6868#endif /* Solaris */ 
    6969 
     
    135135                        } 
    136136                } 
     137 
     138                /* XXX driver issue - on Ultra II's if you don't drain 
     139                 * the device before reading commences then the device 
     140                 * reads in blocks of 500ms irrespective of the 
     141                 * blocksize set.  After a minute or so it flips into the 
     142                 * correct mode, but obviously this is too late to be  
     143                 * useful for most apps. grrr. 
     144                 */ 
     145 
     146                sparc_audio_drain(ad); 
     147 
    137148                return audio_fd; 
    138149        } else { 
    139150                /* Because we opened the device with O_NDELAY 
    140151                 * the waiting flag was not updated so update 
    141                  * it manually using the audioctl device... 
    142                  */ 
     152                 * it manually using the audioctl device...  */ 
    143153                audio_fd = open("/dev/audioctl", O_RDWR); 
    144154                AUDIO_INITINFO(&dev_info); 
     
    416426{ 
    417427        fd_set rfds; 
    418         struct timeval tv; 
    419  
    420         UNUSED(ad); assert(audio_fd > 0); 
    421          
     428        struct timeval tv, s1, s2; 
     429 
     430        UNUSED(ad); assert(audio_fd > 0); 
     431 
    422432        tv.tv_sec = 0; 
    423433        tv.tv_usec = delay_us; 
     
    426436        FD_SET(audio_fd, &rfds); 
    427437 
     438        gettimeofday (&s1, 0); 
    428439        select(audio_fd+1, &rfds, NULL, NULL, &tv); 
     440        gettimeofday (&s2, 0); 
     441 
     442        s2.tv_usec -= s1.tv_usec; 
     443        s2.tv_sec  -= s1.tv_sec; 
     444         
     445        if (s2.tv_usec < 0) { 
     446                s2.tv_usec += 1000000; 
     447                s2.tv_sec  -= 1; 
     448        } 
     449 
     450/*        printf("delay %d pause %ld\n", delay_us, s2.tv_usec / 1000); */ 
    429451 
    430452        return FD_ISSET(audio_fd, &rfds);