spLib
読み取り中…
検索中…
一致する文字列を見つけられません
sfconv.h
1/*
2 * sfconv.h
3 */
4
5#ifndef SPLIB_SFCONV_H
6#define SPLIB_SFCONV_H
7
8#include <sp/vector.h>
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14#if defined(MACOS)
15#pragma import on
16#endif
17
18extern void setsfcframe(double framem);
19extern void getsfcframe(double *framem);
20extern void setsfcparam(double cutoff, double sidelobe, double transition,
21 double tolerance, long fftl);
22extern void getsfcparam(double *cutoff, double *sidelobe, double *transition,
23 double *tolerance, long *fftl);
24extern double getsfcratio(double i_samp_freq, double o_samp_freq, double tolerance,
25 long *upratio, long *downratio);
26
27extern spDVector xdvupsample(spDVector sig, long upratio);
28extern spDVector xdvdownsample(spDVector sig, long downratio, long offset, long length);
29
30extern int resamplefile(const char *i_filename, int i_swap, const char *o_filename, int o_swap,
31 spDVector filter, long upratio, long downratio);
32extern int resampledfile(const char *i_filename, int i_swap, const char *o_filename, int o_swap,
33 spDVector filter, long upratio, long downratio);
34extern int sfconvlongfile(const char *i_filename, int i_swap, double i_samp_freq,
35 const char *o_filename, int o_swap, double o_samp_freq);
36extern int sfconvlongdfile(const char *i_filename, int i_swap, double i_samp_freq,
37 const char *o_filename, int o_swap, double o_samp_freq);
38extern spDVector xdvsfconvfile(const char *i_filename, int swap, double i_samp_freq, double o_samp_freq);
39extern spDVector xdvsfconvdfile(const char *i_filename, int swap, double i_samp_freq, double o_samp_freq);
40extern spDVector xdvfirresample(long upratio, long downratio, double n);
41extern spDVector xdvresample(spDVector isig, spDVector filter, long upratio, long downratio);
42extern spDVector xdvsfconv(spDVector isig, double i_samp_freq, double o_samp_freq, double *new_o_samp_freq);
43extern int sfconvfile(const char *i_filename, int i_swap, double i_samp_freq,
44 const char *o_filename, int o_swap, double o_samp_freq);
45extern int sfconvdfile(const char *i_filename, int i_swap, double i_samp_freq,
46 const char *o_filename, int o_swap, double o_samp_freq);
47
48#define SP_RESAMPLE_VERSION_STRING "1.0.0"
49#define SP_RESAMPLE_VERSION 1
50#define SP_RESAMPLE_REVISION 0
51#define SP_RESAMPLE_UPDATE_LEVEL 0
52#define SP_RESAMPLE_VERSION_ID (SP_RESAMPLE_VERSION * 1000 + SP_RESAMPLE_REVISION)
53
54typedef struct _spResampleRec *spResampleRec;
55
56#define SP_RESAMPLE_OPTION_FILTER_TYPE_KAISER (1<<0)
57#define SP_RESAMPLE_OPTION_FILTER_TYPE_HAMMING (1<<1) /* not supported yet */
58#define SP_RESAMPLE_OPTION_FILTER_TYPE_BUTTERWORTH (1<<2) /* not supported yet */
59#define SP_RESAMPLE_OPTION_FILTER_TYPE_CHEBYSHEV (1<<3) /* not supported yet */
60#define SP_RESAMPLE_OPTION_TRUNCATE_EDGE (1<<8) /* truncate waveform head and tail edge generated by filtering */
61#define SP_RESAMPLE_OPTION_INPUT_INTERLEAVED (1<<9)
62#define SP_RESAMPLE_OPTION_OUTPUT_INTERLEAVED (1<<10)
63
64typedef struct _spResampleConfig {
65 unsigned long version_id; /* this member is automatically initialized by spResampleInitConfig */
66
67 int num_channel; /* number of channels; stereo=2, mono=1. default=1 (mono) */
68 int input_samp_bit;
69 int output_samp_bit;
70
71 long max_input_buf_length;
72
73 unsigned long options;
74
75 double cutoff;
76 double sidelobe;
77 double transition;
78 double tolerance;
79} spResampleConfig;
80
81extern spBool _spResampleInitConfig(spResampleConfig *config, unsigned long version_id);
82#define spResampleInitConfig(conf) _spResampleInitConfig(conf, SP_RESAMPLE_VERSION_ID)
83
84extern spResampleRec spResampleOpen(spResampleConfig *config);
85extern spBool spResampleClose(spResampleRec resample);
86
87extern spBool spResampleSetRatioWithFilter(spResampleRec resample, spDVector filter, long upratio, long downratio,
88 long *max_output_buf_length, long *default_delay);
89extern spBool spResampleSetRatio(spResampleRec resample, long upratio, long downratio,
90 long *max_output_buf_length, long *default_delay);
91extern double spResampleCalcRatioFromFrequency(double tolerance, double i_samp_freq, double o_samp_freq,
92 long *upratio, long *downratio);
93extern double spResampleSetFrequencyWithFilter(spResampleRec resample, spDVector filter, double i_samp_freq, double o_samp_freq,
94 long *max_output_buf_length, long *default_delay);
95extern double spResampleSetFrequency(spResampleRec resample, double i_samp_freq, double o_samp_freq,
96 long *max_output_buf_length, long *default_delay);
97
98extern long spResampleGetNextMaxInputBufferLength(spResampleRec resample, long output_buf_length);
99extern long _spResampleProcess(spResampleRec resample, char *input_buf, long input_buf_length, char *output_buf, long *current_delay);
100#define spResampleProcess(resample, input_buf, input_buf_length, output_buf, current_delay) _spResampleProcess(resample, (char *)(input_buf), input_buf_length, (char *)(output_buf), current_delay)
101
102extern spBool spResampleReset(spResampleRec resample);
103extern long _spResampleFlush(spResampleRec resample, char *output_buf);
104#define spResampleFlush(resample, output_buf) _spResampleFlush(resample, (char *)output_buf)
105
106#if defined(MACOS)
107#pragma import off
108#endif
109
110#ifdef __cplusplus
111} /* Close scope of 'extern "C"' declaration */
112#endif
113
114#endif /* SPLIB_SFCONV_H */
int spBool
double型を扱うためのベクトル型です.
Definition vector.h:248