refactor: convert audiotap from CLI to in-process library#23
Merged
Conversation
Split main.swift into focused modules: - AppAudioCapture: CATapDescription + IOProc → FileHandle - MicCaptureHandler: AVAudioEngine → WAV - AudioCaptureSession: orchestrator (start/stop, computes micDelay) - AudioCaptureResult: result struct - Helpers: machTicksToSeconds, getDefaultOutputDeviceUID, writeAllToFileHandle Key changes: - Package.swift: executableTarget → library product (AudioTapLib) - writeAllToStdout → writeAllToFileHandle (generic file descriptor) - fputs(stderr) → os.log Logger - Thread.sleep in device change handler → DispatchQueue.main.asyncAfter - All public API types/methods marked public - File handle closed on capture failure (prevents fd leak) - Re-entrant device change guard (isRestarting flag) This enables the Mac App Store distribution path by removing the subprocess dependency. The host app imports AudioTapLib directly.
8d1b725 to
4ba7bd8
Compare
Replace subprocess-based audiotap invocation with direct AudioTapLib library calls. DualSourceRecorder now uses AudioCaptureSession directly, eliminating Process/Pipe management, PID file handling, and stderr parsing. Remove findProjectRoot() from Permissions (only caller was the removed findAudiotap()).
Remove build_audiotap.sh (no longer needed). Remove audiotap binary build step, bundle copy, and code signing from build_release.sh. Update CLAUDE.md, README, CONTRIBUTING, and architecture docs to reflect AudioTapLib as a library dependency instead of CLI tool.
063a547 to
a5f8ed9
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tools/audiotap/from CLI executable to SPM library (AudioTapLib)DualSourceRecorderusesAudioCaptureSessiondirectly — no subprocess, no PID files, no stderr parsingChanges
main.swiftinto 5 focused modules (AppAudioCapture,MicCaptureHandler,AudioCaptureSession,AudioCaptureResult,Helpers).fputs→os.log,Thread.sleep→asyncAfter, file handle leak guard, re-entrant restart guard.DualSourceRecorderto useAudioTapLib. RemovefindAudiotap(),killOrphanedAudiotap(), PID file, Process/Pipe/SIGTERM handling. RemoveRecorderError.audiotapNotFound, add.unsupportedOS.build_audiotap.sh, remove audiotap build/copy/sign steps frombuild_release.sh, update all docs.Test plan
swift build— AudioTapLib compilesswift build— App compiles with AudioTapLib dependencyswift test— 491 tests pass, 0 failures./scripts/lint.sh— No new violationsrun_app.sh→ meeting-simulator → recording → transcription → protocol generated