-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/android/gain-node
- Loading branch information
Showing
33 changed files
with
570 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef ANDROID | ||
#include "AudioContextWrapper.h" | ||
|
||
namespace audiocontext { | ||
|
||
std::shared_ptr<OscillatorNodeWrapper> AudioContextWrapper::createOscillator() { | ||
return std::make_shared<OscillatorNodeWrapper>(); | ||
} | ||
|
||
std::shared_ptr<AudioDestinationNodeWrapper> AudioContextWrapper::getDestination() { | ||
throw std::runtime_error("[AudioContextHostObject::getDestination] Not yet implemented!"); | ||
} | ||
} // namespace audiocontext | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifndef ANDROID | ||
#include "AudioNodeWrapper.h" | ||
#include "iostream" | ||
|
||
namespace audiocontext { | ||
|
||
void AudioNodeWrapper::connect(const std::shared_ptr<AudioNodeWrapper> node) const { | ||
throw std::runtime_error("[AudioNodeWrapper::connect] Not yet implemented!"); | ||
} | ||
|
||
void AudioNodeWrapper::disconnect(const std::shared_ptr<AudioNodeWrapper> node) const { | ||
throw std::runtime_error("[AudioNodeWrapper::disconnect] Not yet implemented!"); | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#ifndef ANDROID | ||
#include "OscillatorNodeWrapper.h" | ||
|
||
namespace audiocontext { | ||
|
||
double OscillatorNodeWrapper::getFrequency() { | ||
return oscillator_->getFrequency(); | ||
} | ||
|
||
double OscillatorNodeWrapper::getDetune() { | ||
return oscillator_->getDetune(); | ||
} | ||
|
||
std::string OscillatorNodeWrapper::getType() { | ||
return oscillator_->getType(); | ||
} | ||
|
||
void OscillatorNodeWrapper::start(double time) { | ||
oscillator_->start(); | ||
} | ||
|
||
void OscillatorNodeWrapper::stop(double time) { | ||
oscillator_->stop(); | ||
} | ||
|
||
void OscillatorNodeWrapper::setFrequency(double frequency) { | ||
oscillator_->changeFrequency(frequency); | ||
} | ||
|
||
void OscillatorNodeWrapper::setDetune(double detune) { | ||
oscillator_->changeDetune(detune); | ||
} | ||
|
||
void OscillatorNodeWrapper::setType(const std::string& type) { | ||
oscillator_->setType(type); | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#import <React/RCTBridgeModule.h> | ||
|
||
@interface AudioContextModule : NSObject <RCTBridgeModule> | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <AVFoundation/AVFoundation.h> | ||
|
||
@interface AudioNode : NSObject | ||
|
||
@property (nonatomic, readonly) NSInteger numberOfInputs; | ||
@property (nonatomic, readonly) NSInteger numberOfOutputs; | ||
@property (nonatomic, strong) NSMutableArray<AudioNode *> *connectedNodes; | ||
|
||
- (void)connect:(AudioNode *)node; | ||
- (void)disconnect; | ||
- (void)process; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#import "AudioNode.h" | ||
|
||
@implementation AudioNode | ||
|
||
- (instancetype)init { | ||
if (self = [super init]) { | ||
_connectedNodes = [NSMutableArray array]; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
- (void)connect:(AudioNode *)node { | ||
if (self.numberOfOutputs > 0) { | ||
[self.connectedNodes addObject:node]; | ||
} | ||
} | ||
|
||
- (void)disconnect { | ||
[self.connectedNodes removeAllObjects]; | ||
} | ||
|
||
- (void)process { | ||
for (AudioNode *node in self.connectedNodes) { | ||
[node process]; | ||
} | ||
} | ||
|
||
@end |
8 changes: 8 additions & 0 deletions
8
ios/nodes/AudioScheduledSourceNode/AudioScheduledSourceNode.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#import "AudioNode.h" | ||
|
||
@interface AudioScheduledSourceNode : AudioNode | ||
|
||
- (void)start; | ||
- (void)stop; | ||
|
||
@end |
20 changes: 20 additions & 0 deletions
20
ios/nodes/AudioScheduledSourceNode/AudioScheduledSourceNode.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#import "AudioScheduledSourceNode.h" | ||
|
||
@implementation AudioScheduledSourceNode | ||
|
||
- (void)start { | ||
NSLog(@"Attempting to call `start` on a base class where it is not implemented. You must override `start` in a subclass."); | ||
@throw [NSException exceptionWithName:NSInternalInconsistencyException | ||
reason:[NSString stringWithFormat:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)] | ||
userInfo:nil]; | ||
} | ||
|
||
- (void)stop { | ||
NSLog(@"Attempting to call `stop` on a base class where it is not implemented. You must override `stop` in a subclass."); | ||
@throw [NSException exceptionWithName:NSInternalInconsistencyException | ||
reason:[NSString stringWithFormat:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)] | ||
userInfo:nil]; | ||
} | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#pragma once | ||
|
||
#ifdef __OBJC__ // when compiled as Objective-C++ | ||
#import <OscillatorNode.h> | ||
#else // when compiled as C++ | ||
typedef struct objc_object OscillatorNode; | ||
#endif // __OBJC__ | ||
|
||
#include <string> | ||
|
||
namespace audiocontext { | ||
class IOSOscillator { | ||
public: | ||
explicit IOSOscillator(); | ||
void start() const; | ||
void stop() const; | ||
void changeFrequency(const float frequency) const; | ||
float getFrequency() const; | ||
void changeDetune(const float detune) const; | ||
float getDetune() const; | ||
void setType(const std::string &type) const; | ||
std::string getType() const; | ||
|
||
protected: | ||
OscillatorNode *OscillatorNode_; | ||
}; | ||
} // namespace audiocontext |
Oops, something went wrong.