AC_CONFIG_SRCDIR([src/daemon/main.c])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules dist-xz tar-ustar])
+AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules color-tests dist-xz tar-ustar])
m4_define(pa_major, `echo $VERSION | cut -d. -f1 | cut -d- -f1`)
m4_define(pa_minor, `echo $VERSION | cut -d. -f2 | cut -d- -f1`)
alsa-time-test
endif
+TESTS_ENVIRONMENT=MAKE_CHECK=1
+
if BUILD_TESTS_DEFAULT
noinst_PROGRAMS = $(TESTS) $(TESTS_norun)
else
switch (code) {
case OPERATION_A:
- printf("Operation A\n");
+ pa_log_info("Operation A");
break;
case OPERATION_B:
- printf("Operation B\n");
+ pa_log_info("Operation B");
break;
case OPERATION_C:
- printf("Operation C\n");
+ pa_log_info("Operation C");
break;
case QUIT:
- printf("quit\n");
+ pa_log_info("quit");
quit = 1;
break;
}
pa_assert_se(t = pa_thread_new("test", the_thread, q));
- printf("Operation A post\n");
+ pa_log_info("Operation A post");
pa_asyncmsgq_post(q, NULL, OPERATION_A, NULL, 0, NULL, NULL);
pa_thread_yield();
- printf("Operation B post\n");
+ pa_log_info("Operation B post");
pa_asyncmsgq_post(q, NULL, OPERATION_B, NULL, 0, NULL, NULL);
pa_thread_yield();
- printf("Operation C send\n");
+ pa_log_info("Operation C send");
pa_asyncmsgq_send(q, NULL, OPERATION_C, NULL, 0, NULL);
pa_thread_yield();
- printf("Quit post\n");
+ pa_log_info("Quit post");
pa_asyncmsgq_post(q, NULL, QUIT, NULL, 0, NULL, NULL);
pa_thread_free(t);
int i;
for (i = 0; i < 1000; i++) {
- printf("pushing %i\n", i);
+ pa_log_debug("pushing %i", i);
pa_asyncq_push(q, PA_UINT_TO_PTR(i+1), 1);
}
pa_asyncq_push(q, PA_UINT_TO_PTR(-1), TRUE);
- printf("pushed end\n");
+ pa_log_debug("pushed end");
}
static void consumer(void *_q) {
pa_assert(p == PA_UINT_TO_PTR(i+1));
- printf("popped %i\n", i);
+ pa_log_debug("popped %i", i);
}
- printf("popped end\n");
+ pa_log_debug("popped end");
}
int main(int argc, char *argv[]) {
pa_asyncq *q;
pa_thread *t1, *t2;
+ if (!getenv("MAKE_CHECK"))
+ pa_log_set_level(PA_LOG_DEBUG);
+
pa_assert_se(q = pa_asyncq_new(0));
pa_assert_se(t1 = pa_thread_new("producer", producer, q));
#include <pulse/util.h>
#include <pulse/xmalloc.h>
+#include <pulsecore/log.h>
+
int main(int argc, char *argv[]) {
char *exename;
size_t allocated = 128;
exename = pa_xmalloc(allocated);
if (!pa_get_binary_name(exename, allocated)) {
- printf("failed to read binary name\n");
+ pa_log_error("failed to read binary name");
pa_xfree(exename);
break;
}
if (strlen(exename) < allocated - 1) {
- printf("%s\n", exename);
+ pa_log("%s", exename);
pa_xfree(exename);
return 0;
}
#include <pulse/pulseaudio.h>
#include <pulse/mainloop.h>
+#include <pulsecore/log.h>
#include <pulsecore/macro.h>
#include <pulsecore/thread.h>
if (latency > 0)
flags |= PA_STREAM_ADJUST_LATENCY;
- fprintf(stderr, "Connection established.\n");
+ pa_log("Connection established");
pa_assert_se(stream = pa_stream_new(c, "interpol-test", &ss, NULL));
case PA_CONTEXT_FAILED:
default:
- fprintf(stderr, "Context error: %s\n", pa_strerror(pa_context_errno(c)));
+ pa_log_error("Context error: %s", pa_strerror(pa_context_errno(c)));
abort();
}
}
pa_bool_t corked = FALSE;
#endif
- pa_log_set_level(PA_LOG_DEBUG);
+ if (!getenv("MAKE_CHECK"))
+ pa_log_set_level(PA_LOG_DEBUG);
playback = argc <= 1 || !pa_streq(argv[1], "-r");
-
- latency =
- (argc >= 2 && !pa_streq(argv[1], "-r")) ? atoi(argv[1]) :
- (argc >= 3 ? atoi(argv[2]) : 0);
+ latency = (argc >= 2 && !pa_streq(argv[1], "-r")) ? atoi(argv[1]) : (argc >= 3 ? atoi(argv[2]) : 0);
/* Set up a new main loop */
pa_assert_se(m = pa_threaded_mainloop_new());
pa_bool_t cork_now;
#endif
rtc = pa_timeval_diff(&now, &start);
- printf("%i\t%llu\t%llu\t%llu\t%llu\t%lli\t%u\t%u\t%llu\t%llu\n", k,
+ pa_log_info("%i\t%llu\t%llu\t%llu\t%llu\t%lli\t%u\t%u\t%llu\t%llu\n", k,
(unsigned long long) rtc,
(unsigned long long) t,
(unsigned long long) (rtc-old_rtc),
}
/* Spin loop, ugly but normal usleep() is just too badly grained */
-
tv = now;
while (pa_timeval_diff(pa_gettimeofday(&now), &tv) < 1000)
pa_thread_yield();
#include <netinet/ip.h>
#endif
-#include <pulsecore/socket.h>
+#include <pulsecore/log.h>
#include <pulsecore/macro.h>
+#include <pulsecore/socket.h>
#include <pulsecore/ipacl.h>
#include <pulsecore/arpa-inet.h>
result = pa_ip_acl_check(acl, fd);
pa_ip_acl_free(acl);
- printf("%-20s result=%u (should be %u)\n", s, result, expected);
+ pa_log_info("%-20s result=%u (should be %u)", s, result, expected);
pa_assert(result == expected);
}
int fd;
int r;
+ if (!getenv("MAKE_CHECK"))
+ pa_log_set_level(PA_LOG_DEBUG);
+
fd = socket(PF_INET, SOCK_STREAM, 0);
pa_assert(fd >= 0);
#ifdef HAVE_IPV6
if ( (fd = socket(PF_INET6, SOCK_STREAM, 0)) < 0 ) {
- printf("Unable to open IPv6 socket, IPv6 tests ignored");
+ pa_log_error("Unable to open IPv6 socket, IPv6 tests ignored");
return 0;
}
pa_thread_free(c);
pa_thread_free(d);
- pa_log("End");
-
return 0;
}
#include <stdio.h>
#include <unistd.h>
+#include <pulse/xmalloc.h>
+
+#include <pulsecore/log.h>
#include <pulsecore/memblock.h>
#include <pulsecore/macro.h>
-#include <pulse/xmalloc.h>
static void release_cb(pa_memimport *i, uint32_t block_id, void *userdata) {
- printf("%s: Imported block %u is released.\n", (char*) userdata, block_id);
+ pa_log("%s: Imported block %u is released.", (char*) userdata, block_id);
}
static void revoke_cb(pa_memexport *e, uint32_t block_id, void *userdata) {
- printf("%s: Exported block %u is revoked.\n", (char*) userdata, block_id);
+ pa_log("%s: Exported block %u is revoked.", (char*) userdata, block_id);
}
static void print_stats(pa_mempool *p, const char *text) {
const pa_mempool_stat*s = pa_mempool_get_stat(p);
- printf("%s = {\n"
- "n_allocated = %u\n"
- "n_accumulated = %u\n"
- "n_imported = %u\n"
- "n_exported = %u\n"
- "allocated_size = %u\n"
- "accumulated_size = %u\n"
- "imported_size = %u\n"
- "exported_size = %u\n"
- "n_too_large_for_pool = %u\n"
- "n_pool_full = %u\n"
- "}\n",
+ pa_log_debug("%s = {\n"
+ "\tn_allocated = %u\n"
+ "\tn_accumulated = %u\n"
+ "\tn_imported = %u\n"
+ "\tn_exported = %u\n"
+ "\tallocated_size = %u\n"
+ "\taccumulated_size = %u\n"
+ "\timported_size = %u\n"
+ "\texported_size = %u\n"
+ "\tn_too_large_for_pool = %u\n"
+ "\tn_pool_full = %u\n"
+ "}",
text,
(unsigned) pa_atomic_load(&s->n_allocated),
(unsigned) pa_atomic_load(&s->n_accumulated),
const char txt[] = "This is a test!";
+ if (!getenv("MAKE_CHECK"))
+ pa_log_set_level(PA_LOG_DEBUG);
+
pool_a = pa_mempool_new(TRUE, 0);
pool_b = pa_mempool_new(TRUE, 0);
pool_c = pa_mempool_new(TRUE, 0);
blocks[4] = NULL;
for (i = 0; blocks[i]; i++) {
- printf("Memory block %u\n", i);
+ pa_log("Memory block %u", i);
mb_a = blocks[i];
pa_assert(mb_a);
pa_assert(r >= 0);
pa_assert(shm_id == id_a);
- printf("A: Memory block exported as %u\n", id);
+ pa_log("A: Memory block exported as %u", id);
mb_b = pa_memimport_get(import_b, id, shm_id, offset, size);
pa_assert(mb_b);
pa_assert(shm_id == id_a || shm_id == id_b);
pa_memblock_unref(mb_b);
- printf("B: Memory block exported as %u\n", id);
+ pa_log("B: Memory block exported as %u", id);
mb_c = pa_memimport_get(import_c, id, shm_id, offset, size);
pa_assert(mb_c);
x = pa_memblock_acquire(mb_c);
- printf("1 data=%s\n", x);
+ pa_log_debug("1 data=%s", x);
pa_memblock_release(mb_c);
print_stats(pool_a, "A");
pa_memexport_free(export_b);
x = pa_memblock_acquire(mb_c);
- printf("2 data=%s\n", x);
+ pa_log_debug("2 data=%s", x);
pa_memblock_release(mb_c);
pa_memblock_unref(mb_c);
pa_memexport_free(export_a);
}
- printf("vacuuming...\n");
+ pa_log("vacuuming...");
pa_mempool_vacuum(pool_a);
pa_mempool_vacuum(pool_b);
pa_mempool_vacuum(pool_c);
- printf("vacuuming done...\n");
+ pa_log("vacuuming done...");
pa_mempool_free(pool_a);
pa_mempool_free(pool_b);
q = pa_memblock_acquire(chunk->memblock);
for (e = (char*) q + chunk->index, n = 0; n < chunk->length; n++, e++)
- printf("%c", *e);
+ fprintf(stderr, "%c", *e);
pa_memblock_release(chunk->memblock);
}
pa_assert(bq);
/* First let's dump this as fixed block */
- printf("FIXED >");
+ fprintf(stderr, "FIXED >");
pa_memblockq_peek_fixed_size(bq, 64, &out);
dump_chunk(&out);
pa_memblock_unref(out.memblock);
- printf("<\n");
+ fprintf(stderr, "<\n");
/* Then let's dump the queue manually */
- printf("MANUAL>");
+ fprintf(stderr, "MANUAL>");
for (;;) {
if (pa_memblockq_peek(bq, &out) < 0)
pa_memblockq_drop(bq, out.length);
}
- printf("<\n");
+ fprintf(stderr, "<\n");
}
int main(int argc, char *argv[]) {
void *d;
unsigned i;
+ if (getenv("MAKE_CHECK"))
+ return;
+
d = pa_memblock_acquire(chunk->memblock);
switch (ss->format) {
pa_sample_spec a;
pa_cvolume v;
- pa_log_set_level(PA_LOG_DEBUG);
+ if (!getenv("MAKE_CHECK"))
+ pa_log_set_level(PA_LOG_DEBUG);
pa_assert_se(pool = pa_mempool_new(FALSE, 0));
pa_mix_info m[2];
void *ptr;
- printf("=== mixing: %s\n", pa_sample_format_to_string(a.format));
+ pa_log_debug("=== mixing: %s\n", pa_sample_format_to_string(a.format));
/* Generate block */
i.memblock = generate_block(pool, &a);
pa_assert_se(pthread_setaffinity_np(pthread_self(), sizeof(mask), &mask) == 0);
#endif
- /* pa_log("started up: %s", data); */
+ pa_log_debug("started up: %s", (char *) data);
r = pthread_barrier_wait(&barrier);
pa_assert(r == 0 || r == PTHREAD_BARRIER_SERIAL_THREAD);
int main(int argc, char *argv[]) {
unsigned n, i;
+ if (!getenv("MAKE_CHECK"))
+ pa_log_set_level(PA_LOG_DEBUG);
+
n_cpu = pa_ncpus();
for (n = 0; n < N_ITERATIONS; n++) {
pa_thread_join(threads[i]);
pa_assert(n_run == 1);
- pa_log("ran by %s", ran_by);
+ pa_log_info("ran by %s", ran_by);
for (i = 0; i < N_THREADS; i++) {
pa_xfree(pa_thread_get_data(threads[i]));
#endif
#include <pulsecore/prioq.h>
+#include <pulsecore/log.h>
#include <pulsecore/macro.h>
#define N 1024
srand(0);
+ if (!getenv("MAKE_CHECK"))
+ pa_log_set_level(PA_LOG_DEBUG);
+
q = pa_prioq_new(pa_idxset_trivial_compare_func);
/* Fill in 1024 */
/* Remove half of it again */
for (i = 0; i < N/2; i++){
unsigned u = PA_PTR_TO_UINT(pa_prioq_pop(q));
- pa_log("%16u", u);
+ pa_log_debug("%16u", u);
}
- pa_log("Refilling");
+ pa_log_debug("Refilling");
/* Fill in another 1024 */
for (i = 0; i < N; i++)
pa_prioq_put(q, PA_UINT_TO_PTR((unsigned) rand()));
-
/* Remove everything */
while (!pa_prioq_isempty(q)) {
unsigned u = PA_PTR_TO_UINT(pa_prioq_pop(q));
- pa_log("%16u", u);
+ pa_log_debug("%16u", u);
}
pa_prioq_free(q, NULL, NULL);
const char *text;
const char *x[] = { "foo", NULL };
+ if (!getenv("MAKE_CHECK"))
+ pa_log_set_level(PA_LOG_DEBUG);
+
a = pa_proplist_new();
pa_assert_se(pa_proplist_sets(a, PA_PROP_MEDIA_TITLE, "Brandenburgische Konzerte") == 0);
pa_assert_se(pa_proplist_sets(a, PA_PROP_MEDIA_ARTIST, "Johann Sebastian Bach") == 0);
pa_assert_se(!pa_proplist_gets(a, PA_PROP_MEDIA_ICON));
- printf("%s\n", pa_strnull(pa_proplist_gets(a, PA_PROP_MEDIA_TITLE)));
+ pa_log_debug("%s", pa_strnull(pa_proplist_gets(a, PA_PROP_MEDIA_TITLE)));
pa_assert_se(pa_proplist_unset(b, PA_PROP_MEDIA_TITLE) == 0);
s = pa_proplist_to_string(a);
t = pa_proplist_to_string(b);
- printf("---\n%s---\n%s", s, t);
+ pa_log_debug("---\n%s---\n%s", s, t);
c = pa_proplist_from_string(s);
u = pa_proplist_to_string(c);
text = " eins = zwei drei = \"\\\"vier\\\"\" fuenf=sechs sieben ='\\a\\c\\h\\t\\'\\\"' neun= hex:0123456789abCDef ";
- printf("%s\n", text);
+ pa_log_debug("%s", text);
d = pa_proplist_from_string(text);
v = pa_proplist_to_string(d);
pa_proplist_free(d);
- printf("%s\n", v);
+ pa_log_debug("%s", v);
d = pa_proplist_from_string(v);
pa_xfree(v);
v = pa_proplist_to_string(d);
pa_proplist_free(d);
- printf("%s\n", v);
+ pa_log_debug("%s", v);
pa_xfree(v);
pa_assert_se(ma = pa_modargs_new("foo='foobar=waldo foo2=\"lj\\\"dhflh\" foo3=\"kjlskj\\'\"'", x));
pa_assert_se(pa_modargs_get_proplist(ma, "foo", a, PA_UPDATE_REPLACE) >= 0);
- printf("%s\n", v = pa_proplist_to_string(a));
+ pa_log_debug("%s", v = pa_proplist_to_string(a));
pa_xfree(v);
pa_proplist_free(a);
#include <pulse/volume.h>
#include <pulsecore/i18n.h>
+#include <pulsecore/log.h>
#include <pulsecore/resampler.h>
#include <pulsecore/macro.h>
#include <pulsecore/endianmacros.h>
#include <pulsecore/sample-util.h>
#include <pulsecore/core-util.h>
-static void dump_block(const pa_sample_spec *ss, const pa_memchunk *chunk) {
+static void dump_block(const char *label, const pa_sample_spec *ss, const pa_memchunk *chunk) {
void *d;
unsigned i;
+ if (getenv("MAKE_CHECK"))
+ return;
+ printf("%s: \t", label);
+
d = pa_memblock_acquire(chunk->memblock);
switch (ss->format) {
int main(int argc, char *argv[]) {
pa_mempool *pool = NULL;
pa_sample_spec a, b;
- int ret = 1, verbose = 0, c;
+ int ret = 1, c;
pa_bool_t all_formats = TRUE;
pa_resample_method_t method;
int seconds;
setlocale(LC_ALL, "");
bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR);
- pa_log_set_level(PA_LOG_DEBUG);
+ pa_log_set_level(PA_LOG_WARN);
+ if (!getenv("MAKE_CHECK"))
+ pa_log_set_level(PA_LOG_INFO);
pa_assert_se(pool = pa_mempool_new(FALSE, 0));
case 'v':
pa_log_set_level(PA_LOG_DEBUG);
- verbose = 1;
break;
case ARG_VERSION:
pa_memchunk i, j;
pa_usec_t ts;
- if (verbose) {
- printf(_("Compilation CFLAGS: %s\n"), PA_CFLAGS);
- printf(_("=== %d seconds: %d Hz %d ch (%s) -> %d Hz %d ch (%s)\n"), seconds,
+ pa_log_debug(_("Compilation CFLAGS: %s"), PA_CFLAGS);
+ pa_log_debug(_("=== %d seconds: %d Hz %d ch (%s) -> %d Hz %d ch (%s)"), seconds,
a.rate, a.channels, pa_sample_format_to_string(a.format),
b.rate, b.channels, pa_sample_format_to_string(b.format));
- }
ts = pa_rtclock_now();
pa_assert_se(resampler = pa_resampler_new(pool, &a, NULL, &b, NULL, method, 0));
- printf("init: %llu\n", (long long unsigned)(pa_rtclock_now() - ts));
+ pa_log_info("init: %llu", (long long unsigned)(pa_rtclock_now() - ts));
i.memblock = pa_memblock_new(pool, pa_usec_to_bytes(1*PA_USEC_PER_SEC, &a));
pa_resampler_run(resampler, &i, &j);
pa_memblock_unref(j.memblock);
}
- printf("resampling: %llu\n", (long long unsigned)(pa_rtclock_now() - ts));
+ pa_log_info("resampling: %llu", (long long unsigned)(pa_rtclock_now() - ts));
pa_memblock_unref(i.memblock);
pa_resampler_free(resampler);
pa_resampler *forth, *back;
pa_memchunk i, j, k;
- if (verbose)
- printf("=== %s -> %s -> %s -> /2\n",
+ pa_log_debug("=== %s -> %s -> %s -> /2",
pa_sample_format_to_string(a.format),
pa_sample_format_to_string(b.format),
pa_sample_format_to_string(a.format));
pa_resampler_run(forth, &i, &j);
pa_resampler_run(back, &j, &k);
- printf("before: ");
- dump_block(&a, &i);
- printf("after : ");
- dump_block(&b, &j);
- printf("reverse: ");
- dump_block(&a, &k);
+ dump_block("before", &a, &i);
+ dump_block("after", &b, &j);
+ dump_block("reverse", &a, &k);
pa_memblock_unref(i.memblock);
pa_memblock_unref(j.memblock);
#include <stdio.h>
#include <stdlib.h>
-#include <pulsecore/time-smoother.h>
#include <pulse/timeval.h>
+#include <pulsecore/log.h>
+#include <pulsecore/time-smoother.h>
+
int main(int argc, char*argv[]) {
pa_usec_t x;
unsigned u = 0;
srand(0);
- pa_log_set_level(PA_LOG_DEBUG);
+ if (!getenv("MAKE_CHECK"))
+ pa_log_set_level(PA_LOG_DEBUG);
for (m = 0, u = 0; u < PA_ELEMENTSOF(msec); u+= 2) {
while (u < PA_ELEMENTSOF(msec) && (pa_usec_t) msec[u]*PA_USEC_PER_MSEC < x) {
pa_smoother_put(s, (pa_usec_t) msec[u] * PA_USEC_PER_MSEC, (pa_usec_t) msec[u+1] * PA_USEC_PER_MSEC);
- printf("%i\t\t%i\n", msec[u], msec[u+1]);
+ pa_log_debug("%i\t\t%i", msec[u], msec[u+1]);
u += 2;
pa_smoother_resume(s, (pa_usec_t) msec[u] * PA_USEC_PER_MSEC, TRUE);
}
- printf("%llu\t%llu\n", (unsigned long long) (x/PA_USEC_PER_MSEC), (unsigned long long) (pa_smoother_get(s, x)/PA_USEC_PER_MSEC));
+ pa_log_debug("%llu\t%llu", (unsigned long long) (x/PA_USEC_PER_MSEC), (unsigned long long) (pa_smoother_get(s, x)/PA_USEC_PER_MSEC));
}
pa_smoother_free(s);
fprintf(stderr, "waiting 5s (sleep)\n");
pa_msleep(5000);
- fprintf(stderr, "shutting down\n");
-
pa_threaded_mainloop_stop(m);
pa_threaded_mainloop_free(m);
static void thread_func(void *data) {
pa_tls_set(tls, data);
- pa_log("thread_func() for %s starting...", (char*) pa_tls_get(tls));
+ pa_log_info("thread_func() for %s starting...", (char*) pa_tls_get(tls));
pa_mutex_lock(mutex);
for (;;) {
int k, n;
- pa_log("%s waiting ...", (char*) pa_tls_get(tls));
+ pa_log_info("%s waiting ...", (char*) pa_tls_get(tls));
for (;;) {
pa_cond_signal(cond2, 0);
- pa_log("%s got number %i", (char*) pa_tls_get(tls), k);
+ pa_log_info("%s got number %i", (char*) pa_tls_get(tls), k);
/* Spin! */
for (n = 0; n < k; n++)
pa_mutex_unlock(mutex);
- pa_log("thread_func() for %s done...", (char*) pa_tls_get(tls));
+ pa_log_info("thread_func() for %s done...", (char*) pa_tls_get(tls));
}
int main(int argc, char *argv[]) {
int i, k;
pa_thread* t[THREADS_MAX];
+ if (!getenv("MAKE_CHECK"))
+ pa_log_set_level(PA_LOG_DEBUG);
+
mutex = pa_mutex_new(FALSE, FALSE);
cond1 = pa_cond_new();
cond2 = pa_cond_new();
magic_number = (int) rand() % 0x10000;
- pa_log("iteration %i (%i)", k, magic_number);
+ pa_log_info("iteration %i (%i)", k, magic_number);
pa_cond_signal(cond1, 0);
assert(pa_utf8_valid("hallo\n"));
assert(pa_utf8_valid("hüpfburg\n"));
- printf("LATIN1: %s\n", c = pa_utf8_filter("hüpfburg"));
+ fprintf(stderr, "LATIN1: %s\n", c = pa_utf8_filter("hüpfburg"));
pa_xfree(c);
- printf("UTF8: %sx\n", c = pa_utf8_filter("hüpfburg"));
+ fprintf(stderr, "UTF8: %sx\n", c = pa_utf8_filter("hüpfburg"));
pa_xfree(c);
- printf("LATIN1: %sx\n", c = pa_utf8_filter("üxknärzmörzeltörszß³§dsjkfh"));
+ fprintf(stderr, "LATIN1: %sx\n", c = pa_utf8_filter("üxknärzmörzeltörszß³§dsjkfh"));
pa_xfree(c);
return 0;
#include <pulse/volume.h>
+#include <pulsecore/log.h>
#include <pulsecore/macro.h>
int main(int argc, char *argv[]) {
pa_volume_t md = 0;
unsigned mdn = 0;
- printf("Attenuation of sample 1 against 32767: %g dB\n", 20.0*log10(1.0/32767.0));
- printf("Smallest possible attenuation > 0 applied to 32767: %li\n", lrint(32767.0*pa_sw_volume_to_linear(1)));
+ if (!getenv("MAKE_CHECK"))
+ pa_log_set_level(PA_LOG_DEBUG);
+
+ pa_log("Attenuation of sample 1 against 32767: %g dB", 20.0*log10(1.0/32767.0));
+ pa_log("Smallest possible attenuation > 0 applied to 32767: %li", lrint(32767.0*pa_sw_volume_to_linear(1)));
for (v = PA_VOLUME_MUTED; v <= PA_VOLUME_NORM*2; v += 256) {
double dB = pa_sw_volume_to_dB(v);
double f = pa_sw_volume_to_linear(v);
- printf("Volume: %3i; percent: %i%%; decibel %0.2f; linear = %0.2f; volume(decibel): %3i; volume(linear): %3i\n",
+ pa_log_debug("Volume: %3i; percent: %i%%; decibel %0.2f; linear = %0.2f; volume(decibel): %3i; volume(linear): %3i",
v, (v*100)/PA_VOLUME_NORM, dB, f, pa_sw_volume_from_dB(dB), pa_sw_volume_from_linear(f));
}
pa_cvolume_set(&cv, 2, v);
- printf("Volume: %3i [%s] [%s]\n",
- v,
- pa_cvolume_snprint(s, sizeof(s), &cv),
- pa_sw_cvolume_snprint_dB(t, sizeof(t), &cv));
-
+ pa_log_debug("Volume: %3i [%s] [%s]", v, pa_cvolume_snprint(s, sizeof(s), &cv), pa_sw_cvolume_snprint_dB(t, sizeof(t), &cv));
}
map.channels = cv.channels = 2;
for (cv.values[1] = PA_VOLUME_MUTED; cv.values[1] <= PA_VOLUME_NORM*2; cv.values[1] += 4096) {
char s[PA_CVOLUME_SNPRINT_MAX];
- printf("Volume: [%s]; balance: %2.1f\n", pa_cvolume_snprint(s, sizeof(s), &cv), pa_cvolume_get_balance(&cv, &map));
+ pa_log_debug("Volume: [%s]; balance: %2.1f", pa_cvolume_snprint(s, sizeof(s), &cv), pa_cvolume_get_balance(&cv, &map));
}
for (cv.values[0] = PA_VOLUME_MUTED+4096; cv.values[0] <= PA_VOLUME_NORM*2; cv.values[0] += 4096)
pa_cvolume r;
float k;
- printf("Before: volume: [%s]; balance: %2.1f\n", pa_cvolume_snprint(s, sizeof(s), &cv), pa_cvolume_get_balance(&cv, &map));
+ pa_log_debug("Before: volume: [%s]; balance: %2.1f", pa_cvolume_snprint(s, sizeof(s), &cv), pa_cvolume_get_balance(&cv, &map));
r = cv;
pa_cvolume_set_balance(&r, &map,b);
k = pa_cvolume_get_balance(&r, &map);
- printf("After: volume: [%s]; balance: %2.1f (intended: %2.1f) %s\n", pa_cvolume_snprint(s, sizeof(s), &r), k, b, k < b-.05 || k > b+.5 ? "MISMATCH" : "");
+ pa_log_debug("After: volume: [%s]; balance: %2.1f (intended: %2.1f) %s", pa_cvolume_snprint(s, sizeof(s), &r), k, b, k < b-.05 || k > b+.5 ? "MISMATCH" : "");
}
for (v = PA_VOLUME_MUTED; v <= PA_VOLUME_NORM*2; v += 51) {
}
}
- printf("max deviation: %lu n=%lu\n", (unsigned long) md, (unsigned long) mdn);
+ pa_log("max deviation: %lu n=%lu", (unsigned long) md, (unsigned long) mdn);
pa_assert(md <= 1);
pa_assert(mdn <= 251);