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