disk audio: Make default i/o delay match what device is meant to be running at.
authorRyan C. Gordon <icculus@icculus.org>
Sat, 06 Aug 2016 03:45:45 -0400
changeset 10265886ab9de5f43
parent 10264 db0b712b79dd
child 10266 7c430819edd2
disk audio: Make default i/o delay match what device is meant to be running at.
src/audio/disk/SDL_diskaudio.c
     1.1 --- a/src/audio/disk/SDL_diskaudio.c	Sat Aug 06 03:39:15 2016 -0400
     1.2 +++ b/src/audio/disk/SDL_diskaudio.c	Sat Aug 06 03:45:45 2016 -0400
     1.3 @@ -41,7 +41,6 @@
     1.4  #define DISKENVR_INFILE         "SDL_DISKAUDIOFILEIN"
     1.5  #define DISKDEFAULT_INFILE      "sdlaudio-in.raw"
     1.6  #define DISKENVR_IODELAY      "SDL_DISKAUDIODELAY"
     1.7 -#define DISKDEFAULT_IODELAY   150
     1.8  
     1.9  /* This function waits until it is possible to write a full sound buffer */
    1.10  static void
    1.11 @@ -140,7 +139,11 @@
    1.12      }
    1.13      SDL_zerop(this->hidden);
    1.14  
    1.15 -    this->hidden->io_delay = (envr) ? SDL_atoi(envr) : DISKDEFAULT_IODELAY;
    1.16 +    if (envr != NULL) {
    1.17 +        this->hidden->io_delay = SDL_atoi(envr);
    1.18 +    } else {
    1.19 +        this->hidden->io_delay = ((this->spec.samples * 1000) / this->spec.freq);
    1.20 +    }
    1.21  
    1.22      /* Open the audio device */
    1.23      this->hidden->io = SDL_RWFromFile(fname, iscapture ? "rb" : "wb");