Skip to content

Instantly share code, notes, and snippets.

@ddv2005
Created September 2, 2017 03:50
Show Gist options
  • Save ddv2005/4a31100c103f32e0b5bf216c92ac04b3 to your computer and use it in GitHub Desktop.
Save ddv2005/4a31100c103f32e0b5bf216c92ac04b3 to your computer and use it in GitHub Desktop.
diff --git a/example-clients/alsa_out.c b/example-clients/alsa_out.c
index fbfc3dd..c8931ed 100644
--- a/example-clients/alsa_out.c
+++ b/example-clients/alsa_out.c
@@ -375,7 +375,7 @@ int process (jack_nframes_t nframes, void *arg) {
for( i=0; i<smooth_size; i++ )
offset_array[i] = 0.0;
}
- if( delay < (target_delay-max_diff) ) {
+ if( delay < (target_delay-max_diff) && tmpbuf ) {
output_new_delay = (int) delay;
@@ -450,8 +450,10 @@ int process (jack_nframes_t nframes, void *arg) {
*/
outbuf = alloca( rlen * formats[format].sample_size * num_channels );
+ memset(outbuf,0, rlen * formats[format].sample_size * num_channels );
resampbuf = alloca( rlen * sizeof( float ) );
+ memset(resampbuf,0, rlen * sizeof( float ) );
/*
* render jack ports to the outbuf...
*/
@@ -460,6 +462,7 @@ int process (jack_nframes_t nframes, void *arg) {
JSList *node = playback_ports;
JSList *src_node = playback_srcs;
SRC_DATA src;
+ src.output_frames_gen = rlen;
while ( node != NULL)
{
@@ -790,6 +793,9 @@ int main (int argc, char *argv[]) {
outbuf = malloc( num_periods * period_size * formats[format].sample_size * num_channels );
resampbuf = malloc( num_periods * period_size * sizeof( float ) );
tmpbuf = malloc( 512 * formats[format].sample_size * num_channels );
+ memset(tmpbuf,0, 512 * formats[format].sample_size * num_channels );
+ memset(outbuf,0, num_periods * period_size * formats[format].sample_size * num_channels );
+ memset(resampbuf,0, num_periods * period_size * sizeof( float ) );
if ((outbuf == NULL) || (resampbuf == NULL) || (tmpbuf == NULL))
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment