use Deque for mic audio ringBuffering
This commit is contained in:
1 parent
858e7c7440
commit
9124a1fee5
4 files changed
+43
-3
No files matched your search
@@ -9,6 +9,9 @@
|
|||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
180345E12E819877004AF36F /* libopus-sim.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 180345E02E819877004AF36F /* libopus-sim.a */; };
|
180345E12E819877004AF36F /* libopus-sim.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 180345E02E819877004AF36F /* libopus-sim.a */; };
|
||||||
1817B61E2E6FD04D000D938D /* SafeTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1817B61D2E6FD04D000D938D /* SafeTimer.swift */; };
|
1817B61E2E6FD04D000D938D /* SafeTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1817B61D2E6FD04D000D938D /* SafeTimer.swift */; };
|
||||||
|
182760F72E83E2EA00EC1C5C /* DequeModule in Frameworks */ = {isa = PBXBuildFile; productRef = 182760F62E83E2EA00EC1C5C /* DequeModule */; };
|
||||||
|
182760FA2E83E57D00EC1C5C /* DequeModule in Frameworks */ = {isa = PBXBuildFile; productRef = 182760F92E83E57D00EC1C5C /* DequeModule */; };
|
||||||
|
182760FD2E83E68B00EC1C5C /* Collections in Frameworks */ = {isa = PBXBuildFile; productRef = 182760FC2E83E68B00EC1C5C /* Collections */; };
|
||||||
1829CE3F2E2154DF0074A99A /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1829CE3E2E2154DF0074A99A /* SceneDelegate.m */; };
|
1829CE3F2E2154DF0074A99A /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1829CE3E2E2154DF0074A99A /* SceneDelegate.m */; };
|
||||||
18341A042DEB662C0094E5F2 /* FixedTintImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 18341A032DEB662C0094E5F2 /* FixedTintImageView.m */; };
|
18341A042DEB662C0094E5F2 /* FixedTintImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 18341A032DEB662C0094E5F2 /* FixedTintImageView.m */; };
|
||||||
1850C82A2E667E4000845308 /* MicHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1850C8292E667E4000845308 /* MicHandler.swift */; };
|
1850C82A2E667E4000845308 /* MicHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1850C8292E667E4000845308 /* MicHandler.swift */; };
|
||||||
@@ -394,6 +397,8 @@
|
|||||||
FB8946ED19F6AFE800339C8A /* libopus.a in Frameworks */,
|
FB8946ED19F6AFE800339C8A /* libopus.a in Frameworks */,
|
||||||
98882A082AF60F7400C5A11C /* libavutil.a in Frameworks */,
|
98882A082AF60F7400C5A11C /* libavutil.a in Frameworks */,
|
||||||
180345E12E819877004AF36F /* libopus-sim.a in Frameworks */,
|
180345E12E819877004AF36F /* libopus-sim.a in Frameworks */,
|
||||||
|
182760F72E83E2EA00EC1C5C /* DequeModule in Frameworks */,
|
||||||
|
182760FD2E83E68B00EC1C5C /* Collections in Frameworks */,
|
||||||
FB290CF419B2C406004C83CF /* CoreGraphics.framework in Frameworks */,
|
FB290CF419B2C406004C83CF /* CoreGraphics.framework in Frameworks */,
|
||||||
FB290CF819B2C406004C83CF /* CoreData.framework in Frameworks */,
|
FB290CF819B2C406004C83CF /* CoreData.framework in Frameworks */,
|
||||||
98181BED2791281100E43572 /* CoreMotion.framework in Frameworks */,
|
98181BED2791281100E43572 /* CoreMotion.framework in Frameworks */,
|
||||||
@@ -402,6 +407,7 @@
|
|||||||
FB290CF619B2C406004C83CF /* UIKit.framework in Frameworks */,
|
FB290CF619B2C406004C83CF /* UIKit.framework in Frameworks */,
|
||||||
FB290CF219B2C406004C83CF /* Foundation.framework in Frameworks */,
|
FB290CF219B2C406004C83CF /* Foundation.framework in Frameworks */,
|
||||||
FB4679011A57048000377732 /* CoreFoundation.framework in Frameworks */,
|
FB4679011A57048000377732 /* CoreFoundation.framework in Frameworks */,
|
||||||
|
182760FA2E83E57D00EC1C5C /* DequeModule in Frameworks */,
|
||||||
98181BE92791277400E43572 /* libSDL2.a in Frameworks */,
|
98181BE92791277400E43572 /* libSDL2.a in Frameworks */,
|
||||||
98882A062AF60F7000C5A11C /* libavcodec.a in Frameworks */,
|
98882A062AF60F7000C5A11C /* libavcodec.a in Frameworks */,
|
||||||
);
|
);
|
||||||
@@ -932,6 +938,7 @@
|
|||||||
mainGroup = FB290CE519B2C406004C83CF;
|
mainGroup = FB290CE519B2C406004C83CF;
|
||||||
packageReferences = (
|
packageReferences = (
|
||||||
F74BEF9A2C1A705600224667 /* XCRemoteSwiftPackageReference "OpenSSL-Package" */,
|
F74BEF9A2C1A705600224667 /* XCRemoteSwiftPackageReference "OpenSSL-Package" */,
|
||||||
|
182760F52E83E2EA00EC1C5C /* XCRemoteSwiftPackageReference "swift-collections" */,
|
||||||
);
|
);
|
||||||
productRefGroup = FB290CEF19B2C406004C83CF /* Products */;
|
productRefGroup = FB290CEF19B2C406004C83CF /* Products */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
@@ -1402,6 +1409,14 @@
|
|||||||
/* End XCConfigurationList section */
|
/* End XCConfigurationList section */
|
||||||
|
|
||||||
/* Begin XCRemoteSwiftPackageReference section */
|
/* Begin XCRemoteSwiftPackageReference section */
|
||||||
|
182760F52E83E2EA00EC1C5C /* XCRemoteSwiftPackageReference "swift-collections" */ = {
|
||||||
|
isa = XCRemoteSwiftPackageReference;
|
||||||
|
repositoryURL = "https://github.com/apple/swift-collections.git";
|
||||||
|
requirement = {
|
||||||
|
kind = upToNextMajorVersion;
|
||||||
|
minimumVersion = 1.1.4;
|
||||||
|
};
|
||||||
|
};
|
||||||
F74BEF9A2C1A705600224667 /* XCRemoteSwiftPackageReference "OpenSSL-Package" */ = {
|
F74BEF9A2C1A705600224667 /* XCRemoteSwiftPackageReference "OpenSSL-Package" */ = {
|
||||||
isa = XCRemoteSwiftPackageReference;
|
isa = XCRemoteSwiftPackageReference;
|
||||||
repositoryURL = "https://github.com/krzyzanowskim/OpenSSL-Package.git";
|
repositoryURL = "https://github.com/krzyzanowskim/OpenSSL-Package.git";
|
||||||
@@ -1413,6 +1428,21 @@
|
|||||||
/* End XCRemoteSwiftPackageReference section */
|
/* End XCRemoteSwiftPackageReference section */
|
||||||
|
|
||||||
/* Begin XCSwiftPackageProductDependency section */
|
/* Begin XCSwiftPackageProductDependency section */
|
||||||
|
182760F62E83E2EA00EC1C5C /* DequeModule */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
package = 182760F52E83E2EA00EC1C5C /* XCRemoteSwiftPackageReference "swift-collections" */;
|
||||||
|
productName = DequeModule;
|
||||||
|
};
|
||||||
|
182760F92E83E57D00EC1C5C /* DequeModule */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
package = 182760F52E83E2EA00EC1C5C /* XCRemoteSwiftPackageReference "swift-collections" */;
|
||||||
|
productName = DequeModule;
|
||||||
|
};
|
||||||
|
182760FC2E83E68B00EC1C5C /* Collections */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
package = 182760F52E83E2EA00EC1C5C /* XCRemoteSwiftPackageReference "swift-collections" */;
|
||||||
|
productName = Collections;
|
||||||
|
};
|
||||||
F74BEF9B2C1A705600224667 /* OpenSSL */ = {
|
F74BEF9B2C1A705600224667 /* OpenSSL */ = {
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
package = F74BEF9A2C1A705600224667 /* XCRemoteSwiftPackageReference "OpenSSL-Package" */;
|
package = F74BEF9A2C1A705600224667 /* XCRemoteSwiftPackageReference "OpenSSL-Package" */;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"originHash" : "f17bf6f1131c7255a75ffd6a989b69573cb49c332e612dffb429905d8d7afe72",
|
"originHash" : "f16484589afcd51ca8598428cdd5dc0e795abe386bdc40dfb311787d3f7758a2",
|
||||||
"pins" : [
|
"pins" : [
|
||||||
{
|
{
|
||||||
"identity" : "openssl-package",
|
"identity" : "openssl-package",
|
||||||
@@ -9,6 +9,15 @@
|
|||||||
"revision" : "b9eb055fdf73e595cb4b9f665d13dc85975bf80a",
|
"revision" : "b9eb055fdf73e595cb4b9f665d13dc85975bf80a",
|
||||||
"version" : "3.3.2000"
|
"version" : "3.3.2000"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "swift-collections",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/apple/swift-collections.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "c1805596154bb3a265fd91b8ac0c4433b4348fb0",
|
||||||
|
"version" : "1.2.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"version" : 3
|
"version" : 3
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
// Copyright © 2025 True砖家 on Bilibili. All rights reserved.
|
// Copyright © 2025 True砖家 on Bilibili. All rights reserved.
|
||||||
|
|
||||||
import AVFoundation
|
import AVFoundation
|
||||||
|
import Collections
|
||||||
|
|
||||||
@objc public protocol MicHandlerDelegate: AnyObject {
|
@objc public protocol MicHandlerDelegate: AnyObject {
|
||||||
@objc optional func micHandlerDidFinishPlayback(_ handler: MicHandler)
|
@objc optional func micHandlerDidFinishPlayback(_ handler: MicHandler)
|
||||||
@@ -22,7 +23,7 @@ public class MicHandler: NSObject {
|
|||||||
private var isRecording = false
|
private var isRecording = false
|
||||||
private var useBuiltinMic = false
|
private var useBuiltinMic = false
|
||||||
|
|
||||||
private var pcm16Buffer: [Int16] = []
|
private var pcm16Buffer = Deque<Int16>()
|
||||||
private let bufferQueue = DispatchQueue(label: "pcm.buffer.queue")
|
private let bufferQueue = DispatchQueue(label: "pcm.buffer.queue")
|
||||||
private var timer: SafeTimer?
|
private var timer: SafeTimer?
|
||||||
|
|
||||||
|
|||||||
@@ -680,7 +680,7 @@ BOOL isCustomResolution(int resolutionSelected) {
|
|||||||
[self addSetting:self.useBuiltinMicStack ofId:@"useBuiltinMicStack" withInfoTag:YES withDynamicLabel:NO to:audioSection];
|
[self addSetting:self.useBuiltinMicStack ofId:@"useBuiltinMicStack" withInfoTag:YES withDynamicLabel:NO to:audioSection];
|
||||||
[self addSetting:self.audioConfigStack ofId:@"audioConfigStack" withInfoTag:NO withDynamicLabel:NO to:audioSection];
|
[self addSetting:self.audioConfigStack ofId:@"audioConfigStack" withInfoTag:NO withDynamicLabel:NO to:audioSection];
|
||||||
[audioSection addToParentStack:_parentStack];
|
[audioSection addToParentStack:_parentStack];
|
||||||
[audioSection setExpanded:YES];
|
[audioSection setExpanded:YES];
|
||||||
|
|
||||||
|
|
||||||
otherSection = [[MenuSectionView alloc] init];
|
otherSection = [[MenuSectionView alloc] init];
|
||||||
|
|||||||
Reference in new issue
Block a user