fixed bug that changed the HOME env var inside the program

This commit is contained in:
2023-08-17 17:59:49 +02:00
parent de70866e1f
commit ba37d057fb
2 changed files with 5 additions and 11 deletions

View File

@@ -21,16 +21,8 @@ int play_raw_audio(char file_name[]) {
ss.rate = 48000;
ss.channels = 2;
// Temporarily redirect stderr to /dev/null
// because pulseaudio prints to stderr even though it does not set any error codes
FILE *original_stderr = stderr;
stderr = fopen("/dev/null", "w");
simple = pa_simple_new(NULL, "Audio Playback", PA_STREAM_PLAYBACK, NULL, "playback", &ss, NULL, NULL, &pa_error);
// Restore stderr
stderr = original_stderr;
int i = 0;
while (read(myfd, content, sizeof(content))) {
// skip the first 1024 bytes to not play the file header