├── .gitignore ├── .swiftlint.yml ├── LICENCE ├── MultiSoundChanger.xcodeproj ├── project.pbxproj ├── xcshareddata │ └── xcschemes │ │ └── MultiSoundChanger.xcscheme └── xcuserdata │ ├── ichi.xcuserdatad │ └── xcschemes │ │ └── xcschememanagement.plist │ ├── rlxone.xcuserdatad │ └── xcschemes │ │ └── xcschememanagement.plist │ └── sddsd.xcuserdatad │ └── xcschemes │ ├── DynamicsIllusion.xcscheme │ └── xcschememanagement.plist ├── MultiSoundChanger ├── Other │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── icon_512x512_Normal@2x-1024.png │ │ │ ├── icon_512x512_Normal@2x-128.png │ │ │ ├── icon_512x512_Normal@2x-16.png │ │ │ ├── icon_512x512_Normal@2x-256.png │ │ │ ├── icon_512x512_Normal@2x-32.png │ │ │ ├── icon_512x512_Normal@2x-512.png │ │ │ └── icon_512x512_Normal@2x-64.png │ │ ├── Contents.json │ │ ├── StatusBar1Image.imageset │ │ │ ├── @1xMedium-S.png │ │ │ ├── @2xMedium-S.png │ │ │ └── Contents.json │ │ ├── StatusBar2Image.imageset │ │ │ ├── @1xMedium-S.png │ │ │ ├── @2xMedium-S.png │ │ │ └── Contents.json │ │ ├── StatusBar3Image.imageset │ │ │ ├── @1xMedium-S.png │ │ │ ├── @2xMedium-S.png │ │ │ └── Contents.json │ │ └── StatusBar4Image.imageset │ │ │ ├── @1xMedium-S.png │ │ │ ├── @2xMedium-S.png │ │ │ └── Contents.json │ ├── Constants.swift │ ├── Images.swift │ ├── Info.plist │ ├── Localization │ │ ├── Localizable.strings │ │ └── Strings.swift │ └── MultiSoundChanger-Bridging-Header.h └── Sources │ ├── AppDelegate │ └── AppDelegate.swift │ ├── Classes │ ├── ApplicationController.swift │ ├── AudioManager.swift │ ├── MediaManager.swift │ └── StatusBarController.swift │ ├── Extensions │ └── Extensions.swift │ ├── Frameworks │ └── Audio.swift │ ├── Stories │ ├── Main │ │ └── Base.lproj │ │ │ └── Main.storyboard │ ├── Stories.swift │ └── Volume │ │ ├── ScrollableSlider.swift │ │ ├── Volume.storyboard │ │ └── VolumeViewController.swift │ └── Utils │ ├── Logger.swift │ └── Runner.swift ├── Podfile └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.xcworkspace 2 | Pods 3 | Podfile.lock 4 | build 5 | .DS_Store -------------------------------------------------------------------------------- /.swiftlint.yml: -------------------------------------------------------------------------------- 1 | whitelist_rules: 2 | - attributes 3 | - block_based_kvo 4 | - class_delegate_protocol 5 | - closing_brace 6 | - closure_end_indentation 7 | - closure_parameter_position 8 | - closure_spacing 9 | - collection_alignment 10 | - colon 11 | - comma 12 | - compiler_protocol_init 13 | - conditional_returns_on_newline 14 | - contains_over_first_not_nil 15 | - control_statement 16 | - convenience_type 17 | - discouraged_direct_init 18 | - discouraged_object_literal 19 | - duplicate_imports 20 | - dynamic_inline 21 | - empty_count 22 | - empty_enum_arguments 23 | - empty_parameters 24 | - empty_parentheses_with_trailing_closure 25 | - empty_string 26 | - empty_xctest_method 27 | - explicit_init 28 | - fallthrough 29 | - fatal_error_message 30 | - file_length 31 | - first_where 32 | - for_where 33 | - force_cast 34 | - force_try 35 | - force_unwrapping 36 | - function_body_length 37 | - function_default_parameter_at_end 38 | - function_parameter_count 39 | - identical_operands 40 | - implicit_getter 41 | - inert_defer 42 | - large_tuple 43 | - last_where 44 | - leading_whitespace 45 | - legacy_cggeometry_functions 46 | - legacy_constant 47 | - legacy_constructor 48 | - legacy_hashing 49 | - legacy_random 50 | - let_var_whitespace 51 | - line_length 52 | - mark 53 | - multiline_literal_brackets 54 | - nesting 55 | - number_separator 56 | - opening_brace 57 | - operator_usage_whitespace 58 | - operator_whitespace 59 | - private_over_fileprivate 60 | - protocol_property_accessors_order 61 | - redundant_discardable_let 62 | - return_arrow_whitespace 63 | - shorthand_operator 64 | - sorted_first_last 65 | - sorted_imports 66 | - statement_position 67 | - switch_case_alignment 68 | - syntactic_sugar 69 | - todo 70 | - trailing_closure 71 | - trailing_comma 72 | - trailing_newline 73 | - trailing_semicolon 74 | - type_name 75 | - unneeded_break_in_switch 76 | - unneeded_parentheses_in_closure_argument 77 | - unused_closure_parameter 78 | - unused_control_flow_label 79 | - unused_enumerated 80 | - unused_import 81 | - unused_setter_value 82 | - vertical_parameter_alignment 83 | - vertical_whitespace 84 | - vertical_whitespace_closing_braces 85 | - vertical_whitespace_opening_braces 86 | - void_return 87 | - weak_delegate 88 | - type_body_length 89 | included: # paths to include during linting. `--path` is ignored if present. 90 | - MultiSoundChanger 91 | excluded: # paths to ignore during linting. Takes precedence over `included`. 92 | - Pods 93 | analyzer_rules: # Rules run by `swiftlint analyze` (experimental) 94 | - explicit_self 95 | 96 | line_length: 150 97 | 98 | type_body_length: 99 | warning: 300 100 | error: 400 101 | 102 | file_length: 103 | warning: 500 104 | error: 1000 105 | 106 | function_parameter_count: 107 | warning: 10 108 | error: 20 109 | 110 | reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji, sonarqube, markdown) 111 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /MultiSoundChanger.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 54; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4743EFAB1E91493B0032F5AA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4743EFAA1E91493B0032F5AA /* AppDelegate.swift */; }; 11 | D914CAC52698095C00FB55D2 /* SimplyCoreAudio in Frameworks */ = {isa = PBXBuildFile; productRef = D914CAC42698095C00FB55D2 /* SimplyCoreAudio */; }; 12 | D914CAC626993C5700FB55D2 /* ScrollableSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = D914CAC12698034D00FB55D2 /* ScrollableSlider.swift */; }; 13 | D985A0582C2E6DFE00519731 /* OSD.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D985A0552C2E6DCD00519731 /* OSD.framework */; }; 14 | E4FFDC0757FD125F92CC0F62 /* Pods_MultiSoundChanger.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C34C05E9BD81D579A0C4957 /* Pods_MultiSoundChanger.framework */; }; 15 | F312C54E25B3741C00205846 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F373D8C02561D24600642274 /* Main.storyboard */; }; 16 | F312C55025B3742200205846 /* Volume.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F373D8BC2561D22000642274 /* Volume.storyboard */; }; 17 | F3433FCB25B36E16009AAE86 /* Images.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3433FCA25B36E16009AAE86 /* Images.swift */; }; 18 | F373D8B32561D1A600642274 /* StatusBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F373D8B02561D1A600642274 /* StatusBarController.swift */; }; 19 | F373D8B42561D1A600642274 /* AudioManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F373D8B12561D1A600642274 /* AudioManager.swift */; }; 20 | F373D8B52561D1A600642274 /* MediaManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F373D8B22561D1A600642274 /* MediaManager.swift */; }; 21 | F373D8BB2561D21900642274 /* Stories.swift in Sources */ = {isa = PBXBuildFile; fileRef = F373D8BA2561D21900642274 /* Stories.swift */; }; 22 | F373D8BF2561D22000642274 /* VolumeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F373D8BD2561D22000642274 /* VolumeViewController.swift */; }; 23 | F373D8C62561D2A600642274 /* Audio.swift in Sources */ = {isa = PBXBuildFile; fileRef = F373D8C52561D2A600642274 /* Audio.swift */; }; 24 | F373D8C82561D2B000642274 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F373D8C72561D2B000642274 /* Extensions.swift */; }; 25 | F373D8CD2561D36B00642274 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F373D8CB2561D36B00642274 /* Assets.xcassets */; }; 26 | F37C2ECF256AA987001C3D36 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = F37C2ECE256AA987001C3D36 /* Localizable.strings */; }; 27 | F37C2ED1256AAA4C001C3D36 /* Strings.swift in Sources */ = {isa = PBXBuildFile; fileRef = F37C2ED0256AAA4C001C3D36 /* Strings.swift */; }; 28 | F383684D2561E39E00C7B454 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = F383684C2561E39E00C7B454 /* Constants.swift */; }; 29 | F3925975262F2B8000B7AD62 /* ApplicationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3925974262F2B8000B7AD62 /* ApplicationController.swift */; }; 30 | F3925979262F2F9F00B7AD62 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3925978262F2F9F00B7AD62 /* Logger.swift */; }; 31 | F392597C2631ACE700B7AD62 /* Runner.swift in Sources */ = {isa = PBXBuildFile; fileRef = F392597B2631ACE700B7AD62 /* Runner.swift */; }; 32 | /* End PBXBuildFile section */ 33 | 34 | /* Begin PBXFileReference section */ 35 | 4743EFA71E91493B0032F5AA /* MultiSoundChanger.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MultiSoundChanger.app; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | 4743EFAA1E91493B0032F5AA /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 4C34C05E9BD81D579A0C4957 /* Pods_MultiSoundChanger.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MultiSoundChanger.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | 6FD0ED04AFD1CC1242C9B3B3 /* Pods-MultiSoundChanger.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MultiSoundChanger.debug.xcconfig"; path = "Target Support Files/Pods-MultiSoundChanger/Pods-MultiSoundChanger.debug.xcconfig"; sourceTree = ""; }; 39 | D184B2CD842B856AFFE7DF7E /* Pods-MultiSoundChanger.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MultiSoundChanger.release.xcconfig"; path = "Target Support Files/Pods-MultiSoundChanger/Pods-MultiSoundChanger.release.xcconfig"; sourceTree = ""; }; 40 | D914CAC12698034D00FB55D2 /* ScrollableSlider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollableSlider.swift; sourceTree = ""; }; 41 | D985A0552C2E6DCD00519731 /* OSD.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OSD.framework; path = /System/Library/PrivateFrameworks/OSD.framework; sourceTree = ""; }; 42 | F3433FCA25B36E16009AAE86 /* Images.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Images.swift; sourceTree = ""; }; 43 | F373D8B02561D1A600642274 /* StatusBarController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusBarController.swift; sourceTree = ""; }; 44 | F373D8B12561D1A600642274 /* AudioManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AudioManager.swift; sourceTree = ""; }; 45 | F373D8B22561D1A600642274 /* MediaManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaManager.swift; sourceTree = ""; }; 46 | F373D8BA2561D21900642274 /* Stories.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Stories.swift; sourceTree = ""; }; 47 | F373D8BC2561D22000642274 /* Volume.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Volume.storyboard; sourceTree = ""; }; 48 | F373D8BD2561D22000642274 /* VolumeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VolumeViewController.swift; sourceTree = ""; }; 49 | F373D8C12561D24600642274 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 50 | F373D8C52561D2A600642274 /* Audio.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Audio.swift; path = Sources/Frameworks/Audio.swift; sourceTree = ""; }; 51 | F373D8C72561D2B000642274 /* Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Extensions.swift; path = Sources/Extensions/Extensions.swift; sourceTree = ""; }; 52 | F373D8CA2561D36B00642274 /* MultiSoundChanger-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MultiSoundChanger-Bridging-Header.h"; sourceTree = ""; }; 53 | F373D8CB2561D36B00642274 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 54 | F373D8CC2561D36B00642274 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55 | F37C2ECE256AA987001C3D36 /* Localizable.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = ""; }; 56 | F37C2ED0256AAA4C001C3D36 /* Strings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Strings.swift; sourceTree = ""; }; 57 | F383684C2561E39E00C7B454 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; 58 | F3925974262F2B8000B7AD62 /* ApplicationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplicationController.swift; sourceTree = ""; }; 59 | F3925978262F2F9F00B7AD62 /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = ""; }; 60 | F392597B2631ACE700B7AD62 /* Runner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Runner.swift; sourceTree = ""; }; 61 | /* End PBXFileReference section */ 62 | 63 | /* Begin PBXFrameworksBuildPhase section */ 64 | 4743EFA41E91493B0032F5AA /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | D914CAC52698095C00FB55D2 /* SimplyCoreAudio in Frameworks */, 69 | D985A0582C2E6DFE00519731 /* OSD.framework in Frameworks */, 70 | E4FFDC0757FD125F92CC0F62 /* Pods_MultiSoundChanger.framework in Frameworks */, 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | /* End PBXFrameworksBuildPhase section */ 75 | 76 | /* Begin PBXGroup section */ 77 | 4743EF9E1E91493B0032F5AA = { 78 | isa = PBXGroup; 79 | children = ( 80 | 4743EFA91E91493B0032F5AA /* MultiSoundChanger */, 81 | 4743EFA81E91493B0032F5AA /* Products */, 82 | 5E653FF732220067826E9384 /* Pods */, 83 | 83889335DD9089B748A33010 /* Frameworks */, 84 | ); 85 | sourceTree = ""; 86 | }; 87 | 4743EFA81E91493B0032F5AA /* Products */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | 4743EFA71E91493B0032F5AA /* MultiSoundChanger.app */, 91 | ); 92 | name = Products; 93 | sourceTree = ""; 94 | }; 95 | 4743EFA91E91493B0032F5AA /* MultiSoundChanger */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | F373D8A42561D11900642274 /* Sources */, 99 | F373D8C92561D31700642274 /* Other */, 100 | ); 101 | path = MultiSoundChanger; 102 | sourceTree = ""; 103 | }; 104 | 47E683041E91BC6200C525F7 /* Frameworks */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | F373D8C52561D2A600642274 /* Audio.swift */, 108 | ); 109 | name = Frameworks; 110 | path = ..; 111 | sourceTree = ""; 112 | }; 113 | 47E6830C1E9273C600C525F7 /* Extensions */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | F373D8C72561D2B000642274 /* Extensions.swift */, 117 | ); 118 | name = Extensions; 119 | path = ..; 120 | sourceTree = ""; 121 | }; 122 | 5E653FF732220067826E9384 /* Pods */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 6FD0ED04AFD1CC1242C9B3B3 /* Pods-MultiSoundChanger.debug.xcconfig */, 126 | D184B2CD842B856AFFE7DF7E /* Pods-MultiSoundChanger.release.xcconfig */, 127 | ); 128 | path = Pods; 129 | sourceTree = ""; 130 | }; 131 | 83889335DD9089B748A33010 /* Frameworks */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | D985A0552C2E6DCD00519731 /* OSD.framework */, 135 | 4C34C05E9BD81D579A0C4957 /* Pods_MultiSoundChanger.framework */, 136 | ); 137 | name = Frameworks; 138 | sourceTree = ""; 139 | }; 140 | F373D8A22561D10800642274 /* AppDelegate */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | 4743EFAA1E91493B0032F5AA /* AppDelegate.swift */, 144 | ); 145 | path = AppDelegate; 146 | sourceTree = ""; 147 | }; 148 | F373D8A42561D11900642274 /* Sources */ = { 149 | isa = PBXGroup; 150 | children = ( 151 | F373D8A22561D10800642274 /* AppDelegate */, 152 | F373D8A92561D17C00642274 /* Classes */, 153 | 47E683041E91BC6200C525F7 /* Frameworks */, 154 | F373D8B72561D1C600642274 /* Stories */, 155 | 47E6830C1E9273C600C525F7 /* Extensions */, 156 | F392596C2610DECC00B7AD62 /* Utils */, 157 | ); 158 | path = Sources; 159 | sourceTree = ""; 160 | }; 161 | F373D8A92561D17C00642274 /* Classes */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | F3925974262F2B8000B7AD62 /* ApplicationController.swift */, 165 | F373D8B02561D1A600642274 /* StatusBarController.swift */, 166 | F373D8B12561D1A600642274 /* AudioManager.swift */, 167 | F373D8B22561D1A600642274 /* MediaManager.swift */, 168 | ); 169 | path = Classes; 170 | sourceTree = ""; 171 | }; 172 | F373D8B72561D1C600642274 /* Stories */ = { 173 | isa = PBXGroup; 174 | children = ( 175 | F373D8BA2561D21900642274 /* Stories.swift */, 176 | F373D8B92561D1F200642274 /* Main */, 177 | F373D8B82561D1ED00642274 /* Volume */, 178 | ); 179 | path = Stories; 180 | sourceTree = ""; 181 | }; 182 | F373D8B82561D1ED00642274 /* Volume */ = { 183 | isa = PBXGroup; 184 | children = ( 185 | F373D8BC2561D22000642274 /* Volume.storyboard */, 186 | F373D8BD2561D22000642274 /* VolumeViewController.swift */, 187 | D914CAC12698034D00FB55D2 /* ScrollableSlider.swift */, 188 | ); 189 | path = Volume; 190 | sourceTree = ""; 191 | }; 192 | F373D8B92561D1F200642274 /* Main */ = { 193 | isa = PBXGroup; 194 | children = ( 195 | F373D8C02561D24600642274 /* Main.storyboard */, 196 | ); 197 | path = Main; 198 | sourceTree = ""; 199 | }; 200 | F373D8C92561D31700642274 /* Other */ = { 201 | isa = PBXGroup; 202 | children = ( 203 | F37C2ECD256AA8F0001C3D36 /* Localization */, 204 | F3433FCA25B36E16009AAE86 /* Images.swift */, 205 | F383684C2561E39E00C7B454 /* Constants.swift */, 206 | F373D8CB2561D36B00642274 /* Assets.xcassets */, 207 | F373D8CA2561D36B00642274 /* MultiSoundChanger-Bridging-Header.h */, 208 | F373D8CC2561D36B00642274 /* Info.plist */, 209 | ); 210 | path = Other; 211 | sourceTree = ""; 212 | }; 213 | F37C2ECD256AA8F0001C3D36 /* Localization */ = { 214 | isa = PBXGroup; 215 | children = ( 216 | F37C2ED0256AAA4C001C3D36 /* Strings.swift */, 217 | F37C2ECE256AA987001C3D36 /* Localizable.strings */, 218 | ); 219 | path = Localization; 220 | sourceTree = ""; 221 | }; 222 | F392596C2610DECC00B7AD62 /* Utils */ = { 223 | isa = PBXGroup; 224 | children = ( 225 | F3925978262F2F9F00B7AD62 /* Logger.swift */, 226 | F392597B2631ACE700B7AD62 /* Runner.swift */, 227 | ); 228 | path = Utils; 229 | sourceTree = ""; 230 | }; 231 | /* End PBXGroup section */ 232 | 233 | /* Begin PBXNativeTarget section */ 234 | 4743EFA61E91493B0032F5AA /* MultiSoundChanger */ = { 235 | isa = PBXNativeTarget; 236 | buildConfigurationList = 4743EFB61E91493B0032F5AA /* Build configuration list for PBXNativeTarget "MultiSoundChanger" */; 237 | buildPhases = ( 238 | 11DA7F4B3D2C9321E3505857 /* [CP] Check Pods Manifest.lock */, 239 | F373D8802561638C00642274 /* SwiftLint */, 240 | 4743EFA31E91493B0032F5AA /* Sources */, 241 | 4743EFA41E91493B0032F5AA /* Frameworks */, 242 | 4743EFA51E91493B0032F5AA /* Resources */, 243 | 8ABB500BA33A8DA7ECBE36B7 /* [CP] Embed Pods Frameworks */, 244 | ); 245 | buildRules = ( 246 | ); 247 | dependencies = ( 248 | ); 249 | name = MultiSoundChanger; 250 | packageProductDependencies = ( 251 | D914CAC42698095C00FB55D2 /* SimplyCoreAudio */, 252 | ); 253 | productName = DynamicsIllusion; 254 | productReference = 4743EFA71E91493B0032F5AA /* MultiSoundChanger.app */; 255 | productType = "com.apple.product-type.application"; 256 | }; 257 | /* End PBXNativeTarget section */ 258 | 259 | /* Begin PBXProject section */ 260 | 4743EF9F1E91493B0032F5AA /* Project object */ = { 261 | isa = PBXProject; 262 | attributes = { 263 | LastSwiftUpdateCheck = 0830; 264 | LastUpgradeCheck = 1200; 265 | ORGANIZATIONNAME = "Dmitry Medyuho"; 266 | TargetAttributes = { 267 | 4743EFA61E91493B0032F5AA = { 268 | CreatedOnToolsVersion = 8.3; 269 | ProvisioningStyle = Manual; 270 | }; 271 | }; 272 | }; 273 | buildConfigurationList = 4743EFA21E91493B0032F5AA /* Build configuration list for PBXProject "MultiSoundChanger" */; 274 | compatibilityVersion = "Xcode 3.2"; 275 | developmentRegion = en; 276 | hasScannedForEncodings = 0; 277 | knownRegions = ( 278 | en, 279 | Base, 280 | ); 281 | mainGroup = 4743EF9E1E91493B0032F5AA; 282 | packageReferences = ( 283 | D914CAC32698095C00FB55D2 /* XCRemoteSwiftPackageReference "SimplyCoreAudio" */, 284 | ); 285 | productRefGroup = 4743EFA81E91493B0032F5AA /* Products */; 286 | projectDirPath = ""; 287 | projectRoot = ""; 288 | targets = ( 289 | 4743EFA61E91493B0032F5AA /* MultiSoundChanger */, 290 | ); 291 | }; 292 | /* End PBXProject section */ 293 | 294 | /* Begin PBXResourcesBuildPhase section */ 295 | 4743EFA51E91493B0032F5AA /* Resources */ = { 296 | isa = PBXResourcesBuildPhase; 297 | buildActionMask = 2147483647; 298 | files = ( 299 | F312C55025B3742200205846 /* Volume.storyboard in Resources */, 300 | F312C54E25B3741C00205846 /* Main.storyboard in Resources */, 301 | F37C2ECF256AA987001C3D36 /* Localizable.strings in Resources */, 302 | F373D8CD2561D36B00642274 /* Assets.xcassets in Resources */, 303 | ); 304 | runOnlyForDeploymentPostprocessing = 0; 305 | }; 306 | /* End PBXResourcesBuildPhase section */ 307 | 308 | /* Begin PBXShellScriptBuildPhase section */ 309 | 11DA7F4B3D2C9321E3505857 /* [CP] Check Pods Manifest.lock */ = { 310 | isa = PBXShellScriptBuildPhase; 311 | buildActionMask = 2147483647; 312 | files = ( 313 | ); 314 | inputFileListPaths = ( 315 | ); 316 | inputPaths = ( 317 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 318 | "${PODS_ROOT}/Manifest.lock", 319 | ); 320 | name = "[CP] Check Pods Manifest.lock"; 321 | outputFileListPaths = ( 322 | ); 323 | outputPaths = ( 324 | "$(DERIVED_FILE_DIR)/Pods-MultiSoundChanger-checkManifestLockResult.txt", 325 | ); 326 | runOnlyForDeploymentPostprocessing = 0; 327 | shellPath = /bin/sh; 328 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 329 | showEnvVarsInLog = 0; 330 | }; 331 | 8ABB500BA33A8DA7ECBE36B7 /* [CP] Embed Pods Frameworks */ = { 332 | isa = PBXShellScriptBuildPhase; 333 | buildActionMask = 2147483647; 334 | files = ( 335 | ); 336 | inputPaths = ( 337 | "${PODS_ROOT}/Target Support Files/Pods-MultiSoundChanger/Pods-MultiSoundChanger-frameworks.sh", 338 | "${BUILT_PRODUCTS_DIR}/MediaKeyTap/MediaKeyTap.framework", 339 | ); 340 | name = "[CP] Embed Pods Frameworks"; 341 | outputPaths = ( 342 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MediaKeyTap.framework", 343 | ); 344 | runOnlyForDeploymentPostprocessing = 0; 345 | shellPath = /bin/sh; 346 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-MultiSoundChanger/Pods-MultiSoundChanger-frameworks.sh\"\n"; 347 | showEnvVarsInLog = 0; 348 | }; 349 | F373D8802561638C00642274 /* SwiftLint */ = { 350 | isa = PBXShellScriptBuildPhase; 351 | buildActionMask = 2147483647; 352 | files = ( 353 | ); 354 | inputFileListPaths = ( 355 | ); 356 | inputPaths = ( 357 | ); 358 | name = SwiftLint; 359 | outputFileListPaths = ( 360 | ); 361 | outputPaths = ( 362 | ); 363 | runOnlyForDeploymentPostprocessing = 0; 364 | shellPath = /bin/sh; 365 | shellScript = "\"${PODS_ROOT}/SwiftLint/swiftlint\"\n"; 366 | }; 367 | /* End PBXShellScriptBuildPhase section */ 368 | 369 | /* Begin PBXSourcesBuildPhase section */ 370 | 4743EFA31E91493B0032F5AA /* Sources */ = { 371 | isa = PBXSourcesBuildPhase; 372 | buildActionMask = 2147483647; 373 | files = ( 374 | F373D8C82561D2B000642274 /* Extensions.swift in Sources */, 375 | F392597C2631ACE700B7AD62 /* Runner.swift in Sources */, 376 | F3433FCB25B36E16009AAE86 /* Images.swift in Sources */, 377 | D914CAC626993C5700FB55D2 /* ScrollableSlider.swift in Sources */, 378 | F3925975262F2B8000B7AD62 /* ApplicationController.swift in Sources */, 379 | F373D8C62561D2A600642274 /* Audio.swift in Sources */, 380 | F37C2ED1256AAA4C001C3D36 /* Strings.swift in Sources */, 381 | F373D8B52561D1A600642274 /* MediaManager.swift in Sources */, 382 | F373D8B42561D1A600642274 /* AudioManager.swift in Sources */, 383 | F373D8B32561D1A600642274 /* StatusBarController.swift in Sources */, 384 | 4743EFAB1E91493B0032F5AA /* AppDelegate.swift in Sources */, 385 | F373D8BF2561D22000642274 /* VolumeViewController.swift in Sources */, 386 | F3925979262F2F9F00B7AD62 /* Logger.swift in Sources */, 387 | F373D8BB2561D21900642274 /* Stories.swift in Sources */, 388 | F383684D2561E39E00C7B454 /* Constants.swift in Sources */, 389 | ); 390 | runOnlyForDeploymentPostprocessing = 0; 391 | }; 392 | /* End PBXSourcesBuildPhase section */ 393 | 394 | /* Begin PBXVariantGroup section */ 395 | F373D8C02561D24600642274 /* Main.storyboard */ = { 396 | isa = PBXVariantGroup; 397 | children = ( 398 | F373D8C12561D24600642274 /* Base */, 399 | ); 400 | name = Main.storyboard; 401 | sourceTree = ""; 402 | }; 403 | /* End PBXVariantGroup section */ 404 | 405 | /* Begin XCBuildConfiguration section */ 406 | 4743EFB41E91493B0032F5AA /* Debug */ = { 407 | isa = XCBuildConfiguration; 408 | buildSettings = { 409 | ALWAYS_SEARCH_USER_PATHS = NO; 410 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 411 | CLANG_ANALYZER_NONNULL = YES; 412 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 413 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 414 | CLANG_CXX_LIBRARY = "libc++"; 415 | CLANG_ENABLE_MODULES = YES; 416 | CLANG_ENABLE_OBJC_ARC = YES; 417 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 418 | CLANG_WARN_BOOL_CONVERSION = YES; 419 | CLANG_WARN_COMMA = YES; 420 | CLANG_WARN_CONSTANT_CONVERSION = YES; 421 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 422 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 423 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 424 | CLANG_WARN_EMPTY_BODY = YES; 425 | CLANG_WARN_ENUM_CONVERSION = YES; 426 | CLANG_WARN_INFINITE_RECURSION = YES; 427 | CLANG_WARN_INT_CONVERSION = YES; 428 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 429 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 430 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 431 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 432 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 433 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 434 | CLANG_WARN_STRICT_PROTOTYPES = YES; 435 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 436 | CLANG_WARN_UNREACHABLE_CODE = YES; 437 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 438 | CODE_SIGN_IDENTITY = "-"; 439 | COPY_PHASE_STRIP = NO; 440 | DEBUG_INFORMATION_FORMAT = dwarf; 441 | ENABLE_STRICT_OBJC_MSGSEND = YES; 442 | ENABLE_TESTABILITY = YES; 443 | GCC_C_LANGUAGE_STANDARD = gnu99; 444 | GCC_DYNAMIC_NO_PIC = NO; 445 | GCC_NO_COMMON_BLOCKS = YES; 446 | GCC_OPTIMIZATION_LEVEL = 0; 447 | GCC_PREPROCESSOR_DEFINITIONS = ( 448 | "DEBUG=1", 449 | "$(inherited)", 450 | ); 451 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 452 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 453 | GCC_WARN_UNDECLARED_SELECTOR = YES; 454 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 455 | GCC_WARN_UNUSED_FUNCTION = YES; 456 | GCC_WARN_UNUSED_VARIABLE = YES; 457 | MACOSX_DEPLOYMENT_TARGET = 10.10; 458 | MTL_ENABLE_DEBUG_INFO = YES; 459 | ONLY_ACTIVE_ARCH = YES; 460 | SDKROOT = macosx; 461 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 462 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 463 | SWIFT_VERSION = 5.0; 464 | }; 465 | name = Debug; 466 | }; 467 | 4743EFB51E91493B0032F5AA /* Release */ = { 468 | isa = XCBuildConfiguration; 469 | buildSettings = { 470 | ALWAYS_SEARCH_USER_PATHS = NO; 471 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 472 | CLANG_ANALYZER_NONNULL = YES; 473 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 474 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 475 | CLANG_CXX_LIBRARY = "libc++"; 476 | CLANG_ENABLE_MODULES = YES; 477 | CLANG_ENABLE_OBJC_ARC = YES; 478 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 479 | CLANG_WARN_BOOL_CONVERSION = YES; 480 | CLANG_WARN_COMMA = YES; 481 | CLANG_WARN_CONSTANT_CONVERSION = YES; 482 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 483 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 484 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 485 | CLANG_WARN_EMPTY_BODY = YES; 486 | CLANG_WARN_ENUM_CONVERSION = YES; 487 | CLANG_WARN_INFINITE_RECURSION = YES; 488 | CLANG_WARN_INT_CONVERSION = YES; 489 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 490 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 491 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 492 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 493 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 494 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 495 | CLANG_WARN_STRICT_PROTOTYPES = YES; 496 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 497 | CLANG_WARN_UNREACHABLE_CODE = YES; 498 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 499 | CODE_SIGN_IDENTITY = "-"; 500 | COPY_PHASE_STRIP = NO; 501 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 502 | ENABLE_NS_ASSERTIONS = NO; 503 | ENABLE_STRICT_OBJC_MSGSEND = YES; 504 | GCC_C_LANGUAGE_STANDARD = gnu99; 505 | GCC_NO_COMMON_BLOCKS = YES; 506 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 507 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 508 | GCC_WARN_UNDECLARED_SELECTOR = YES; 509 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 510 | GCC_WARN_UNUSED_FUNCTION = YES; 511 | GCC_WARN_UNUSED_VARIABLE = YES; 512 | MACOSX_DEPLOYMENT_TARGET = 10.10; 513 | MTL_ENABLE_DEBUG_INFO = NO; 514 | SDKROOT = macosx; 515 | SWIFT_COMPILATION_MODE = wholemodule; 516 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 517 | SWIFT_VERSION = 5.0; 518 | }; 519 | name = Release; 520 | }; 521 | 4743EFB71E91493B0032F5AA /* Debug */ = { 522 | isa = XCBuildConfiguration; 523 | baseConfigurationReference = 6FD0ED04AFD1CC1242C9B3B3 /* Pods-MultiSoundChanger.debug.xcconfig */; 524 | buildSettings = { 525 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 526 | CODE_SIGN_IDENTITY = "-"; 527 | CODE_SIGN_STYLE = Manual; 528 | COMBINE_HIDPI_IMAGES = YES; 529 | DEVELOPMENT_TEAM = ""; 530 | EXCLUDED_ARCHS = ""; 531 | FRAMEWORK_SEARCH_PATHS = ( 532 | "$(inherited)", 533 | "$(PROJECT_DIR)", 534 | ); 535 | INFOPLIST_FILE = MultiSoundChanger/Other/Info.plist; 536 | LD_RUNPATH_SEARCH_PATHS = ( 537 | "$(inherited)", 538 | "@executable_path/../Frameworks", 539 | ); 540 | MACOSX_DEPLOYMENT_TARGET = 10.13; 541 | MARKETING_VERSION = 1.0.1; 542 | PRODUCT_BUNDLE_IDENTIFIER = com.rlxone.multisoundchanger; 543 | PRODUCT_NAME = "$(TARGET_NAME)"; 544 | PROVISIONING_PROFILE_SPECIFIER = ""; 545 | SWIFT_OBJC_BRIDGING_HEADER = "MultiSoundChanger/Other/MultiSoundChanger-Bridging-Header.h"; 546 | SWIFT_VERSION = 5.0; 547 | SYSTEM_FRAMEWORK_SEARCH_PATHS = ( 548 | "$(inherited)", 549 | "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks", 550 | ); 551 | }; 552 | name = Debug; 553 | }; 554 | 4743EFB81E91493B0032F5AA /* Release */ = { 555 | isa = XCBuildConfiguration; 556 | baseConfigurationReference = D184B2CD842B856AFFE7DF7E /* Pods-MultiSoundChanger.release.xcconfig */; 557 | buildSettings = { 558 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 559 | CODE_SIGN_IDENTITY = "-"; 560 | CODE_SIGN_STYLE = Manual; 561 | COMBINE_HIDPI_IMAGES = YES; 562 | DEVELOPMENT_TEAM = ""; 563 | EXCLUDED_ARCHS = ""; 564 | FRAMEWORK_SEARCH_PATHS = ( 565 | "$(inherited)", 566 | "$(PROJECT_DIR)", 567 | ); 568 | INFOPLIST_FILE = MultiSoundChanger/Other/Info.plist; 569 | LD_RUNPATH_SEARCH_PATHS = ( 570 | "$(inherited)", 571 | "@executable_path/../Frameworks", 572 | ); 573 | MACOSX_DEPLOYMENT_TARGET = 10.13; 574 | MARKETING_VERSION = 1.0.1; 575 | PRODUCT_BUNDLE_IDENTIFIER = com.rlxone.multisoundchanger; 576 | PRODUCT_NAME = "$(TARGET_NAME)"; 577 | PROVISIONING_PROFILE_SPECIFIER = ""; 578 | SWIFT_OBJC_BRIDGING_HEADER = "MultiSoundChanger/Other/MultiSoundChanger-Bridging-Header.h"; 579 | SWIFT_VERSION = 5.0; 580 | SYSTEM_FRAMEWORK_SEARCH_PATHS = ( 581 | "$(inherited)", 582 | "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks", 583 | ); 584 | }; 585 | name = Release; 586 | }; 587 | /* End XCBuildConfiguration section */ 588 | 589 | /* Begin XCConfigurationList section */ 590 | 4743EFA21E91493B0032F5AA /* Build configuration list for PBXProject "MultiSoundChanger" */ = { 591 | isa = XCConfigurationList; 592 | buildConfigurations = ( 593 | 4743EFB41E91493B0032F5AA /* Debug */, 594 | 4743EFB51E91493B0032F5AA /* Release */, 595 | ); 596 | defaultConfigurationIsVisible = 0; 597 | defaultConfigurationName = Release; 598 | }; 599 | 4743EFB61E91493B0032F5AA /* Build configuration list for PBXNativeTarget "MultiSoundChanger" */ = { 600 | isa = XCConfigurationList; 601 | buildConfigurations = ( 602 | 4743EFB71E91493B0032F5AA /* Debug */, 603 | 4743EFB81E91493B0032F5AA /* Release */, 604 | ); 605 | defaultConfigurationIsVisible = 0; 606 | defaultConfigurationName = Release; 607 | }; 608 | /* End XCConfigurationList section */ 609 | 610 | /* Begin XCRemoteSwiftPackageReference section */ 611 | D914CAC32698095C00FB55D2 /* XCRemoteSwiftPackageReference "SimplyCoreAudio" */ = { 612 | isa = XCRemoteSwiftPackageReference; 613 | repositoryURL = "https://github.com/rnine/SimplyCoreAudio"; 614 | requirement = { 615 | kind = upToNextMajorVersion; 616 | minimumVersion = 4.1.1; 617 | }; 618 | }; 619 | /* End XCRemoteSwiftPackageReference section */ 620 | 621 | /* Begin XCSwiftPackageProductDependency section */ 622 | D914CAC42698095C00FB55D2 /* SimplyCoreAudio */ = { 623 | isa = XCSwiftPackageProductDependency; 624 | package = D914CAC32698095C00FB55D2 /* XCRemoteSwiftPackageReference "SimplyCoreAudio" */; 625 | productName = SimplyCoreAudio; 626 | }; 627 | /* End XCSwiftPackageProductDependency section */ 628 | }; 629 | rootObject = 4743EF9F1E91493B0032F5AA /* Project object */; 630 | } 631 | -------------------------------------------------------------------------------- /MultiSoundChanger.xcodeproj/xcshareddata/xcschemes/MultiSoundChanger.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /MultiSoundChanger.xcodeproj/xcuserdata/ichi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | MultiSoundChanger.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /MultiSoundChanger.xcodeproj/xcuserdata/rlxone.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | MultiSoundChanger.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 3 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4743EFA61E91493B0032F5AA 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /MultiSoundChanger.xcodeproj/xcuserdata/sddsd.xcuserdatad/xcschemes/DynamicsIllusion.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /MultiSoundChanger.xcodeproj/xcuserdata/sddsd.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DynamicsIllusion.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4743EFA61E91493B0032F5AA 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "icon_512x512_Normal@2x-16.png", 5 | "idiom" : "mac", 6 | "scale" : "1x", 7 | "size" : "16x16" 8 | }, 9 | { 10 | "filename" : "icon_512x512_Normal@2x-32.png", 11 | "idiom" : "mac", 12 | "scale" : "2x", 13 | "size" : "16x16" 14 | }, 15 | { 16 | "filename" : "icon_512x512_Normal@2x-32.png", 17 | "idiom" : "mac", 18 | "scale" : "1x", 19 | "size" : "32x32" 20 | }, 21 | { 22 | "filename" : "icon_512x512_Normal@2x-64.png", 23 | "idiom" : "mac", 24 | "scale" : "2x", 25 | "size" : "32x32" 26 | }, 27 | { 28 | "filename" : "icon_512x512_Normal@2x-128.png", 29 | "idiom" : "mac", 30 | "scale" : "1x", 31 | "size" : "128x128" 32 | }, 33 | { 34 | "filename" : "icon_512x512_Normal@2x-256.png", 35 | "idiom" : "mac", 36 | "scale" : "2x", 37 | "size" : "128x128" 38 | }, 39 | { 40 | "filename" : "icon_512x512_Normal@2x-256.png", 41 | "idiom" : "mac", 42 | "scale" : "1x", 43 | "size" : "256x256" 44 | }, 45 | { 46 | "filename" : "icon_512x512_Normal@2x-512.png", 47 | "idiom" : "mac", 48 | "scale" : "2x", 49 | "size" : "256x256" 50 | }, 51 | { 52 | "filename" : "icon_512x512_Normal@2x-512.png", 53 | "idiom" : "mac", 54 | "scale" : "1x", 55 | "size" : "512x512" 56 | }, 57 | { 58 | "filename" : "icon_512x512_Normal@2x-1024.png", 59 | "idiom" : "mac", 60 | "scale" : "2x", 61 | "size" : "512x512" 62 | } 63 | ], 64 | "info" : { 65 | "author" : "xcode", 66 | "version" : 1 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/AppIcon.appiconset/icon_512x512_Normal@2x-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrum/MultiSoundChanger/c60e25a937c7aa3bf9216c467ddaa74a747f5e3a/MultiSoundChanger/Other/Assets.xcassets/AppIcon.appiconset/icon_512x512_Normal@2x-1024.png -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/AppIcon.appiconset/icon_512x512_Normal@2x-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrum/MultiSoundChanger/c60e25a937c7aa3bf9216c467ddaa74a747f5e3a/MultiSoundChanger/Other/Assets.xcassets/AppIcon.appiconset/icon_512x512_Normal@2x-128.png -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/AppIcon.appiconset/icon_512x512_Normal@2x-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrum/MultiSoundChanger/c60e25a937c7aa3bf9216c467ddaa74a747f5e3a/MultiSoundChanger/Other/Assets.xcassets/AppIcon.appiconset/icon_512x512_Normal@2x-16.png -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/AppIcon.appiconset/icon_512x512_Normal@2x-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrum/MultiSoundChanger/c60e25a937c7aa3bf9216c467ddaa74a747f5e3a/MultiSoundChanger/Other/Assets.xcassets/AppIcon.appiconset/icon_512x512_Normal@2x-256.png -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/AppIcon.appiconset/icon_512x512_Normal@2x-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrum/MultiSoundChanger/c60e25a937c7aa3bf9216c467ddaa74a747f5e3a/MultiSoundChanger/Other/Assets.xcassets/AppIcon.appiconset/icon_512x512_Normal@2x-32.png -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/AppIcon.appiconset/icon_512x512_Normal@2x-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrum/MultiSoundChanger/c60e25a937c7aa3bf9216c467ddaa74a747f5e3a/MultiSoundChanger/Other/Assets.xcassets/AppIcon.appiconset/icon_512x512_Normal@2x-512.png -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/AppIcon.appiconset/icon_512x512_Normal@2x-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrum/MultiSoundChanger/c60e25a937c7aa3bf9216c467ddaa74a747f5e3a/MultiSoundChanger/Other/Assets.xcassets/AppIcon.appiconset/icon_512x512_Normal@2x-64.png -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/StatusBar1Image.imageset/@1xMedium-S.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrum/MultiSoundChanger/c60e25a937c7aa3bf9216c467ddaa74a747f5e3a/MultiSoundChanger/Other/Assets.xcassets/StatusBar1Image.imageset/@1xMedium-S.png -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/StatusBar1Image.imageset/@2xMedium-S.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrum/MultiSoundChanger/c60e25a937c7aa3bf9216c467ddaa74a747f5e3a/MultiSoundChanger/Other/Assets.xcassets/StatusBar1Image.imageset/@2xMedium-S.png -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/StatusBar1Image.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "@1xMedium-S.png", 5 | "idiom" : "mac", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "filename" : "@2xMedium-S.png", 10 | "idiom" : "mac", 11 | "scale" : "2x" 12 | } 13 | ], 14 | "info" : { 15 | "author" : "xcode", 16 | "version" : 1 17 | }, 18 | "properties" : { 19 | "template-rendering-intent" : "template" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/StatusBar2Image.imageset/@1xMedium-S.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrum/MultiSoundChanger/c60e25a937c7aa3bf9216c467ddaa74a747f5e3a/MultiSoundChanger/Other/Assets.xcassets/StatusBar2Image.imageset/@1xMedium-S.png -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/StatusBar2Image.imageset/@2xMedium-S.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrum/MultiSoundChanger/c60e25a937c7aa3bf9216c467ddaa74a747f5e3a/MultiSoundChanger/Other/Assets.xcassets/StatusBar2Image.imageset/@2xMedium-S.png -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/StatusBar2Image.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "@1xMedium-S.png", 5 | "idiom" : "mac", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "filename" : "@2xMedium-S.png", 10 | "idiom" : "mac", 11 | "scale" : "2x" 12 | } 13 | ], 14 | "info" : { 15 | "author" : "xcode", 16 | "version" : 1 17 | }, 18 | "properties" : { 19 | "template-rendering-intent" : "template" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/StatusBar3Image.imageset/@1xMedium-S.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrum/MultiSoundChanger/c60e25a937c7aa3bf9216c467ddaa74a747f5e3a/MultiSoundChanger/Other/Assets.xcassets/StatusBar3Image.imageset/@1xMedium-S.png -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/StatusBar3Image.imageset/@2xMedium-S.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrum/MultiSoundChanger/c60e25a937c7aa3bf9216c467ddaa74a747f5e3a/MultiSoundChanger/Other/Assets.xcassets/StatusBar3Image.imageset/@2xMedium-S.png -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/StatusBar3Image.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "@1xMedium-S.png", 5 | "idiom" : "mac", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "filename" : "@2xMedium-S.png", 10 | "idiom" : "mac", 11 | "scale" : "2x" 12 | } 13 | ], 14 | "info" : { 15 | "author" : "xcode", 16 | "version" : 1 17 | }, 18 | "properties" : { 19 | "template-rendering-intent" : "template" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/StatusBar4Image.imageset/@1xMedium-S.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrum/MultiSoundChanger/c60e25a937c7aa3bf9216c467ddaa74a747f5e3a/MultiSoundChanger/Other/Assets.xcassets/StatusBar4Image.imageset/@1xMedium-S.png -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/StatusBar4Image.imageset/@2xMedium-S.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrum/MultiSoundChanger/c60e25a937c7aa3bf9216c467ddaa74a747f5e3a/MultiSoundChanger/Other/Assets.xcassets/StatusBar4Image.imageset/@2xMedium-S.png -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Assets.xcassets/StatusBar4Image.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "@1xMedium-S.png", 5 | "idiom" : "mac", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "filename" : "@2xMedium-S.png", 10 | "idiom" : "mac", 11 | "scale" : "2x" 12 | } 13 | ], 14 | "info" : { 15 | "author" : "xcode", 16 | "version" : 1 17 | }, 18 | "properties" : { 19 | "template-rendering-intent" : "template" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Constants.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Constants.swift 3 | // MultiSoundChanger 4 | // 5 | // Created by Dmitry Medyuho on 16.11.2020. 6 | // Copyright © 2020 Dmitry Medyuho. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | enum Constants { 12 | static let chicletsCount = 16 13 | static let optionMaxLength = 25 14 | static let muteVolumeLowerbound: Float = 0.001 15 | static let logFilename = "app.log" 16 | 17 | enum AppBundleIdentifier { 18 | static let systemPreferences = "com.apple.systempreferences" 19 | static let audioDevices = "com.apple.audio.AudioMIDISetup" 20 | } 21 | 22 | enum SystemPreferencesPane { 23 | static let sound = "/System/Library/PreferencePanes/Sound.prefPane" 24 | } 25 | 26 | enum Notifications { 27 | static let accessibility = "com.apple.accessibility.api" 28 | } 29 | 30 | enum Keys: String { 31 | case empty = "" 32 | case q 33 | } 34 | 35 | enum InnerMessages { 36 | static let accessEnabled = "Access enabled" 37 | static let accessDenied = "Access denied" 38 | static let getDisplayError = "Error getting display under cursor" 39 | static let outputDevices = "Output devices" 40 | static let bundleIdentifierError = "Can't get bundle identifier" 41 | static let controllerIdentifierError = "Wrong controller identifier" 42 | 43 | static func debugDevice(deviceID: String, deviceName: String) -> String { 44 | return "id: \(deviceID) | name: \(deviceName)" 45 | } 46 | 47 | static func selectDevice(deviceID: String) -> String { 48 | return "Select device id: \(deviceID)" 49 | } 50 | 51 | static func selectedDeviceVolume(volume: String) -> String { 52 | return "Selected device volume: \(volume)" 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Images.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Images.swift 3 | // MultiSoundChanger 4 | // 5 | // Created by Dmitry Medyuho on 16.01.2021. 6 | // Copyright © 2021 Dmitry Medyuho. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | enum Images { 12 | static let volumeImage1 = NSImage(named: "StatusBar1Image") 13 | static let volumeImage2 = NSImage(named: "StatusBar2Image") 14 | static let volumeImage3 = NSImage(named: "StatusBar3Image") 15 | static let volumeImage4 = NSImage(named: "StatusBar4Image") 16 | } 17 | -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(MARKETING_VERSION) 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | LSUIElement 26 | 27 | NSHumanReadableCopyright 28 | Copyright © 2017 Dmitry Medyuho. All rights reserved. 29 | NSMainStoryboardFile 30 | Main 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Localization/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localization.strings 3 | MultiSoundChanger 4 | 5 | Created by Dmitry Medyuho on 22.11.2020. 6 | Copyright © 2020 Dmitry Medyuho. All rights reserved. 7 | */ 8 | 9 | "volume" = "Volume:"; 10 | "output" = "Output Device:"; 11 | "quit" = "Quit"; 12 | "sound.preferences" = "Sound Preferences..."; 13 | "audio.devices" = "Audio Devices..."; 14 | -------------------------------------------------------------------------------- /MultiSoundChanger/Other/Localization/Strings.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Strings.swift 3 | // MultiSoundChanger 4 | // 5 | // Created by Dmitry Medyuho on 22.11.2020. 6 | // Copyright © 2020 Dmitry Medyuho. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | enum Strings { 12 | static var volume = NSLocalizedString("volume", comment: "") 13 | static var output = NSLocalizedString("output", comment: "") 14 | static var quit = NSLocalizedString("quit", comment: "") 15 | static var soundPreferences = NSLocalizedString("sound.preferences", comment: "") 16 | static var audioDevices = NSLocalizedString("audio.devices", comment: "") 17 | } 18 | -------------------------------------------------------------------------------- /MultiSoundChanger/Other/MultiSoundChanger-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // MultiSoundChanger-Bridging-Header.h 3 | // MultiSoundChanger 4 | // 5 | // 6 | 7 | #ifndef MultiSoundChanger_Bridging_Header_h 8 | #define MultiSoundChanger_Bridging_Header_h 9 | 10 | #import 11 | 12 | @protocol OSDUIHelperProtocol 13 | - (void)showFullScreenImage:(long long)arg1 onDisplayID:(unsigned int)arg2 priority:(unsigned int)arg3 msecToAnimate:(unsigned int)arg4; 14 | - (void)fadeClassicImageOnDisplay:(unsigned int)arg1; 15 | - (void)showImageAtPath:(NSString *)arg1 onDisplayID:(unsigned int)arg2 priority:(unsigned int)arg3 msecUntilFade:(unsigned int)arg4 withText:(NSString *)arg5; 16 | - (void)showImage:(long long)arg1 onDisplayID:(unsigned int)arg2 priority:(unsigned int)arg3 msecUntilFade:(unsigned int)arg4 filledChiclets:(unsigned int)arg5 totalChiclets:(unsigned int)arg6 locked:(BOOL)arg7; 17 | - (void)showImage:(long long)arg1 onDisplayID:(unsigned int)arg2 priority:(unsigned int)arg3 msecUntilFade:(unsigned int)arg4 withText:(NSString *)arg5; 18 | - (void)showImage:(long long)arg1 onDisplayID:(unsigned int)arg2 priority:(unsigned int)arg3 msecUntilFade:(unsigned int)arg4; 19 | @end 20 | 21 | @class NSXPCConnection; 22 | 23 | @interface OSDManager : NSObject 24 | { 25 | id _proxyObject; 26 | NSXPCConnection *connection; 27 | } 28 | 29 | + (id)sharedManager; 30 | @property(retain) NSXPCConnection *connection; // @synthesize connection; 31 | - (void)showFullScreenImage:(long long)arg1 onDisplayID:(unsigned int)arg2 priority:(unsigned int)arg3 msecToAnimate:(unsigned int)arg4; 32 | - (void)fadeClassicImageOnDisplay:(unsigned int)arg1; 33 | - (void)showImageAtPath:(id)arg1 onDisplayID:(unsigned int)arg2 priority:(unsigned int)arg3 msecUntilFade:(unsigned int)arg4 withText:(id)arg5; 34 | - (void)showImage:(long long)arg1 onDisplayID:(unsigned int)arg2 priority:(unsigned int)arg3 msecUntilFade:(unsigned int)arg4 filledChiclets:(unsigned int)arg5 totalChiclets:(unsigned int)arg6 locked:(BOOL)arg7; 35 | - (void)showImage:(long long)arg1 onDisplayID:(unsigned int)arg2 priority:(unsigned int)arg3 msecUntilFade:(unsigned int)arg4 withText:(id)arg5; 36 | - (void)showImage:(long long)arg1 onDisplayID:(unsigned int)arg2 priority:(unsigned int)arg3 msecUntilFade:(unsigned int)arg4; 37 | @property(readonly) id remoteObjectProxy; // @dynamic remoteObjectProxy; 38 | 39 | @end 40 | 41 | typedef enum { 42 | OSDGraphicBacklight = 1, // 1, 2, 7, 8 43 | OSDGraphicSpeaker = 3, // 3, 5, 17, 23 44 | OSDGraphicSpeakerMuted = 4, // 4, 16, 21, 22 45 | OSDGraphicEject = 6, 46 | OSDGraphicNoWiFi = 9, 47 | OSDGraphicKeyboardBacklightMeter = 11, // 11, 25 48 | OSDGraphicKeyboardBacklightDisabledMeter = 12, // 12, 26 49 | OSDGraphicKeyboardBacklightNotConnected = 13, // 13, 27 50 | OSDGraphicKeyboardBacklightDisabledNotConnected = 14, // 14, 28 51 | OSDGraphicMacProOpen = 15, 52 | OSDGraphicHotspot = 19, 53 | OSDGraphicSleep = 20, 54 | // There may be more 55 | } OSDGraphic; 56 | 57 | #endif /* MultiSoundChanger_Bridging_Header_h */ 58 | -------------------------------------------------------------------------------- /MultiSoundChanger/Sources/AppDelegate/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // MultiSoundChanger 4 | // 5 | // Created by Dmitry Medyuho on 02.04.17. 6 | // Copyright © 2017 Dmitry Medyuho. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | @NSApplicationMain 12 | class AppDelegate: NSObject, NSApplicationDelegate { 13 | private let applicationController: ApplicationController = ApplicationControllerImp() 14 | 15 | func applicationDidFinishLaunching(_ aNotification: Notification) { 16 | applicationController.start() 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /MultiSoundChanger/Sources/Classes/ApplicationController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ApplicationController.swift 3 | // MultiSoundChanger 4 | // 5 | // Created by Dmitry Medyuho on 20.04.21. 6 | // Copyright © 2021 Dmitry Medyuho. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import MediaKeyTap 11 | import SimplyCoreAudio 12 | import UserNotifications 13 | 14 | // MARK: - Protocols 15 | 16 | protocol ApplicationController: class { 17 | func start() 18 | } 19 | 20 | // MARK: - Implementation 21 | 22 | final class ApplicationControllerImp: ApplicationController { 23 | private lazy var simplyCA: SimplyCoreAudio = SimplyCoreAudio() 24 | private lazy var audioManager: AudioManager = AudioManagerImpl() 25 | private lazy var mediaManager: MediaManager = MediaManagerImpl(delegate: self) 26 | private lazy var statusBarController: StatusBarController = StatusBarControllerImpl(audioManager: audioManager, simplyCoreAudio: simplyCA) 27 | 28 | var observers: [NSObjectProtocol] = [] 29 | 30 | func start() { 31 | statusBarController.createMenu() 32 | mediaManager.listenMediaKeyTaps() 33 | 34 | observers.append(NotificationCenter.default.addObserver(forName: .deviceListChanged, 35 | object: nil, 36 | queue: .main) { [weak self] _ in 37 | self?.statusBarController.createMenu() 38 | }) 39 | 40 | observers.append(NotificationCenter.default.addObserver(forName: .defaultOutputDeviceChanged, 41 | object: nil, 42 | queue: .main) { [weak self] _ in 43 | self?.statusBarController.createMenu() 44 | self?.sendDeviceChangedNotification() 45 | }) 46 | 47 | observers.append(NotificationCenter.default.addObserver(forName: .deviceVolumeDidChange, 48 | object: nil, 49 | queue: .main) { [weak self] _ in 50 | if let volume = self?.audioManager.getSelectedDeviceVolume() { 51 | self?.statusBarController.updateVolume(value: volume * 100) 52 | } 53 | }) 54 | } 55 | 56 | deinit { 57 | for observer in observers { 58 | NotificationCenter.default.removeObserver(observer) 59 | } 60 | } 61 | } 62 | 63 | // MARK: - MediaManagerDelegate 64 | 65 | extension ApplicationControllerImp: MediaManagerDelegate { 66 | func onMediaKeyTap(mediaKey: MediaKey) { 67 | guard let selectedDeviceVolume = audioManager.getSelectedDeviceVolume() else { 68 | return 69 | } 70 | 71 | let volumeStep: Float = 1 / Float(Constants.chicletsCount) 72 | var volume: Float = (selectedDeviceVolume / volumeStep).rounded() * volumeStep 73 | 74 | switch mediaKey { 75 | case .volumeUp: 76 | volume = (volume + volumeStep).clamped(to: 0...1) 77 | audioManager.setSelectedDeviceVolume(masterChannelLevel: volume, leftChannelLevel: volume, rightChannelLevel: volume) 78 | 79 | case .volumeDown: 80 | volume = (volume - volumeStep).clamped(to: 0...1) 81 | audioManager.setSelectedDeviceVolume(masterChannelLevel: volume, leftChannelLevel: volume, rightChannelLevel: volume) 82 | 83 | case .mute: 84 | audioManager.toggleMute() 85 | if audioManager.isSelectedDeviceMuted() { 86 | volume = 0 87 | } else { 88 | volume = audioManager.getSelectedDeviceVolume() ?? 0 89 | } 90 | 91 | default: 92 | break 93 | } 94 | 95 | let correctedVolume = volume * 100 96 | 97 | statusBarController.updateVolume(value: correctedVolume) 98 | mediaManager.showOSD(volume: correctedVolume, chicletsCount: Constants.chicletsCount) 99 | 100 | Logger.debug(Constants.InnerMessages.selectedDeviceVolume(volume: String(correctedVolume))) 101 | } 102 | } 103 | 104 | extension ApplicationControllerImp { 105 | func sendDeviceChangedNotification() { 106 | if #available(macOS 10.14, *) { 107 | let notificationCenter = UNUserNotificationCenter.current() 108 | notificationCenter.requestAuthorization(options: [.alert]) { _, error in 109 | if error != nil { 110 | print("Failed to add a notification request: \(String(describing: error))") 111 | } 112 | 113 | let selectedDevice = self.simplyCA.defaultOutputDevice 114 | 115 | let content = UNMutableNotificationContent() 116 | content.title = "Ouput Device Changed" 117 | content.body = selectedDevice?.name ?? "N/A" 118 | let uuidString = UUID().uuidString 119 | 120 | let date = Calendar.current.dateComponents([.year, .month, .day, .hour, .minute, .second], from: Date()) 121 | let trigger = UNCalendarNotificationTrigger(dateMatching: date, repeats: false) 122 | 123 | let request = UNNotificationRequest(identifier: uuidString, content: content, trigger: trigger) 124 | 125 | UNUserNotificationCenter.current().add(request) { error in 126 | if error != nil { 127 | print("Failed to add a notification request: \(String(describing: error))") 128 | } 129 | } 130 | } 131 | } 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /MultiSoundChanger/Sources/Classes/AudioManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AudioManager.swift 3 | // MultiSoundChanger 4 | // 5 | // Created by Dmitry Medyuho on 15.11.2020. 6 | // Copyright © 2020 Dmitry Medyuho. All rights reserved. 7 | // 8 | 9 | import AudioToolbox 10 | import Foundation 11 | 12 | // MARK: - Protocols 13 | 14 | protocol AudioManager: class { 15 | func selectDevice(deviceID: AudioDeviceID) 16 | func getSelectedDeviceVolume() -> Float? 17 | func setSelectedDeviceVolume(masterChannelLevel: Float, leftChannelLevel: Float, rightChannelLevel: Float) 18 | func isSelectedDeviceMuted() -> Bool 19 | func toggleMute() 20 | 21 | var isMuted: Bool { get } 22 | } 23 | 24 | // MARK: - Implementation 25 | 26 | final class AudioManagerImpl: AudioManager { 27 | private let audio: Audio = AudioImpl() 28 | private var devices: [AudioDeviceID: String]? 29 | private var selectedDevice: AudioDeviceID? 30 | 31 | private lazy var observer = NotificationCenter.default.addObserver(forName: .deviceListChanged, 32 | object: nil, 33 | queue: .main) { [weak self] _ in 34 | self?.refreshDevices() 35 | } 36 | 37 | init() { 38 | refreshDevices() 39 | } 40 | 41 | deinit { 42 | NotificationCenter.default.removeObserver(observer) 43 | } 44 | 45 | func refreshDevices() { 46 | self.devices = audio.getOutputDevices() 47 | self.printDevices() 48 | } 49 | 50 | func getDefaultOutputDevice() -> AudioDeviceID { 51 | return audio.getDefaultOutputDevice() 52 | } 53 | 54 | func getOutputDevices() -> [AudioDeviceID: String]? { 55 | return devices 56 | } 57 | 58 | func isAggregateDevice(deviceID: AudioDeviceID) -> Bool { 59 | return audio.isAggregateDevice(deviceID: deviceID) 60 | } 61 | 62 | func selectDevice(deviceID: AudioDeviceID) { 63 | selectedDevice = deviceID 64 | audio.setOutputDevice(newDeviceID: deviceID) 65 | Logger.debug(Constants.InnerMessages.selectDevice(deviceID: String(deviceID))) 66 | } 67 | 68 | func getSelectedDeviceVolume() -> Float? { 69 | guard let selectedDevice = selectedDevice else { 70 | return nil 71 | } 72 | 73 | if audio.isAggregateDevice(deviceID: selectedDevice) { 74 | let aggregatedDevices = audio.getAggregateDeviceSubDeviceList(deviceID: selectedDevice) 75 | 76 | for device in aggregatedDevices { 77 | if audio.isOutputDevice(deviceID: device) { 78 | return audio.getDeviceVolume(deviceID: device).max() 79 | } 80 | } 81 | } else { 82 | return audio.getDeviceVolume(deviceID: selectedDevice).max() 83 | } 84 | 85 | return nil 86 | } 87 | 88 | func setSelectedDeviceVolume(masterChannelLevel: Float, leftChannelLevel: Float, rightChannelLevel: Float) { 89 | guard let selectedDevice = selectedDevice else { 90 | return 91 | } 92 | 93 | let isMute = masterChannelLevel < Constants.muteVolumeLowerbound 94 | && leftChannelLevel < Constants.muteVolumeLowerbound 95 | && rightChannelLevel < Constants.muteVolumeLowerbound 96 | 97 | if audio.isAggregateDevice(deviceID: selectedDevice) { 98 | let aggregatedDevices = audio.getAggregateDeviceSubDeviceList(deviceID: selectedDevice) 99 | 100 | for device in aggregatedDevices { 101 | audio.setDeviceVolume( 102 | deviceID: device, 103 | masterChannelLevel: masterChannelLevel, 104 | leftChannelLevel: leftChannelLevel, 105 | rightChannelLevel: rightChannelLevel 106 | ) 107 | audio.setDeviceMute(deviceID: device, isMute: isMute) 108 | } 109 | } else { 110 | audio.setDeviceVolume( 111 | deviceID: selectedDevice, 112 | masterChannelLevel: masterChannelLevel, 113 | leftChannelLevel: leftChannelLevel, 114 | rightChannelLevel: rightChannelLevel 115 | ) 116 | audio.setDeviceMute(deviceID: selectedDevice, isMute: isMute) 117 | } 118 | } 119 | 120 | func setSelectedDeviceMute(isMute: Bool) { 121 | guard let selectedDevice = selectedDevice else { 122 | return 123 | } 124 | 125 | if audio.isAggregateDevice(deviceID: selectedDevice) { 126 | let aggregatedDevices = audio.getAggregateDeviceSubDeviceList(deviceID: selectedDevice) 127 | 128 | for device in aggregatedDevices { 129 | audio.setDeviceMute(deviceID: device, isMute: isMute) 130 | } 131 | } else { 132 | audio.setDeviceMute(deviceID: selectedDevice, isMute: isMute) 133 | } 134 | } 135 | 136 | func isSelectedDeviceMuted() -> Bool { 137 | guard let selectedDevice = selectedDevice else { 138 | return false 139 | } 140 | 141 | if audio.isAggregateDevice(deviceID: selectedDevice) { 142 | let aggregatedDevices = audio.getAggregateDeviceSubDeviceList(deviceID: selectedDevice) 143 | 144 | guard let device = aggregatedDevices.first else { 145 | return false 146 | } 147 | 148 | return audio.isDeviceMuted(deviceID: device) 149 | } else { 150 | return audio.isDeviceMuted(deviceID: selectedDevice) 151 | } 152 | } 153 | 154 | func toggleMute() { 155 | if isSelectedDeviceMuted() { 156 | setSelectedDeviceMute(isMute: false) 157 | let volume = getSelectedDeviceVolume() ?? 0 158 | setSelectedDeviceVolume(masterChannelLevel: volume, leftChannelLevel: volume, rightChannelLevel: volume) 159 | } else { 160 | setSelectedDeviceMute(isMute: true) 161 | } 162 | } 163 | 164 | var isMuted: Bool { 165 | return isSelectedDeviceMuted() 166 | } 167 | 168 | private func printDevices() { 169 | guard let devices = devices else { 170 | return 171 | } 172 | Logger.debug(Constants.InnerMessages.outputDevices) 173 | for device in devices { 174 | Logger.debug(Constants.InnerMessages.debugDevice(deviceID: String(device.key), deviceName: device.value)) 175 | } 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /MultiSoundChanger/Sources/Classes/MediaManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MediaManager.swift 3 | // MultiSoundChanger 4 | // 5 | // Created by Dmitry Medyuho on 15.11.2020. 6 | // Copyright © 2020 Dmitry Medyuho. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | import Foundation 11 | import MediaKeyTap 12 | 13 | // MARK: - Protocols 14 | 15 | protocol MediaManagerDelegate: class { 16 | func onMediaKeyTap(mediaKey: MediaKey) 17 | } 18 | 19 | protocol MediaManager: class { 20 | func listenMediaKeyTaps() 21 | func showOSD(volume: Float, chicletsCount: Int) 22 | } 23 | 24 | // MARK: - Implementation 25 | 26 | final class MediaManagerImpl: MediaManager { 27 | private weak var delegate: MediaManagerDelegate? 28 | private var mediaKeyTap: MediaKeyTap? 29 | 30 | init(delegate: MediaManagerDelegate) { 31 | self.delegate = delegate 32 | } 33 | 34 | deinit { 35 | DistributedNotificationCenter.default().removeObserver(self) 36 | } 37 | 38 | // MARK: Public 39 | 40 | func listenMediaKeyTaps() { 41 | observeMediaKeyOnAccessibiltiyApiChange() 42 | startMediaKeyTap() 43 | } 44 | 45 | func showOSD(volume: Float, chicletsCount: Int = 16) { 46 | guard let manager = OSDManager.sharedManager() as? OSDManager else { 47 | return 48 | } 49 | 50 | let mouseloc: NSPoint = NSEvent.mouseLocation 51 | var displayForPoint: CGDirectDisplayID = 0 52 | var count: UInt32 = 0 53 | 54 | if CGGetDisplaysWithPoint(mouseloc, 1, &displayForPoint, &count) != .success { 55 | Logger.warning(Constants.InnerMessages.getDisplayError) 56 | displayForPoint = CGMainDisplayID() 57 | } 58 | 59 | let image = (volume == 0) ? OSDGraphicSpeakerMuted.rawValue : OSDGraphicSpeaker.rawValue 60 | let volumeStep: Float = 100 / Float(chicletsCount) 61 | 62 | manager.showImage( 63 | Int64(image), 64 | onDisplayID: displayForPoint, 65 | priority: 0x1F4, 66 | msecUntilFade: 1_000, 67 | filledChiclets: UInt32(volume / volumeStep), 68 | totalChiclets: UInt32(100.0 / volumeStep), 69 | locked: false 70 | ) 71 | } 72 | 73 | // MARK: Private 74 | 75 | private func acquirePrivileges() { 76 | let trusted = kAXTrustedCheckOptionPrompt.takeUnretainedValue() 77 | let privOptions = [trusted: true] as CFDictionary 78 | let accessEnabled = AXIsProcessTrustedWithOptions(privOptions) 79 | 80 | if accessEnabled { 81 | Logger.warning(Constants.InnerMessages.accessEnabled) 82 | } else { 83 | Logger.warning(Constants.InnerMessages.accessDenied) 84 | } 85 | } 86 | 87 | private func startMediaKeyTap() { 88 | acquirePrivileges() 89 | 90 | let keys: [MediaKey] = [ 91 | .volumeUp, 92 | .volumeDown, 93 | .mute 94 | ] 95 | 96 | mediaKeyTap?.stop() 97 | mediaKeyTap = MediaKeyTap(delegate: self, for: keys, observeBuiltIn: true) 98 | mediaKeyTap?.start() 99 | } 100 | 101 | private func observeMediaKeyOnAccessibiltiyApiChange() { 102 | let notificaion = NSNotification.Name(rawValue: Constants.Notifications.accessibility) 103 | 104 | DistributedNotificationCenter.default().addObserver( 105 | self, 106 | selector: #selector(onAccessibilityNotification), 107 | name: notificaion, 108 | object: nil 109 | ) 110 | } 111 | 112 | @objc 113 | private func onAccessibilityNotification(_ aNotification: Notification) { 114 | DispatchQueue.main.async { [weak self] in 115 | self?.startMediaKeyTap() 116 | } 117 | } 118 | } 119 | 120 | // MARK: - MediaKeyTapDelegate 121 | 122 | extension MediaManagerImpl: MediaKeyTapDelegate { 123 | func handle(mediaKey: MediaKey, event: KeyEvent?, modifiers: NSEvent.ModifierFlags?) { 124 | delegate?.onMediaKeyTap(mediaKey: mediaKey) 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /MultiSoundChanger/Sources/Classes/StatusBarController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // StatusBarController.swift 3 | // MultiSoundChanger 4 | // 5 | // Created by Dmitry Medyuho on 15.11.2020. 6 | // Copyright © 2020 Dmitry Medyuho. All rights reserved. 7 | // 8 | 9 | import SimplyCoreAudio 10 | import AudioToolbox 11 | import Cocoa 12 | 13 | // MARK: - Protocols 14 | 15 | protocol StatusBarController: class { 16 | func createMenu() 17 | func changeStatusItemImage(value: Float) 18 | func updateVolume(value: Float) 19 | } 20 | 21 | // MARK: - Extensions 22 | 23 | extension StatusBarControllerImpl { 24 | enum MenuItem { 25 | case volume 26 | case slider 27 | case output 28 | case separator 29 | case soundPreferences 30 | case audioSetup 31 | case quit 32 | } 33 | } 34 | 35 | // MARK: - Implementation 36 | 37 | final class StatusBarControllerImpl: StatusBarController { 38 | private let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength) 39 | private let volumeController: VolumeViewController 40 | private let audioManager: AudioManager 41 | private let simplyCA: SimplyCoreAudio 42 | 43 | init(audioManager: AudioManager, simplyCoreAudio: SimplyCoreAudio) { 44 | self.audioManager = audioManager 45 | self.simplyCA = simplyCoreAudio 46 | 47 | self.volumeController = Stories.volume.controller(VolumeViewController.self) 48 | self.volumeController.audioManager = audioManager 49 | self.volumeController.statusBarController = self 50 | } 51 | 52 | func createMenu() { 53 | if let button = statusItem.button { 54 | button.image = Images.volumeImage1 55 | } 56 | 57 | let menu = statusItem.menu ?? NSMenu() 58 | menu.removeAllItems() 59 | menu.autoenablesItems = false 60 | 61 | let volumeItem = getMenuItem(by: .volume) 62 | let sliderItem = getMenuItem(by: .slider) 63 | let outputItem = getMenuItem(by: .output) 64 | let firstSeparatorItem = getMenuItem(by: .separator) 65 | let soundPreferencesItem = getMenuItem(by: .soundPreferences) 66 | let audioSetupItem = getMenuItem(by: .audioSetup) 67 | let secondSeparatorItem = getMenuItem(by: .separator) 68 | let quitItem = getMenuItem(by: .quit) 69 | 70 | menu.addItem(volumeItem) 71 | menu.addItem(sliderItem) 72 | menu.addItem(outputItem) 73 | setOutputDeviceList(for: menu) 74 | menu.addItem(firstSeparatorItem) 75 | menu.addItem(soundPreferencesItem) 76 | menu.addItem(audioSetupItem) 77 | menu.addItem(secondSeparatorItem) 78 | menu.addItem(quitItem) 79 | 80 | statusItem.menu = menu 81 | } 82 | 83 | func changeStatusItemImage(value: Float) { 84 | if value < 1 { 85 | statusItem.button?.image = Images.volumeImage1 86 | } else if value > 1 && value <= 100 / 3 { 87 | statusItem.button?.image = Images.volumeImage2 88 | } else if value > 100 / 3 && value <= 100 / 3 * 2 { 89 | statusItem.button?.image = Images.volumeImage3 90 | } else if value > 100 / 3 * 2 && value <= 100 { 91 | statusItem.button?.image = Images.volumeImage4 92 | } 93 | } 94 | 95 | func updateVolume(value: Float) { 96 | volumeController.updateSliderVolume(volume: value) 97 | changeStatusItemImage(value: value) 98 | } 99 | 100 | private func getMenuItem(by type: MenuItem) -> NSMenuItem { 101 | switch type { 102 | case .volume: 103 | let item = NSMenuItem(title: Strings.volume, action: nil, keyEquivalent: Constants.Keys.empty.rawValue) 104 | item.isEnabled = false 105 | return item 106 | 107 | case .slider: 108 | let item = NSMenuItem(title: String(), action: nil, keyEquivalent: Constants.Keys.empty.rawValue) 109 | item.view = volumeController.view 110 | return item 111 | 112 | case .output: 113 | let item = NSMenuItem(title: Strings.output, action: nil, keyEquivalent: Constants.Keys.empty.rawValue) 114 | item.isEnabled = false 115 | return item 116 | 117 | case .separator: 118 | return NSMenuItem.separator() 119 | 120 | case .soundPreferences: 121 | let item = NSMenuItem( 122 | title: Strings.soundPreferences, 123 | action: #selector(menuSoundPreferencesAction), 124 | keyEquivalent: Constants.Keys.empty.rawValue 125 | ) 126 | item.target = self 127 | return item 128 | 129 | case .audioSetup: 130 | let item = NSMenuItem(title: Strings.audioDevices, action: #selector(menuAudioSetupAction), keyEquivalent: Constants.Keys.empty.rawValue) 131 | item.target = self 132 | return item 133 | 134 | case .quit: 135 | let item = NSMenuItem(title: Strings.quit, action: #selector(menuQuitAction), keyEquivalent: Constants.Keys.q.rawValue) 136 | item.target = self 137 | return item 138 | } 139 | } 140 | 141 | private func setOutputDeviceList(for menu: NSMenu) { 142 | let devices = simplyCA.allOutputDevices.filter { !$0.isHidden }.filter { $0.name != "ZoomAudioDevice" && $0.name != "Microsoft Teams Audio" } 143 | 144 | let defaultDevice = simplyCA.defaultOutputDevice 145 | 146 | for device in devices { 147 | let item = NSMenuItem( 148 | title: truncate(device.name, length: Constants.optionMaxLength), 149 | action: #selector(menuItemAction), 150 | keyEquivalent: String() 151 | ) 152 | item.target = self 153 | item.tag = Int(device.id) 154 | 155 | if let defaultDeviceId = defaultDevice?.id, device.id == defaultDeviceId { 156 | item.state = .on 157 | selectDevice(device: device.id) 158 | } 159 | 160 | menu.addItem(item) 161 | } 162 | } 163 | 164 | private func selectDevice(device: AudioDeviceID) { 165 | guard let new_device = simplyCA.allDevices.first(where: { $0.id == device }) else { 166 | return 167 | } 168 | new_device.isDefaultOutputDevice = true 169 | new_device.isDefaultSystemOutputDevice = true 170 | if new_device.isOutputOnlyDevice == false { 171 | new_device.isDefaultInputDevice = true 172 | } 173 | 174 | audioManager.selectDevice(deviceID: device) 175 | 176 | guard let volume = audioManager.getSelectedDeviceVolume() else { 177 | return 178 | } 179 | let correctedVolume = audioManager.isMuted ? 0 : volume * 100 180 | volumeController.updateSliderVolume(volume: correctedVolume) 181 | changeStatusItemImage(value: correctedVolume) 182 | } 183 | 184 | private func truncate(_ string: String, length: Int, trailing: String = "…") -> String { 185 | if string.count > length { 186 | return String(string.prefix(length)) + trailing 187 | } else { 188 | return string 189 | } 190 | } 191 | 192 | @objc 193 | private func menuItemAction(sender: NSMenuItem) { 194 | guard let items = statusItem.menu?.items else { 195 | return 196 | } 197 | for item in items { 198 | if item == sender { 199 | item.state = .on 200 | let deviceID = AudioDeviceID(item.tag) 201 | selectDevice(device: deviceID) 202 | } else { 203 | item.state = NSControl.StateValue.off 204 | } 205 | } 206 | } 207 | 208 | @objc 209 | private func menuSoundPreferencesAction() { 210 | Runner.shell("open -b \(Constants.AppBundleIdentifier.systemPreferences) \(Constants.SystemPreferencesPane.sound)") 211 | } 212 | 213 | @objc 214 | private func menuAudioSetupAction() { 215 | Runner.launchApplication(bundleIndentifier: Constants.AppBundleIdentifier.audioDevices, options: .default) 216 | } 217 | 218 | @objc 219 | private func menuQuitAction() { 220 | NSApplication.shared.terminate(self) 221 | } 222 | } 223 | -------------------------------------------------------------------------------- /MultiSoundChanger/Sources/Extensions/Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // StringExtensions.swift 3 | // MultiSoundChanger 4 | // 5 | // Created by Dmitry Medyuho on 03.04.17. 6 | // Copyright © 2017 Dmitry Medyuho. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Comparable { 12 | func clamped(to limits: ClosedRange) -> Self { 13 | return min(max(self, limits.lowerBound), limits.upperBound) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /MultiSoundChanger/Sources/Frameworks/Audio.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Audio.swift 3 | // MultiSoundChanger 4 | // 5 | // Created by Dmitry Medyuho on 03.04.17. 6 | // Copyright © 2017 Dmitry Medyuho. All rights reserved. 7 | // 8 | 9 | import AudioToolbox 10 | import Cocoa 11 | import Foundation 12 | 13 | // MARK: - Protocols 14 | 15 | protocol Audio { 16 | func getOutputDevices() -> [AudioDeviceID: String]? 17 | func isOutputDevice(deviceID: AudioDeviceID) -> Bool 18 | func getAggregateDeviceSubDeviceList(deviceID: AudioDeviceID) -> [AudioDeviceID] 19 | func isAggregateDevice(deviceID: AudioDeviceID) -> Bool 20 | func setDeviceVolume(deviceID: AudioDeviceID, masterChannelLevel: Float, leftChannelLevel: Float, rightChannelLevel: Float) 21 | func setDeviceMute(deviceID: AudioDeviceID, isMute: Bool) 22 | func setOutputDevice(newDeviceID: AudioDeviceID) 23 | func isDeviceMuted(deviceID: AudioDeviceID) -> Bool 24 | func getDeviceVolume(deviceID: AudioDeviceID) -> [Float] 25 | func getDefaultOutputDevice() -> AudioDeviceID 26 | func getDeviceTransportType(deviceID: AudioDeviceID) -> AudioDevicePropertyID 27 | } 28 | 29 | // MARK: - Implementation 30 | 31 | final class AudioImpl: Audio { 32 | func getOutputDevices() -> [AudioDeviceID: String]? { 33 | var result: [AudioDeviceID: String] = [:] 34 | let devices = getAllDevices() 35 | 36 | for device in devices where isOutputDevice(deviceID: device) { 37 | result[device] = getDeviceName(deviceID: device) 38 | } 39 | 40 | return result 41 | } 42 | 43 | func isOutputDevice(deviceID: AudioDeviceID) -> Bool { 44 | var propertySize: UInt32 = 256 45 | 46 | var propertyAddress = AudioObjectPropertyAddress( 47 | mSelector: AudioObjectPropertySelector(kAudioDevicePropertyStreams), 48 | mScope: AudioObjectPropertyScope(kAudioDevicePropertyScopeOutput), 49 | mElement: AudioObjectPropertyElement(kAudioObjectPropertyElementMaster)) 50 | 51 | AudioObjectGetPropertyDataSize(deviceID, &propertyAddress, 0, nil, &propertySize) 52 | 53 | return propertySize > 0 54 | } 55 | 56 | func getAggregateDeviceSubDeviceList(deviceID: AudioDeviceID) -> [AudioDeviceID] { 57 | let subDevicesCount = getNumberOfSubDevices(deviceID: deviceID) 58 | var subDevices = [AudioDeviceID](repeating: 0, count: Int(subDevicesCount)) 59 | 60 | var propertyAddress = AudioObjectPropertyAddress( 61 | mSelector: AudioObjectPropertySelector(kAudioAggregateDevicePropertyActiveSubDeviceList), 62 | mScope: AudioObjectPropertyScope(kAudioObjectPropertyScopeGlobal), 63 | mElement: AudioObjectPropertyElement(kAudioObjectPropertyElementMaster)) 64 | 65 | var subDevicesSize = subDevicesCount * UInt32(MemoryLayout.size) 66 | 67 | AudioObjectGetPropertyData(deviceID, &propertyAddress, 0, nil, &subDevicesSize, &subDevices) 68 | 69 | return subDevices 70 | } 71 | 72 | func isAggregateDevice(deviceID: AudioDeviceID) -> Bool { 73 | let deviceType = getDeviceTransportType(deviceID: deviceID) 74 | return deviceType == kAudioDeviceTransportTypeAggregate 75 | } 76 | 77 | func isDeviceMuted(deviceID: AudioDeviceID) -> Bool { 78 | var mutedValue: UInt32 = 0 79 | var propertySize = UInt32(MemoryLayout.size) 80 | 81 | var propertyAddress = AudioObjectPropertyAddress( 82 | mSelector: AudioObjectPropertySelector(kAudioDevicePropertyMute), 83 | mScope: AudioObjectPropertyScope(kAudioDevicePropertyScopeOutput), 84 | mElement: AudioObjectPropertyElement(kAudioObjectPropertyElementMaster)) 85 | 86 | let status = AudioObjectGetPropertyData(deviceID, &propertyAddress, 0, nil, &propertySize, &mutedValue) 87 | 88 | if status != noErr { 89 | return false 90 | } 91 | 92 | return mutedValue == 1 93 | } 94 | 95 | func setDeviceVolume(deviceID: AudioDeviceID, masterChannelLevel: Float, leftChannelLevel: Float, rightChannelLevel: Float) { 96 | var leftLevel = leftChannelLevel 97 | var rigthLevel = rightChannelLevel 98 | var masterLevel = masterChannelLevel 99 | 100 | var masterLevelPropertyAddress = AudioObjectPropertyAddress( 101 | mSelector: AudioObjectPropertySelector(kAudioDevicePropertyVolumeScalar), 102 | mScope: AudioObjectPropertyScope(kAudioDevicePropertyScopeOutput), 103 | mElement: AudioObjectPropertyElement(0) 104 | ) 105 | 106 | var leftLevelPropertyAddress = AudioObjectPropertyAddress( 107 | mSelector: AudioObjectPropertySelector(kAudioDevicePropertyVolumeScalar), 108 | mScope: AudioObjectPropertyScope(kAudioDevicePropertyScopeOutput), 109 | mElement: AudioObjectPropertyElement(1) 110 | ) 111 | 112 | var rightLevelPropertyAddress = AudioObjectPropertyAddress( 113 | mSelector: AudioObjectPropertySelector(kAudioDevicePropertyVolumeScalar), 114 | mScope: AudioObjectPropertyScope(kAudioDevicePropertyScopeOutput), 115 | mElement: AudioObjectPropertyElement(2) 116 | ) 117 | 118 | var size = UInt32(0) 119 | 120 | AudioObjectGetPropertyDataSize(deviceID, &masterLevelPropertyAddress, 0, nil, &size) 121 | AudioObjectSetPropertyData(deviceID, &masterLevelPropertyAddress, 0, nil, size, &masterLevel) 122 | 123 | AudioObjectGetPropertyDataSize(deviceID, &leftLevelPropertyAddress, 0, nil, &size) 124 | AudioObjectSetPropertyData(deviceID, &leftLevelPropertyAddress, 0, nil, size, &leftLevel) 125 | 126 | AudioObjectGetPropertyDataSize(deviceID, &rightLevelPropertyAddress, 0, nil, &size) 127 | AudioObjectSetPropertyData(deviceID, &rightLevelPropertyAddress, 0, nil, size, &rigthLevel) 128 | } 129 | 130 | func setDeviceMute(deviceID: AudioDeviceID, isMute: Bool) { 131 | var mutedValue: UInt32 = isMute ? 1 : 0 132 | let propertySize = UInt32(MemoryLayout.size) 133 | 134 | var propertyAddress = AudioObjectPropertyAddress( 135 | mSelector: AudioObjectPropertySelector(kAudioDevicePropertyMute), 136 | mScope: AudioObjectPropertyScope(kAudioDevicePropertyScopeOutput), 137 | mElement: AudioObjectPropertyElement(kAudioObjectPropertyElementMaster)) 138 | 139 | AudioObjectSetPropertyData(deviceID, &propertyAddress, 0, nil, propertySize, &mutedValue) 140 | } 141 | 142 | func setOutputDevice(newDeviceID: AudioDeviceID) { 143 | let propertySize = UInt32(MemoryLayout.size) 144 | var deviceID = newDeviceID 145 | 146 | var propertyAddress = AudioObjectPropertyAddress( 147 | mSelector: AudioObjectPropertySelector(kAudioHardwarePropertyDefaultOutputDevice), 148 | mScope: AudioObjectPropertyScope(kAudioObjectPropertyScopeGlobal), 149 | mElement: AudioObjectPropertyElement(kAudioObjectPropertyElementMaster)) 150 | 151 | AudioObjectSetPropertyData(AudioObjectID(kAudioObjectSystemObject), &propertyAddress, 0, nil, propertySize, &deviceID) 152 | } 153 | 154 | func getDeviceVolume(deviceID: AudioDeviceID) -> [Float] { 155 | var leftLevel = Float32(0) 156 | var rigthLevel = Float32(0) 157 | var masterLevel = Float32(0) 158 | 159 | var masterLevelPropertyAddress = AudioObjectPropertyAddress( 160 | mSelector: AudioObjectPropertySelector(kAudioDevicePropertyVolumeScalar), 161 | mScope: AudioObjectPropertyScope(kAudioDevicePropertyScopeOutput), 162 | mElement: AudioObjectPropertyElement(0) 163 | ) 164 | 165 | var leftLevelPropertyAddress = AudioObjectPropertyAddress( 166 | mSelector: AudioObjectPropertySelector(kAudioDevicePropertyVolumeScalar), 167 | mScope: AudioObjectPropertyScope(kAudioDevicePropertyScopeOutput), 168 | mElement: AudioObjectPropertyElement(1) 169 | ) 170 | 171 | var rightLevelPropertyAddress = AudioObjectPropertyAddress( 172 | mSelector: AudioObjectPropertySelector(kAudioDevicePropertyVolumeScalar), 173 | mScope: AudioObjectPropertyScope(kAudioDevicePropertyScopeOutput), 174 | mElement: AudioObjectPropertyElement(2) 175 | ) 176 | 177 | var size = UInt32(0) 178 | 179 | AudioObjectGetPropertyDataSize(deviceID, &masterLevelPropertyAddress, 0, nil, &size) 180 | AudioObjectGetPropertyData(deviceID, &masterLevelPropertyAddress, 0, nil, &size, &masterLevel) 181 | 182 | AudioObjectGetPropertyDataSize(deviceID, &leftLevelPropertyAddress, 0, nil, &size) 183 | AudioObjectGetPropertyData(deviceID, &leftLevelPropertyAddress, 0, nil, &size, &leftLevel) 184 | 185 | AudioObjectGetPropertyDataSize(deviceID, &rightLevelPropertyAddress, 0, nil, &size) 186 | AudioObjectGetPropertyData(deviceID, &rightLevelPropertyAddress, 0, nil, &size, &rigthLevel) 187 | 188 | return [masterLevel, leftLevel, rigthLevel] 189 | } 190 | 191 | func getDefaultOutputDevice() -> AudioDeviceID { 192 | var propertySize = UInt32(MemoryLayout.size) 193 | var deviceID = kAudioDeviceUnknown 194 | 195 | var propertyAddress = AudioObjectPropertyAddress( 196 | mSelector: AudioObjectPropertySelector(kAudioHardwarePropertyDefaultOutputDevice), 197 | mScope: AudioObjectPropertyScope(kAudioObjectPropertyScopeGlobal), 198 | mElement: AudioObjectPropertyElement(kAudioObjectPropertyElementMaster)) 199 | 200 | AudioObjectGetPropertyData(AudioObjectID(kAudioObjectSystemObject), &propertyAddress, 0, nil, &propertySize, &deviceID) 201 | 202 | return deviceID 203 | } 204 | 205 | func getDeviceTransportType(deviceID: AudioDeviceID) -> AudioDevicePropertyID { 206 | var deviceTransportType = AudioDevicePropertyID() 207 | var propertySize = UInt32(MemoryLayout.size) 208 | 209 | var propertyAddress = AudioObjectPropertyAddress( 210 | mSelector: AudioObjectPropertySelector(kAudioDevicePropertyTransportType), 211 | mScope: AudioObjectPropertyScope(kAudioObjectPropertyScopeGlobal), 212 | mElement: AudioObjectPropertyElement(kAudioObjectPropertyElementMaster)) 213 | 214 | AudioObjectGetPropertyData(deviceID, &propertyAddress, 0, nil, &propertySize, &deviceTransportType) 215 | 216 | return deviceTransportType 217 | } 218 | 219 | private func getNumberOfDevices() -> UInt32 { 220 | var propertySize: UInt32 = 0 221 | 222 | var propertyAddress = AudioObjectPropertyAddress( 223 | mSelector: AudioObjectPropertySelector(kAudioHardwarePropertyDevices), 224 | mScope: AudioObjectPropertyScope(kAudioObjectPropertyScopeGlobal), 225 | mElement: AudioObjectPropertyElement(kAudioObjectPropertyElementMaster)) 226 | 227 | AudioObjectGetPropertyDataSize(AudioObjectID(kAudioObjectSystemObject), &propertyAddress, 0, nil, &propertySize) 228 | 229 | return propertySize / UInt32(MemoryLayout.size) 230 | } 231 | 232 | private func getNumberOfSubDevices(deviceID: AudioDeviceID) -> UInt32 { 233 | var propertySize: UInt32 = 0 234 | 235 | var propertyAddress = AudioObjectPropertyAddress( 236 | mSelector: AudioObjectPropertySelector(kAudioAggregateDevicePropertyActiveSubDeviceList), 237 | mScope: AudioObjectPropertyScope(kAudioObjectPropertyScopeGlobal), 238 | mElement: AudioObjectPropertyElement(kAudioObjectPropertyElementMaster)) 239 | 240 | AudioObjectGetPropertyDataSize(deviceID, &propertyAddress, 0, nil, &propertySize) 241 | 242 | return propertySize / UInt32(MemoryLayout.size) 243 | } 244 | 245 | private func getDeviceName(deviceID: AudioDeviceID) -> String { 246 | var propertySize = UInt32(MemoryLayout.size) 247 | 248 | var propertyAddress = AudioObjectPropertyAddress( 249 | mSelector: AudioObjectPropertySelector(kAudioDevicePropertyDeviceNameCFString), 250 | mScope: AudioObjectPropertyScope(kAudioObjectPropertyScopeGlobal), 251 | mElement: AudioObjectPropertyElement(kAudioObjectPropertyElementMaster)) 252 | 253 | var result: CFString = "" as CFString 254 | 255 | AudioObjectGetPropertyData(deviceID, &propertyAddress, 0, nil, &propertySize, &result) 256 | 257 | return result as String 258 | } 259 | 260 | private func getDeviceType(deviceID: AudioDeviceID) -> String { 261 | var propertyAddress = AudioObjectPropertyAddress( 262 | mSelector: AudioObjectPropertySelector(kAudioDevicePropertyDataSourceNameForIDCFString), 263 | mScope: AudioObjectPropertyScope(kAudioObjectPropertyScopeOutput), 264 | mElement: AudioObjectPropertyElement(kAudioObjectPropertyElementMaster)) 265 | 266 | var sourceID: UInt32 = 0 267 | var result: CFString = "" as CFString 268 | 269 | var translation = AudioValueTranslation( 270 | mInputData: withUnsafeMutablePointer(to: &sourceID) { pointer in pointer }, 271 | mInputDataSize: UInt32(MemoryLayout.size), 272 | mOutputData: withUnsafeMutablePointer(to: &result) { pointer in pointer }, 273 | mOutputDataSize: UInt32(MemoryLayout.size) 274 | ) 275 | 276 | var propertySize = UInt32(MemoryLayout.size) 277 | 278 | AudioObjectGetPropertyData(deviceID, &propertyAddress, 0, nil, &propertySize, &translation) 279 | 280 | return result as String 281 | } 282 | 283 | private func getAllDevices() -> [AudioDeviceID] { 284 | let devicesCount = getNumberOfDevices() 285 | var devices = [AudioDeviceID](repeating: 0, count: Int(devicesCount)) 286 | 287 | var propertyAddress = AudioObjectPropertyAddress( 288 | mSelector: AudioObjectPropertySelector(kAudioHardwarePropertyDevices), 289 | mScope: AudioObjectPropertyScope(kAudioObjectPropertyScopeGlobal), 290 | mElement: AudioObjectPropertyElement(kAudioObjectPropertyElementMaster)) 291 | 292 | var devicesSize = devicesCount * UInt32(MemoryLayout.size) 293 | 294 | AudioObjectGetPropertyData(AudioObjectID(kAudioObjectSystemObject), &propertyAddress, 0, nil, &devicesSize, &devices) 295 | 296 | return devices 297 | } 298 | } 299 | -------------------------------------------------------------------------------- /MultiSoundChanger/Sources/Stories/Main/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /MultiSoundChanger/Sources/Stories/Stories.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Stories.swift 3 | // MultiSoundChanger 4 | // 5 | // Created by Dmitry Medyuho on 15.11.2020. 6 | // Copyright © 2020 Dmitry Medyuho. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | enum Stories: String { 12 | case main = "Main" 13 | case volume = "Volume" 14 | } 15 | 16 | extension Stories { 17 | func controller(_ classType: T.Type) -> T { 18 | let storyboard = NSStoryboard(name: rawValue, bundle: nil) 19 | let identifier = String(describing: classType) 20 | 21 | guard let controller = storyboard.instantiateController(withIdentifier: identifier) as? T else { 22 | Logger.error(Constants.InnerMessages.controllerIdentifierError) 23 | fatalError(Constants.InnerMessages.controllerIdentifierError) 24 | } 25 | 26 | return controller 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /MultiSoundChanger/Sources/Stories/Volume/ScrollableSlider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ScrollableSlider.swift 3 | // 4 | // Created by Nate Thompson on 10/24/17. 5 | // 6 | // https://github.com/thompsonate/Scrollable-NSSlider 7 | // 8 | 9 | import Cocoa 10 | 11 | class ScrollableSlider: NSSlider { 12 | override func scrollWheel(with event: NSEvent) { 13 | guard self.isEnabled else { 14 | return 15 | } 16 | 17 | let range = Float(self.maxValue - self.minValue) 18 | var delta = Float(0) 19 | 20 | // Allow horizontal scrolling on horizontal and circular sliders 21 | if _isVertical && self.sliderType == .linear { 22 | delta = Float(event.deltaY) 23 | } else if self.userInterfaceLayoutDirection == .rightToLeft { 24 | delta = Float(event.deltaY + event.deltaX) 25 | } else { 26 | delta = Float(event.deltaY - event.deltaX) 27 | } 28 | 29 | // Account for natural scrolling 30 | if event.isDirectionInvertedFromDevice { 31 | delta *= -1 32 | } 33 | 34 | let increment = range * delta / 100 35 | var value = self.floatValue + increment 36 | 37 | // Wrap around if slider is circular 38 | if self.sliderType == .circular { 39 | let minValue = Float(self.minValue) 40 | let maxValue = Float(self.maxValue) 41 | 42 | if value < minValue { 43 | value = maxValue - abs(increment) 44 | } else if value > maxValue { 45 | value = minValue + abs(increment) 46 | } 47 | } 48 | 49 | self.floatValue = value 50 | self.sendAction(self.action, to: self.target) 51 | } 52 | 53 | private var _isVertical: Bool { 54 | if #available(macOS 10.12, *) { 55 | return self.isVertical 56 | } else { 57 | // isVertical is an NSInteger in versions before 10.12 58 | return ((self.value(forKey: "isVertical") as? NSInteger) ?? 0) == 1 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /MultiSoundChanger/Sources/Stories/Volume/Volume.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /MultiSoundChanger/Sources/Stories/Volume/VolumeViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // MultiSoundChanger 4 | // 5 | // Created by Dmitry Medyuho on 02.04.17. 6 | // Copyright © 2017 Dmitry Medyuho. All rights reserved. 7 | // 8 | 9 | import AudioToolbox 10 | import Cocoa 11 | import MediaKeyTap 12 | 13 | final class VolumeViewController: NSViewController { 14 | @IBOutlet weak var volumeSlider: NSSlider! 15 | private var muted: Bool = false 16 | 17 | weak var statusBarController: StatusBarController? 18 | var audioManager: AudioManager? 19 | 20 | private func changeDeviceVolume(value: Float) { 21 | audioManager?.setSelectedDeviceVolume(masterChannelLevel: value, leftChannelLevel: value, rightChannelLevel: value) 22 | } 23 | 24 | func updateSliderVolume(volume: Float) { 25 | volumeSlider.floatValue = volume.clamped(to: 0...100) 26 | } 27 | 28 | @IBAction func volumeSliderAction(_ sender: Any) { 29 | changeDeviceVolume(value: volumeSlider.floatValue / 100) 30 | statusBarController?.changeStatusItemImage(value: volumeSlider.floatValue) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /MultiSoundChanger/Sources/Utils/Logger.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Logger.swift 3 | // MultiSoundChanger 4 | // 5 | // Created by Dmitry Medyuho on 20.04.21. 6 | // Copyright © 2021 Dmitry Medyuho. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | enum Logger { 12 | private enum DebugSymbol: String { 13 | case info = "🔵" 14 | case debug = "🟢" 15 | case warning = "🟠" 16 | case error = "🔴" 17 | } 18 | 19 | private enum Symbol: String { 20 | case newLine = "\n" 21 | } 22 | 23 | private enum LoggerError: Error { 24 | case fileError(String) 25 | case dataError 26 | } 27 | 28 | private static var isLogFileRemoved = false 29 | 30 | private static var bundleIdentifier: String { 31 | guard let bundleIdentifier = Bundle.main.bundleIdentifier else { 32 | outPrint(symbol: .error, string: Constants.InnerMessages.bundleIdentifierError) 33 | fatalError(Constants.InnerMessages.bundleIdentifierError) 34 | } 35 | return bundleIdentifier 36 | } 37 | 38 | static func info(_ string: String) { 39 | outAndFilePrint(symbol: .info, string: string) 40 | } 41 | 42 | static func debug(_ string: String) { 43 | outAndFilePrint(symbol: .debug, string: string) 44 | } 45 | 46 | static func warning(_ string: String) { 47 | outAndFilePrint(symbol: .warning, string: string) 48 | } 49 | 50 | static func error(_ string: String) { 51 | outAndFilePrint(symbol: .error, string: string) 52 | } 53 | 54 | private static func getDebugLine(symbol: DebugSymbol, string: String) -> String { 55 | let symbol = DebugSymbol.info.rawValue 56 | let logDate = getLogDate() 57 | return "\(symbol) [\(logDate)] \(string)" 58 | } 59 | 60 | private static func outAndFilePrint(symbol: DebugSymbol, string: String) { 61 | outPrint(symbol: .error, string: string) 62 | do { 63 | try filePrint(symbol: .info, string: string) 64 | } catch let error { 65 | outPrint(symbol: .error, string: error.localizedDescription) 66 | } 67 | } 68 | 69 | private static func outPrint(symbol: DebugSymbol, string: String) { 70 | let line = getDebugLine(symbol: symbol, string: string) 71 | print(line) 72 | } 73 | 74 | private static func filePrint(symbol: DebugSymbol, string: String, filename: String = Constants.logFilename) throws { 75 | do { 76 | var directoryUrl = try FileManager.default.url( 77 | for: .cachesDirectory, 78 | in: .userDomainMask, 79 | appropriateFor: nil, 80 | create: true 81 | ) 82 | directoryUrl.appendPathComponent(bundleIdentifier) 83 | try createDirectoryIfNeeded(url: directoryUrl) 84 | let fileUrl = directoryUrl.appendingPathComponent(Constants.logFilename, isDirectory: false) 85 | let line = wrapNewLine(getDebugLine(symbol: symbol, string: string)) 86 | try removeLogFileIfNeeded(url: fileUrl) 87 | try appendToFile(url: fileUrl, content: line) 88 | } catch let error { 89 | throw LoggerError.fileError(error.localizedDescription) 90 | } 91 | } 92 | 93 | private static func appendToFile(url: URL, content: String) throws { 94 | if FileManager.default.fileExists(atPath: url.path) { 95 | let fileHandle = try FileHandle(forWritingTo: url) 96 | guard let data = content.data(using: .utf8) else { 97 | throw LoggerError.dataError 98 | } 99 | fileHandle.seekToEndOfFile() 100 | fileHandle.write(data) 101 | fileHandle.closeFile() 102 | } else { 103 | try content.write(to: url, atomically: true, encoding: .utf8) 104 | } 105 | } 106 | 107 | private static func createDirectoryIfNeeded(url: URL) throws { 108 | guard !FileManager.default.fileExists(atPath: url.path) else { 109 | return 110 | } 111 | try FileManager.default.createDirectory(at: url, withIntermediateDirectories: false, attributes: nil) 112 | } 113 | 114 | private static func removeLogFileIfNeeded(url: URL) throws { 115 | guard !isLogFileRemoved else { 116 | return 117 | } 118 | isLogFileRemoved = true 119 | guard FileManager.default.fileExists(atPath: url.path) else { 120 | return 121 | } 122 | try FileManager.default.removeItem(at: url) 123 | } 124 | 125 | private static func wrapNewLine(_ string: String) -> String { 126 | return string + Symbol.newLine.rawValue 127 | } 128 | 129 | private static func getLogDate() -> String { 130 | let date = Date() 131 | let formatter = DateFormatter() 132 | formatter.dateStyle = .short 133 | formatter.timeStyle = .medium 134 | return formatter.string(from: date) 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /MultiSoundChanger/Sources/Utils/Runner.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Runner.swift 3 | // MultiSoundChanger 4 | // 5 | // Created by Dmitry Medyuho on 22.04.21. 6 | // Copyright © 2021 Dmitry Medyuho. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | enum Runner { 12 | @discardableResult 13 | static func shell(_ command: String) -> String? { 14 | let task = Process() 15 | let pipe = Pipe() 16 | 17 | task.standardOutput = pipe 18 | task.standardError = pipe 19 | task.arguments = ["-c", command] 20 | task.launchPath = "/bin/sh" 21 | task.launch() 22 | 23 | let data = pipe.fileHandleForReading.readDataToEndOfFile() 24 | 25 | guard let output = String(data: data, encoding: .utf8) else { 26 | return nil 27 | } 28 | 29 | return output 30 | } 31 | 32 | static func launchApplication(bundleIndentifier: String, options: NSWorkspace.LaunchOptions) { 33 | NSWorkspace.shared.launchApplication( 34 | withBundleIdentifier: bundleIndentifier, 35 | options: options, 36 | additionalEventParamDescriptor: nil, 37 | launchIdentifier: nil 38 | ) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.13' 2 | target 'MultiSoundChanger' do 3 | # Comment the next line if you don't want to use dynamic frameworks 4 | use_frameworks! 5 | 6 | pod 'SwiftLint' 7 | pod 'MediaKeyTap', :git => 'https://github.com/the0neyouseek/MediaKeyTap.git', :branch => 'master' 8 | end 9 | 10 | 11 | post_install do |installer| 12 | installer.pods_project.targets.each do |target| 13 | target.build_configurations.each do |config| 14 | config.build_settings["MACOSX_DEPLOYMENT_TARGET"] = "10.13" 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 | ## MultiSound Changer for MacOS 6 | Latest release https://github.com/rlxone/MultiSoundChanger/releases 7 | 8 | A small tool for changing sound volume **even for aggregate devices** cause native sound volume controller can't change volume of aggregate devices (it was always pain in the ass with my laptop). 9 | 10 | 11 | 12 | Features: 13 | * **Changing sound volume of every device** (even virtual aggregate device volume by changing volume of every device in aggregate device) 14 | * Changing default output device 15 | * Native appearance (looks like native volume controller) 16 | * Media keys support 17 | 18 | I think it can be very useful if you're using VoodooHDA with 4.0+ sound on the board (my use case), but you can find another use cases. 19 | 20 | ## Usage 21 | 22 | For example if you want to play 2 or more output devices at the same time you should: 23 | * Create aggregate device in Audio MIDI Setup 24 | * Add all output devices you want to this new aggregate device 25 | * Hide default sound controller icon if enabled (by dragging away or in audio preferences) 26 | * Use our app to control sound volume 27 | * Add our app to startup (if you need) 28 | 29 | 30 | ## Inspiration 31 | * [retrography/audioswitch](https://github.com/retrography/audioswitch) 32 | 33 | ## Licence 34 | * This project is released under the Apache 2.0 licence. See LICENCE 35 | --------------------------------------------------------------------------------