测试已测试 | ✗ |
语言语言 | Objective C++Objective C++ |
许可证 | BSD 3.0 |
发布最后发布 | 2016年6月 |
由 Hirohito Kato 维护。
适用于 iOS 的音频合成器和序列器引擎。它使您能够轻松地创建节奏盒/鼓电脑应用程序。
import HKLSynthesizer
(如果您使用 Objective-C,请导入 AudioEngineIF.h)let engine_ = AudioEngineIF()
start()
开始合成器stop()
停止运行tempo
属性设置其 bpmnumSteps
属性决定序列器的总步数sounds
属性为每个轨道设置声音文件。setStepSequence()
为指定轨道设置音符开启/关闭序列。setAmpGain()
为指定轨道设置增益。setPanPosition()
为指定轨道设置音量平衡。类 API 如下
@protocol AudioEngineIFProtocol;
@interface AudioEngineIF : NSObject
/**
* bpm
*/
@property (nonatomic, assign) double tempo;
/**
* number of steps in a track
*/
@property (nonatomic, assign) NSInteger numSteps;
/**
* Sound files. The number of sounds must be equal to the number of tracks
*/
@property (nonatomic, copy) NSArray<NSString*>* _Nullable sounds;
/**
* Set sequence for the specified track.
*
* The sequence contains NSNumber<bool> values. The size must be equal to numSteps property.
*
* @param sequence array of bool values. true means note on.
* @param trackNo track number
*/
- (void)setStepSequence:(NSArray<NSNumber *>* _Nonnull)sequence ofTrack:(NSInteger)trackNo;
/**
* Set amplifier gain(0.0-2.0) for the specified track
*
* @param ampGain 0.0(mute)…1.0(original)…2.0(x2.0)
* @param trackNo track number
*/
- (void)setAmpGain:(double)ampGain ofTrack:(NSInteger)trackNo;
/**
* Set pan position(-1.0…1.0) for the specified track.
*
* @param position -1.0(left)…0.0(center)…1.0(right)
* @param trackNo track number
*/
- (void)setPanPosition:(double)position ofTrack:(NSInteger)trackNo;
/**
* Start a sequencer
*/
- (void)start;
/**
* Stop a sequencer
*/
- (void)stop;
/**
* Delegate object conforms to AudioEngineIFProtocol
*/
@property (nonatomic, weak) id<AudioEngineIFProtocol> delegate;
@end
@protocol AudioEngineIFProtocol <NSObject>
@required
/**
* Tells the delegate that the sequencer has triggered at the step(time)
*
* @param engine the audio engine that the tracks are triggered
* @param tracks tracks that the note is ON
* @param stepNo step number
* @param absoluteTime time for triggered
*/
- (void)audioEngine:(AudioEngineIF * _Nonnull)engine didTriggeredTracks:(NSArray<NSNumber *>* _Nonnull) tracks step:(int)stepNo atTime:(uint64_t)absoluteTime;
@end
示例展示了 4 个轨道和 N 个步骤序列器。
新 BSD 许可证
该库使用 KORG WIST SDK 的示例程序 作为音频引擎。