2026-01-16 13:38:03 +08:00
|
|
|
|
//
|
|
|
|
|
|
// KBAiWaveformView.h
|
|
|
|
|
|
// keyBoard
|
|
|
|
|
|
//
|
|
|
|
|
|
// Created by Mac on 2026/1/15.
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
|
|
|
|
/// 波形动画视图
|
|
|
|
|
|
/// 根据音量 RMS 值实时显示波形动画
|
|
|
|
|
|
@interface KBAiWaveformView : UIView
|
|
|
|
|
|
|
|
|
|
|
|
/// 波形颜色
|
|
|
|
|
|
@property(nonatomic, strong) UIColor *waveColor;
|
|
|
|
|
|
|
|
|
|
|
|
/// 波形条数量
|
|
|
|
|
|
@property(nonatomic, assign) NSInteger barCount;
|
|
|
|
|
|
|
|
|
|
|
|
/// 波形条宽度
|
|
|
|
|
|
@property(nonatomic, assign) CGFloat barWidth;
|
|
|
|
|
|
|
|
|
|
|
|
/// 波形条间距
|
|
|
|
|
|
@property(nonatomic, assign) CGFloat barSpacing;
|
|
|
|
|
|
|
2026-02-02 19:07:00 +08:00
|
|
|
|
/// 自定义柱状高度基准(0~1),长度需 >= barCount,未设置则使用默认算法
|
|
|
|
|
|
@property(nonatomic, strong, nullable) NSArray<NSNumber *> *barHeightPattern;
|
|
|
|
|
|
|
2026-01-16 13:38:03 +08:00
|
|
|
|
/// 更新音量值
|
|
|
|
|
|
/// @param rms 音量 RMS 值 (0.0 - 1.0)
|
|
|
|
|
|
- (void)updateWithRMS:(float)rms;
|
|
|
|
|
|
|
|
|
|
|
|
/// 开始动画(空闲波动)
|
|
|
|
|
|
- (void)startIdleAnimation;
|
|
|
|
|
|
|
|
|
|
|
|
/// 停止动画
|
|
|
|
|
|
- (void)stopAnimation;
|
|
|
|
|
|
|
|
|
|
|
|
/// 重置波形
|
|
|
|
|
|
- (void)reset;
|
|
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|