]> code.delx.au - pulseaudio/blob - src/tests/lo-test-util.h
channelmap: Add 2.1 surround
[pulseaudio] / src / tests / lo-test-util.h
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, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA.
21 ***/
22
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26
27 #include <pulse/pulseaudio.h>
28
29 typedef struct pa_lo_test_context {
30 /* Tests need to set these */
31 const char *context_name;
32
33 pa_sample_spec sample_spec;
34 int play_latency; /* ms */
35 int rec_latency; /* ms */
36
37 pa_stream_request_cb_t write_cb, read_cb;
38
39 /* These are set by lo_test_init() */
40 pa_mainloop *mainloop;
41 pa_context *context;
42
43 pa_stream *play_stream, *rec_stream;
44
45 int ss, fs; /* sample size, frame size for convenience */
46 } pa_lo_test_context;
47
48 /* Initialise the test parameters, connect */
49 int pa_lo_test_init(pa_lo_test_context *ctx);
50 /* Start running the test */
51 int pa_lo_test_run(pa_lo_test_context *ctx);
52 /* Clean up */
53 void pa_lo_test_deinit(pa_lo_test_context *ctx);
54
55 /* Return RMS for the given signal. Assumes the data is a single channel for
56 * simplicity */
57 float pa_rms(const float *s, int n);