1 /*** 2 This file is part of PulseAudio. 3 4 Copyright 2013 Collabora Ltd. 5 Author: Arun Raghavan <arun.raghavan@collabora.co.uk> 6 7 PulseAudio is free software; you can redistribute it and/or modify 8 it under the terms of the GNU Lesser General Public License as published 9 by the Free Software Foundation; either version 2.1 of the License, 10 or (at your option) any later version. 11 12 PulseAudio is distributed in the hope that it will be useful, but 13 WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 General Public License for more details. 16 17 You should have received a copy of the GNU Lesser General Public License 18 along with PulseAudio; if not, see <http://www.gnu.org/licenses/>. 19 ***/ 20 21 #ifdef HAVE_CONFIG_H 22 #include <config.h> 23 #endif 24 25 #include <pulse/pulseaudio.h> 26 27 typedef struct pa_lo_test_context { 28 /* Tests need to set these */ 29 const char *context_name; 30 31 pa_sample_spec sample_spec; 32 int play_latency; /* ms */ 33 int rec_latency; /* ms */ 34 35 pa_stream_request_cb_t write_cb, read_cb; 36 37 /* These are set by lo_test_init() */ 38 pa_mainloop *mainloop; 39 pa_context *context; 40 41 pa_stream *play_stream, *rec_stream; 42 43 int ss, fs; /* sample size, frame size for convenience */ 44 } pa_lo_test_context; 45 46 /* Initialise the test parameters, connect */ 47 int pa_lo_test_init(pa_lo_test_context *ctx); 48 /* Start running the test */ 49 int pa_lo_test_run(pa_lo_test_context *ctx); 50 /* Clean up */ 51 void pa_lo_test_deinit(pa_lo_test_context *ctx); 52 53 /* Return RMS for the given signal. Assumes the data is a single channel for 54 * simplicity */ 55 float pa_rms(const float *s, int n); 56