00001 /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 00002 /* 00003 * Copyright (c) 2008 Beyond Access, Inc. All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 00009 * 1. Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * 00012 * 2. Redistributions in binary form must reproduce the above copyright 00013 * notice, this list of conditions and the following disclaimer in 00014 * the documentation and/or other materials provided with the 00015 * distribution. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY BEYOND ACCESS, INC. ``AS IS'' AND ANY 00018 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00019 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00020 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BEYOND ACCESS, INC. NOR 00021 * ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00022 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00023 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00024 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00025 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00026 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00027 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00028 */ 00029 00042 #ifndef __YIN_H__ 00043 #define __YIN_H__ 00044 00045 #ifdef __cplusplus 00046 extern "C" 00047 #endif 00048 #if 0 00049 } /* Fool Emacs. */ 00050 #endif 00051 00052 #include <prim_type.h> 00053 00057 typedef struct yin_s yin_t; 00058 00062 yin_t *yin_init(int frame_size, float search_threshold, 00063 float search_range, int smooth_window); 00064 00068 void yin_free(yin_t *pe); 00069 00073 void yin_start(yin_t *pe); 00074 00078 void yin_end(yin_t *pe); 00079 00087 void yin_write(yin_t *pe, int16 const *frame); 00088 00102 int yin_read(yin_t *pe, uint16 *out_period, uint16 *out_bestdiff); 00103 00104 #ifdef __cplusplus 00105 } 00106 #endif 00107 00108 #endif /* __YIN_H__ */ 00109