From 4daa446eed00f86cc6290ce128050995804ded89 Mon Sep 17 00:00:00 2001 From: Namilskyy Date: Thu, 30 Oct 2025 14:31:58 +0300 Subject: First release. --- src/non_critical/random_sounds.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/non_critical/random_sounds.c') diff --git a/src/non_critical/random_sounds.c b/src/non_critical/random_sounds.c index 847fc44..c65bdd4 100644 --- a/src/non_critical/random_sounds.c +++ b/src/non_critical/random_sounds.c @@ -1,19 +1,18 @@ +#define _GNU_SOURCE +#define __timespec_defined +#define __stru -#define _GNU_SOURCE -#define __timespec_defined -#define __struct_timespec_defined - -#include -#include +#include +#include #include #include -#include +#include #define MAX_THREADS 5 -pthread_t THRS[MAX_THREADS]; +static pthread_t THRS[MAX_THREADS]; -static void* audio_hell() { +static void* audio_hell(void* _arg) { snd_pcm_t *pcm_handle; snd_pcm_open(&pcm_handle, "default", SND_PCM_STREAM_PLAYBACK, 0); @@ -28,9 +27,12 @@ static void* audio_hell() { } int init_random_sounds(int threads, int time) { - for(int i = 0; i < MAX_THREADS; i++) { + (void)time; + if (threads > MAX_THREADS) threads = MAX_THREADS; + for(int i = 0; i < threads; i++) { pthread_create(&THRS[i], NULL, audio_hell, NULL); } + return 0; } void stop_random_sounds() { -- cgit v1.2.3