-
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a way to get sample rate via AppleScript
- Loading branch information
1 parent
991f1e0
commit e8955f9
Showing
5 changed files
with
45 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd"> | ||
<dictionary title="LosslessSwitcher Terminology"> | ||
<suite name="LS Suite" code="sdse" description="Standard commands for this application"> | ||
<command name="get latest sample rate" code="getlrate" description="returns the last known sample rate"> | ||
<cocoa class="LosslessSwitcher.ScriptableApplicationCommand"/> | ||
<result type="integer" description="sample rate"/> | ||
</command> | ||
</suite> | ||
</dictionary> |
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,22 @@ | ||
// | ||
// ScriptableApplicationCommand.swift | ||
// LosslessSwitcher | ||
// | ||
// Created by Vincent Neo on 6/12/23. | ||
// | ||
|
||
import Cocoa | ||
|
||
class ScriptableApplicationCommand: NSScriptCommand { | ||
|
||
override func performDefaultImplementation() -> Any? { | ||
guard let delegate = AppDelegate.instance else { | ||
return -1000 | ||
} | ||
let od = delegate.outputDevices | ||
guard let sampleRate = od?.currentSampleRate else { | ||
return -1 | ||
} | ||
return Int(sampleRate * 1000) | ||
} | ||
} |