diff options
Diffstat (limited to 'ztmonitor.c')
-rwxr-xr-x | ztmonitor.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/ztmonitor.c b/ztmonitor.c index c226c33..d915ece 100755 --- a/ztmonitor.c +++ b/ztmonitor.c @@ -227,8 +227,10 @@ int main(int argc, char *argv[]) } if (!visual) { /* Open audio */ - if ((afd = audio_open()) < 0) - exit(1); + if ((afd = audio_open()) < 0) { + printf("Cannot open audio ...\n"); + if (!ofh) exit(0); + } } /* Open Pseudo device */ if ((pfd = pseudo_open()) < 0) @@ -278,13 +280,14 @@ int main(int argc, char *argv[]) } else { if (ofh) fwrite(buf, 1, res, ofh); - - if (stereo) { - for (x=0;x<res;x++) - buf2[x<<1] = buf2[(x<<1) + 1] = buf[x]; - write(afd, buf2, res << 1); - } else - write(afd, buf, res); + if (afd) { + if (stereo) { + for (x=0;x<res;x++) + buf2[x<<1] = buf2[(x<<1) + 1] = buf[x]; + write(afd, buf2, res << 1); + } else + write(afd, buf, res); + } } } if (ofh) fclose(ofh); /*Never Reached */ |