Skip to content

Commit

Permalink
only run one test at the same time
Browse files Browse the repository at this point in the history
  • Loading branch information
Piasy committed Jun 15, 2018
1 parent 1b5c98b commit 600d197
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ allprojects {
compile 'com.github.piasy:AudioMixer:1.0.0'
```

### iOS
### iOS & macOS

Due to the file size limitation, publish with CocoaPods is difficult, so please [download the prebuilt `AudioMixer.framework`](https://github.com/Piasy/AudioMixer/releases) directly.

Expand Down Expand Up @@ -68,7 +68,7 @@ if (buffer.getSize() > 0) {

For more detailed info, please refer to [the source code](https://github.com/Piasy/AudioMixer/tree/master/android_project/AudioMixer/).

### iOS
### iOS & macOS

Initialize:

Expand Down Expand Up @@ -148,5 +148,5 @@ For more detailed info, please refer to [the source code](https://github.com/Pia

+ [ ] ffmpeg 4.0 audio decoder doesn't work
+ [x] iOS
+ [ ] macOS
+ [x] macOS
+ [ ] Windows
31 changes: 31 additions & 0 deletions ios_project/example/AudioMixerTestController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ void PullRenderData(int bits_per_sample, int sample_rate,
};

typedef NS_ENUM(NSInteger, TestType) {
TEST_NONE,
TEST_DECODE_MONO,
TEST_RESAMPLE,
TEST_DECODE_ANY,
Expand Down Expand Up @@ -132,8 +133,20 @@ @implementation AudioMixerTestController {
NSFileHandle* _recordAndMixDumper;
}

- (instancetype)init {
self = [super init];
if (self) {
_testType = TEST_NONE;
}
return self;
}

- (void)doDecodeMono {
NSLog(@"doDecodeMono");
if (_testType != TEST_NONE) {
NSLog(@"test already started: %ld", (long)_testType);
return;
}
_testType = TEST_DECODE_MONO;

_sampleRate = 16000;
Expand All @@ -153,6 +166,10 @@ - (void)deliverMonoDecodedData:(void*)buf numFrames:(int32_t)numFrames {

- (void)doResample {
NSLog(@"doResample");
if (_testType != TEST_NONE) {
NSLog(@"test already started: %ld", (long)_testType);
return;
}
_testType = TEST_RESAMPLE;

_resamplerInputSampleRate = 44100;
Expand Down Expand Up @@ -208,6 +225,10 @@ - (void)deliverResampledData:(void*)buf numFrames:(int32_t)numFrames {

- (void)doDecodeAny {
NSLog(@"doDecodeAny");
if (_testType != TEST_NONE) {
NSLog(@"test already started: %ld", (long)_testType);
return;
}
_testType = TEST_DECODE_ANY;

_sampleRate = 48000;
Expand Down Expand Up @@ -249,6 +270,10 @@ - (void)deliverAnyDecodedData:(void*)buf numFrames:(int32_t)numFrames {

- (void)doMix {
NSLog(@"doMix");
if (_testType != TEST_NONE) {
NSLog(@"test already started: %ld", (long)_testType);
return;
}
_testType = TEST_MIX;

_sampleRate = 48000;
Expand Down Expand Up @@ -310,6 +335,10 @@ - (void)deliverMixedData:(void*)buf numFrames:(int32_t)numFrames {

- (void)doRecordAndMix {
NSLog(@"doRecordAndMix");
if (_testType != TEST_NONE) {
NSLog(@"test already started: %ld", (long)_testType);
return;
}
_testType = TEST_RECORD_AND_MIX;

_sampleRate = 48000;
Expand Down Expand Up @@ -447,6 +476,8 @@ - (void)doStopTest {
_adm->Terminate();
_adm->RegisterAudioCallback(nullptr);
_adm = nullptr;

_testType = TEST_NONE;
}

- (int32_t)RecordedDataIsAvailable:(const void*)audioSamples
Expand Down

0 comments on commit 600d197

Please sign in to comment.