Browse Source

Clear to avoid playing dirty buffers when the client does not produce output anymore

git-svn-id: svn+ssh://jackaudio.org/trunk/jack@809 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.109.0
letz 21 years ago
parent
commit
ec2bb3a329
2 changed files with 11 additions and 3 deletions
  1. +7
    -1
      drivers/coreaudio/coreaudio_driver.c
  2. +4
    -2
      drivers/portaudio/portaudio_driver.c

+ 7
- 1
drivers/coreaudio/coreaudio_driver.c View File

@@ -29,6 +29,8 @@
Feb 04, 2004: Johnny Petrantoni: now the driver supports interfaces with multiple interleaved streams (such as the MOTU 828).
Nov 05, 2004: S.Letz: correct management of -I option for use with JackPilot.
Nov 15, 2004: S.Letz: Set a default value for deviceID.
Nov 30, 2004: S.Letz: In coreaudio_driver_write : clear to avoid playing dirty buffers when the client does not produce output anymore.
TODO:
- fix cpu load behavior.
@@ -262,7 +264,7 @@ coreaudio_driver_write(coreaudio_driver_t * driver, jack_nframes_t nframes)
channel_t chn;
jack_port_t *port;
JSList *node;
int i;
int i,bytes = nframes*sizeof(float);

int b = 0;

@@ -277,6 +279,8 @@ coreaudio_driver_write(coreaudio_driver_t * driver, jack_nframes_t nframes)
float *out = driver->outcoreaudio[chn];
buf = jack_port_get_buffer(port, nframes);
memcpy(out, buf, sizeof(float) * nframes);
/* clear to avoid playing dirty buffers when the client does not produce output anymore */
memset(buf, 0, bytes);
}
} else {
if (jack_port_connected(port)
@@ -296,6 +300,8 @@ coreaudio_driver_write(coreaudio_driver_t * driver, jack_nframes_t nframes)
buf = jack_port_get_buffer(port, nframes);
for (i = 0; i < nframes; i++)
out[channels * i + chn] = buf[i];
/* clear to avoid playing dirty buffers when the client does not produce output anymore */
memset(buf, 0, bytes);
}
}
}


+ 4
- 2
drivers/portaudio/portaudio_driver.c View File

@@ -236,10 +236,10 @@ portaudio_driver_write (portaudio_driver_t *driver, jack_nframes_t nframes)
channel_t chn;
jack_port_t *port;
JSList *node;
int i;
int i,bytes = nframes*sizeof(float);
/* Clear in case of nothing is connected */
memset(driver->outPortAudio, 0, (driver->playback_nchannels * nframes * sizeof(float)));
memset(driver->outPortAudio, 0, driver->playback_nchannels*bytes);
for (chn = 0, node = driver->playback_ports; node; node = jack_slist_next (node), chn++) {
@@ -250,6 +250,8 @@ portaudio_driver_write (portaudio_driver_t *driver, jack_nframes_t nframes)
float* out = driver->outPortAudio;
buf = jack_port_get_buffer (port, nframes);
for (i = 0; i< nframes; i++) out[channels*i+chn] = buf[i];
/* clear to avoid playing dirty buffers when the client does not produce output anymore */
memset(buf, 0, bytes);
}
}


Loading…
Cancel
Save