xref: /btstack/platform/posix/wav_util.h (revision abc9118691c439b59ae8345cd3aab821aca3bb5b)
1*abc91186SMilanka Ringwald /*
2*abc91186SMilanka Ringwald  * Copyright (C) 2016 BlueKitchen GmbH
3*abc91186SMilanka Ringwald  *
4*abc91186SMilanka Ringwald  * Redistribution and use in source and binary forms, with or without
5*abc91186SMilanka Ringwald  * modification, are permitted provided that the following conditions
6*abc91186SMilanka Ringwald  * are met:
7*abc91186SMilanka Ringwald  *
8*abc91186SMilanka Ringwald  * 1. Redistributions of source code must retain the above copyright
9*abc91186SMilanka Ringwald  *    notice, this list of conditions and the following disclaimer.
10*abc91186SMilanka Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11*abc91186SMilanka Ringwald  *    notice, this list of conditions and the following disclaimer in the
12*abc91186SMilanka Ringwald  *    documentation and/or other materials provided with the distribution.
13*abc91186SMilanka Ringwald  * 3. Neither the name of the copyright holders nor the names of
14*abc91186SMilanka Ringwald  *    contributors may be used to endorse or promote products derived
15*abc91186SMilanka Ringwald  *    from this software without specific prior written permission.
16*abc91186SMilanka Ringwald  * 4. Any redistribution, use, or modification is done solely for
17*abc91186SMilanka Ringwald  *    personal benefit and not for any commercial purpose or for
18*abc91186SMilanka Ringwald  *    monetary gain.
19*abc91186SMilanka Ringwald  *
20*abc91186SMilanka Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21*abc91186SMilanka Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22*abc91186SMilanka Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23*abc91186SMilanka Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
24*abc91186SMilanka Ringwald  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25*abc91186SMilanka Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26*abc91186SMilanka Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27*abc91186SMilanka Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28*abc91186SMilanka Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29*abc91186SMilanka Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30*abc91186SMilanka Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31*abc91186SMilanka Ringwald  * SUCH DAMAGE.
32*abc91186SMilanka Ringwald  *
33*abc91186SMilanka Ringwald  * Please inquire about commercial licensing options at
34*abc91186SMilanka Ringwald  * [email protected]
35*abc91186SMilanka Ringwald  *
36*abc91186SMilanka Ringwald  */
37*abc91186SMilanka Ringwald 
38*abc91186SMilanka Ringwald #include <stdint.h>
39*abc91186SMilanka Ringwald #include <stdio.h>
40*abc91186SMilanka Ringwald #include <stdlib.h>
41*abc91186SMilanka Ringwald #include <string.h>
42*abc91186SMilanka Ringwald #include <fcntl.h>
43*abc91186SMilanka Ringwald #include <unistd.h>
44*abc91186SMilanka Ringwald 
45*abc91186SMilanka Ringwald // return 0 if ok
46*abc91186SMilanka Ringwald int wav_writer_open(const char * filepath, int num_channels, int sampling_frequency);
47*abc91186SMilanka Ringwald int wav_writer_write_int8(int num_samples, int8_t * data);
48*abc91186SMilanka Ringwald int wav_writer_close(void);
49*abc91186SMilanka Ringwald 
50*abc91186SMilanka Ringwald 
51*abc91186SMilanka Ringwald // return 0 if ok
52*abc91186SMilanka Ringwald int wav_reader_open(const char * filepath);
53*abc91186SMilanka Ringwald int wav_reader_read_int8(int num_samples, int8_t * data);
54*abc91186SMilanka Ringwald int wav_reader_close(void);
55*abc91186SMilanka Ringwald 
56*abc91186SMilanka Ringwald //
57*abc91186SMilanka Ringwald void wav_synthesize_sine_wave_int8(int num_samples, int8_t * data);
58*abc91186SMilanka Ringwald 
59