Skip to content

Commit

Permalink
fix microphone, fix file extension, add record window area, update re…
Browse files Browse the repository at this point in the history
…adme
  • Loading branch information
lihaoyun6 committed Dec 26, 2024
1 parent c1cbbab commit 51b5065
Show file tree
Hide file tree
Showing 18 changed files with 340 additions and 158 deletions.
27 changes: 22 additions & 5 deletions QuickRecorder.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
184506CE2C69213400AFDA45 /* MatrixColorSelector in Frameworks */ = {isa = PBXBuildFile; productRef = 184506CD2C69213400AFDA45 /* MatrixColorSelector */; };
184CAEC72BDCCC2300D61D57 /* AVContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 184CAEC62BDCCC2300D61D57 /* AVContext.swift */; };
184CAEC92BDDEC6800D61D57 /* AppBlockSelector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 184CAEC82BDDEC6800D61D57 /* AppBlockSelector.swift */; };
185582A62D1D1CC100F0CF47 /* AECAudioStream in Frameworks */ = {isa = PBXBuildFile; productRef = 185582A52D1D1CC100F0CF47 /* AECAudioStream */; };
1862BF8D2BD5494E003ED522 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 1862BF8F2BD5494E003ED522 /* Credits.rtf */; };
18775C202BE21F38008333EF /* iDeviceSelector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18775C1F2BE21F38008333EF /* iDeviceSelector.swift */; };
187966FA2BD5639D003DB1B2 /* MousePointer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 187966F92BD5639D003DB1B2 /* MousePointer.swift */; };
Expand Down Expand Up @@ -101,6 +102,7 @@
18FDFC912BDA4DB30020E685 /* KeyboardShortcuts in Frameworks */,
181724052BE3BEA600F5F539 /* Sparkle in Frameworks */,
18F40B492BFB988A00F0AC70 /* SwiftLAME in Frameworks */,
185582A62D1D1CC100F0CF47 /* AECAudioStream in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -178,9 +180,9 @@
children = (
18944C632D0AD36C00B6C811 /* SurpriseView.swift */,
18D3BDFE2BCE5E4B006CFFC0 /* StatusBar.swift */,
18FEBDAF2BD2C0D1003F09BC /* SettingsView.swift */,
18D3BDEC2BCE5DC1006CFFC0 /* ContentView.swift */,
1821F2E72CF4B226004A2EC0 /* ContentViewNew.swift */,
18FEBDAF2BD2C0D1003F09BC /* SettingsView.swift */,
18D3BE002BCEB1BF006CFFC0 /* AppSelector.swift */,
18FEBDAB2BD01E82003F09BC /* WinSelector.swift */,
18F1A0E12BD3E4C000DB102C /* AreaSelector.swift */,
Expand Down Expand Up @@ -218,6 +220,7 @@
181724042BE3BEA600F5F539 /* Sparkle */,
18F40B482BFB988A00F0AC70 /* SwiftLAME */,
184506CD2C69213400AFDA45 /* MatrixColorSelector */,
185582A52D1D1CC100F0CF47 /* AECAudioStream */,
);
productName = QuickRecorder;
productReference = 18D3BDE72BCE5DC1006CFFC0 /* QuickRecorder.app */;
Expand Down Expand Up @@ -255,6 +258,7 @@
181724032BE3BEA600F5F539 /* XCRemoteSwiftPackageReference "Sparkle" */,
18F40B472BFB988A00F0AC70 /* XCRemoteSwiftPackageReference "SwiftLAME" */,
184506CC2C69213400AFDA45 /* XCRemoteSwiftPackageReference "MatrixColorSelector" */,
185582A42D1D1CC100F0CF47 /* XCRemoteSwiftPackageReference "AECAudioStream" */,
);
productRefGroup = 18D3BDE82BCE5DC1006CFFC0 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -483,7 +487,7 @@
CODE_SIGN_ENTITLEMENTS = QuickRecorder/QuickRecorder.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 160;
CURRENT_PROJECT_VERSION = 161;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"QuickRecorder/Preview Content\"";
DEVELOPMENT_TEAM = L4T783637F;
Expand All @@ -501,7 +505,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.3;
MARKETING_VERSION = 1.6.0;
MARKETING_VERSION = 1.6.1;
PRODUCT_BUNDLE_IDENTIFIER = com.lihaoyun6.QuickRecorder;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -517,7 +521,7 @@
CODE_SIGN_ENTITLEMENTS = QuickRecorder/QuickRecorder.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 160;
CURRENT_PROJECT_VERSION = 161;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"QuickRecorder/Preview Content\"";
DEVELOPMENT_TEAM = L4T783637F;
Expand All @@ -535,7 +539,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.3;
MARKETING_VERSION = 1.6.0;
MARKETING_VERSION = 1.6.1;
PRODUCT_BUNDLE_IDENTIFIER = com.lihaoyun6.QuickRecorder;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down Expand Up @@ -583,6 +587,14 @@
kind = branch;
};
};
185582A42D1D1CC100F0CF47 /* XCRemoteSwiftPackageReference "AECAudioStream" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/lihaoyun6/AECAudioStream.git";
requirement = {
branch = main;
kind = branch;
};
};
18F40B472BFB988A00F0AC70 /* XCRemoteSwiftPackageReference "SwiftLAME" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/hidden-spectrum/SwiftLAME.git";
Expand Down Expand Up @@ -612,6 +624,11 @@
package = 184506CC2C69213400AFDA45 /* XCRemoteSwiftPackageReference "MatrixColorSelector" */;
productName = MatrixColorSelector;
};
185582A52D1D1CC100F0CF47 /* AECAudioStream */ = {
isa = XCSwiftPackageProductDependency;
package = 185582A42D1D1CC100F0CF47 /* XCRemoteSwiftPackageReference "AECAudioStream" */;
productName = AECAudioStream;
};
18F40B482BFB988A00F0AC70 /* SwiftLAME */ = {
isa = XCSwiftPackageProductDependency;
package = 18F40B472BFB988A00F0AC70 /* XCRemoteSwiftPackageReference "SwiftLAME" */;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{
"originHash" : "1b1d5eee536d7383fd89cd017b59783f56323dd3ee0eaa42a8fdfe9a288c991c",
"originHash" : "0f878abe53bbbdf062a4d3cca15cfa8ef45688fb494b96acec807209ad7e0f36",
"pins" : [
{
"identity" : "aecaudiostream",
"kind" : "remoteSourceControl",
"location" : "https://github.com/lihaoyun6/AECAudioStream.git",
"state" : {
"branch" : "main",
"revision" : "0eab971c1dd0420ee84646c71172dd66fa59117c"
}
},
{
"identity" : "keyboardshortcuts",
"kind" : "remoteSourceControl",
Expand Down
4 changes: 2 additions & 2 deletions QuickRecorder/AVContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class AVOutputClass: NSObject, AVCaptureFileOutputRecordingDelegate, AVCaptureVi
SCContext.previewSession.startRunning()
DispatchQueue.main.async {
closeAllWindow(except: "Area Overlayer".local)
AppDelegate.shared.updateStatusBar()
updateStatusBar()
AppDelegate.shared.startDeviceOverlayer(size: NSSize(width: 300, height: 500))
}
}
Expand All @@ -125,7 +125,7 @@ class AVOutputClass: NSObject, AVCaptureFileOutputRecordingDelegate, AVCaptureVi
DispatchQueue.main.async {
controlPanel.close()
deviceWindow.close()
AppDelegate.shared.updateStatusBar()
updateStatusBar()
}
}
}
Expand Down
55 changes: 40 additions & 15 deletions QuickRecorder/QuickRecorderApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,45 @@ class AppDelegate: NSObject, NSApplicationDelegate, SCStreamDelegate, SCStreamOu
var isResizing = false
var presenterType = "OFF"
var frameQueue = FixedLengthArray<CMTime>(maxLength: 20)
@AppStorage("showOnDock") private var showOnDock: Bool = true
@AppStorage("showMenubar") private var showMenubar: Bool = false

@AppStorage("showOnDock") var showOnDock: Bool = true
@AppStorage("showMenubar") var showMenubar: Bool = false
@AppStorage("enableAEC") var enableAEC: Bool = false
@AppStorage("recordMic") var recordMic: Bool = false
@AppStorage("micDevice") var micDevice: String = "default"
@AppStorage("remuxAudio") var remuxAudio: Bool = true
@AppStorage("recordWinSound") var recordWinSound: Bool = true
@AppStorage("recordHDR") var recordHDR: Bool = false
@AppStorage("encoder") var encoder: Encoder = .h264
@AppStorage("highRes") var highRes: Int = 2
@AppStorage("AECLevel") var AECLevel: String = "mid"
@AppStorage("withAlpha") var withAlpha: Bool = false
@AppStorage("saveDirectory") var saveDirectory: String?
@AppStorage("countdown") var countdown: Int = 0
@AppStorage("poSafeDelay") var poSafeDelay: Int = 1
@AppStorage("highlightMouse") var highlightMouse: Bool = false
@AppStorage("includeMenuBar") var includeMenuBar: Bool = true
@AppStorage("hideDesktopFiles") var hideDesktopFiles: Bool = false
@AppStorage("trimAfterRecord") var trimAfterRecord: Bool = false
@AppStorage("miniStatusBar") var miniStatusBar: Bool = false
@AppStorage("hideSelf") var hideSelf: Bool = true
@AppStorage("preventSleep") var preventSleep: Bool = true
@AppStorage("showPreview") var showPreview: Bool = true
@AppStorage("background") var background: BackgroundType = .wallpaper
@AppStorage("showMouse") var showMouse: Bool = true
@AppStorage("frameRate") var frameRate: Int = 60
@AppStorage("videoQuality") var videoQuality: Double = 1.0
@AppStorage("videoFormat") var videoFormat: VideoFormat = .mp4
@AppStorage("audioFormat") var audioFormat: AudioFormat = .aac
@AppStorage("audioQuality") var audioQuality: AudioQuality = .high
@AppStorage("pixelFormat") var pixelFormat: PixFormat = .delault

func mousePointerReLocation(event: NSEvent) {
if event.type == .scrollWheel { return }
if !ud.bool(forKey: "highlightMouse")
|| hideMousePointer
|| SCContext.stream == nil
|| SCContext.streamType == .window
{ mousePointer.orderOut(nil); return }
if !highlightMouse || hideMousePointer || SCContext.stream == nil || SCContext.streamType == .window {
mousePointer.orderOut(nil)
return
}
let mouseLocation = event.locationInWindow
var windowFrame = mousePointer.frame
windowFrame.origin = NSPoint(x: mouseLocation.x - windowFrame.width / 2, y: mouseLocation.y - windowFrame.height / 2)
Expand Down Expand Up @@ -212,12 +241,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, SCStreamDelegate, SCStreamOu
]
)

if ud.integer(forKey: "highRes") == 0 { ud.setValue(2, forKey: "highRes") }
if ud.bool(forKey: "showOnDock") { NSApp.setActivationPolicy(.regular) }
if isMacOS12 {
ud.setValue(false, forKey: "showPreview")
ud.setValue(false, forKey: "remuxAudio")
}
if highRes == 0 { highRes = 2 }
if showOnDock { NSApp.setActivationPolicy(.regular) }
if isMacOS12 { showPreview = false; remuxAudio = false }

UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in
if let error = error { print("Notification authorization denied: \(error.localizedDescription)") }
Expand Down Expand Up @@ -307,7 +333,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, SCStreamDelegate, SCStreamOu
return
}
}

updateStatusBar()
}

Expand Down Expand Up @@ -369,7 +394,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, SCStreamDelegate, SCStreamOu
}

func closeMainWindow() {
for w in NSApplication.shared.windows.filter({ $0.title == "QuickRecorder".local }) {
for w in NSApp.windows.filter({ $0.title == "QuickRecorder".local }) {
w.close()
}
}
Expand Down
Loading

0 comments on commit 51b5065

Please sign in to comment.