提交 68365e34 authored 作者: Michael Jerris's avatar Michael Jerris

Add function pointer typedef.

Switch to use /* */ comments to survive pickier compile flags.
Change destroy function to take ** pointer so it can set the pointer back to NULL
make code style consistent with the rest of the lib.






git-svn-id: http://svn.openzap.org/svn/openzap/trunk@202 a93c3328-9c30-0410-af19-c9cd2b2d52af
上级 5eed6650
...@@ -35,19 +35,22 @@ ...@@ -35,19 +35,22 @@
#ifndef __BELL202_H__ #ifndef __BELL202_H__
#define __BELL202_H__ #define __BELL202_H__
typedef void (*bytehandler_func_t) (void *, int);
typedef void (*bithandler_func_t) (void *, int);
typedef struct dsp_bell202_attr_s typedef struct dsp_bell202_attr_s
{ {
int sample_rate; // sample rate in HZ int sample_rate; // sample rate in HZ
void (*bithandler) (void *, int); // bit handler bithandler_func_t bithandler; // bit handler
void *bithandler_arg; // arbitrary ID passed to bithandler as first argument void *bithandler_arg; // arbitrary ID passed to bithandler as first argument
void (*bytehandler) (void *, int); // byte handler bytehandler_func_t bytehandler; // byte handler
void *bytehandler_arg; // arbitrary ID passed to bytehandler as first argument void *bytehandler_arg; // arbitrary ID passed to bytehandler as first argument
} dsp_bell202_attr_t; } dsp_bell202_attr_t;
typedef struct typedef struct
{ {
dsp_bell202_attr_t attr; // attributes structure dsp_bell202_attr_t attr; // attributes structure
double *correlates [4]; // one for each of sin/cos for mark/space double *correlates[4]; // one for each of sin/cos for mark/space
int corrsize; // correlate size (also number of samples in ring buffer) int corrsize; // correlate size (also number of samples in ring buffer)
double *buffer; // sample ring buffer double *buffer; // sample ring buffer
int ringstart; // ring buffer start offset int ringstart; // ring buffer start offset
...@@ -69,19 +72,19 @@ typedef struct ...@@ -69,19 +72,19 @@ typedef struct
* d) feed samples through the handler (dsp_bell202_sample) * d) feed samples through the handler (dsp_bell202_sample)
*/ */
extern void dsp_bell202_attr_init (dsp_bell202_attr_t *attributes); void dsp_bell202_attr_init(dsp_bell202_attr_t *attributes);
extern void (*dsp_bell202_attr_get_bithandler (dsp_bell202_attr_t *attributes, void **bithandler_arg)) (void *, int); bithandler_func_t dsp_bell202_attr_get_bithandler(dsp_bell202_attr_t *attributes, void **bithandler_arg);
extern void dsp_bell202_attr_set_bithandler (dsp_bell202_attr_t *attributes, void (*bithandler) (void *, int ), void *bithandler_arg); void dsp_bell202_attr_set_bithandler(dsp_bell202_attr_t *attributes, bithandler_func_t bithandler, void *bithandler_arg);
extern void (*dsp_bell202_attr_get_bytehandler (dsp_bell202_attr_t *attributes, void **bytehandler_arg)) (void *, int); bytehandler_func_t dsp_bell202_attr_get_bytehandler(dsp_bell202_attr_t *attributes, void **bytehandler_arg);
extern void dsp_bell202_attr_set_bytehandler (dsp_bell202_attr_t *attributes, void (*bytehandler) (void *, int ), void *bytehandler_arg); void dsp_bell202_attr_set_bytehandler(dsp_bell202_attr_t *attributes, bytehandler_func_t bytehandler, void *bytehandler_arg);
extern int dsp_bell202_attr_get_samplerate (dsp_bell202_attr_t *attributes); int dsp_bell202_attr_get_samplerate(dsp_bell202_attr_t *attributes);
extern int dsp_bell202_attr_set_samplerate (dsp_bell202_attr_t *attributes, int samplerate); int dsp_bell202_attr_set_samplerate(dsp_bell202_attr_t *attributes, int samplerate);
extern dsp_bell202_handle_t * dsp_bell202_create (dsp_bell202_attr_t *attributes); dsp_bell202_handle_t * dsp_bell202_create(dsp_bell202_attr_t *attributes);
extern void dsp_bell202_destroy (dsp_bell202_handle_t *handle); void dsp_bell202_destroy(dsp_bell202_handle_t **handle);
extern void dsp_bell202_sample (dsp_bell202_handle_t *handle, double normalized_sample); void dsp_bell202_sample(dsp_bell202_handle_t *handle, double normalized_sample);
#endif // __BELL202_H__ #endif // __BELL202_H__
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论