-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Checkpoint of new listener from Atila.
Screwed up and used watch app reference. Working but moving to iOS
- Loading branch information
Showing
9 changed files
with
432 additions
and
9 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
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,17 @@ | ||
// | ||
// VBListener.h | ||
// voicebox | ||
// | ||
// Created by Steve Cosman on 2024-04-03. | ||
// | ||
|
||
#import "../Whisper/VBAudioListener.h" | ||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface VBListener : NSObject <VBListenerProto> | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_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,76 @@ | ||
// | ||
// VBListener.m | ||
// voicebox | ||
// | ||
// Created by Steve Cosman on 2024-04-03. | ||
// | ||
|
||
#import "VBListener.h" | ||
|
||
#import "voicebox-Swift.h" | ||
|
||
@interface VBListener () | ||
|
||
@property (nonatomic, strong) NSHashTable* delegates; | ||
@property (nonatomic, strong) VBSwiftListener* wk; | ||
@end | ||
|
||
@implementation VBListener | ||
|
||
- (instancetype)init | ||
{ | ||
self = [super init]; | ||
if (self) { | ||
self.wk = [[VBSwiftListener alloc] init]; | ||
} | ||
return self; | ||
} | ||
|
||
static VBListener* sharedInstance = nil; | ||
|
||
+ (VBListener*)sharedInstance | ||
{ | ||
@synchronized(VBListener.class) { | ||
if (!sharedInstance) { | ||
sharedInstance = [[self alloc] init]; | ||
} | ||
|
||
return sharedInstance; | ||
} | ||
} | ||
|
||
+ (void)releaseSharedInstance | ||
{ | ||
@synchronized(VBListener.class) { | ||
sharedInstance = nil; | ||
} | ||
} | ||
|
||
- (void)registerDelegate:(id<VBAudioListenerDelegate>)delegate | ||
{ | ||
[_delegates addObject:delegate]; | ||
} | ||
|
||
- (void)deregisterDelegate:(id<VBAudioListenerDelegate>)delegate | ||
{ | ||
[_delegates removeObject:delegate]; | ||
} | ||
|
||
- (void)startListening | ||
{ | ||
[self.wk startWithCompletionHandler:^(NSError* _Nullable err) { | ||
if (err) { | ||
NSLog(@"Error %@", err); | ||
} | ||
}]; | ||
} | ||
|
||
- (void)stateUpdate:(bool)running segments:(nullable NSArray<NSString*>*)segments | ||
{ | ||
} | ||
|
||
- (void)stopCapturing | ||
{ | ||
} | ||
|
||
@end |
Oops, something went wrong.