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 23*2fca4dadSMilanka Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN 24*2fca4dadSMilanka Ringwald * GMBH 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 384795fc1aSMatthias Ringwald #ifndef WAV_UIL_H 394795fc1aSMatthias Ringwald #define WAV_UIL_H 404795fc1aSMatthias Ringwald 41abc91186SMilanka Ringwald #include <stdint.h> 42abc91186SMilanka Ringwald #include <stdio.h> 43abc91186SMilanka Ringwald #include <stdlib.h> 44abc91186SMilanka Ringwald #include <string.h> 45abc91186SMilanka Ringwald #include <fcntl.h> 46abc91186SMilanka Ringwald #include <unistd.h> 47abc91186SMilanka Ringwald 484795fc1aSMatthias Ringwald #if defined __cplusplus 494795fc1aSMatthias Ringwald extern "C" { 504795fc1aSMatthias Ringwald #endif 514795fc1aSMatthias Ringwald 52abc91186SMilanka Ringwald // return 0 if ok 5392abe7b9SMatthias Ringwald 5492abe7b9SMatthias Ringwald /** 557f812a18SMatthias Ringwald * Open singleton wav writer 5692abe7b9SMatthias Ringwald * @return 0 if ok 5792abe7b9SMatthias Ringwald */ 58abc91186SMilanka Ringwald int wav_writer_open(const char * filepath, int num_channels, int sampling_frequency); 5992abe7b9SMatthias Ringwald /** 6092abe7b9SMatthias Ringwald * Write Int8 samples 6192abe7b9SMatthias Ringwald * @return 0 if ok 6292abe7b9SMatthias Ringwald */ 63abc91186SMilanka Ringwald int wav_writer_write_int8(int num_samples, int8_t * data); 6492abe7b9SMatthias Ringwald /** 6592abe7b9SMatthias Ringwald * Write Int16 samples (host endianess) 6692abe7b9SMatthias Ringwald * @return 0 if ok 6792abe7b9SMatthias Ringwald */ 68fbc7c9f2SMilanka Ringwald int wav_writer_write_int16(int num_samples, int16_t * data); 6992abe7b9SMatthias Ringwald /** 7092abe7b9SMatthias Ringwald * Write Little Endian Int16 samples 7192abe7b9SMatthias Ringwald * @return 0 if ok 7292abe7b9SMatthias Ringwald */ 7392abe7b9SMatthias Ringwald int wav_writer_write_le_int16(int num_samples, int16_t * data); 7492abe7b9SMatthias Ringwald /** 7592abe7b9SMatthias Ringwald * Close wav writer and update wav file header 7692abe7b9SMatthias Ringwald * @return 0 if ok 7792abe7b9SMatthias Ringwald */ 78abc91186SMilanka Ringwald int wav_writer_close(void); 79abc91186SMilanka Ringwald 80abc91186SMilanka Ringwald 817f812a18SMatthias Ringwald /** 827f812a18SMatthias Ringwald * Open singleton war reader 837f812a18SMatthias Ringwald * @return 0 if ok 847f812a18SMatthias Ringwald */ 85abc91186SMilanka Ringwald int wav_reader_open(const char * filepath); 867f812a18SMatthias Ringwald /** 877f812a18SMatthias Ringwald * Read Int8 samples 887f812a18SMatthias Ringwald * @return 0 if ok 897f812a18SMatthias Ringwald */ 90abc91186SMilanka Ringwald int wav_reader_read_int8(int num_samples, int8_t * data); 917f812a18SMatthias Ringwald /** 927f812a18SMatthias Ringwald * Read Int16 samples (host endianess) 937f812a18SMatthias Ringwald * @return 0 if ok 947f812a18SMatthias Ringwald */ 95fbc7c9f2SMilanka Ringwald int wav_reader_read_int16(int num_samples, int16_t * data); 967f812a18SMatthias Ringwald /** 977f812a18SMatthias Ringwald * Close war reader 987f812a18SMatthias Ringwald * @return 0 if ok 997f812a18SMatthias Ringwald */ 100abc91186SMilanka Ringwald int wav_reader_close(void); 101abc91186SMilanka Ringwald 1024795fc1aSMatthias Ringwald #if defined __cplusplus 1034795fc1aSMatthias Ringwald } 1044795fc1aSMatthias Ringwald #endif 1054795fc1aSMatthias Ringwald 1064795fc1aSMatthias Ringwald #endif // WAV_UTIL_H 107