-
Notifications
You must be signed in to change notification settings - Fork 3
/
Replay.h
92 lines (76 loc) · 2.71 KB
/
Replay.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//
// Replay.h
// 4champ Amiga Music Player
//
// Copyright © 2018 Aleksi Sitomaniemi. All rights reserved.
//
#import <Foundation/Foundation.h>
/// The Replay control API
@protocol ReplayControl <NSObject>
/**
Supported @formats
*/
@property (class, nonatomic, strong, readonly) NSArray<NSString*>* supportedFormats;
/**
Loads module for playback from given path.
@param path identifies the module file. Path extension can identify format (type)
@param type can be passed separately if path does not have extension. If this parameter
is given, it will be used to determine the replayer.
*/
- (bool) loadModule:(NSString*)path type:(NSString*)type;
/**
Sets current position in the playing module
@param newPosition the new position in range 0 - moduleLength
*/
- (void) setCurrentPosition: (int)newPosition;
/**
Sets stereo separation of the module playback
@param value integer in range 0-100. Actual Replay implementation maps to correct scale
*/
- (void) setStereoSeparation:(NSInteger)value;
/**
Sets interpolation filter length (used for LibOpenMPT playback)
@param value integer that maps to a interpolation filter setting defined for OPENMPT_MODULE_RENDER_INTERPOLATIONFILTER_LENGTH
in libpopenmpt.h
*/
- (void) setInterpolationFilterLength:(NSInteger)value;
/**
Free replayer resources
*/
- (void) cleanup;
@end
/// Visualisation API getters
@protocol ReplayInformation <NSObject>
- (int) currentPosition; //returns current position in current module
- (int) moduleLength; //returns current mod length in seconds
- (NSInteger) volumeOnChannel:(NSInteger)channel; //returns current volume on requested channel
- (NSInteger) numberOfChannels; //returns number of channels in current module
- (NSArray<NSString*>*) getSamples; //returns sample names of current mod
- (NSArray<NSString*>*) getInstruments; //returns instrument names of current mod
@end
/// Stream API for getting rendered frames for output
@protocol ReplayerStream <NSObject>
- (int) readFrames:(size_t)count bufLeft:(int16_t*)bufLeft bufRight:(int16_t*)bufRight;
@end
@class Replay;
@protocol ReplayStreamDelegate <NSObject>
/**
Called when replay reaches end of the module
@param replay identifies the Replay object
*/
- (void) reachedEndOfStream:(Replay*)replay;
@end
@protocol ReplayStatusDelegate <NSObject>
- (void) playStatusChanged:(Replay*)replay;
@end
@interface Replay : NSObject<ReplayControl, ReplayInformation>
@property (nonatomic, weak) NSObject<ReplayStreamDelegate>* streamDelegate;
@property (nonatomic, weak) NSObject<ReplayStatusDelegate>* statusDelegate;
@property (nonatomic, assign) BOOL isPlaying;
@property (nonatomic, assign) BOOL isPaused;
- (void) initAudio;
- (void) play;
- (void) stop;
- (void) pause;
- (void) resume;
@end