diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 14 | ||||
-rw-r--r-- | src/capture.c | 21 |
2 files changed, 31 insertions, 4 deletions
diff --git a/src/Makefile b/src/Makefile index 6b93d4c..f8b0aaf 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,12 +1,18 @@ CC=gcc -CFLAGS=-W -Wall -Werror -Wno-error=unused-parameter -g -LDFLAGS=-Werror -g +# For debug +#CFLAGS=-W -Wall -Werror -Wno-error=unused-parameter -g +#LDFLAGS=-Werror -g + +# For release +CFLAGS=-W -Wall -Werror -Wno-error=unused-parameter -O2 +LDFLAGS=-Werror EXEC=music2light CFLAGS+=$(shell pkg-config --cflags gtk+-2.0 gthread-2.0 libpulse) -# Maths for FFT related code, libftdi is the driver for USB2DMX module, rt is for ftdi +# Maths for FFT related code, libftdi is the driver for USB2DMX module LDFLAGS+=-lm -lftdi -# -lrt +# -lrt for nanosleep but create many tiny buffers from PulseAudio +#LDFLAGS+=-lm -lftdi -lrt LDFLAGS+=$(shell pkg-config --libs gtk+-2.0 gthread-2.0 libpulse) SRC= $(wildcard *.c) diff --git a/src/capture.c b/src/capture.c index 14e7abf..5a174d4 100644 --- a/src/capture.c +++ b/src/capture.c @@ -13,6 +13,7 @@ int capture_init(pa_mainloop **m, pa_context **c); void context_state_callback(pa_context *c, void *userdata); void context_get_server_info_callback(pa_context *c, const pa_server_info*si, void *userdata); void context_get_source_info_callback(pa_context *c, const pa_source_info *si, int is_last, void *userdata); +void context_get_source_info_list_callback(pa_context *c, const pa_source_info *si, int is_last, void *userdata); pa_stream * create_stream(pa_context *c, const pa_source_info *si); void stream_state_callback(pa_stream *s, void *userdata); void stream_read_callback(pa_stream *s, size_t nbytes, void *userdata); @@ -100,10 +101,30 @@ void context_get_server_info_callback(pa_context *c, const pa_server_info*si, vo return; } + //Temp : + pa_operation_unref(pa_context_get_source_info_list(c,context_get_source_info_list_callback,NULL)); + + pa_operation_unref(pa_context_get_source_info_by_name(c, si->default_source_name, context_get_source_info_callback, NULL)); } +//Temp +void context_get_source_info_list_callback(pa_context *c, const pa_source_info *si, int is_last, void *userdata) { + if (is_last < 0) { + printf("Failed to get sink information\n"); + return; + } + + if (!si) { + return; + } + + printf("%i : '%s' (%s)\n", si->index, si->name, si->description); + +} + + void context_get_source_info_callback(pa_context *c, const pa_source_info *si, int is_last, void *userdata) { if (is_last < 0) { |