代码例子 http://pan.baidu.com/s/1tckHZ
DrawView.h
//
// DrawView.h
// ooo
//
// Created by 杜甲 on 13-11-9.
// Copyright (c) 2013年 杜甲. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface DrawView : UIView
@property short *drawBuffer;
@property int dataLen;
@property float *outRel;
@property float *outImg;
@property int bias;
@property int wSize;
- (void)genKernel;
@end
DrawView.m
//
// DrawView.m
// ooo
//
// Created by 杜甲 on 13-11-9.
// Copyright (c) 2013年 杜甲. All rights reserved.
//
#import "DrawView.h"
#define kHillSegmentWidth 10
@implementation DrawView
struct WavInfo
{
int size;
char *data;
short channels;
short block_align;
short bits_per_sample;
unsigned long sample_rate;
unsigned long format_length;
unsigned long format_tag;
unsigned long avg_bytes_sec;
};
#define KSIZE 20
#define BIAS 10000
static double fk[KSIZE] = {0};
static double _filterData[2048];
void decodeWaveInfo(const char *fname, struct WavInfo *info)
{
FILE *fp;
fp = fopen(fname,