├── .gitignore ├── README.md ├── VHDAPrefPane └── VoodooHDA │ ├── English.lproj │ ├── InfoPlist.strings │ └── VoodooHDAPref.xib │ ├── Info.plist │ ├── VoodooHDA.xcodeproj │ ├── fassl.mode1v3 │ ├── fassl.pbxuser │ ├── project.pbxproj │ ├── slice.mode1v3 │ └── slice.pbxuser │ ├── VoodooHDAPref.h │ ├── VoodooHDAPref.m │ ├── VoodooHDAPref.tiff │ └── VoodooHDA_Prefix.pch ├── VoodooHDA ├── AppleAudioClip.cpp ├── AppleAudioClip.h ├── AppleAudioCommon.h ├── AudioClip.cpp ├── Common.h ├── English.lproj │ └── InfoPlist.strings ├── Info.plist ├── License.h ├── Models.h ├── OssCompat.h ├── PCMBlitterLib.cpp ├── PCMBlitterLib.h ├── PCMBlitterLibDispatch.h ├── PCMBlitterLibX86.cpp ├── Parser.cpp ├── Private.h ├── Readme.txt ├── Registers.h ├── Shared.h ├── Tables.c ├── Tables.h ├── TigerAdditionals.cpp ├── TigerAdditionals.h ├── Verbs.h ├── VoodooHDA.xcodeproj │ ├── TemplateIcon.tiff │ ├── dima.mode1v3 │ ├── dima.pbxuser │ ├── project.pbxproj │ ├── sergey.mode1v3 │ ├── sergey.pbxuser │ ├── slice.mode1v3 │ ├── slice.pbxuser │ ├── user.mode1v3 │ └── user.pbxuser ├── VoodooHDADevice.cpp ├── VoodooHDADevice.h ├── VoodooHDAEngine.cpp ├── VoodooHDAEngine.h ├── VoodooHDAUserClient.cpp ├── VoodooHDAUserClient.h ├── emmintrin.h ├── float.h ├── getdump.c ├── helper.sh ├── iSubTypes.h ├── mm3dnow.h ├── mm_malloc.h ├── mmintrin.h ├── version.plist └── xmmintrin.h └── VoodooHdaSettingsLoader ├── bin └── VoodooHdaSettingsLoader.app │ └── Contents │ ├── Info.plist │ ├── MacOS │ └── VoodooHdaSettingsLoader │ ├── PkgInfo │ └── Resources │ └── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.nib └── src ├── VoodooHdaSettingsLoader.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── Ben.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── WorkspaceSettings.xcsettings ├── slice.mode1v3 ├── slice.pbxuser └── xcuserdata │ └── Ben.xcuserdatad │ └── xcschemes │ ├── VoodooHdaSettingsLoader.xcscheme │ └── xcschememanagement.plist └── VoodooHdaSettingsLoader ├── AppDelegate.h ├── AppDelegate.m ├── VoodooHdaSettingsLoader-Info.plist ├── VoodooHdaSettingsLoader-Prefix.pch ├── VoodooHdaSettingsLoader.h ├── VoodooHdaSettingsLoader.m ├── en.lproj ├── Credits.rtf ├── InfoPlist.strings └── MainMenu.xib └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | build/* 3 | *.pbxuser 4 | !default.pbxuser 5 | *.mode1v3 6 | !default.mode1v3 7 | *.mode2v3 8 | !default.mode2v3 9 | *.perspectivev3 10 | !default.perspectivev3 11 | *.xcworkspace 12 | !default.xcworkspace 13 | xcuserdata 14 | profile 15 | *.moved-aside 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | VoodooHDA 2 | ========= 3 | 4 | VoodooHDA Official Web Site: http://voodoohda.sourceforge.net/ 5 | 6 | Support: http://www.projectosx.com/forum/index.php?showtopic=355 7 | 8 | VoodooHDA is an open source audio driver for devices compliant with the Intel High Definition Audio specification. It is intended as an Intel-only replacement for AppleHDA on Mac OS X with support for a wide range of audio controllers and codecs. -------------------------------------------------------------------------------- /VHDAPrefPane/VoodooHDA/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AppleLife/VoodooHDA/e9708dea706eedb7f07365375e01ec1d67cb6f7d/VHDAPrefPane/VoodooHDA/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /VHDAPrefPane/VoodooHDA/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | VoodooHDAPref 11 | CFBundleIdentifier 12 | org.voodoo.${PRODUCT_NAME:identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleShortVersionString 20 | $(MODULE_VERSION) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(MODULE_VERSION) 25 | NSMainNibFile 26 | VoodooHDAPref 27 | NSPrefPaneIconFile 28 | VoodooHDAPref.tiff 29 | NSPrefPaneIconLabel 30 | VoodooHDA 31 | NSPrincipalClass 32 | VoodooHDAPref 33 | 34 | 35 | -------------------------------------------------------------------------------- /VHDAPrefPane/VoodooHDA/VoodooHDA.xcodeproj/fassl.pbxuser: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | 089C1669FE841209C02AAC07 /* Project object */ = { 4 | activeBuildConfigurationName = Debug; 5 | activeTarget = 8D202CE80486D31800D8A456 /* VoodooHDA */; 6 | addToTargets = ( 7 | 8D202CE80486D31800D8A456 /* VoodooHDA */, 8 | ); 9 | codeSenseManager = F413B3180F9666E600FE446E /* Code sense */; 10 | perUserDictionary = { 11 | PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { 12 | PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; 13 | PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; 14 | PBXFileTableDataSourceColumnWidthsKey = ( 15 | 20, 16 | 341, 17 | 20, 18 | 48, 19 | 43, 20 | 43, 21 | 20, 22 | ); 23 | PBXFileTableDataSourceColumnsKey = ( 24 | PBXFileDataSource_FiletypeID, 25 | PBXFileDataSource_Filename_ColumnID, 26 | PBXFileDataSource_Built_ColumnID, 27 | PBXFileDataSource_ObjectSize_ColumnID, 28 | PBXFileDataSource_Errors_ColumnID, 29 | PBXFileDataSource_Warnings_ColumnID, 30 | PBXFileDataSource_Target_ColumnID, 31 | ); 32 | }; 33 | PBXPerProjectTemplateStateSaveDate = 262011819; 34 | PBXWorkspaceStateSaveDate = 262011819; 35 | }; 36 | perUserProjectItems = { 37 | F413B34B0F968FEF00FE446E /* PBXTextBookmark */ = F413B34B0F968FEF00FE446E /* PBXTextBookmark */; 38 | F413B34C0F968FEF00FE446E /* PBXTextBookmark */ = F413B34C0F968FEF00FE446E /* PBXTextBookmark */; 39 | F4585BEF0F9DFC7900C3FCA3 /* PBXTextBookmark */ = F4585BEF0F9DFC7900C3FCA3 /* PBXTextBookmark */; 40 | F4585BF00F9DFC7900C3FCA3 /* PBXTextBookmark */ = F4585BF00F9DFC7900C3FCA3 /* PBXTextBookmark */; 41 | F46370C70F9C948C00099341 /* PBXTextBookmark */ = F46370C70F9C948C00099341 /* PBXTextBookmark */; 42 | F46370CA0F9C948C00099341 /* PBXTextBookmark */ = F46370CA0F9C948C00099341 /* PBXTextBookmark */; 43 | F47090240F9B83C600CC84B4 /* PBXTextBookmark */ = F47090240F9B83C600CC84B4 /* PBXTextBookmark */; 44 | F47090290F9B83C600CC84B4 /* PBXTextBookmark */ = F47090290F9B83C600CC84B4 /* PBXTextBookmark */; 45 | F4CD2B090F9C7B3500F9AC0B /* PBXTextBookmark */ = F4CD2B090F9C7B3500F9AC0B /* PBXTextBookmark */; 46 | F4CD2B0B0F9C7B3500F9AC0B /* PBXTextBookmark */ = F4CD2B0B0F9C7B3500F9AC0B /* PBXTextBookmark */; 47 | F4CD2B210F9C7C1600F9AC0B /* PBXTextBookmark */ = F4CD2B210F9C7C1600F9AC0B /* PBXTextBookmark */; 48 | }; 49 | sourceControlManager = F413B3170F9666E600FE446E /* Source Control */; 50 | userBuildSettings = { 51 | }; 52 | }; 53 | 8D202CE80486D31800D8A456 /* VoodooHDA */ = { 54 | activeExec = 0; 55 | }; 56 | F413B3170F9666E600FE446E /* Source Control */ = { 57 | isa = PBXSourceControlManager; 58 | fallbackIsa = XCSourceControlManager; 59 | isSCMEnabled = 0; 60 | scmConfiguration = { 61 | }; 62 | }; 63 | F413B3180F9666E600FE446E /* Code sense */ = { 64 | isa = PBXCodeSenseManager; 65 | indexTemplatePath = ""; 66 | }; 67 | F413B34B0F968FEF00FE446E /* PBXTextBookmark */ = { 68 | isa = PBXTextBookmark; 69 | fRef = F506C03D013D9D7901CA16C8 /* VoodooHDAPref.m */; 70 | name = "VoodooHDAPref.m: 1"; 71 | rLen = 0; 72 | rLoc = 0; 73 | rType = 0; 74 | vrLen = 225; 75 | vrLoc = 0; 76 | }; 77 | F413B34C0F968FEF00FE446E /* PBXTextBookmark */ = { 78 | isa = PBXTextBookmark; 79 | fRef = F506C03C013D9D7901CA16C8 /* VoodooHDAPref.h */; 80 | name = "VoodooHDAPref.h: 1"; 81 | rLen = 0; 82 | rLoc = 0; 83 | rType = 0; 84 | vrLen = 369; 85 | vrLoc = 0; 86 | }; 87 | F4585BEF0F9DFC7900C3FCA3 /* PBXTextBookmark */ = { 88 | isa = PBXTextBookmark; 89 | fRef = F506C03C013D9D7901CA16C8 /* VoodooHDAPref.h */; 90 | name = "VoodooHDAPref.h: 87"; 91 | rLen = 0; 92 | rLoc = 1909; 93 | rType = 0; 94 | vrLen = 314; 95 | vrLoc = 187; 96 | }; 97 | F4585BF00F9DFC7900C3FCA3 /* PBXTextBookmark */ = { 98 | isa = PBXTextBookmark; 99 | fRef = F506C03C013D9D7901CA16C8 /* VoodooHDAPref.h */; 100 | name = "VoodooHDAPref.h: 81"; 101 | rLen = 0; 102 | rLoc = 1812; 103 | rType = 0; 104 | vrLen = 1398; 105 | vrLoc = 772; 106 | }; 107 | F46370C70F9C948C00099341 /* PBXTextBookmark */ = { 108 | isa = PBXTextBookmark; 109 | fRef = F506C03C013D9D7901CA16C8 /* VoodooHDAPref.h */; 110 | name = "VoodooHDAPref.h: 87"; 111 | rLen = 0; 112 | rLoc = 1909; 113 | rType = 0; 114 | vrLen = 314; 115 | vrLoc = 187; 116 | }; 117 | F46370CA0F9C948C00099341 /* PBXTextBookmark */ = { 118 | isa = PBXTextBookmark; 119 | fRef = F506C03C013D9D7901CA16C8 /* VoodooHDAPref.h */; 120 | name = "VoodooHDAPref.h: 81"; 121 | rLen = 0; 122 | rLoc = 1812; 123 | rType = 0; 124 | vrLen = 1398; 125 | vrLoc = 772; 126 | }; 127 | F47090240F9B83C600CC84B4 /* PBXTextBookmark */ = { 128 | isa = PBXTextBookmark; 129 | fRef = F47090250F9B83C600CC84B4 /* voodoohdahelper.c */; 130 | name = "voodoohdahelper.c: 166"; 131 | rLen = 0; 132 | rLoc = 3883; 133 | rType = 0; 134 | vrLen = 439; 135 | vrLoc = 3468; 136 | }; 137 | F47090250F9B83C600CC84B4 /* voodoohdahelper.c */ = { 138 | isa = PBXFileReference; 139 | lastKnownFileType = sourcecode.c.c; 140 | name = voodoohdahelper.c; 141 | path = /Users/fassl/Documents/Source/Checkouts/VoodooHDA/trunk/voodoohdahelper.c; 142 | sourceTree = ""; 143 | }; 144 | F47090290F9B83C600CC84B4 /* PBXTextBookmark */ = { 145 | isa = PBXTextBookmark; 146 | fRef = F470902A0F9B83C600CC84B4 /* voodoohdahelper.c */; 147 | name = "voodoohdahelper.c: 166"; 148 | rLen = 0; 149 | rLoc = 3883; 150 | rType = 0; 151 | vrLen = 439; 152 | vrLoc = 3468; 153 | }; 154 | F470902A0F9B83C600CC84B4 /* voodoohdahelper.c */ = { 155 | isa = PBXFileReference; 156 | lastKnownFileType = sourcecode.c.c; 157 | name = voodoohdahelper.c; 158 | path = /Users/fassl/Documents/Source/Checkouts/VoodooHDA/trunk/voodoohdahelper.c; 159 | sourceTree = ""; 160 | }; 161 | F4CD2B090F9C7B3500F9AC0B /* PBXTextBookmark */ = { 162 | isa = PBXTextBookmark; 163 | fRef = F4F1FBCF0F9B9414005DFE1D /* Parser.cpp */; 164 | name = "Parser.cpp: 2839"; 165 | rLen = 0; 166 | rLoc = 91346; 167 | rType = 0; 168 | vrLen = 299; 169 | vrLoc = 91329; 170 | }; 171 | F4CD2B0B0F9C7B3500F9AC0B /* PBXTextBookmark */ = { 172 | isa = PBXTextBookmark; 173 | fRef = F4F1FBCF0F9B9414005DFE1D /* Parser.cpp */; 174 | name = "Parser.cpp: 2839"; 175 | rLen = 0; 176 | rLoc = 91346; 177 | rType = 0; 178 | vrLen = 299; 179 | vrLoc = 91329; 180 | }; 181 | F4CD2B210F9C7C1600F9AC0B /* PBXTextBookmark */ = { 182 | isa = PBXTextBookmark; 183 | fRef = F506C03D013D9D7901CA16C8 /* VoodooHDAPref.m */; 184 | name = "VoodooHDAPref.m: 22"; 185 | rLen = 0; 186 | rLoc = 1610; 187 | rType = 0; 188 | vrLen = 603; 189 | vrLoc = 268; 190 | }; 191 | F4F1FBCF0F9B9414005DFE1D /* Parser.cpp */ = { 192 | isa = PBXFileReference; 193 | lastKnownFileType = sourcecode.cpp.cpp; 194 | name = Parser.cpp; 195 | path = /Users/fassl/Documents/Source/Checkouts/VoodooHDA/trunk/Parser.cpp; 196 | sourceTree = ""; 197 | }; 198 | F506C03C013D9D7901CA16C8 /* VoodooHDAPref.h */ = { 199 | uiCtxt = { 200 | sepNavIntBoundsRect = "{{0, 0}, {1000, 1372}}"; 201 | sepNavSelRange = "{1812, 0}"; 202 | sepNavVisRange = "{772, 1398}"; 203 | sepNavWindowFrame = "{{415, 0}, {1059, 778}}"; 204 | }; 205 | }; 206 | F506C03D013D9D7901CA16C8 /* VoodooHDAPref.m */ = { 207 | uiCtxt = { 208 | sepNavIntBoundsRect = "{{0, 0}, {1000, 6202}}"; 209 | sepNavSelRange = "{8132, 10}"; 210 | sepNavVisRange = "{8501, 1258}"; 211 | sepNavWindowFrame = "{{467, 0}, {1059, 778}}"; 212 | }; 213 | }; 214 | } 215 | -------------------------------------------------------------------------------- /VHDAPrefPane/VoodooHDA/VoodooHDA.xcodeproj/slice.pbxuser: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | 089C1669FE841209C02AAC07 /* Project object */ = { 4 | activeBuildConfigurationName = "Release Tiger"; 5 | activeTarget = 8D202CE80486D31800D8A456 /* VoodooHDA */; 6 | addToTargets = ( 7 | 8D202CE80486D31800D8A456 /* VoodooHDA */, 8 | ); 9 | breakpoints = ( 10 | ); 11 | codeSenseManager = 12E1D8FE121C1F22002EB548 /* Code sense */; 12 | perUserDictionary = { 13 | "PBXConfiguration.PBXBreakpointsDataSource.v1:1CA1AED706398EBD00589147" = { 14 | PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; 15 | PBXFileTableDataSourceColumnSortingKey = PBXBreakpointsDataSource_BreakpointID; 16 | PBXFileTableDataSourceColumnWidthsKey = ( 17 | 20, 18 | 20, 19 | 198, 20 | 20, 21 | 99, 22 | 99, 23 | 29, 24 | 20, 25 | ); 26 | PBXFileTableDataSourceColumnsKey = ( 27 | PBXBreakpointsDataSource_ActionID, 28 | PBXBreakpointsDataSource_TypeID, 29 | PBXBreakpointsDataSource_BreakpointID, 30 | PBXBreakpointsDataSource_UseID, 31 | PBXBreakpointsDataSource_LocationID, 32 | PBXBreakpointsDataSource_ConditionID, 33 | PBXBreakpointsDataSource_IgnoreCountID, 34 | PBXBreakpointsDataSource_ContinueID, 35 | ); 36 | }; 37 | PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { 38 | PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; 39 | PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; 40 | PBXFileTableDataSourceColumnWidthsKey = ( 41 | 20, 42 | 243, 43 | 20, 44 | 48, 45 | 43, 46 | 43, 47 | 20, 48 | ); 49 | PBXFileTableDataSourceColumnsKey = ( 50 | PBXFileDataSource_FiletypeID, 51 | PBXFileDataSource_Filename_ColumnID, 52 | PBXFileDataSource_Built_ColumnID, 53 | PBXFileDataSource_ObjectSize_ColumnID, 54 | PBXFileDataSource_Errors_ColumnID, 55 | PBXFileDataSource_Warnings_ColumnID, 56 | PBXFileDataSource_Target_ColumnID, 57 | ); 58 | }; 59 | PBXConfiguration.PBXFileTableDataSource3.XCSCMDataSource = { 60 | PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; 61 | PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; 62 | PBXFileTableDataSourceColumnWidthsKey = ( 63 | 20, 64 | 20, 65 | 219, 66 | 20, 67 | 48, 68 | 43, 69 | 43, 70 | 20, 71 | ); 72 | PBXFileTableDataSourceColumnsKey = ( 73 | PBXFileDataSource_SCM_ColumnID, 74 | PBXFileDataSource_FiletypeID, 75 | PBXFileDataSource_Filename_ColumnID, 76 | PBXFileDataSource_Built_ColumnID, 77 | PBXFileDataSource_ObjectSize_ColumnID, 78 | PBXFileDataSource_Errors_ColumnID, 79 | PBXFileDataSource_Warnings_ColumnID, 80 | PBXFileDataSource_Target_ColumnID, 81 | ); 82 | }; 83 | PBXPerProjectTemplateStateSaveDate = 307804587; 84 | PBXWorkspaceStateSaveDate = 307804587; 85 | }; 86 | sourceControlManager = 12E1D8FD121C1F22002EB548 /* Source Control */; 87 | userBuildSettings = { 88 | }; 89 | }; 90 | 089C167EFE841241C02AAC07 /* English */ = { 91 | uiCtxt = { 92 | sepNavIntBoundsRect = "{{0, 0}, {853, 391}}"; 93 | sepNavSelRange = "{103, 0}"; 94 | sepNavVisRange = "{0, 107}"; 95 | }; 96 | }; 97 | 12E1D8FD121C1F22002EB548 /* Source Control */ = { 98 | isa = PBXSourceControlManager; 99 | fallbackIsa = XCSourceControlManager; 100 | isSCMEnabled = 1; 101 | scmConfiguration = { 102 | repositoryNamesForRoots = { 103 | "" = voodoohda; 104 | }; 105 | }; 106 | scmType = scm.subversion; 107 | }; 108 | 12E1D8FE121C1F22002EB548 /* Code sense */ = { 109 | isa = PBXCodeSenseManager; 110 | indexTemplatePath = ""; 111 | }; 112 | 8D202CE80486D31800D8A456 /* VoodooHDA */ = { 113 | activeExec = 0; 114 | }; 115 | F506C03C013D9D7901CA16C8 /* VoodooHDAPref.h */ = { 116 | uiCtxt = { 117 | sepNavIntBoundsRect = "{{0, 0}, {853, 1456}}"; 118 | sepNavSelRange = "{2226, 13}"; 119 | sepNavVisRange = "{1948, 843}"; 120 | }; 121 | }; 122 | F506C03D013D9D7901CA16C8 /* VoodooHDAPref.m */ = { 123 | uiCtxt = { 124 | sepNavIntBoundsRect = "{{0, 0}, {734, 8414}}"; 125 | sepNavSelRange = "{9906, 0}"; 126 | sepNavVisRange = "{8503, 1235}"; 127 | sepNavVisRect = "{{0, 4577}, {734, 195}}"; 128 | }; 129 | }; 130 | } 131 | -------------------------------------------------------------------------------- /VHDAPrefPane/VoodooHDA/VoodooHDAPref.h: -------------------------------------------------------------------------------- 1 | // 2 | // VoodooHDAPref.h 3 | // VoodooHDA 4 | // 5 | // Created by fassl on 15.04.09. 6 | // Copyright (c) 2009 Voodoo. All rights reserved. 7 | // 8 | 9 | 10 | #import 11 | 12 | #include 13 | #define kVoodooHDAClassName "VoodooHDADevice" 14 | #define MAX_SLIDER_TAB_NAME_LENGTH 32 15 | #define SOUND_MIXER_NRDEVICES 25 16 | 17 | typedef union { 18 | struct { 19 | UInt8 action; 20 | UInt8 channel; 21 | UInt8 device; 22 | UInt8 val; 23 | } info; 24 | UInt32 value; 25 | } actionInfo; 26 | 27 | typedef struct _mixerDeviceInfo { 28 | UInt8 mixId; 29 | UInt8 value; 30 | char name[MAX_SLIDER_TAB_NAME_LENGTH]; 31 | bool enabled; 32 | UInt8 non[5]; //align to 8 bytes 33 | } mixerDeviceInfo; 34 | 35 | typedef struct _ChannelInfo { 36 | char name[MAX_SLIDER_TAB_NAME_LENGTH]; 37 | mixerDeviceInfo mixerValues[SOUND_MIXER_NRDEVICES]; 38 | UInt8 numChannels; 39 | bool vectorize; 40 | bool useStereo; 41 | UInt8 noiseLevel; 42 | UInt8 StereoBase; 43 | UInt8 empty[3]; 44 | } ChannelInfo; 45 | 46 | enum { 47 | kVoodooHDAActionMethod = 0, 48 | kVoodooHDANumMethods 49 | }; 50 | 51 | enum { 52 | kVoodooHDAChannelNames = 0x3000 53 | }; 54 | 55 | enum { 56 | kVoodooHDAActionSetMixer = 0x40, 57 | kVoodooHDAActionGetMixers = 0x50, 58 | kVoodooHDAActionSetMath = 0x60 59 | }; 60 | 61 | @interface VoodooHDAPref : NSPreferencePane 62 | { 63 | IBOutlet NSTextField *versionText; 64 | IBOutlet NSSlider *sliderAltPCM; 65 | IBOutlet NSSlider *sliderBass; 66 | IBOutlet NSSlider *sliderCD; 67 | IBOutlet NSSlider *sliderDigital1; 68 | IBOutlet NSSlider *sliderDigital2; 69 | IBOutlet NSSlider *sliderDigital3; 70 | IBOutlet NSSlider *sliderIGain; 71 | IBOutlet NSSlider *sliderIMix; 72 | IBOutlet NSSlider *sliderLine; 73 | IBOutlet NSSlider *sliderLine1; 74 | IBOutlet NSSlider *sliderLine2; 75 | IBOutlet NSSlider *sliderLine3; 76 | IBOutlet NSSlider *sliderMic; 77 | IBOutlet NSSlider *sliderMonitor; 78 | IBOutlet NSSlider *sliderOGain; 79 | IBOutlet NSSlider *sliderPCM; 80 | IBOutlet NSSlider *sliderPhoneIn; 81 | IBOutlet NSSlider *sliderPhoneOut; 82 | IBOutlet NSSlider *sliderRadio; 83 | IBOutlet NSSlider *sliderRecLev; 84 | IBOutlet NSSlider *sliderSpeaker; 85 | IBOutlet NSSlider *sliderSynth; 86 | IBOutlet NSSlider *sliderTreble; 87 | IBOutlet NSSlider *sliderVideo; 88 | 89 | IBOutlet NSSlider *sliderNoise; 90 | IBOutlet NSSlider *sliderVolume; 91 | IBOutlet NSSlider *sliderStereo; 92 | 93 | IBOutlet NSButton *soundVector; 94 | IBOutlet NSButton *stereoEnhance; 95 | 96 | IBOutlet NSPopUpButton *selector; 97 | 98 | UInt8 currentChannel; 99 | ChannelInfo *chInfo; 100 | io_service_t service; 101 | io_connect_t connect; 102 | 103 | } 104 | //- (bool) updateChannelInfo; 105 | - (bool) updateMath; 106 | - (bool) updateSliders; 107 | - (void) awakeFromNib; 108 | - (void) didUnselect; 109 | - (bool) saveSettings; 110 | - (IBAction)sliderMoved:(NSSlider *)sender; 111 | - (IBAction)selectorChanged:(NSPopUpButton *)sender; 112 | //- (IBAction)enableAllSLiders:(NSButton *)sender; 113 | - (IBAction)SSEChanged:(NSButton *)sender; 114 | - (IBAction)useStereoEnhance:(NSButton *)sender; 115 | 116 | //- (void) changeVersionText; 117 | 118 | @end 119 | -------------------------------------------------------------------------------- /VHDAPrefPane/VoodooHDA/VoodooHDAPref.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AppleLife/VoodooHDA/e9708dea706eedb7f07365375e01ec1d67cb6f7d/VHDAPrefPane/VoodooHDA/VoodooHDAPref.tiff -------------------------------------------------------------------------------- /VHDAPrefPane/VoodooHDA/VoodooHDA_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'VoodooHDA' target in the 'VoodooHDA' project. 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #import 8 | #endif 9 | -------------------------------------------------------------------------------- /VoodooHDA/AppleAudioClip.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1998-2008 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | #ifndef _APPLEUSBAUDIOCLIP_H 25 | #define _APPLEUSBAUDIOCLIP_H 26 | 27 | #include 28 | 29 | #include "iSubTypes.h" // aml 3.01.02 added to get iSub typdefs 30 | 31 | extern "C" { 32 | // floating point types 33 | typedef float Float32; 34 | typedef double Float64; 35 | 36 | typedef struct _sPreviousValues { 37 | Float32 xl_1; 38 | Float32 xr_1; 39 | Float32 xl_2; 40 | Float32 xr_2; 41 | Float32 yl_1; 42 | Float32 yr_1; 43 | Float32 yl_2; 44 | Float32 yr_2; 45 | } PreviousValues; 46 | 47 | // aml 2.21.02 added structure for 1st order phase compensator 48 | // use in case of 2nd order crossover filter 49 | typedef struct _sPreviousValues1stOrder { 50 | Float32 xl_1; 51 | Float32 xr_1; 52 | Float32 yl_1; 53 | Float32 yr_1; 54 | } PreviousValues1stOrder; 55 | 56 | UInt32 CalculateOffset (UInt64 nanoseconds, UInt32 sampleRate); 57 | 58 | IOReturn clipAppleUSBAudioToOutputStreamiSub (const void *mixBuf, 59 | void *sampleBuf, 60 | PreviousValues *filterState, 61 | // aml 2.21.02 adding extra state for 4th order filter and 62 | // phase compensator 63 | PreviousValues *filterState2, 64 | PreviousValues *phaseCompState, 65 | float *low, 66 | float *high, 67 | UInt32 firstSampleFrame, 68 | UInt32 numSampleFrames, 69 | UInt32 sampleRate, 70 | const IOAudioStreamFormat *streamFormat, 71 | SInt16 * iSubBufferMemory, 72 | UInt32 *loopCount, 73 | SInt32 *iSubBufferOffset, 74 | UInt32 iSubBufferLen, 75 | // aml 3.01.02 adding format type 76 | iSubAudioFormatType* iSubFormat, 77 | float* srcPhase, // aml 3.5.02 78 | float* srcState); // aml 3.6.02 79 | 80 | IOReturn clipAppleUSBAudioToOutputStream (const void *mixBuf, 81 | void *sampleBuf, 82 | UInt32 firstSampleFrame, 83 | UInt32 numSampleFrames, 84 | const IOAudioStreamFormat *streamFormat); 85 | 86 | IOReturn convertFromAppleUSBAudioInputStream_NoWrap (const void *sampleBuf, 87 | void *destBuf, 88 | UInt32 firstSampleFrame, 89 | UInt32 numSampleFrames, 90 | const IOAudioStreamFormat *streamFormat); 91 | } 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /VoodooHDA/AppleAudioCommon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1998-2009 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | //-------------------------------------------------------------------------------- 25 | // 26 | // File: AppleUSBAudioCommon.h 27 | // 28 | // Contains: Various debug switches for the AppleUSBAudio project 29 | // 30 | // Technology: OS X 31 | // 32 | //-------------------------------------------------------------------------------- 33 | 34 | #ifndef _APPLEUSBAUDIOCOMMON_H 35 | #define _APPLEUSBAUDIOCOMMON_H 36 | 37 | #include 38 | 39 | #ifdef DEBUGLOGGING 40 | #define DEBUG_LEVEL 1 41 | #ifdef __USE_USBLOG_FOR_AUA_MESSAGES__ 42 | #include 43 | #endif 44 | #ifdef __USE_FIRELOG_FOR_AUA_MESSAGES__ 45 | #include 46 | #ifndef _FIRELOG_H 47 | #error Must install FireLog to build FireLog builds! 48 | #endif 49 | #endif 50 | #endif 51 | 52 | 53 | // ----------------------------------------------------------------- 54 | #define SoundAssertionMessage( cond, file, line, handler ) \ 55 | "Sound assertion \"" #cond "\" failed in " #file " at line " #line " goto " #handler "" 56 | 57 | #define SoundAssertionFailed( cond, file, line, handler ) \ 58 | {debugIOLog( SoundAssertionMessage( cond, file, line, handler )); IOSleep(20);}; 59 | 60 | // ----------------------------------------------------------------- 61 | #define FailIf( cond, handler ) \ 62 | if( cond ){ \ 63 | SoundAssertionFailed( cond, __FILE__, __LINE__, handler ) \ 64 | goto handler; \ 65 | } 66 | 67 | // ----------------------------------------------------------------- 68 | #define FailWithAction( cond, action, handler ) \ 69 | if( cond ){ \ 70 | SoundAssertionFailed( cond, __FILE__, __LINE__, handler ) \ 71 | { action; } \ 72 | goto handler; \ 73 | } 74 | 75 | // ----------------------------------------------------------------- 76 | #define FailMessage(cond) \ 77 | if (cond) { \ 78 | SoundAssertionFailed(cond, __FILE__, __LINE__, handler) \ 79 | } 80 | 81 | // ----------------------------------------------------------------- 82 | // 83 | // System Logging or USB Prober Logging 84 | // 85 | //#define sleepTime 20 86 | #define sleepTime 0 87 | 88 | #ifdef DEBUGLOGGING /* { */ 89 | #ifdef CONSOLELOGGING /* { */ 90 | #define debugIOLog( message... ) \ 91 | do {IOLog( #message "\n", message ); IOSleep(sleepTime);} while (0) 92 | #elif defined (__USE_FIREWIRE_KPRINTF_FOR_AUA_MESSAGES__) /* }{ */ 93 | #define debugIOLog( message... ) \ 94 | do { kprintf ( message ); kprintf ( "\n" ); } while (0) 95 | #elif defined (__USE_FIRELOG_FOR_AUA_MESSAGES__) /* }{ */ 96 | #define debugIOLog( message... ) \ 97 | do { FireLog( message ); FireLog( "\n" ); } while (0) 98 | #elif defined (__USE_USBLOG_FOR_AUA_MESSAGES__) /* }{ */ 99 | #define debugIOLog( message... ) \ 100 | do {USBLog( DEBUG_LEVEL_DEVELOPMENT, message );} while (0) 101 | #endif /* } */ 102 | #else /* }{ */ 103 | #define debugIOLog( message... ) ; 104 | #endif /* } */ 105 | 106 | // Following are a list of precompiler variables that affect the way that AppleUSBAudio executes, logs, and compiles. 107 | 108 | // kUSBInputRecoveryTimeFraction represents the denominator (with 1 as the numerator) of the fractional multiple of a USB frame we must wait 109 | // before data read via isoc in is available for converting. This must be greater than zero. 110 | #define kUSBInputRecoveryTimeFraction 4 111 | 112 | // kMinimumSyncRefreshInterval is the smallest log base 2 amount of time in ms AppleUSBAudio will honor for a sync endppoint 113 | #define kMinimumSyncRefreshInterval 1 114 | 115 | // DEBUGLATENCY enables methods that allow the tracking of how long clipped samples stay in the output buffer prior to DMA 116 | #define DEBUGLATENCY FALSE 117 | 118 | // PRIMEISOCINPUT queues kNumIsocFramesToPrime USB frames to be read and disregarded before attempting to stream samples to CoreAudio 119 | #define PRIMEISOCINPUT TRUE 120 | #define kNumUSBFramesToPrime 12 121 | 122 | // LOGTIMESTAMPS prints the timestamp in nanoseconds whenever takeTimeStamp it is called 123 | #define LOGTIMESTAMPS FALSE 124 | 125 | // RESETAFTERSLEEP causes a device reset to be issued after waking from sleep for all devices. 126 | #define RESETAFTERSLEEP TRUE 127 | 128 | // DEBUGANCHORS prints out the last kAnchorsToAccumulate anchors whenever the list fills; used to check anchor accuracy. 129 | #define DEBUGANCHORS FALSE 130 | #define kAnchorsToAccumulate 10 131 | 132 | // LOGWALLTIMEPERUSBCYCLE will display mWallTimePerUSBCycle * kExtraPrecision each time updateWallTimePerUSBCycle is executed. 133 | 134 | #define LOGWALLTIMEPERUSBCYCLE FALSE 135 | 136 | // LOGDEVICEREQUESTS shows each device request and its result after it has been issued 137 | #define LOGDEVICEREQUESTS FALSE 138 | 139 | // DEBUGTIMER shows the entry and exit of all USB rate timer functions 140 | #define DEBUGTIMER FALSE 141 | 142 | // DEBUGCONVERT shows the entry and exit of all calls to convertInputSamples 143 | #define DEBUGCONVERT FALSE 144 | 145 | // STAGGERINTERFACES delays even-numbered streaming interfaces' initHardware by a fixed value (for readability) 146 | #define STAGGERINTERFACES FALSE 147 | 148 | // [rdar://5600254] Log the data cadence for debug purposes. 149 | #define SHOWCADENCE FALSE 150 | 151 | // Poll for the clock status. 152 | #define POLLCLOCKSTATUS TRUE 153 | 154 | #define DEBUGZEROTIME FALSE 155 | #define DEBUGUSB FALSE 156 | #define DEBUGISUB FALSE 157 | #define DEBUGLOADING FALSE 158 | #define DEBUGTIMESTAMPS FALSE 159 | #define DEBUGINPUT FALSE 160 | #define DEBUGUHCI FALSE 161 | 162 | // The following return codes are used by AppleUSBAudioDevice to detail the status of a format change. 163 | enum 164 | { 165 | kAUAFormatChangeNormal = kIOReturnSuccess, 166 | kAUAFormatChangeForced, 167 | kAUAFormatChangeForceFailure, 168 | kAUAFormatChangeError = kIOReturnError 169 | 170 | }; 171 | 172 | // The following definitions are for lock delay units 173 | enum 174 | { 175 | kLockDelayUnitMilliseconds = 1, 176 | kLockDelayUnitsDecodedPCMSamples = 2 177 | }; 178 | 179 | 180 | // Publish property for USB audio plugin. 181 | #define kIDVendorString "idVendor" 182 | #define kIDProductString "idProduct" 183 | 184 | // Sizes in bits for OSNumbers 185 | #define BITSTOBYTES 8 186 | #define SIZEINBITS( x ) ( BITSTOBYTES * sizeof( x ) ) 187 | 188 | #endif /* _APPLEUSBAUDIOCOMMON_H */ 189 | -------------------------------------------------------------------------------- /VoodooHDA/AudioClip.cpp: -------------------------------------------------------------------------------- 1 | #include "License.h" 2 | //#ifndef USE_APPLE_ROUTINES 3 | //#include "AppleAudioClip.h" 4 | //#include "AppleAudioCommon.h" 5 | #include "VoodooHDADevice.h" 6 | #include "VoodooHDAEngine.h" 7 | #include "PCMBlitterLibDispatch.h" 8 | 9 | #define errorMsg(fmt, args...) do { if (mDevice) mDevice->errorMsg(fmt, ##args); } while (0) 10 | 11 | IOReturn VoodooHDAEngine::clipOutputSamples(const void *mixBuf, void *sampleBuf, UInt32 firstSampleFrame, 12 | UInt32 numSampleFrames, const IOAudioStreamFormat *streamFormat, 13 | __unused IOAudioStream *audioStream) 14 | { 15 | if(!streamFormat) 16 | { 17 | return kIOReturnBadArgument; 18 | } 19 | UInt32 firstSample = firstSampleFrame * streamFormat->fNumChannels; 20 | UInt32 numSamples = numSampleFrames * streamFormat->fNumChannels; 21 | Float32 *floatMixBuf = ((Float32*)mixBuf) + firstSample; 22 | 23 | UInt8 *sourceBuf = (UInt8 *) sampleBuf; 24 | 25 | // figure out what sort of blit we need to do 26 | if ((streamFormat->fSampleFormat == kIOAudioStreamSampleFormatLinearPCM) && streamFormat->fIsMixable) { 27 | // it's mixable linear PCM, which means we will be calling a blitter, which works in samples 28 | // not frames 29 | 30 | if (streamFormat->fNumericRepresentation == kIOAudioStreamNumericRepresentationSignedInt) { 31 | // it's some kind of signed integer, which we handle as some kind of even byte length 32 | bool nativeEndianInts; 33 | nativeEndianInts = (streamFormat->fByteOrder == kIOAudioStreamByteOrderLittleEndian); 34 | 35 | switch (streamFormat->fBitWidth) { 36 | case 8: 37 | if (nativeEndianInts) 38 | { 39 | SInt8* theOutputBufferSInt8 = ((SInt8*)sampleBuf) + firstSample; 40 | ClipFloat32ToSInt8_4(floatMixBuf, theOutputBufferSInt8, numSamples); 41 | } else 42 | Float32ToInt8(theMixBuffer, theOutputBufferSInt8, theNumberSamples); 43 | break; 44 | 45 | case 16: 46 | SInt16* theOutputBufferSInt16 = ((SInt16*)sampleBuf) + firstSample; 47 | if (nativeEndianInts) { 48 | if (vectorize) { 49 | Float32ToNativeInt16(floatMixBuf, theOutputBufferSInt16, numSamples); 50 | } else { 51 | ClipFloat32ToSInt16LE_4(floatMixBuf, theOutputBufferSInt16, numSamples); 52 | } 53 | } 54 | else 55 | Float32ToSwapInt16(floatMixBuf, (SInt16 *) &sourceBuf[2 * firstSample], 56 | numSamples); 57 | break; 58 | 59 | case 20: 60 | case 24: 61 | SInt32* theOutputBufferSInt24 = (SInt32*)(((UInt8*)sampleBuf) + (firstSample * 3)); 62 | if (nativeEndianInts) { 63 | if (vectorize) { 64 | Float32ToNativeInt24(floatMixBuf, theOutputBufferSInt24, numSamples); 65 | } else { 66 | ClipFloat32ToSInt24LE_4(floatMixBuf, theOutputBufferSInt24, numSamples); 67 | } 68 | } 69 | else 70 | Float32ToSwapInt24(floatMixBuf, &sourceBuf[3 * firstSample], numSamples); 71 | break; 72 | 73 | case 32: 74 | SInt32* theOutputBufferSInt32 = ((SInt32*)sampleBuf) + firstSample; 75 | if (nativeEndianInts) { 76 | if (vectorize) { 77 | Float32ToNativeInt32(floatMixBuf, theOutputBufferSInt32, numSamples); 78 | } else { 79 | ClipFloat32ToSInt32LE_4(floatMixBuf, theOutputBufferSInt32, theNumberSamples); 80 | } 81 | } 82 | else 83 | Float32ToSwapInt32(floatMixBuf, (SInt32 *) &sourceBuf[4 * firstSample], 84 | numSamples); 85 | break; 86 | 87 | default: 88 | errorMsg("clipOutputSamples: can't handle signed integers with a bit width of %d", 89 | streamFormat->fBitWidth); 90 | break; 91 | 92 | } 93 | } else if (streamFormat->fNumericRepresentation == kIOAudioStreamNumericRepresentationIEEE754Float) { 94 | // it is some kind of floating point format 95 | if ((streamFormat->fBitWidth == 32) && (streamFormat->fBitDepth == 32) && 96 | (streamFormat->fByteOrder == kIOAudioStreamByteOrderLittleEndian)) { 97 | // it's Float32, so we are just going to copy the data 98 | memcpy(&((Float32 *) sampleBuf)[firstSample], &floatMixBuf[firstSample], 99 | numSamples * sizeof (Float32)); 100 | } else 101 | errorMsg("clipOutputSamples: can't handle floats with a bit width of %d, bit depth of %d, " 102 | "and/or the given byte order", streamFormat->fBitWidth, streamFormat->fBitDepth); 103 | } 104 | } else { 105 | // it's not linear PCM or it's not mixable, so just copy the data into the target buffer 106 | UInt32 offset = firstSampleFrame * (streamFormat->fBitWidth / 8) * streamFormat->fNumChannels; 107 | UInt32 size = numSampleFrames * (streamFormat->fBitWidth / 8) * streamFormat->fNumChannels; 108 | memcpy(&((SInt8 *) sampleBuf)[offset], &((SInt8 *) mixBuf)[offset], size); 109 | } 110 | 111 | return kIOReturnSuccess; 112 | } 113 | 114 | IOReturn VoodooHDAEngine::convertInputSamples(const void *sampleBuf, void *destBuf, 115 | UInt32 firstSampleFrame, UInt32 numSampleFrames, const IOAudioStreamFormat *streamFormat, 116 | __unused IOAudioStream *audioStream) 117 | { 118 | UInt32 numSamplesLeft, numSamples; 119 | float *floatDestBuf; 120 | 121 | floatDestBuf = (float *)destBuf; 122 | UInt32 firstSample = firstSampleFrame * streamFormat->fNumChannels; 123 | numSamples = numSamplesLeft = numSampleFrames * streamFormat->fNumChannels; 124 | long int noiseMask = ~((1 << noiseLevel) - 1); 125 | 126 | UInt8 *sourceBuf = (UInt8 *) sampleBuf; 127 | 128 | // figure out what sort of blit we need to do 129 | if ((streamFormat->fSampleFormat == kIOAudioStreamSampleFormatLinearPCM) && streamFormat->fIsMixable) { 130 | // it's linear PCM, which means the target is Float32 and we will be calling a blitter, which 131 | // works in samples not frames 132 | Float32 *floatDestBuf = (Float32 *) destBuf; 133 | 134 | if (streamFormat->fNumericRepresentation == kIOAudioStreamNumericRepresentationSignedInt) { 135 | // it's some kind of signed integer, which we handle as some kind of even byte length 136 | bool nativeEndianInts; 137 | nativeEndianInts = (streamFormat->fByteOrder == kIOAudioStreamByteOrderLittleEndian); 138 | 139 | switch (streamFormat->fBitWidth) { 140 | case 8: 141 | SInt8 *inputBuf8; 142 | 143 | inputBuf8 = &(((SInt8 *)sampleBuf)[firstSample]); 144 | #if defined(__ppc__) 145 | Int8ToFloat32(inputBuf8, floatDestBuf, numSamplesLeft); 146 | #elif defined(__i386__) 147 | while (numSamplesLeft-- > 0) 148 | { 149 | *(floatDestBuf++) = (float)(*(inputBuf8++) &= (SInt8)noiseMask) * kOneOverMaxSInt8Value; 150 | } 151 | #endif 152 | 153 | break; 154 | case 16: 155 | if (nativeEndianInts) 156 | if (vectorize) { 157 | NativeInt16ToFloat32((SInt16 *) &sampleBuf[2 * firstSample], floatDestBuf, numSamples); 158 | } else { 159 | SInt16 *inputBuf16; 160 | 161 | inputBuf16 = &(((SInt16 *)sampleBuf)[firstSample]); 162 | #if defined(__ppc__) 163 | SwapInt16ToFloat32(inputBuf16, floatDestBuf, numSamplesLeft, 16); 164 | #elif defined(__i386__) 165 | while (numSamplesLeft-- > 0) 166 | { 167 | *(floatDestBuf++) = (float)(*(inputBuf16++) &= (SInt16)noiseMask) * kOneOverMaxSInt16Value; 168 | } 169 | #endif 170 | } 171 | 172 | 173 | else 174 | SwapInt16ToFloat32((SInt16 *) &sampleBuf[2 * firstSample], floatDestBuf, numSamples); 175 | break; 176 | 177 | case 20: 178 | case 24: 179 | if (nativeEndianInts) 180 | if (vectorize) { 181 | NativeInt24ToFloat32(&sourceBuf[3 * firstSample], floatDestBuf, numSamples); 182 | } else { 183 | register SInt8 *inputBuf24; 184 | 185 | // Multiply by 3 because 20 and 24 bit samples are packed into only three bytes, so we have to index bytes, not shorts or longs 186 | inputBuf24 = &(((SInt8 *)sampleBuf)[firstSample * 3]); 187 | 188 | #if defined(__ppc__) 189 | SwapInt24ToFloat32((long *)inputBuf24, floatDestBuf, numSamplesLeft, 24); 190 | #elif defined(__i386__) 191 | register SInt32 inputSample; 192 | 193 | // [rdar://4311684] - Fixed 24-bit input convert routine. /thw 194 | while (numSamplesLeft-- > 1) 195 | { 196 | inputSample = (* (UInt32 *)inputBuf24) & 0x00FFFFFF & noiseMask; 197 | // Sign extend if necessary 198 | if (inputSample > 0x7FFFFF) 199 | { 200 | inputSample |= 0xFF000000; 201 | } 202 | inputBuf24 += 3; 203 | *(floatDestBuf++) = (float)inputSample * kOneOverMaxSInt24Value; 204 | } 205 | // Convert last sample. The following line does the same work as above without going over the edge of the buffer. 206 | inputSample = SInt32 ((UInt32 (*(UInt16 *) inputBuf24) & 0x0000FFFF & noiseMask) 207 | | (SInt32 (*(inputBuf24 + 2)) << 16)); 208 | *(floatDestBuf++) = (float)inputSample * kOneOverMaxSInt24Value; 209 | #endif 210 | 211 | } 212 | 213 | 214 | else 215 | SwapInt24ToFloat32(&sourceBuf[3 * firstSample], floatDestBuf, numSamples); 216 | break; 217 | 218 | case 32: 219 | if (nativeEndianInts) { 220 | if (vectorize) { 221 | NativeInt32ToFloat32((SInt32 *) &sourceBuf[4 * firstSample], floatDestBuf, numSamples); 222 | } else { 223 | register SInt32 *inputBuf32; 224 | inputBuf32 = &(((SInt32 *)sampleBuf)[firstSample]); 225 | 226 | #if defined(__ppc__) 227 | SwapInt32ToFloat32(inputBuf32, floatDestBuf, numSamplesLeft, 32); 228 | #elif defined(__i386__) 229 | while (numSamplesLeft-- > 0) { 230 | *(floatDestBuf++) = (float)(*(inputBuf32++) & noiseMask) * kOneOverMaxSInt32Value; 231 | } 232 | #endif 233 | 234 | } 235 | } 236 | else 237 | SwapInt32ToFloat32((SInt32 *) &sourceBuf[4 * firstSample], floatDestBuf, numSamples); 238 | break; 239 | 240 | default: 241 | errorMsg("convertInputSamples: can't handle signed integers with a bit width of %d", 242 | streamFormat->fBitWidth); 243 | break; 244 | 245 | } 246 | 247 | //Меняю местами значения для левого и правого канала 248 | if(mDevice && mDevice->mSwitchCh && (streamFormat->fNumChannels > 1)) { 249 | UInt32 i; 250 | Float32 tempSamples; 251 | 252 | for(i = 0; i < numSamples; i+= streamFormat->fNumChannels) { 253 | tempSamples = floatDestBuf[i]; 254 | floatDestBuf[i] = floatDestBuf[i+1]; 255 | floatDestBuf[i+1] = tempSamples; 256 | } 257 | } 258 | 259 | } else if (streamFormat->fNumericRepresentation == kIOAudioStreamNumericRepresentationIEEE754Float) { 260 | // it is some kind of floating point format 261 | if ((streamFormat->fBitWidth == 32) && (streamFormat->fBitDepth == 32) && 262 | (streamFormat->fByteOrder == kIOAudioStreamByteOrderLittleEndian)) { 263 | // it's Float32, so we are just going to copy the data 264 | memcpy(floatDestBuf, &((Float32 *) sampleBuf)[firstSample], numSamples * sizeof (Float32)); 265 | } else 266 | errorMsg("convertInputSamples: can't handle floats with a bit width of %d, bit depth of %d, " 267 | "and/or the given byte order", streamFormat->fBitWidth, streamFormat->fBitDepth); 268 | } 269 | } else { 270 | // it's not linear PCM or it's not mixable, so just copy the data into the target buffer 271 | UInt32 offset = firstSampleFrame * (streamFormat->fBitWidth / 8) * streamFormat->fNumChannels; 272 | UInt32 size = numSampleFrames * (streamFormat->fBitWidth / 8) * streamFormat->fNumChannels; 273 | memcpy(destBuf, &sourceBuf[offset], size); 274 | } 275 | 276 | return kIOReturnSuccess; 277 | } 278 | //#endif 279 | -------------------------------------------------------------------------------- /VoodooHDA/Common.h: -------------------------------------------------------------------------------- 1 | #include "License.h" 2 | 3 | #ifndef _COMMON_H 4 | #define _COMMON_H 5 | 6 | #undef panic(...) 7 | void panic(const char *str, ...) __attribute__((__noreturn__)); 8 | 9 | #define ASSERT(expr) do { if (!(expr)) panic("%s: failed assertion '%s'", __FUNCTION__, #expr); } while (0) 10 | #define BUG(msg) panic("%s: %s\n", __FUNCTION__, msg) 11 | 12 | #define RELEASE(x) do { if (x) { (x)->release(); (x) = NULL; } } while (0) 13 | #define DELETE(x) do { if (x) { delete (x); (x) = NULL; } } while (0) 14 | #define FREE(x) do { if (x) { freeMem(x); (x) = NULL; } } while (0) 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /VoodooHDA/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AppleLife/VoodooHDA/e9708dea706eedb7f07365375e01ec1d67cb6f7d/VoodooHDA/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /VoodooHDA/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | org.voodoo.driver.${PRODUCT_NAME:identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | KEXT 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(MODULE_VERSION) 23 | CFBundleShortVersionString 24 | $(MODULE_VERSION) 25 | IOKitPersonalities 26 | 27 | VoodooHDA 28 | 29 | CFBundleIdentifier 30 | org.voodoo.driver.VoodooHDA 31 | IOClass 32 | VoodooHDADevice 33 | IOMatchCategory 34 | VoodooHDADevice 35 | IOPCIClassMatch 36 | 0x04030000&0xffff0000 37 | IOProviderClass 38 | IOPCIDevice 39 | IOUserClientClass 40 | VoodooHDAUserClient 41 | VoodooHDAEnableVolumeChangeFix 42 | 43 | VoodooHDAEnableHalfMicVolumeFix 44 | 45 | VoodooHDAEnableHalfVolumeFix 46 | 47 | VoodooHDAEnableMuteFix 48 | 49 | InhibitCache 50 | 51 | Vectorize 52 | 53 | Noise 54 | 0 55 | VoodooHDAVerboseLevel 56 | 0 57 | NodesToPatch 58 | 59 | MixerValues 60 | 61 | Rec 62 | 70 63 | PCM 64 | 90 65 | iMix 66 | 0 67 | iGain 68 | 90 69 | 70 | 71 | 72 | OSBundleLibraries 73 | 74 | com.apple.iokit.IOAudioFamily 75 | 1.1fc9 76 | com.apple.iokit.IOPCIFamily 77 | 2.1 78 | com.apple.kpi.iokit 79 | 9.0.0 80 | com.apple.kpi.libkern 81 | 9.0.0 82 | com.apple.kpi.mach 83 | 9.0.0 84 | com.apple.kpi.unsupported 85 | 9.0.0 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /VoodooHDA/License.h: -------------------------------------------------------------------------------- 1 | /* The following license applies to code derived from the FreeBSD hdac driver. */ 2 | 3 | /* Copyright (c) 2006 Stephane E. Potvin 4 | * Copyright (c) 2006 Ariff Abdullah 5 | * Copyright (c) 2008 Alexander Motin 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | */ 29 | 30 | /* The following license applies to code upon which the included PCMBlitterLib 31 | * and AudioClip source code (from AudioReflectorDriver) is based. It also applies 32 | * to portions of VoodooHDA which were derived from SamplePCIAudioDevice and other 33 | * sample code available from Apple. */ 34 | 35 | /* Copyright © 2007 Apple Inc. All Rights Reserved. 36 | * 37 | * Disclaimer: IMPORTANT: This Apple software is supplied to you by 38 | * Apple Inc. ("Apple") in consideration of your agreement to the 39 | * following terms, and your use, installation, modification or 40 | * redistribution of this Apple software constitutes acceptance of these 41 | * terms. If you do not agree with these terms, please do not use, 42 | * install, modify or redistribute this Apple software. 43 | * 44 | * In consideration of your agreement to abide by the following terms, and 45 | * subject to these terms, Apple grants you a personal, non-exclusive 46 | * license, under Apple's copyrights in this original Apple software (the 47 | * "Apple Software"), to use, reproduce, modify and redistribute the Apple 48 | * Software, with or without modifications, in source and/or binary forms; 49 | * provided that if you redistribute the Apple Software in its entirety and 50 | * without modifications, you must retain this notice and the following 51 | * text and disclaimers in all such redistributions of the Apple Software. 52 | * Neither the name, trademarks, service marks or logos of Apple Inc. 53 | * may be used to endorse or promote products derived from the Apple 54 | * Software without specific prior written permission from Apple. Except 55 | * as expressly stated in this notice, no other rights or licenses, express 56 | * or implied, are granted by Apple herein, including but not limited to 57 | * any patent rights that may be infringed by your derivative works or by 58 | * other works in which the Apple Software may be incorporated. 59 | * 60 | * The Apple Software is provided by Apple on an "AS IS" basis. APPLE 61 | * MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 62 | * THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 63 | * FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 64 | * OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 65 | * 66 | * IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 67 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 68 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 69 | * INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 70 | * MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 71 | * AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 72 | * STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 73 | * POSSIBILITY OF SUCH DAMAGE. 74 | */ 75 | -------------------------------------------------------------------------------- /VoodooHDA/OssCompat.h: -------------------------------------------------------------------------------- 1 | #include "License.h" 2 | 3 | #ifndef _OSS_COMPAT_H 4 | #define _OSS_COMPAT_H 5 | 6 | #define PCMDIR_FAKE 0 7 | #define PCMDIR_PLAY 1 8 | #define PCMDIR_PLAY_VIRTUAL 2 9 | #define PCMDIR_REC -1 10 | #define PCMDIR_REC_VIRTUAL -2 11 | 12 | #define SOUND_MIXER_NRDEVICES 25 13 | #define SOUND_MIXER_VOLUME 0 /* Master output level */ 14 | #define SOUND_MIXER_BASS 1 /* [unused] Treble level of all output channels */ 15 | #define SOUND_MIXER_TREBLE 2 /* [unused] Bass level of all output channels */ 16 | #define SOUND_MIXER_SYNTH 3 /* [unused] Volume of synthesier input */ 17 | #define SOUND_MIXER_PCM 4 /* Output level for the audio device */ 18 | #define SOUND_MIXER_SPEAKER 5 /* Output level for the PC speaker signals */ 19 | #define SOUND_MIXER_LINE 6 /* Volume level for the line in jack */ 20 | #define SOUND_MIXER_MIC 7 /* Volume for the signal coming from the microphone jack */ 21 | #define SOUND_MIXER_CD 8 /* Volume level for the input signal connected to the CD audio input */ 22 | #define SOUND_MIXER_IMIX 9 /* Recording monitor. It controls the output volume of the selected 23 | * recording sources while recording */ 24 | #define SOUND_MIXER_ALTPCM 10 /* [unused] Volume of the alternative codec device */ 25 | #define SOUND_MIXER_RECLEV 11 /* Global recording level */ 26 | #define SOUND_MIXER_IGAIN 12 /* Input gain */ 27 | #define SOUND_MIXER_OGAIN 13 /* Output gain */ 28 | /* The AD1848 codec and compatibles have three line level inputs 29 | * (line, aux1 and aux2). Since each card manufacturer have assigned 30 | * different meanings to these inputs, it's inpractical to assign 31 | * specific meanings (line, cd, synth etc.) to them. */ 32 | #define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */ 33 | #define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */ 34 | #define SOUND_MIXER_LINE3 16 /* Input source 3 (line) */ 35 | #define SOUND_MIXER_DIGITAL1 17 /* Digital (input) 1 */ 36 | #define SOUND_MIXER_DIGITAL2 18 /* Digital (input) 2 */ 37 | #define SOUND_MIXER_DIGITAL3 19 /* Digital (input) 3 */ 38 | #define SOUND_MIXER_PHONEIN 20 /* Phone input */ 39 | #define SOUND_MIXER_PHONEOUT 21 /* Phone output */ 40 | #define SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */ 41 | #define SOUND_MIXER_RADIO 23 /* Radio in */ 42 | #define SOUND_MIXER_MONITOR 24 /* Monitor (usually mic) volume */ 43 | 44 | #define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME) 45 | #define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS) 46 | #define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE) 47 | #define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH) 48 | #define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM) 49 | #define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER) 50 | #define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE) 51 | #define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC) 52 | #define SOUND_MASK_CD (1 << SOUND_MIXER_CD) 53 | #define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX) 54 | #define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM) 55 | #define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV) 56 | #define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN) 57 | #define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN) 58 | #define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1) 59 | #define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2) 60 | #define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3) 61 | #define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1) 62 | #define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2) 63 | #define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3) 64 | #define SOUND_MASK_PHONEIN (1 << SOUND_MIXER_PHONEIN) 65 | #define SOUND_MASK_PHONEOUT (1 << SOUND_MIXER_PHONEOUT) 66 | #define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO) 67 | #define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO) 68 | #define SOUND_MASK_MONITOR (1 << SOUND_MIXER_MONITOR) 69 | //Slice 70 | #define SOUND_MASK_INPUT \ 71 | (SOUND_MASK_LINE | SOUND_MASK_MIC | SOUND_MASK_CD | SOUND_MASK_MONITOR) 72 | // 73 | 74 | #define SOUND_DEVICE_NAMES { \ 75 | "vol", "bass", "treble", "synth", "pcm", "speaker", "line", \ 76 | "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \ 77 | "line1", "line2", "line3", "dig1", "dig2", "dig3", \ 78 | "phin", "phout", "video", "radio", "monitor", "out_mix" } 79 | 80 | #define AFMT_S16_LE 0x00000010 /* Little endian signed 16-bit */ 81 | #define AFMT_AC3 0x00000400 /* Dolby Digital AC3 */ 82 | #define AFMT_S32_LE 0x00001000 /* Little endian signed 32-bit */ 83 | #define AFMT_S24_LE 0x00010000 /* [unused] Little endian signed 24-bit */ 84 | #define AFMT_STEREO 0x10000000 /* can do/want stereo */ 85 | 86 | /* 87 | * We're simply using unused, contiguous bits from various AFMT_ definitions. 88 | * ~(0xb00ff7ff) 89 | */ 90 | #define AFMT_ENCODING_MASK 0xf00fffff 91 | #define AFMT_CHANNEL_MASK 0x01f00000 92 | #define AFMT_CHANNEL_SHIFT 20 93 | #define AFMT_EXTCHANNEL_MASK 0x0e000000 94 | #define AFMT_EXTCHANNEL_SHIFT 25 95 | 96 | #define AFMT_ENCODING(v) ((v) & AFMT_ENCODING_MASK) 97 | 98 | #define AFMT_EXTCHANNEL(v) (((v) & AFMT_EXTCHANNEL_MASK) >> \ 99 | AFMT_EXTCHANNEL_SHIFT) 100 | 101 | #define AFMT_CHANNEL(v) (((v) & AFMT_CHANNEL_MASK) >> \ 102 | AFMT_CHANNEL_SHIFT) 103 | 104 | 105 | #define SND_FORMAT(f, c, m) (AFMT_ENCODING(f) | \ 106 | (((c) << AFMT_CHANNEL_SHIFT) & \ 107 | AFMT_CHANNEL_MASK) | \ 108 | (((m) << AFMT_EXTCHANNEL_SHIFT) & \ 109 | AFMT_EXTCHANNEL_MASK)) 110 | 111 | #define AFMT_ALIGN(v) (AFMT_BPS(v) * AFMT_CHANNEL(v)) 112 | 113 | #define AFMT_U8_NE AFMT_U8 114 | #define AFMT_S8_NE AFMT_S8 115 | 116 | #undef AFMT_S16_NE 117 | 118 | #define AFMT_S16_NE AFMT_S16_LE 119 | #define AFMT_S24_NE AFMT_S24_LE 120 | #define AFMT_S32_NE AFMT_S32_LE 121 | #define AFMT_U16_NE AFMT_U16_LE 122 | #define AFMT_U24_NE AFMT_U24_LE 123 | #define AFMT_U32_NE AFMT_U32_LE 124 | #define AFMT_S16_OE AFMT_S16_BE 125 | #define AFMT_S24_OE AFMT_S24_BE 126 | #define AFMT_S32_OE AFMT_S32_BE 127 | #define AFMT_U16_OE AFMT_U16_BE 128 | #define AFMT_U24_OE AFMT_U24_BE 129 | #define AFMT_U32_OE AFMT_U32_BE 130 | #endif -------------------------------------------------------------------------------- /VoodooHDA/PCMBlitterLib.cpp: -------------------------------------------------------------------------------- 1 | #include "License.h" 2 | 3 | #include "PCMBlitterLibDispatch.h" 4 | 5 | /* 6 | This file contains portable int<->float blitters. 7 | */ 8 | 9 | #if !TARGET_OS_MAC 10 | // we have optimized versions of most of these for Mac OS 11 | 12 | #pragma mark - 13 | #pragma mark 16-bit 14 | // ____________________________________________________________________________ 15 | // 16 | void NativeInt16ToFloat32_Portable(const SInt16 *src, Float32 *dest, unsigned int count) 17 | { 18 | TIntToFloatBlitter blitter(16); 19 | 20 | blitter.Convert(src, dest, count); 21 | } 22 | 23 | void SwapInt16ToFloat32_Portable(const SInt16 *src, Float32 *dest, unsigned int count) 24 | { 25 | TIntToFloatBlitter blitter(16); 26 | 27 | blitter.Convert(src, dest, count); 28 | } 29 | 30 | void Float32ToNativeInt16_Portable(const Float32 *src, SInt16 *dest, unsigned int count) 31 | { 32 | TFloatToIntBlitter blitter(16); 33 | 34 | blitter.Convert(src, dest, count); 35 | } 36 | 37 | void Float32ToSwapInt16_Portable(const Float32 *src, SInt16 *dest, unsigned int count) 38 | { 39 | TFloatToIntBlitter blitter(16); 40 | 41 | blitter.Convert(src, dest, count); 42 | } 43 | 44 | #pragma mark - 45 | #pragma mark 32-bit 46 | // ____________________________________________________________________________ 47 | // 48 | void NativeInt32ToFloat32_Portable(const SInt32 *src, Float32 *dest, unsigned int count) 49 | { 50 | TIntToFloatBlitter blitter(32); 51 | 52 | blitter.Convert(src, dest, count); 53 | } 54 | 55 | void SwapInt32ToFloat32_Portable(const SInt32 *src, Float32 *dest, unsigned int count) 56 | { 57 | TIntToFloatBlitter blitter(32); 58 | 59 | blitter.Convert(src, dest, count); 60 | } 61 | 62 | void Float32ToNativeInt32_Portable(const Float32 *src, SInt32 *dest, unsigned int count) 63 | { 64 | TFloatToIntBlitter blitter(32); 65 | 66 | blitter.Convert(src, dest, count); 67 | } 68 | 69 | void Float32ToSwapInt32_Portable(const Float32 *src, SInt32 *dest, unsigned int count) 70 | { 71 | TFloatToIntBlitter blitter(32); 72 | 73 | blitter.Convert(src, dest, count); 74 | } 75 | 76 | #pragma mark - 77 | #pragma mark 24-bit 78 | 79 | // ____________________________________________________________________________ 80 | // 81 | void Float32ToNativeInt24_Portable(const Float32 *src, UInt8 *vdest, unsigned int nSamples) 82 | { 83 | UInt32 *dest = (UInt32 *)vdest; 84 | double maxInt32 = 2147483648.0; // 1 << 31 85 | double round = 128.0; 86 | double max32 = maxInt32 - 1.0 - round; 87 | double min32 = -2147483648.0; 88 | int shift = 8, count; 89 | 90 | SET_ROUNDMODE 91 | 92 | count = nSamples >> 2; 93 | while (count--) { 94 | double f1 = src[0] * maxInt32 + round; 95 | double f2 = src[1] * maxInt32 + round; 96 | double f3 = src[2] * maxInt32 + round; 97 | double f4 = src[3] * maxInt32 + round; 98 | SInt32 i1 = FloatToInt(f1, min32, max32) >> shift; 99 | SInt32 i2 = FloatToInt(f2, min32, max32) >> shift; 100 | SInt32 i3 = FloatToInt(f3, min32, max32) >> shift; 101 | SInt32 i4 = FloatToInt(f4, min32, max32) >> shift; 102 | // memory: a3 a2 a1 b3 register: b3 a1 a2 a3 103 | dest[0] = (i1 & 0xFFFFFF) | ((i2 & 0xFF) << 24); 104 | // memory: b2 b1 c3 c2 register: c2 c3 b1 b2 105 | dest[1] = (i3 << 16) | ((i2 >> 8) & 0xFFFF); 106 | // memory: c1 d3 d2 d1 register: d1 d2 d3 c1 107 | dest[2] = ((i3 >> 16) & 0xFF) | ((i4 & 0xFFFFFF) << 8); 108 | src += 4; 109 | dest += 3; 110 | } 111 | UInt8 *p = (UInt8 *)dest; 112 | count = nSamples & 3; 113 | while (count--) { 114 | double f1 = *src++ * maxInt32 + round; 115 | SInt32 i1 = FloatToInt(f1, min32, max32) >> shift; 116 | p[0] = UInt8(i1); 117 | p[1] = UInt8(i1 >> 8); 118 | p[2] = UInt8(i1 >> 16); 119 | p += 3; 120 | } 121 | RESTORE_ROUNDMODE 122 | }; 123 | 124 | #endif // !TARGET_OS_MAC 125 | 126 | #if !TARGET_OS_MAC || TARGET_CPU_X86 127 | // These are needed for both non-MacOS and MacOS/X86 128 | 129 | // ____________________________________________________________________________ 130 | // 131 | void Float32ToSwapInt24_Portable(const Float32 *src, UInt8 *vdest, unsigned int nSamples) 132 | { 133 | UInt32 *dest = (UInt32 *)vdest; 134 | double maxInt32 = 2147483648.0; // 1 << 31 135 | double round = 128.0; 136 | double max32 = maxInt32 - 1.0 - round; 137 | double min32 = -2147483648.0; 138 | int shift = 8, count; 139 | 140 | SET_ROUNDMODE 141 | 142 | count = nSamples >> 2; 143 | while (count--) { 144 | double f1 = src[0] * maxInt32 + round; 145 | double f2 = src[1] * maxInt32 + round; 146 | double f3 = src[2] * maxInt32 + round; 147 | double f4 = src[3] * maxInt32 + round; 148 | SInt32 i1 = FloatToInt(f1, min32, max32) >> shift; 149 | SInt32 i2 = FloatToInt(f2, min32, max32) >> shift; 150 | SInt32 i3 = FloatToInt(f3, min32, max32) >> shift; 151 | SInt32 i4 = FloatToInt(f4, min32, max32) >> shift; 152 | // memory: a1 a2 a3 b1 register: b1 a3 a2 a1 153 | dest[0] = ((i2 & 0x00FF0000) << 8) 154 | | ((i1 & 0x000000FF) << 16) 155 | | (i1 & 0x0000FF00) 156 | | ((i1 & 0x00FF0000) >> 16); 157 | // memory: b2 b3 c1 c2 register: c2 c1 b3 b2 158 | dest[1] = ((i3 & 0x0000FF00) << 16) 159 | | (i3 & 0x00FF0000) 160 | | ((i2 & 0x000000FF) << 8) 161 | | ((i2 & 0x0000FF00) >> 8); 162 | // memory: c3 d1 d2 d3 register: d3 d2 d1 c3 163 | dest[2] = ((i4 & 0x000000FF) << 24) 164 | | ((i4 & 0x0000FF00) << 8) 165 | | ((i4 & 0x00FF0000) >> 8) 166 | | (i3 & 0x000000FF); 167 | src += 4; 168 | dest += 3; 169 | } 170 | UInt8 *p = (UInt8 *)dest; 171 | count = nSamples & 3; 172 | while (count--) { 173 | double f1 = *src++ * maxInt32 + round; 174 | SInt32 i1 = FloatToInt(f1, min32, max32) >> shift; 175 | p[0] = UInt8(i1 >> 16); 176 | p[1] = UInt8(i1 >> 8); 177 | p[2] = UInt8(i1); 178 | p += 3; 179 | } 180 | RESTORE_ROUNDMODE 181 | } 182 | 183 | // ____________________________________________________________________________ 184 | // 185 | void NativeInt24ToFloat32_Portable(const UInt8 *vsrc, Float32 *dest, unsigned int count) 186 | { 187 | const UInt32 *src = (const UInt32 *)vsrc; 188 | Float32 scale = (1. / 2147483648.0); 189 | int nSamples4 = count >> 2; 190 | 191 | while (nSamples4--) { 192 | SInt32 lv1 = src[0]; // BE: a1 a2 a3 b1 LE memory: a3 a2 a1 b3 register: b3 a1 a2 a3 193 | SInt32 lv2 = src[1]; // BE: b2 b3 c1 c2 LE memory: b2 b1 c3 c2 register: c2 c3 b1 b2 194 | SInt32 lv3 = src[2]; // BE: c3 d1 d2 d3 LE memory: c1 d3 d2 d1 register: d1 d2 d3 c1 195 | SInt32 lv4; 196 | 197 | // printf("%08X %08X %08X => ", lv1, lv2, lv3); 198 | lv4 = lv3 & 0xFFFFFF00; 199 | lv3 = (lv3 << 24) | ((lv2 & 0xFFFF0000) >> 8); 200 | lv2 = (lv2 << 16) | ((lv1 & 0xFF000000) >> 16); 201 | lv1 = (lv1 << 8); 202 | // printf("%08X %08X %08X %08X\n", lv1, lv2, lv3, lv4); 203 | 204 | dest[0] = lv1 * scale; 205 | dest[1] = lv2 * scale; 206 | dest[2] = lv3 * scale; 207 | dest[3] = lv4 * scale; 208 | 209 | src += 3; 210 | dest += 4; 211 | } 212 | int nSamples = count & 3; 213 | UInt8 *p = (UInt8 *)src; 214 | while (nSamples--) { 215 | SInt32 lv = p[0] | (p[1] << 8) | (p[2] << 16); 216 | lv <<= 8; 217 | p += 3; 218 | *dest++ = lv * scale; 219 | } 220 | } 221 | 222 | // ____________________________________________________________________________ 223 | // 224 | void SwapInt24ToFloat32_Portable(const UInt8 *vsrc, Float32 *dest, unsigned int count) 225 | { 226 | const UInt32 *src = (const UInt32 *)vsrc; 227 | Float32 scale = (1. / 2147483648.0); 228 | int nSamples4 = count >> 2; 229 | 230 | while (nSamples4--) { 231 | SInt32 lv1 = src[0]; // BE: a3 a2 a1 b3 LE memory: a1 a2 a3 b1 register: b1 a3 a2 a1 232 | SInt32 lv2 = src[1]; // BE: b2 b1 c3 c2 LE memory: b2 b3 c1 c2 register: c2 c1 b3 b2 233 | SInt32 lv3 = src[2]; // BE: c1 d3 d2 d1 LE memory: c3 d1 d2 d3 register: d3 d2 d1 c3 234 | SInt32 lv4; 235 | 236 | // printf("%08X %08X %08X => ", lv1, lv2, lv3); 237 | lv4 = ((lv3 & 0x0000FF00) << 16) 238 | | (lv3 & 0x00FF0000) 239 | | ((lv3 & 0xFF000000) >> 16); 240 | lv3 = ((lv2 & 0x00FF0000) << 8) 241 | | ((lv2 & 0xFF000000) >> 8) 242 | | ((lv3 & 0x000000FF) << 8); 243 | lv2 = (lv1 & 0xFF000000) 244 | | ((lv2 & 0x000000FF) << 16) 245 | | (lv2 & 0x0000FF00); 246 | lv1 = (lv1 << 24) 247 | | ((lv1 & 0x0000FF00) << 8) 248 | | ((lv1 & 0x00FF0000) >> 8); 249 | // printf("%08X %08X %08X %08X\n", lv1, lv2, lv3, lv4); 250 | 251 | dest[0] = lv1 * scale; 252 | dest[1] = lv2 * scale; 253 | dest[2] = lv3 * scale; 254 | dest[3] = lv4 * scale; 255 | 256 | src += 3; 257 | dest += 4; 258 | } 259 | int nSamples = count & 3; 260 | UInt8 *p = (UInt8 *)src; 261 | while (nSamples--) { 262 | #if TARGET_RT_LITTLE_ENDIAN 263 | SInt32 lv = (p[0] << 16) | (p[1] << 8) | p[2]; 264 | #else 265 | SInt32 lv = p[0] | (p[1] << 8) | (p[2] << 16); 266 | #endif 267 | lv <<= 8; 268 | p += 3; 269 | *dest++ = lv * scale; 270 | } 271 | } 272 | #endif 273 | 274 | -------------------------------------------------------------------------------- /VoodooHDA/PCMBlitterLib.h: -------------------------------------------------------------------------------- 1 | #include "License.h" 2 | 3 | #ifndef __PCMBlitterLib_h__ 4 | #define __PCMBlitterLib_h__ 5 | 6 | #include 7 | 8 | typedef float Float32; 9 | typedef double Float64; 10 | 11 | // ============================================================================ 12 | // 13 | // N.B. These functions should not be called directly; use the interfaces in 14 | // PCMBlitterLibDispatch.h. 15 | // 16 | // ============================================================================ 17 | 18 | typedef const void *ConstVoidPtr; 19 | 20 | #pragma mark - 21 | #pragma mark Utilities 22 | 23 | // our compiler does ALL floating point with SSE 24 | #define GETCSR() ({ int _result; asm volatile ("stmxcsr %0" : "=m" (*&_result)); /*return*/ _result; }) 25 | #define SETCSR(a) { int _temp = a; asm volatile("ldmxcsr %0" : : "m" (*&_temp)); } 26 | 27 | #define DISABLE_DENORMALS int _savemxcsr = GETCSR(); SETCSR(_savemxcsr | 0x8040); 28 | #define RESTORE_DENORMALS SETCSR(_savemxcsr); 29 | 30 | #define ROUNDMODE_NEG_INF int _savemxcsr = GETCSR(); SETCSR((_savemxcsr & ~0x6000) | 0x2000); 31 | #define RESTORE_ROUNDMODE SETCSR(_savemxcsr); 32 | #define SET_ROUNDMODE ROUNDMODE_NEG_INF 33 | 34 | // ____________________________________________________________________________ 35 | // 36 | // FloatToInt 37 | // N.B. Functions which use this should invoke SET_ROUNDMODE / RESTORE_ROUNDMODE. 38 | static inline SInt32 FloatToInt(double inf, __unused double min32, double max32) 39 | { 40 | if (inf >= max32) return 0x7FFFFFFF; 41 | return (SInt32)inf; 42 | } 43 | 44 | #ifdef __cplusplus 45 | #pragma mark - 46 | #pragma mark C++ templates 47 | // ____________________________________________________________________________ 48 | // 49 | // PCMBlitter 50 | class PCMBlitter { 51 | public: 52 | virtual void Convert(const void *vsrc, void *vdest, unsigned int nSamples) = 0; 53 | // nSamples = nFrames * nChannels 54 | virtual ~PCMBlitter() { } 55 | }; 56 | 57 | // ____________________________________________________________________________ 58 | // 59 | // Types for use in templates 60 | class PCMFloat32 { 61 | public: 62 | typedef Float32 value_type; 63 | 64 | static value_type load(const value_type *p) { return *p; } 65 | static void store(value_type *p, float val) { *p = val; } 66 | }; 67 | 68 | class PCMFloat64 { 69 | public: 70 | typedef Float64 value_type; 71 | 72 | static value_type load(const value_type *p) { return *p; } 73 | static void store(value_type *p, value_type val) { *p = val; } 74 | }; 75 | 76 | class PCMSInt8 { 77 | public: 78 | typedef SInt8 value_type; 79 | 80 | static value_type load(const value_type *p) { return *p; } 81 | static void store(value_type *p, int val) { *p = val; } 82 | }; 83 | 84 | class PCMUInt8 { 85 | public: 86 | typedef SInt8 value_type; // signed so that sign-extending works right 87 | 88 | static value_type load(const value_type *p) { return *p ^ 0x80; } 89 | static void store(value_type *p, int val) { *p = val ^ 0x80; } 90 | }; 91 | 92 | class PCMSInt16Native { 93 | public: 94 | typedef SInt16 value_type; 95 | 96 | static value_type load(const value_type *p) { return *p; } 97 | static void store(value_type *p, int val) { *p = val; } 98 | }; 99 | 100 | class PCMSInt16Swap { 101 | public: 102 | typedef SInt16 value_type; 103 | 104 | static value_type load(const value_type *p) 105 | { 106 | return OSReadSwapInt16(p, 0); 107 | } 108 | static void store(value_type *p, int val) 109 | { 110 | OSWriteSwapInt16(p, 0, val); 111 | } 112 | }; 113 | 114 | class PCMSInt32Native { 115 | public: 116 | typedef SInt32 value_type; 117 | 118 | static value_type load(const value_type *p) { return *p; } 119 | static void store(value_type *p, int val) { *p = val; } 120 | }; 121 | 122 | class PCMSInt32Swap { 123 | public: 124 | typedef UInt32 value_type; 125 | 126 | static value_type load(const value_type *p) 127 | { 128 | return OSReadSwapInt32(p, 0); 129 | } 130 | static void store(value_type *p, int val) 131 | { 132 | *p = val; 133 | OSWriteSwapInt32(p, 0, val); 134 | } 135 | }; 136 | 137 | class PCMFloat64Swap { 138 | public: 139 | typedef Float64 value_type; 140 | 141 | static value_type load(const value_type *vp) { 142 | union { 143 | Float64 d; 144 | UInt32 i[2]; 145 | } u; 146 | UInt32 *p = (UInt32 *)vp; 147 | u.i[0] = PCMSInt32Swap::load(p + 1); 148 | u.i[1] = PCMSInt32Swap::load(p + 0); 149 | return u.d; 150 | } 151 | static void store(value_type *vp, value_type val) { 152 | union { 153 | Float64 d; 154 | UInt32 i[2]; 155 | } u; 156 | u.d = val; 157 | UInt32 *p = (UInt32 *)vp; 158 | PCMSInt32Swap::store(p + 1, u.i[0]); 159 | PCMSInt32Swap::store(p + 0, u.i[1]); 160 | } 161 | }; 162 | 163 | // ____________________________________________________________________________ 164 | // 165 | // FloatToIntBlitter 166 | class FloatToIntBlitter : public PCMBlitter { 167 | public: 168 | FloatToIntBlitter(int bitDepth) 169 | { 170 | int rightShift = 32 - bitDepth; 171 | mShift = rightShift; 172 | mRound = (rightShift > 0) ? double(1L << (rightShift - 1)) : 0.; 173 | } 174 | 175 | protected: 176 | double mRound; 177 | int mShift; // how far to shift a 32 bit value right 178 | }; 179 | 180 | // ____________________________________________________________________________ 181 | // 182 | // TFloatToIntBlitter 183 | // only used for: 8-bit, low-aligned, or non-PPC 184 | template 185 | class TFloatToIntBlitter : public FloatToIntBlitter { 186 | public: 187 | typedef typename FloatType::value_type float_val; 188 | typedef typename IntType::value_type int_val; 189 | 190 | TFloatToIntBlitter(int bitDepth) : FloatToIntBlitter(bitDepth) { } 191 | 192 | virtual void Convert(const void *vsrc, void *vdest, unsigned int nSamples) 193 | { 194 | const float_val *src = (const float_val *)vsrc; 195 | int_val *dest = (int_val *)vdest; 196 | double maxInt32 = 2147483648.0; // 1 << 31 197 | double round = mRound; 198 | double max32 = maxInt32 - 1.0 - round; 199 | double min32 = -2147483648.0; 200 | int shift = mShift, count; 201 | double f1, f2, f3, f4; 202 | int i1, i2, i3, i4; 203 | 204 | SET_ROUNDMODE 205 | 206 | if (nSamples >= 8) { 207 | f1 = FloatType::load(src + 0); 208 | 209 | f2 = FloatType::load(src + 1); 210 | f1 = f1 * maxInt32 + round; 211 | 212 | f3 = FloatType::load(src + 2); 213 | f2 = f2 * maxInt32 + round; 214 | i1 = FloatToInt(f1, min32, max32); 215 | 216 | src += 3; 217 | 218 | nSamples -= 4; 219 | count = nSamples >> 2; 220 | nSamples &= 3; 221 | 222 | while (count--) { 223 | f4 = FloatType::load(src + 0); 224 | f3 = f3 * maxInt32 + round; 225 | i2 = FloatToInt(f2, min32, max32); 226 | IntType::store(dest + 0, i1 >> shift); 227 | 228 | f1 = FloatType::load(src + 1); 229 | f4 = f4 * maxInt32 + round; 230 | i3 = FloatToInt(f3, min32, max32); 231 | IntType::store(dest + 1, i2 >> shift); 232 | 233 | f2 = FloatType::load(src + 2); 234 | f1 = f1 * maxInt32 + round; 235 | i4 = FloatToInt(f4, min32, max32); 236 | IntType::store(dest + 2, i3 >> shift); 237 | 238 | f3 = FloatType::load(src + 3); 239 | f2 = f2 * maxInt32 + round; 240 | i1 = FloatToInt(f1, min32, max32); 241 | IntType::store(dest + 3, i4 >> shift); 242 | 243 | src += 4; 244 | dest += 4; 245 | } 246 | 247 | f4 = FloatType::load(src); 248 | f3 = f3 * maxInt32 + round; 249 | i2 = FloatToInt(f2, min32, max32); 250 | IntType::store(dest + 0, i1 >> shift); 251 | 252 | f4 = f4 * maxInt32 + round; 253 | i3 = FloatToInt(f3, min32, max32); 254 | IntType::store(dest + 1, i2 >> shift); 255 | 256 | i4 = FloatToInt(f4, min32, max32); 257 | IntType::store(dest + 2, i3 >> shift); 258 | 259 | IntType::store(dest + 3, i4 >> shift); 260 | 261 | src += 1; 262 | dest += 4; 263 | } 264 | 265 | count = nSamples; 266 | while (count--) { 267 | f1 = FloatType::load(src) * maxInt32 + round; 268 | i1 = FloatToInt(f1, min32, max32) >> shift; 269 | IntType::store(dest, i1); 270 | src += 1; 271 | dest += 1; 272 | } 273 | RESTORE_ROUNDMODE 274 | } 275 | }; 276 | 277 | // ____________________________________________________________________________ 278 | // 279 | // IntToFloatBlitter 280 | class IntToFloatBlitter : public PCMBlitter { 281 | public: 282 | IntToFloatBlitter(int bitDepth) : 283 | mBitDepth(bitDepth) 284 | { 285 | mScale = static_cast(1.0 / float(1UL << (bitDepth - 1))); 286 | } 287 | 288 | Float32 mScale; 289 | UInt32 mBitDepth; 290 | }; 291 | 292 | // ____________________________________________________________________________ 293 | // 294 | // TIntToFloatBlitter - only used for non-PPC 295 | // On PPC these are roughly only half as fast as the optimized versions 296 | template 297 | class TIntToFloatBlitter : public IntToFloatBlitter { 298 | public: 299 | typedef typename FloatType::value_type float_val; 300 | typedef typename IntType::value_type int_val; 301 | 302 | TIntToFloatBlitter(int bitDepth) : IntToFloatBlitter(bitDepth) { } 303 | 304 | virtual void Convert(const void *vsrc, void *vdest, unsigned int nSamples) 305 | { 306 | const int_val *src = (const int_val *)vsrc; 307 | float_val *dest = (float_val *)vdest; 308 | int count = nSamples; 309 | Float32 scale = mScale; 310 | int_val i0, i1, i2, i3; 311 | float_val f0, f1, f2, f3; 312 | 313 | /* 314 | $i = IntType::load(src); ++src; 315 | $f = $i; 316 | $f *= scale; 317 | FloatType::store(dest, $f); ++dest; 318 | */ 319 | 320 | if (count >= 4) { 321 | // Cycle 1 322 | i0 = IntType::load(src); ++src; 323 | 324 | // Cycle 2 325 | i1 = IntType::load(src); ++src; 326 | f0 = i0; 327 | 328 | // Cycle 3 329 | i2 = IntType::load(src); ++src; 330 | f1 = i1; 331 | f0 *= scale; 332 | 333 | // Cycle 4 334 | i3 = IntType::load(src); ++src; 335 | f2 = i2; 336 | f1 *= scale; 337 | FloatType::store(dest, f0); ++dest; 338 | 339 | count -= 4; 340 | int loopCount = count / 4; 341 | count -= 4 * loopCount; 342 | 343 | while (loopCount--) { 344 | // Cycle A 345 | i0 = IntType::load(src); ++src; 346 | f3 = i3; 347 | f2 *= scale; 348 | FloatType::store(dest, f1); ++dest; 349 | 350 | // Cycle B 351 | i1 = IntType::load(src); ++src; 352 | f0 = i0; 353 | f3 *= scale; 354 | FloatType::store(dest, f2); ++dest; 355 | 356 | // Cycle C 357 | i2 = IntType::load(src); ++src; 358 | f1 = i1; 359 | f0 *= scale; 360 | FloatType::store(dest, f3); ++dest; 361 | 362 | // Cycle D 363 | i3 = IntType::load(src); ++src; 364 | f2 = i2; 365 | f1 *= scale; 366 | FloatType::store(dest, f0); ++dest; 367 | } 368 | 369 | // Cycle 3 370 | f3 = i3; 371 | f2 *= scale; 372 | FloatType::store(dest, f1); ++dest; 373 | 374 | // Cycle 2 375 | f3 *= scale; 376 | FloatType::store(dest, f2); ++dest; 377 | 378 | // Cycle 1 379 | FloatType::store(dest, f3); ++dest; 380 | } 381 | 382 | while (count--) { 383 | i0 = IntType::load(src); ++src; 384 | f0 = i0; 385 | f0 *= scale; 386 | FloatType::store(dest, f0); ++dest; 387 | } 388 | } 389 | }; 390 | #endif // __cplusplus 391 | 392 | #ifdef __cplusplus 393 | extern "C" { 394 | #endif 395 | 396 | #pragma mark - 397 | #pragma mark X86 SSE2 398 | // ____________________________________________________________________________________ 399 | // X86 SSE2 400 | void NativeInt16ToFloat32_X86(const SInt16 *src, Float32 *dest, unsigned int count); 401 | void SwapInt16ToFloat32_X86(const SInt16 *src, Float32 *dest, unsigned int count); 402 | void Float32ToNativeInt16_X86(const Float32 *src, SInt16 *dest, unsigned int count); 403 | void Float32ToSwapInt16_X86(const Float32 *src, SInt16 *dest, unsigned int count); 404 | 405 | void Float32ToNativeInt24_X86(const Float32 *src, UInt8 *dst, unsigned int numToConvert); 406 | void Float32ToSwapInt24_X86(const Float32 *src, UInt8 *dst, unsigned int numToConvert); 407 | 408 | void NativeInt32ToFloat32_X86(const SInt32 *src, Float32 *dest, unsigned int count); 409 | void SwapInt32ToFloat32_X86(const SInt32 *src, Float32 *dest, unsigned int count); 410 | void Float32ToNativeInt32_X86(const Float32 *src, SInt32 *dest, unsigned int count); 411 | void Float32ToSwapInt32_X86(const Float32 *src, SInt32 *dest, unsigned int count); 412 | 413 | #pragma mark - 414 | #pragma mark Portable 415 | // ____________________________________________________________________________________ 416 | // Portable 417 | void Float32ToNativeInt16_Portable(const Float32 *src, SInt16 *dest, unsigned int count); 418 | void Float32ToSwapInt16_Portable(const Float32 *src, SInt16 *dest, unsigned int count); 419 | void NativeInt16ToFloat32_Portable(const SInt16 *src, Float32 *dest, unsigned int count); 420 | void SwapInt16ToFloat32_Portable(const SInt16 *src, Float32 *dest, unsigned int count); 421 | 422 | void Float32ToNativeInt24_Portable(const Float32 *src, UInt8 *dest, unsigned int count); 423 | void Float32ToSwapInt24_Portable(const Float32 *src, UInt8 *dest, unsigned int count); 424 | void NativeInt24ToFloat32_Portable(const UInt8 *src, Float32 *dest, unsigned int count); 425 | void SwapInt24ToFloat32_Portable(const UInt8 *src, Float32 *dest, unsigned int count); 426 | 427 | void Float32ToNativeInt32_Portable(const Float32 *src, SInt32 *dest, unsigned int count); 428 | void Float32ToSwapInt32_Portable(const Float32 *src, SInt32 *dest, unsigned int count); 429 | void NativeInt32ToFloat32_Portable(const SInt32 *src, Float32 *dest, unsigned int count); 430 | void SwapInt32ToFloat32_Portable(const SInt32 *src, Float32 *dest, unsigned int count); 431 | 432 | #ifdef __cplusplus 433 | }; 434 | #endif 435 | 436 | #endif // __PCMBlitterLib_h__ 437 | -------------------------------------------------------------------------------- /VoodooHDA/PCMBlitterLibDispatch.h: -------------------------------------------------------------------------------- 1 | #include "License.h" 2 | 3 | #ifndef __PCMBlitterLibDispatch_h__ 4 | #define __PCMBlitterLibDispatch_h__ 5 | 6 | #include "PCMBlitterLib.h" 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | /* 13 | PCM int<->float library. 14 | 15 | These are the high-level interfaces which dispatch to (often processor-specific) optimized routines. 16 | Avoid calling the lower-level routines directly; they are subject to renaming etc. 17 | 18 | There are two sets of interfaces: 19 | [1] integer formats are either "native" or "swap" 20 | [2] integer formats are "BE" or "LE", signifying big or little endian. These are simply macros for the other functions. 21 | 22 | All floating point numbers are 32-bit native-endian. 23 | Supports 16, 24, and 32-bit integers, big and little endian. 24 | 25 | 32-bit floats and ints must be 4-byte aligned. 26 | 24-bit samples have no alignment requirements. 27 | 16-bit ints must be 2-byte aligned. 28 | 29 | On Intel, some implementations assume SSE2. 30 | */ 31 | 32 | inline void NativeInt16ToFloat32(const SInt16 *src, Float32 *dest, unsigned int count) 33 | { 34 | NativeInt16ToFloat32_X86(src, dest, count); 35 | } 36 | 37 | inline void SwapInt16ToFloat32(const SInt16 *src, Float32 *dest, unsigned int count) 38 | { 39 | SwapInt16ToFloat32_X86(src, dest, count); 40 | } 41 | 42 | inline void NativeInt24ToFloat32(const UInt8 *src, Float32 *dest, unsigned int count) 43 | { 44 | NativeInt24ToFloat32_Portable(src, dest, count); 45 | } 46 | 47 | inline void SwapInt24ToFloat32(const UInt8 *src, Float32 *dest, unsigned int count) 48 | { 49 | SwapInt24ToFloat32_Portable(src, dest, count); 50 | } 51 | 52 | inline void NativeInt32ToFloat32(const SInt32 *src, Float32 *dest, unsigned int count) 53 | { 54 | NativeInt32ToFloat32_X86(src, dest, count); 55 | } 56 | 57 | inline void SwapInt32ToFloat32(const SInt32 *src, Float32 *dest, unsigned int count) 58 | { 59 | SwapInt32ToFloat32_X86(src, dest, count); 60 | } 61 | 62 | 63 | inline void Float32ToNativeInt16(const Float32 *src, SInt16 *dest, unsigned int count) 64 | { 65 | Float32ToNativeInt16_X86(src, dest, count); 66 | } 67 | 68 | inline void Float32ToSwapInt16(const Float32 *src, SInt16 *dest, unsigned int count) 69 | { 70 | Float32ToSwapInt16_X86(src, dest, count); 71 | } 72 | 73 | inline void Float32ToNativeInt24(const Float32 *src, UInt8 *dest, unsigned int count) 74 | { 75 | Float32ToNativeInt24_X86(src, dest, count); 76 | } 77 | 78 | inline void Float32ToSwapInt24(const Float32 *src, UInt8 *dest, unsigned int count) 79 | { 80 | Float32ToSwapInt24_Portable(src, dest, count); 81 | } 82 | 83 | inline void Float32ToNativeInt32(const Float32 *src, SInt32 *dest, unsigned int count) 84 | { 85 | Float32ToNativeInt32_X86(src, dest, count); 86 | } 87 | 88 | inline void Float32ToSwapInt32(const Float32 *src, SInt32 *dest, unsigned int count) 89 | { 90 | Float32ToSwapInt32_X86(src, dest, count); 91 | } 92 | 93 | // Alternate names for the above: these explicitly specify the endianism of the integer format instead of "native"/"swap" 94 | #pragma mark - 95 | #pragma mark Alternate names 96 | 97 | #define LEInt16ToFloat32 NativeInt16ToFloat32 98 | #define BEInt16ToFloat32 SwapInt16ToFloat32 99 | #define LEInt24ToFloat32 NativeInt24ToFloat32 100 | #define BEInt24ToFloat32 SwapInt24ToFloat32 101 | #define LEInt32ToFloat32 NativeInt32ToFloat32 102 | #define BEInt32ToFloat32 SwapInt32ToFloat32 103 | 104 | #define Float32ToLEInt16 Float32ToNativeInt16 105 | #define Float32ToBEInt16 Float32ToSwapInt16 106 | #define Float32ToLEInt24 Float32ToNativeInt24 107 | #define Float32ToBEInt24 Float32ToSwapInt24 108 | #define Float32ToLEInt32 Float32ToNativeInt32 109 | #define Float32ToBEInt32 Float32ToSwapInt32 110 | 111 | #ifdef __cplusplus 112 | }; 113 | #endif 114 | 115 | #endif // __PCMBlitterLibDispatch_h__ 116 | -------------------------------------------------------------------------------- /VoodooHDA/Private.h: -------------------------------------------------------------------------------- 1 | #include "License.h" 2 | 3 | #ifndef _PRIVATE_H 4 | #define _PRIVATE_H 5 | 6 | #include "Registers.h" 7 | #include "OssCompat.h" 8 | #include "Shared.h" 9 | 10 | /* Miscellaneous defines */ 11 | 12 | #define HDAC_DMA_ALIGNMENT 128 13 | #define HDAC_CODEC_MAX 16 14 | 15 | // xxx: check what these flags were for 16 | 17 | #define HDAC_F_DMA_NOCACHE 0x00000001 18 | #define HDAC_F_MSI 0x00000002 19 | 20 | #define HDAC_UNSOLQ_MAX 64 21 | #define HDAC_UNSOLQ_READY 0 22 | #define HDAC_UNSOLQ_BUSY 1 23 | 24 | /* Misc constants.. */ 25 | 26 | #define HDA_AMP_VOL_DEFAULT (-1) 27 | #define HDA_AMP_MUTE_DEFAULT (0xffffffff) 28 | #define HDA_AMP_MUTE_NONE (0) 29 | #define HDA_AMP_MUTE_LEFT (1 << 0) 30 | #define HDA_AMP_MUTE_RIGHT (1 << 1) 31 | #define HDA_AMP_MUTE_ALL (HDA_AMP_MUTE_LEFT | HDA_AMP_MUTE_RIGHT) 32 | 33 | #define HDA_AMP_LEFT_MUTED(v) ((v) & (HDA_AMP_MUTE_LEFT)) 34 | #define HDA_AMP_RIGHT_MUTED(v) (((v) & HDA_AMP_MUTE_RIGHT) >> 1) 35 | 36 | #define HDA_ADC_MONITOR (1 << 0) 37 | 38 | #define HDA_CTL_OUT 1 39 | #define HDA_CTL_IN 2 40 | 41 | /*********/ 42 | 43 | #define HDA_BDL_MIN 2 44 | #define HDA_BDL_MAX 256 45 | #define HDA_BDL_DEFAULT HDA_BDL_MIN 46 | 47 | #define HDA_BLK_MIN HDAC_DMA_ALIGNMENT 48 | #define HDA_BLK_ALIGN (~(HDA_BLK_MIN - 1)) 49 | 50 | #define HDA_BUFSZ_MIN 4096 51 | //#define HDA_BUFSZ_MAX 65536 52 | #define HDA_BUFSZ_MAX 262144 53 | #define HDA_BUFSZ_DEFAULT HDA_BUFSZ_MAX 54 | 55 | #define HDA_PARSE_MAXDEPTH 10 56 | 57 | #define HDAC_UNSOLTAG_EVENT_HP 0x00 58 | 59 | /* Helper Macros */ 60 | 61 | #define HDAC_ISDCTL(n) (_HDAC_ISDCTL((n), mInStreamsSup, mOutStreamsSup)) 62 | #define HDAC_ISDSTS(n) (_HDAC_ISDSTS((n), mInStreamsSup, mOutStreamsSup)) 63 | #define HDAC_ISDPICB(n) (_HDAC_ISDPICB((n), mInStreamsSup, mOutStreamsSup)) 64 | #define HDAC_ISDCBL(n) (_HDAC_ISDCBL((n), mInStreamsSup, mOutStreamsSup)) 65 | #define HDAC_ISDLVI(n) (_HDAC_ISDLVI((n), mInStreamsSup, mOutStreamsSup)) 66 | #define HDAC_ISDFIFOD(n) (_HDAC_ISDFIFOD((n), mInStreamsSup, mOutStreamsSup)) 67 | #define HDAC_ISDFMT(n) (_HDAC_ISDFMT((n), mInStreamsSup, mOutStreamsSup)) 68 | #define HDAC_ISDBDPL(n) (_HDAC_ISDBDPL((n), mInStreamsSup, mOutStreamsSup)) 69 | #define HDAC_ISDBDPU(n) (_HDAC_ISDBDPU((n), mInStreamsSup, mOutStreamsSup)) 70 | 71 | #define HDAC_OSDCTL(n) (_HDAC_OSDCTL((n), mInStreamsSup, mOutStreamsSup)) 72 | #define HDAC_OSDSTS(n) (_HDAC_OSDSTS((n), mInStreamsSup, mOutStreamsSup)) 73 | #define HDAC_OSDPICB(n) (_HDAC_OSDPICB((n), mInStreamsSup, mOutStreamsSup)) 74 | #define HDAC_OSDCBL(n) (_HDAC_OSDCBL((n), mInStreamsSup, mOutStreamsSup)) 75 | #define HDAC_OSDLVI(n) (_HDAC_OSDLVI((n), mInStreamsSup, mOutStreamsSup)) 76 | #define HDAC_OSDFIFOD(n) (_HDAC_OSDFIFOD((n), mInStreamsSup, mOutStreamsSup)) 77 | #define HDAC_OSDBDPL(n) (_HDAC_OSDBDPL((n), mInStreamsSup, mOutStreamsSup)) 78 | #define HDAC_OSDBDPU(n) (_HDAC_OSDBDPU((n), mInStreamsSup, mOutStreamsSup)) 79 | 80 | #define HDAC_BSDCTL(n) (_HDAC_BSDCTL((n), mInStreamsSup, mOutStreamsSup)) 81 | #define HDAC_BSDSTS(n) (_HDAC_BSDSTS((n), mInStreamsSup, mOutStreamsSup)) 82 | #define HDAC_BSDPICB(n) (_HDAC_BSDPICB((n), mInStreamsSup, mOutStreamsSup)) 83 | #define HDAC_BSDCBL(n) (_HDAC_BSDCBL((n), mInStreamsSup, mOutStreamsSup)) 84 | #define HDAC_BSDLVI(n) (_HDAC_BSDLVI((n), mInStreamsSup, mOutStreamsSup)) 85 | #define HDAC_BSDFIFOD(n) (_HDAC_BSDFIFOD((n), mInStreamsSup, mOutStreamsSup)) 86 | #define HDAC_BSDBDPL(n) (_HDAC_BSDBDPL((n), mInStreamsSup, mOutStreamsSup)) 87 | #define HDAC_BSDBDPU(n) (_HDAC_BSDBDPU((n), mInStreamsSup, mOutStreamsSup)) 88 | 89 | /*************************************************************************************/ 90 | /*************************************************************************************/ 91 | 92 | typedef int nid_t; 93 | 94 | typedef struct _DmaMemory DmaMemory; 95 | 96 | typedef struct _RirbResponse RirbResponse; 97 | typedef struct _CommandList CommandList; 98 | typedef struct _BdlEntry BdlEntry; 99 | 100 | typedef struct _ChannelCaps ChannelCaps; 101 | 102 | typedef struct _Widget Widget; 103 | typedef struct _AudioControl AudioControl; 104 | typedef struct _AudioAssoc AudioAssoc; 105 | typedef struct _PcmDevice PcmDevice; 106 | typedef struct _FunctionGroup FunctionGroup; 107 | typedef struct _Channel Channel; 108 | typedef struct _Codec Codec; 109 | 110 | class IODMACommand; 111 | 112 | typedef struct _DmaMemory { 113 | const char *description; 114 | IODMACommand *command; 115 | IOMemoryMap *map; 116 | UInt64 size; 117 | UInt64 physAddr; 118 | IOVirtualAddress virtAddr; 119 | } DmaMemory; 120 | 121 | /* Hold a response from a verb sent to a codec received via the rirb. */ 122 | typedef struct _RirbResponse { 123 | UInt32 response; 124 | UInt32 response_ex; 125 | } RirbResponse; 126 | 127 | #define HDAC_RIRB_RESPONSE_EX_SDATA_IN_MASK 0x0000000f 128 | #define HDAC_RIRB_RESPONSE_EX_SDATA_IN_OFFSET 0 129 | #define HDAC_RIRB_RESPONSE_EX_UNSOLICITED 0x00000010 130 | 131 | #define HDAC_RIRB_RESPONSE_EX_SDATA_IN(response_ex) \ 132 | (((response_ex) & HDAC_RIRB_RESPONSE_EX_SDATA_IN_MASK) >> \ 133 | HDAC_RIRB_RESPONSE_EX_SDATA_IN_OFFSET) 134 | 135 | /* This structure holds the list of verbs that are to be sent to the codec 136 | * via the corb and the responses received via the rirb. It's allocated by 137 | * the codec driver and is owned by it. */ 138 | typedef struct _CommandList { 139 | int numCommands; 140 | UInt32 *verbs; 141 | UInt32 *responses; 142 | } CommandList; 143 | 144 | typedef struct _BdlEntry { 145 | volatile UInt32 addrl; 146 | volatile UInt32 addrh; 147 | volatile UInt32 len; 148 | volatile UInt32 ioc; 149 | } __attribute__((__packed__)) BdlEntry; 150 | 151 | #define HDA_MAX_CONNS 32 152 | #define HDA_MAX_NAMELEN 32 153 | 154 | #define TRACE_DIR_NONE 0 155 | #define TRACE_DIR_IN 1 156 | #define TRACE_DIR_OUT 2 157 | #define TRACE_DIR_INOUT 3 158 | 159 | typedef struct _Widget { 160 | nid_t nid; 161 | int type; 162 | int enable; 163 | int nconns, selconn, connsenabled; 164 | int waspin; 165 | UInt32 pflags; 166 | int bindAssoc; 167 | int bindSeqMask; 168 | int ossdev; 169 | int sense; 170 | UInt32 ossmask; 171 | nid_t conns[HDA_MAX_CONNS]; 172 | UInt8 connsenable[HDA_MAX_CONNS]; 173 | char name[HDA_MAX_NAMELEN]; 174 | FunctionGroup *funcGroup; 175 | UInt8 traceDir; 176 | nid_t favoritDAC; 177 | struct { 178 | UInt32 widgetCap; 179 | UInt32 outAmpCap; 180 | UInt32 inAmpCap; 181 | UInt32 supStreamFormats; 182 | UInt32 supPcmSizeRates; 183 | UInt32 eapdBtl; 184 | } params; 185 | struct { 186 | UInt32 config; 187 | UInt32 cap; 188 | UInt32 ctrl; 189 | } pin; /* wclass */ 190 | } Widget; 191 | 192 | typedef struct _AudioControl { 193 | Widget *widget, *childWidget; 194 | int enable; 195 | int index, dir, ndir; 196 | int mute, step, size, offset; 197 | int left, right, forcemute; 198 | UInt32 muted; 199 | UInt32 ossmask, possmask; 200 | } AudioControl; 201 | 202 | typedef struct _NidForSwitch { 203 | nid_t mainNid; 204 | nid_t nextNid; 205 | int connNum; 206 | }NidForSwitch; 207 | 208 | /* Association is a group of pins bound for some special function. */ 209 | typedef struct _AudioAssoc { 210 | UInt8 enable; 211 | UInt8 index; 212 | UInt8 dir; 213 | UInt8 pincnt; 214 | UInt8 pinset; 215 | UInt8 fakeredir; 216 | UInt8 digital; 217 | nid_t hpredir; 218 | nid_t pins[16]; 219 | nid_t dacs[16]; 220 | nid_t activeNid; 221 | int chan; 222 | int dirty; 223 | //AutumnRain 224 | NidForSwitch nidForSwitch[16]; 225 | SInt8 defaultPin; 226 | SInt8 jackPin; 227 | } AudioAssoc; 228 | 229 | typedef struct _PcmDevice { 230 | FunctionGroup *funcGroup; 231 | int index; 232 | bool registered; 233 | int playChanId, recChanId; 234 | UInt8 left[SOUND_MIXER_NRDEVICES]; 235 | UInt8 right[SOUND_MIXER_NRDEVICES]; 236 | UInt32 chanSize; 237 | UInt32 chanNumBlocks; 238 | UInt8 digital; 239 | UInt32 recDevMask, devMask; 240 | } PcmDevice; 241 | 242 | typedef struct _FunctionGroup { 243 | UInt8 nodeType; 244 | nid_t nid; 245 | nid_t startNode, endNode; 246 | int numNodes; 247 | bool mSwitchEnable; 248 | Codec *codec; 249 | Widget *widgets; 250 | struct { 251 | UInt32 outAmpCap; 252 | UInt32 inAmpCap; 253 | UInt32 supStreamFormats; 254 | UInt32 supPcmSizeRates; 255 | int numControls, numAssocs; 256 | AudioControl *controls; 257 | AudioAssoc *assocs; 258 | UInt32 quirks; 259 | UInt32 gpio; 260 | PcmDevice *pcmDevices; 261 | int numPcmDevices; 262 | } audio; /* function */ 263 | /* XXX undefined: modem, hdmi. */ 264 | } FunctionGroup; 265 | 266 | #define HDAC_CHN_RUNNING 0x00000001 267 | #define HDAC_CHN_SUSPEND 0x00000002 268 | 269 | typedef struct _ChannelCaps { 270 | UInt32 minSpeed, maxSpeed; 271 | UInt32 *formats; 272 | UInt32 caps; 273 | UInt32 channels; 274 | } ChannelCaps; 275 | 276 | typedef struct _Channel { 277 | ChannelCaps caps; 278 | FunctionGroup *funcGroup; 279 | PcmDevice *pcmDevice; 280 | UInt32 speed, format; 281 | UInt32 formats[8], pcmRates[16]; 282 | UInt32 supStreamFormats, supPcmSizeRates; 283 | UInt32 numBlocks, blockSize; 284 | UInt32 *dmaPos; 285 | UInt32 flags; 286 | int direction; 287 | int off; 288 | int streamId; 289 | int bit16, bit32; 290 | int assocNum; 291 | nid_t io[16]; // adc/dac nids 292 | //Math 293 | bool vectorize; 294 | bool useStereo; 295 | UInt8 noiseLevel; 296 | UInt8 StereoBase; 297 | 298 | DmaMemory *bdlMem; 299 | DmaMemory *buffer; 300 | } Channel; 301 | 302 | #define CODEC_ID(codec) ((((UInt32) (codec)->vendorId & 0xffff) << 16) | \ 303 | ((UInt32) (codec)->deviceId & 0xffff)) 304 | 305 | typedef struct _Codec { 306 | int numVerbsSent; 307 | int numRespReceived; 308 | nid_t cad; 309 | UInt16 vendorId; 310 | UInt16 deviceId; 311 | UInt8 revisionId; 312 | UInt8 steppingId; 313 | CommandList *commands; 314 | FunctionGroup *funcGroups; 315 | int numFuncGroups; 316 | } Codec; 317 | 318 | #endif 319 | -------------------------------------------------------------------------------- /VoodooHDA/Readme.txt: -------------------------------------------------------------------------------- 1 | 0.2.6 release note 2 | The original driver hdac.c from FreeBSD is changed so we applied its correction to our driver 3 | * added support for new chipsets and new codecs 4 | * added HDMI support 5 | * added input monitor support 6 | * Multichannel? It is already present because of Apple's audio system. You must choose between autodetect and multichannel. Either one or the other. 7 | Compared to 0.2.5x driver in this version some bugs 8 | 9 | VoodooHDA 0.2.52 release notes 10 | It made by Slice&AutumnRain from Russia based on voodoohda 0.2.2 while original authors dropped the project as is 11 | with numerous mistakes. 12 | The driver tested worldwide in very different hardware. Almost always it works. 13 | The driver was completely revised and additional functionalities were added 14 | * added NotesToPatch into info.plist so the user can manually correct and tune the audio configuration 15 | * no more predefined quirks. In previous version there are incorrect quirks. 16 | * full autodetect of devices in any combinations of outputs and inputs (in 0.2.2 there is only 17 | speaker/headphone autodetect) 18 | * device names is changed on the fly (only in 10.5.x, but not in 10.6.x - question to Apple) 19 | * works with internal microphone as never before 20 | * correct sequence of initializations and starts. No more kernel panics. 21 | * more advanced names in Sound Preferencies to differ devices. "Line-out (Black Front)" 22 | * resolved sleep issue didn't mentioned below 23 | * getExtDump added to provide amplifiers control during work 24 | * advanced mixer controls 25 | 26 | voodoohda 0.2.2 release notes 27 | 28 | note: this driver has been tested on only a few systems, so bugs and glitches should be expected. 29 | there is currently no official binary release, so while you are free to compile this source or 30 | use any derivative releases thereof, this driver should be considered experimental. 31 | 32 | development 33 | ----------- 34 | 35 | * sources are hosted at the voodoohda project site at google code: http://voodoohda.googlecode.com/ 36 | * code guidelines: four-space tab (not spaces), ~110 line width, k&r style 37 | * the provided "helper.sh" utility can be used to clean or build the project, create a compiled 38 | release package, or load and unload the driver for testing 39 | * the latest cvs revision of the freebsd hdac driver can be found here: 40 | http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/dev/sound/pci/hda/ 41 | (the revision corresponding to voodoohda sources is identified by HDAC_REVISION) 42 | * one of the main focuses in porting from hdac was to keep the structure and functionality of the 43 | code (especially the widget parser) relatively close to that of the original code, in order to 44 | ease integrating changes from upstream; that said, the code has been heavily reworked in some 45 | places due to porting necessity as well as clarification 46 | 47 | hints 48 | ----- 49 | 50 | * use the provided 'getdump' utility to get a codec dump for debugging or to see how each logical 51 | pcm device is configured, see pcmAttach notices (same notion as pcmN with freebsd hdac) 52 | * one pcm device at a time can be active (unless aggregate devices are used), each is designated 53 | by "Analog/Digital PCM #N" in sound preference pane - separate selectors for "Master", "PCM", 54 | etc. are not different devices but correspond to standard oss controls 55 | * to change sample rate or bit depth or setup aggregate devices use Audio Midi Setup.app 56 | 57 | known issues 58 | ------------ 59 | 60 | * bad things (tm) will happen if some other hda driver is loaded or present in the catalogue 61 | when voodoohda is loaded 62 | * extremely cluttered and not particularly user-friendly audio controls in sound preference pane, 63 | only way around this is to dumb it down or implement a hal plugin (as applehda does) 64 | * distinction between oss controls and actual "ports" corresponding to pcm device play/rec channels 65 | is unclear - need to find out how to get audio port name (in "type" column) displayed 66 | * need to kextunload two or three times to actually unload the driver, seems to be an audio family 67 | bug as this happens with sample audio drivers too 68 | * manual specification of quirks and hints is currently unsupported 69 | 70 | license 71 | ------- 72 | 73 | see license.txt for details and copyright notices 74 | 75 | changelog 76 | --------- 77 | 78 | 0.2.2 (4/14/09): 79 | 80 | * mute controls implemented 81 | * seperate left/right audio level controls implemented 82 | * showing just one device for each input/output in Sound preference pane 83 | 84 | 0.2.1 (4/10/09): 85 | 86 | * minor source clean-up in preparation for release 87 | * synchronized sources with hdac cvs revision 20090401_0132 (numerous codec-specific fixes, more 88 | controller/codec ids, improved widget parsing, cosmetic fixes) 89 | 90 | 0.2 (12/28/08): 91 | 92 | * new message logging system, can be adjusted with VoodooHDAVerboseLevel setting in Info.plist; 93 | overview follows, each level is inclusive of previous one 94 | 0: quiet (except codec/controller id info at init, all errors) 95 | 1: verbose init messages, audio engine/control debugging 96 | 2: codec dump 97 | 3: interrupt stats 98 | 4: lock debugging 99 | * support for multiple sample rates and bit depths (16, 24, and 32-bit) 100 | * new audio controls in sound preference pane, separate selector for each logical oss control; 101 | each logical pcm device correponds to pcmN devices as with freebsd hdac (check codec dump for 102 | information on configurations) - this is temporary until a hal plugin is implemented which 103 | will allow better organization of controls 104 | * synchronized sources with latest hdac cvs revision 20081226_0122 (new controller and codec ids, 105 | also some special handling in parser for ad1986a) 106 | * implemented user client and included tool (getdump) for obtaining codec dump 107 | * many internal fixes and improvements as well as massive source cleanup 108 | -------------------------------------------------------------------------------- /VoodooHDA/Registers.h: -------------------------------------------------------------------------------- 1 | #include "License.h" 2 | 3 | #ifndef _REGISTERS_H 4 | #define _REGISTERS_H 5 | 6 | /**************************************************************************** 7 | * HDA Controller Register Set 8 | ****************************************************************************/ 9 | #define HDAC_GCAP 0x00 /* 2 - Global Capabilities*/ 10 | #define HDAC_VMIN 0x02 /* 1 - Minor Version */ 11 | #define HDAC_VMAJ 0x03 /* 1 - Major Version */ 12 | #define HDAC_OUTPAY 0x04 /* 2 - Output Payload Capability */ 13 | #define HDAC_INPAY 0x06 /* 2 - Input Payload Capability */ 14 | #define HDAC_GCTL 0x08 /* 4 - Global Control */ 15 | #define HDAC_WAKEEN 0x0c /* 2 - Wake Enable */ 16 | #define HDAC_STATESTS 0x0e /* 2 - State Change Status */ 17 | #define HDAC_GSTS 0x10 /* 2 - Global Status */ 18 | #define HDAC_OUTSTRMPAY 0x18 /* 2 - Output Stream Payload Capability */ 19 | #define HDAC_INSTRMPAY 0x1a /* 2 - Input Stream Payload Capability */ 20 | #define HDAC_INTCTL 0x20 /* 4 - Interrupt Control */ 21 | #define HDAC_INTSTS 0x24 /* 4 - Interrupt Status */ 22 | #define HDAC_WALCLK 0x30 /* 4 - Wall Clock Counter */ 23 | #define HDAC_SSYNC 0x38 /* 4 - Stream Synchronization */ 24 | #define HDAC_CORBLBASE 0x40 /* 4 - CORB Lower Base Address */ 25 | #define HDAC_CORBUBASE 0x44 /* 4 - CORB Upper Base Address */ 26 | #define HDAC_CORBWP 0x48 /* 2 - CORB Write Pointer */ 27 | #define HDAC_CORBRP 0x4a /* 2 - CORB Read Pointer */ 28 | #define HDAC_CORBCTL 0x4c /* 1 - CORB Control */ 29 | #define HDAC_CORBSTS 0x4d /* 1 - CORB Status */ 30 | #define HDAC_CORBSIZE 0x4e /* 1 - CORB Size */ 31 | #define HDAC_RIRBLBASE 0x50 /* 4 - RIRB Lower Base Address */ 32 | #define HDAC_RIRBUBASE 0x54 /* 4 - RIRB Upper Base Address */ 33 | #define HDAC_RIRBWP 0x58 /* 2 - RIRB Write Pointer */ 34 | #define HDAC_RINTCNT 0x5a /* 2 - Response Interrupt Count */ 35 | #define HDAC_RIRBCTL 0x5c /* 1 - RIRB Control */ 36 | #define HDAC_RIRBSTS 0x5d /* 1 - RIRB Status */ 37 | #define HDAC_RIRBSIZE 0x5e /* 1 - RIRB Size */ 38 | #define HDAC_ICOI 0x60 /* 4 - Immediate Command Output Interface */ 39 | #define HDAC_ICII 0x64 /* 4 - Immediate Command Input Interface */ 40 | #define HDAC_ICIS 0x68 /* 2 - Immediate Command Status */ 41 | #define HDAC_DPIBLBASE 0x70 /* 4 - DMA Position Buffer Lower Base */ 42 | #define HDAC_DPIBUBASE 0x74 /* 4 - DMA Position Buffer Upper Base */ 43 | #define HDAC_SDCTL0 0x80 /* 3 - Stream Descriptor Control */ 44 | #define HDAC_SDCTL1 0x81 /* 3 - Stream Descriptor Control */ 45 | #define HDAC_SDCTL2 0x82 /* 3 - Stream Descriptor Control */ 46 | #define HDAC_SDSTS 0x83 /* 1 - Stream Descriptor Status */ 47 | #define HDAC_SDLPIB 0x84 /* 4 - Link Position in Buffer */ 48 | #define HDAC_SDCBL 0x88 /* 4 - Cyclic Buffer Length */ 49 | #define HDAC_SDLVI 0x8C /* 2 - Last Valid Index */ 50 | #define HDAC_SDFIFOS 0x90 /* 2 - FIFOS */ 51 | #define HDAC_SDFMT 0x92 /* 2 - fmt */ 52 | #define HDAC_SDBDPL 0x98 /* 4 - Buffer Descriptor Pointer Lower Base */ 53 | #define HDAC_SDBDPU 0x9C /* 4 - Buffer Descriptor Pointer Upper Base */ 54 | 55 | #define _HDAC_ISDOFFSET(n, iss, oss) (0x80 + ((n) * 0x20)) 56 | #define _HDAC_ISDCTL(n, iss, oss) (0x00 + _HDAC_ISDOFFSET(n, iss, oss)) 57 | #define _HDAC_ISDSTS(n, iss, oss) (0x03 + _HDAC_ISDOFFSET(n, iss, oss)) 58 | #define _HDAC_ISDPICB(n, iss, oss) (0x04 + _HDAC_ISDOFFSET(n, iss, oss)) 59 | #define _HDAC_ISDCBL(n, iss, oss) (0x08 + _HDAC_ISDOFFSET(n, iss, oss)) 60 | #define _HDAC_ISDLVI(n, iss, oss) (0x0c + _HDAC_ISDOFFSET(n, iss, oss)) 61 | #define _HDAC_ISDFIFOD(n, iss, oss) (0x10 + _HDAC_ISDOFFSET(n, iss, oss)) 62 | #define _HDAC_ISDFMT(n, iss, oss) (0x12 + _HDAC_ISDOFFSET(n, iss, oss)) 63 | #define _HDAC_ISDBDPL(n, iss, oss) (0x18 + _HDAC_ISDOFFSET(n, iss, oss)) 64 | #define _HDAC_ISDBDPU(n, iss, oss) (0x1c + _HDAC_ISDOFFSET(n, iss, oss)) 65 | 66 | #define _HDAC_OSDOFFSET(n, iss, oss) (0x80 + ((iss) * 0x20) + ((n) * 0x20)) 67 | #define _HDAC_OSDCTL(n, iss, oss) (0x00 + _HDAC_OSDOFFSET(n, iss, oss)) 68 | #define _HDAC_OSDSTS(n, iss, oss) (0x03 + _HDAC_OSDOFFSET(n, iss, oss)) 69 | #define _HDAC_OSDPICB(n, iss, oss) (0x04 + _HDAC_OSDOFFSET(n, iss, oss)) 70 | #define _HDAC_OSDCBL(n, iss, oss) (0x08 + _HDAC_OSDOFFSET(n, iss, oss)) 71 | #define _HDAC_OSDLVI(n, iss, oss) (0x0c + _HDAC_OSDOFFSET(n, iss, oss)) 72 | #define _HDAC_OSDFIFOD(n, iss, oss) (0x10 + _HDAC_OSDOFFSET(n, iss, oss)) 73 | #define _HDAC_OSDFMT(n, iss, oss) (0x12 + _HDAC_OSDOFFSET(n, iss, oss)) 74 | #define _HDAC_OSDBDPL(n, iss, oss) (0x18 + _HDAC_OSDOFFSET(n, iss, oss)) 75 | #define _HDAC_OSDBDPU(n, iss, oss) (0x1c + _HDAC_OSDOFFSET(n, iss, oss)) 76 | 77 | #define _HDAC_BSDOFFSET(n, iss, oss) (0x80 + ((iss) * 0x20) + ((oss) * 0x20) + ((n) * 0x20)) 78 | #define _HDAC_BSDCTL(n, iss, oss) (0x00 + _HDAC_BSDOFFSET(n, iss, oss)) 79 | #define _HDAC_BSDSTS(n, iss, oss) (0x03 + _HDAC_BSDOFFSET(n, iss, oss)) 80 | #define _HDAC_BSDPICB(n, iss, oss) (0x04 + _HDAC_BSDOFFSET(n, iss, oss)) 81 | #define _HDAC_BSDCBL(n, iss, oss) (0x08 + _HDAC_BSDOFFSET(n, iss, oss)) 82 | #define _HDAC_BSDLVI(n, iss, oss) (0x0c + _HDAC_BSDOFFSET(n, iss, oss)) 83 | #define _HDAC_BSDFIFOD(n, iss, oss) (0x10 + _HDAC_BSDOFFSET(n, iss, oss)) 84 | #define _HDAC_BSDFMT(n, iss, oss) (0x12 + _HDAC_BSDOFFSET(n, iss, oss)) 85 | #define _HDAC_BSDBDPL(n, iss, oss) (0x18 + _HDAC_BSDOFFSET(n, iss, oss)) 86 | #define _HDAC_BSDBDBU(n, iss, oss) (0x1c + _HDAC_BSDOFFSET(n, iss, oss)) 87 | 88 | /**************************************************************************** 89 | * HDA Controller Register Fields 90 | ****************************************************************************/ 91 | 92 | /* GCAP - Global Capabilities */ 93 | #define HDAC_GCAP_64OK 0x0001 94 | #define HDAC_GCAP_NSDO_MASK 0x0006 95 | #define HDAC_GCAP_NSDO_SHIFT 1 96 | #define HDAC_GCAP_BSS_MASK 0x00f8 97 | #define HDAC_GCAP_BSS_SHIFT 3 98 | #define HDAC_GCAP_ISS_MASK 0x0f00 99 | #define HDAC_GCAP_ISS_SHIFT 8 100 | #define HDAC_GCAP_OSS_MASK 0xf000 101 | #define HDAC_GCAP_OSS_SHIFT 12 102 | 103 | #define HDAC_GCAP_NSDO_1SDO 0x00 104 | #define HDAC_GCAP_NSDO_2SDO 0x02 105 | #define HDAC_GCAP_NSDO_4SDO 0x04 106 | 107 | #define HDAC_GCAP_BSS(gcap) \ 108 | (((gcap) & HDAC_GCAP_BSS_MASK) >> HDAC_GCAP_BSS_SHIFT) 109 | #define HDAC_GCAP_ISS(gcap) \ 110 | (((gcap) & HDAC_GCAP_ISS_MASK) >> HDAC_GCAP_ISS_SHIFT) 111 | #define HDAC_GCAP_OSS(gcap) \ 112 | (((gcap) & HDAC_GCAP_OSS_MASK) >> HDAC_GCAP_OSS_SHIFT) 113 | #define HDAC_GCAP_NSDO(gcap) \ 114 | (((gcap) & HDAC_GCAP_NSDO_MASK) >> HDAC_GCAP_NSDO_SHIFT) 115 | 116 | 117 | /* GCTL - Global Control */ 118 | #define HDAC_GCTL_CRST 0x00000001 119 | #define HDAC_GCTL_FCNTRL 0x00000002 120 | #define HDAC_GCTL_UNSOL 0x00000100 121 | 122 | /* WAKEEN - Wake Enable */ 123 | #define HDAC_WAKEEN_SDIWEN_MASK 0x7fff 124 | #define HDAC_WAKEEN_SDIWEN_SHIFT 0 125 | 126 | /* STATESTS - State Change Status */ 127 | #define HDAC_STATESTS_SDIWAKE_MASK 0x7fff 128 | #define HDAC_STATESTS_SDIWAKE_SHIFT 0 129 | 130 | #define HDAC_STATESTS_SDIWAKE(statests, n) \ 131 | (((((statests) & HDAC_STATESTS_SDIWAKE_MASK) >> \ 132 | HDAC_STATESTS_SDIWAKE_SHIFT) >> (n)) & 0x0001) 133 | 134 | /* GSTS - Global Status */ 135 | #define HDAC_GSTS_FSTS 0x0002 136 | 137 | /* INTCTL - Interrut Control */ 138 | #define HDAC_INTCTL_SIE_MASK 0x3fffffff 139 | #define HDAC_INTCTL_SIE_SHIFT 0 140 | #define HDAC_INTCTL_CIE 0x40000000 141 | #define HDAC_INTCTL_GIE 0x80000000 142 | 143 | /* INTSTS - Interrupt Status */ 144 | #define HDAC_INTSTS_SIS_MASK 0x3fffffff 145 | #define HDAC_INTSTS_SIS_SHIFT 0 146 | #define HDAC_INTSTS_CIS 0x40000000 147 | #define HDAC_INTSTS_GIS 0x80000000 148 | 149 | /* SSYNC - Stream Synchronization */ 150 | #define HDAC_SSYNC_SSYNC_MASK 0x3fffffff 151 | #define HDAC_SSYNC_SSYNC_SHIFT 0 152 | 153 | /* CORBWP - CORB Write Pointer */ 154 | #define HDAC_CORBWP_CORBWP_MASK 0x00ff 155 | #define HDAC_CORBWP_CORBWP_SHIFT 0 156 | 157 | /* CORBRP - CORB Read Pointer */ 158 | #define HDAC_CORBRP_CORBRP_MASK 0x00ff 159 | #define HDAC_CORBRP_CORBRP_SHIFT 0 160 | #define HDAC_CORBRP_CORBRPRST 0x8000 161 | 162 | /* CORBCTL - CORB Control */ 163 | #define HDAC_CORBCTL_CMEIE 0x01 164 | #define HDAC_CORBCTL_CORBRUN 0x02 165 | 166 | /* CORBSTS - CORB Status */ 167 | #define HDAC_CORBSTS_CMEI 0x01 168 | 169 | /* CORBSIZE - CORB Size */ 170 | #define HDAC_CORBSIZE_CORBSIZE_MASK 0x03 171 | #define HDAC_CORBSIZE_CORBSIZE_SHIFT 0 172 | #define HDAC_CORBSIZE_CORBSZCAP_MASK 0xf0 173 | #define HDAC_CORBSIZE_CORBSZCAP_SHIFT 4 174 | 175 | #define HDAC_CORBSIZE_CORBSIZE_2 0x00 176 | #define HDAC_CORBSIZE_CORBSIZE_16 0x01 177 | #define HDAC_CORBSIZE_CORBSIZE_256 0x02 178 | 179 | #define HDAC_CORBSIZE_CORBSZCAP_2 0x10 180 | #define HDAC_CORBSIZE_CORBSZCAP_16 0x20 181 | #define HDAC_CORBSIZE_CORBSZCAP_256 0x40 182 | 183 | #define HDAC_CORBSIZE_CORBSIZE(corbsize) \ 184 | (((corbsize) & HDAC_CORBSIZE_CORBSIZE_MASK) >> HDAC_CORBSIZE_CORBSIZE_SHIFT) 185 | 186 | /* RIRBWP - RIRB Write Pointer */ 187 | #define HDAC_RIRBWP_RIRBWP_MASK 0x00ff 188 | #define HDAC_RIRBWP_RIRBWP_SHIFT 0 189 | #define HDAC_RIRBWP_RIRBWPRST 0x8000 190 | 191 | /* RINTCTN - Response Interrupt Count */ 192 | #define HDAC_RINTCNT_MASK 0x00ff 193 | #define HDAC_RINTCNT_SHIFT 0 194 | 195 | /* RIRBCTL - RIRB Control */ 196 | #define HDAC_RIRBCTL_RINTCTL 0x01 197 | #define HDAC_RIRBCTL_RIRBDMAEN 0x02 198 | #define HDAC_RIRBCTL_RIRBOIC 0x04 199 | 200 | /* RIRBSTS - RIRB Status */ 201 | #define HDAC_RIRBSTS_RINTFL 0x01 202 | #define HDAC_RIRBSTS_RIRBOIS 0x04 203 | 204 | /* RIRBSIZE - RIRB Size */ 205 | #define HDAC_RIRBSIZE_RIRBSIZE_MASK 0x03 206 | #define HDAC_RIRBSIZE_RIRBSIZE_SHIFT 0 207 | #define HDAC_RIRBSIZE_RIRBSZCAP_MASK 0xf0 208 | #define HDAC_RIRBSIZE_RIRBSZCAP_SHIFT 4 209 | 210 | #define HDAC_RIRBSIZE_RIRBSIZE_2 0x00 211 | #define HDAC_RIRBSIZE_RIRBSIZE_16 0x01 212 | #define HDAC_RIRBSIZE_RIRBSIZE_256 0x02 213 | 214 | #define HDAC_RIRBSIZE_RIRBSZCAP_2 0x10 215 | #define HDAC_RIRBSIZE_RIRBSZCAP_16 0x20 216 | #define HDAC_RIRBSIZE_RIRBSZCAP_256 0x40 217 | 218 | #define HDAC_RIRBSIZE_RIRBSIZE(rirbsize) \ 219 | (((rirbsize) & HDAC_RIRBSIZE_RIRBSIZE_MASK) >> HDAC_RIRBSIZE_RIRBSIZE_SHIFT) 220 | 221 | /* DPLBASE - DMA Position Lower Base Address */ 222 | #define HDAC_DPLBASE_DPLBASE_MASK 0xffffff80 223 | #define HDAC_DPLBASE_DPLBASE_SHIFT 7 224 | #define HDAC_DPLBASE_DPLBASE_DMAPBE 0x00000001 225 | 226 | /* SDCTL - Stream Descriptor Control */ 227 | #define HDAC_SDCTL_SRST 0x000001 228 | #define HDAC_SDCTL_RUN 0x000002 229 | #define HDAC_SDCTL_IOCE 0x000004 230 | #define HDAC_SDCTL_FEIE 0x000008 231 | #define HDAC_SDCTL_DEIE 0x000010 232 | #define HDAC_SDCTL_STRIPE_MASK 0x030000 233 | #define HDAC_SDCTL_STRIPE_SHIFT 16 234 | #define HDAC_SDCTL_TP 0x040000 235 | #define HDAC_SDCTL_DIR 0x080000 236 | #define HDAC_SDCTL2_STRM_MASK 0xf0 237 | #define HDAC_SDCTL2_STRM_SHIFT 4 238 | 239 | #define HDAC_SDSTS_DESE (1 << 4) 240 | #define HDAC_SDSTS_FIFOE (1 << 3) 241 | #define HDAC_SDSTS_BCIS (1 << 2) 242 | 243 | #endif 244 | -------------------------------------------------------------------------------- /VoodooHDA/Shared.h: -------------------------------------------------------------------------------- 1 | #include "License.h" 2 | 3 | #ifndef _SHARED_H 4 | #define _SHARED_H 5 | 6 | #define kVoodooHDAClassName "VoodooHDADevice" 7 | 8 | enum { 9 | kVoodooHDAActionMethod = 0, 10 | kVoodooHDANumMethods 11 | }; 12 | 13 | enum { 14 | kVoodooHDAActionTest = 0x1000 15 | }; 16 | 17 | enum { 18 | kVoodooHDAMemoryMessageBuffer = 0x2000, 19 | kVoodooHDAMemoryPinDump, 20 | kVoodooHDAMemoryCommand = 0x3000, 21 | kVoodooHDAMemoryExtMessageBuffer 22 | }; 23 | #define MAX_SLIDER_TAB_NAME_LENGTH 32 24 | 25 | /* Slice -> sorry AutumnRain = mixerDeviceInfo 26 | typedef struct _sliderInfo{ 27 | unsigned char num; //Порядковый номер регулятора 28 | unsigned char value; //Значение усиления от 0 до 0x64 29 | char sliderName[MAX_SLIDER_TAB_NAME_LENGTH]; //Название регулятора 30 | unsigned char enabled; //Можно ли пользователю менять значение регулятора 31 | }sliderInfo; 32 | 33 | typedef struct sliders{ 34 | char tabName[MAX_SLIDER_TAB_NAME_LENGTH]; //Название PinComplex для которого менятся значения усиления 35 | sliderInfo info[SOUND_MIXER_NRDEVICES]; 36 | unsigned char size; //Число структур 37 | unsigned char non[3]; 38 | }sliders; 39 | */ 40 | 41 | enum { 42 | kVoodooHDAChannelNames = 0x3000 43 | }; 44 | 45 | enum { 46 | kVoodooHDAActionSetMixer = 0x40, 47 | kVoodooHDAActionGetMixers = 0x50, 48 | kVoodooHDAActionSetMath = 0x60 49 | }; 50 | 51 | typedef union { 52 | struct { 53 | UInt8 action; 54 | UInt8 channel; 55 | UInt8 device; 56 | UInt8 val; 57 | } info; 58 | UInt32 value; 59 | } actionInfo; 60 | 61 | typedef struct _mixerDeviceInfo { 62 | UInt8 mixId; 63 | UInt8 value; 64 | char name[MAX_SLIDER_TAB_NAME_LENGTH]; 65 | bool enabled; 66 | UInt8 non[5]; //align to 8 bytes 67 | } mixerDeviceInfo; 68 | 69 | typedef struct _ChannelInfo { 70 | char name[MAX_SLIDER_TAB_NAME_LENGTH]; 71 | mixerDeviceInfo mixerValues[SOUND_MIXER_NRDEVICES]; 72 | UInt8 numChannels; 73 | bool vectorize; 74 | bool useStereo; 75 | UInt8 noiseLevel; 76 | UInt8 StereoBase; 77 | UInt8 empty[3]; //align to 8 bytes 78 | } ChannelInfo; 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /VoodooHDA/Tables.h: -------------------------------------------------------------------------------- 1 | #include "License.h" 2 | 3 | #ifndef _TABLES_H 4 | #define _TABLES_H 5 | 6 | #include 7 | 8 | typedef struct { 9 | UInt32 model; 10 | char *name; 11 | } ControllerListItem; 12 | 13 | typedef struct { 14 | UInt32 id; 15 | char *name; 16 | } CodecListItem; 17 | 18 | typedef struct { 19 | UInt32 rate; 20 | int valid; 21 | UInt16 base; 22 | UInt16 mul; 23 | UInt16 div; 24 | } RateTableItem; 25 | 26 | typedef struct { 27 | char *key; 28 | UInt32 value; 29 | } QuirkType; 30 | 31 | typedef struct { 32 | UInt32 model; 33 | UInt32 id; 34 | UInt32 set, unset; 35 | } QuirkListItem; 36 | 37 | typedef struct { 38 | const char* name; 39 | int index; 40 | UInt16 initValue; 41 | }MixerValueName; 42 | 43 | 44 | extern const ControllerListItem gControllerList[]; 45 | extern const CodecListItem gCodecList[]; 46 | extern const RateTableItem gRateTable[]; 47 | extern const QuirkType gQuirkTypes[]; 48 | extern const QuirkListItem gQuirkList[]; 49 | extern UInt16 gMixerDefaults[]; 50 | extern const MixerValueName MixerValueNamesBind[]; 51 | 52 | #define HDA_GPIO_MAX 8 53 | /* 0 - 7 = GPIO , 8 = Flush */ 54 | #define HDA_QUIRK_GPIO0 (1 << 0) 55 | #define HDA_QUIRK_GPIO1 (1 << 1) 56 | #define HDA_QUIRK_GPIO2 (1 << 2) 57 | #define HDA_QUIRK_GPIO3 (1 << 3) 58 | #define HDA_QUIRK_GPIO4 (1 << 4) 59 | #define HDA_QUIRK_GPIO5 (1 << 5) 60 | #define HDA_QUIRK_GPIO6 (1 << 6) 61 | #define HDA_QUIRK_GPIO7 (1 << 7) 62 | #define HDA_QUIRK_GPIOFLUSH (1 << 8) 63 | 64 | /* 9 - 25 = anything else */ 65 | #define HDA_QUIRK_SOFTPCMVOL (1 << 9) 66 | #define HDA_QUIRK_FIXEDRATE (1 << 10) 67 | #define HDA_QUIRK_FORCESTEREO (1 << 11) 68 | #define HDA_QUIRK_EAPDINV (1 << 12) 69 | #define HDA_QUIRK_DMAPOS (1 << 13) 70 | #define HDA_QUIRK_SENSEINV (1 << 14) 71 | 72 | /* 26 - 31 = vrefs */ 73 | #define HDA_QUIRK_IVREF50 (1 << 26) 74 | #define HDA_QUIRK_IVREF80 (1 << 27) 75 | #define HDA_QUIRK_IVREF100 (1 << 28) 76 | #define HDA_QUIRK_OVREF50 (1 << 29) 77 | #define HDA_QUIRK_OVREF80 (1 << 30) 78 | #define HDA_QUIRK_OVREF100 (1 << 31) 79 | 80 | #define HDA_QUIRK_IVREF (HDA_QUIRK_IVREF50 | HDA_QUIRK_IVREF80 | HDA_QUIRK_IVREF100) 81 | #define HDA_QUIRK_OVREF (HDA_QUIRK_OVREF50 | HDA_QUIRK_OVREF80 | HDA_QUIRK_OVREF100) 82 | #define HDA_QUIRK_VREF (HDA_QUIRK_IVREF | HDA_QUIRK_OVREF) 83 | 84 | #endif -------------------------------------------------------------------------------- /VoodooHDA/TigerAdditionals.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * TigerAdditionals.cpp 3 | * VoodooHDA 4 | * 5 | * Created by Andy Vandijck on 12/03/10. 6 | * Copyright 2010 AnV Software. All rights reserved. 7 | * 8 | * Slice, 05.10.2010 some additions 9 | */ 10 | 11 | #ifdef TIGER // needed for compile fix 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | int 29 | vprintf_vhda(const char *fmt, va_list ap) 30 | { 31 | char tmp[65536]; /* Should be enough, right? */ 32 | 33 | vsnprintf(tmp, sizeof(tmp), fmt, ap); 34 | printf("%s", tmp); 35 | 36 | return 0; 37 | } 38 | 39 | int snprintf_vhda(char *text, size_t maxlen, const char *fmt, ...) 40 | { 41 | va_list ap; 42 | int retval; 43 | 44 | va_start(ap, fmt); 45 | retval = vsnprintf(text, maxlen, fmt, ap); 46 | va_end(ap); 47 | 48 | return retval; 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /VoodooHDA/TigerAdditionals.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TigerAdditionals.h 3 | * VoodooHDA 4 | * 5 | * Created by Andy Vandijck on 12/03/10. 6 | * Copyright 2010 AnV Software. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifdef TIGER // needed for compile fix... 11 | int vprintf_vhda(const char *fmt, va_list ap); 12 | int snprintf_vhda(char *text, size_t maxlen, const char *fmt, ...); 13 | 14 | #define vprintf vprintf_vhda 15 | #define snprintf snprintf_vhda 16 | #define strlcpy strncpy 17 | #define strlcat strncat 18 | 19 | enum { 20 | kIOUCVariableStructureSize = 0xffffffff 21 | }; 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /VoodooHDA/VoodooHDA.xcodeproj/TemplateIcon.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AppleLife/VoodooHDA/e9708dea706eedb7f07365375e01ec1d67cb6f7d/VoodooHDA/VoodooHDA.xcodeproj/TemplateIcon.tiff -------------------------------------------------------------------------------- /VoodooHDA/VoodooHDA.xcodeproj/slice.pbxuser: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | 089C1669FE841209C02AAC07 /* Project object */ = { 4 | activeArchitecturePreference = x86_64; 5 | activeBuildConfigurationName = "Release Multichannel"; 6 | activeTarget = 32D94FC30562CBF700B6AF17 /* VoodooHDA */; 7 | addToTargets = ( 8 | 32D94FC30562CBF700B6AF17 /* VoodooHDA */, 9 | ); 10 | codeSenseManager = 12F6C0C91243DB5B00B39552 /* Code sense */; 11 | perUserDictionary = { 12 | PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { 13 | PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; 14 | PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; 15 | PBXFileTableDataSourceColumnWidthsKey = ( 16 | 20, 17 | 670, 18 | 20, 19 | 48, 20 | 43, 21 | 43, 22 | 20, 23 | ); 24 | PBXFileTableDataSourceColumnsKey = ( 25 | PBXFileDataSource_FiletypeID, 26 | PBXFileDataSource_Filename_ColumnID, 27 | PBXFileDataSource_Built_ColumnID, 28 | PBXFileDataSource_ObjectSize_ColumnID, 29 | PBXFileDataSource_Errors_ColumnID, 30 | PBXFileDataSource_Warnings_ColumnID, 31 | PBXFileDataSource_Target_ColumnID, 32 | ); 33 | }; 34 | PBXConfiguration.PBXFileTableDataSource3.XCSCMDataSource = { 35 | PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; 36 | PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; 37 | PBXFileTableDataSourceColumnWidthsKey = ( 38 | 20, 39 | 20, 40 | 703, 41 | 20, 42 | 48, 43 | 43, 44 | 43, 45 | 20, 46 | ); 47 | PBXFileTableDataSourceColumnsKey = ( 48 | PBXFileDataSource_SCM_ColumnID, 49 | PBXFileDataSource_FiletypeID, 50 | PBXFileDataSource_Filename_ColumnID, 51 | PBXFileDataSource_Built_ColumnID, 52 | PBXFileDataSource_ObjectSize_ColumnID, 53 | PBXFileDataSource_Errors_ColumnID, 54 | PBXFileDataSource_Warnings_ColumnID, 55 | PBXFileDataSource_Target_ColumnID, 56 | ); 57 | }; 58 | PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { 59 | PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; 60 | PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; 61 | PBXFileTableDataSourceColumnWidthsKey = ( 62 | 20, 63 | 687, 64 | 60, 65 | 20, 66 | 48.16259765625, 67 | 43, 68 | 43, 69 | ); 70 | PBXFileTableDataSourceColumnsKey = ( 71 | PBXFileDataSource_FiletypeID, 72 | PBXFileDataSource_Filename_ColumnID, 73 | PBXTargetDataSource_PrimaryAttribute, 74 | PBXFileDataSource_Built_ColumnID, 75 | PBXFileDataSource_ObjectSize_ColumnID, 76 | PBXFileDataSource_Errors_ColumnID, 77 | PBXFileDataSource_Warnings_ColumnID, 78 | ); 79 | }; 80 | PBXPerProjectTemplateStateSaveDate = 366033151; 81 | PBXWorkspaceStateSaveDate = 366033151; 82 | }; 83 | perUserProjectItems = { 84 | 1218A2E113CADFAE006DD3A3 /* PBXTextBookmark */ = 1218A2E113CADFAE006DD3A3 /* PBXTextBookmark */; 85 | 1218A2E213CADFAE006DD3A3 /* PBXTextBookmark */ = 1218A2E213CADFAE006DD3A3 /* PBXTextBookmark */; 86 | 1259B90313C6E8F6003D54BA /* PBXTextBookmark */ = 1259B90313C6E8F6003D54BA /* PBXTextBookmark */; 87 | 1259B90513C6E8F6003D54BA /* PBXTextBookmark */ = 1259B90513C6E8F6003D54BA /* PBXTextBookmark */; 88 | 12BEC4ED15AB13E50055A99E /* PBXTextBookmark */ = 12BEC4ED15AB13E50055A99E /* PBXTextBookmark */; 89 | 12C142BA1563E8BC00C5A9FB /* PBXTextBookmark */ = 12C142BA1563E8BC00C5A9FB /* PBXTextBookmark */; 90 | 12C142BB1563E8BC00C5A9FB /* PlistBookmark */ = 12C142BB1563E8BC00C5A9FB /* PlistBookmark */; 91 | 12C142BC1563E8BC00C5A9FB /* PlistBookmark */ = 12C142BC1563E8BC00C5A9FB /* PlistBookmark */; 92 | 12E06E8115D000210069E011 /* PBXTextBookmark */ = 12E06E8115D000210069E011 /* PBXTextBookmark */; 93 | 12E06E9D15D0034D0069E011 /* PBXTextBookmark */ = 12E06E9D15D0034D0069E011 /* PBXTextBookmark */; 94 | 12E06EDE15D132E80069E011 /* PBXTextBookmark */ = 12E06EDE15D132E80069E011 /* PBXTextBookmark */; 95 | 12E06EFA15D1390F0069E011 /* PBXTextBookmark */ = 12E06EFA15D1390F0069E011 /* PBXTextBookmark */; 96 | 12E06F0515D13A800069E011 /* PBXTextBookmark */ = 12E06F0515D13A800069E011 /* PBXTextBookmark */; 97 | }; 98 | sourceControlManager = 12F6C0C81243DB5B00B39552 /* Source Control */; 99 | userBuildSettings = { 100 | }; 101 | }; 102 | 089C167EFE841241C02AAC07 /* English */ = { 103 | uiCtxt = { 104 | sepNavIntBoundsRect = "{{0, 0}, {848, 332}}"; 105 | sepNavSelRange = "{0, 0}"; 106 | sepNavVisRange = "{0, 45}"; 107 | }; 108 | }; 109 | 1218A2E113CADFAE006DD3A3 /* PBXTextBookmark */ = { 110 | isa = PBXTextBookmark; 111 | fRef = CE6725D60EF0880E00FAFBED /* Common.h */; 112 | name = "Common.h: 1"; 113 | rLen = 0; 114 | rLoc = 0; 115 | rType = 0; 116 | vrLen = 526; 117 | vrLoc = 0; 118 | }; 119 | 1218A2E213CADFAE006DD3A3 /* PBXTextBookmark */ = { 120 | isa = PBXTextBookmark; 121 | fRef = 12B21F1612464EEC002948CA /* emmintrin.h */; 122 | name = "emmintrin.h: 936"; 123 | rLen = 23; 124 | rLoc = 28855; 125 | rType = 0; 126 | vrLen = 807; 127 | vrLoc = 28448; 128 | }; 129 | 1259B90313C6E8F6003D54BA /* PBXTextBookmark */ = { 130 | isa = PBXTextBookmark; 131 | fRef = CE5D398A0EF4784000140715 /* Parser.cpp */; 132 | name = "Parser.cpp: 2344"; 133 | rLen = 7; 134 | rLoc = 75085; 135 | rType = 0; 136 | vrLen = 850; 137 | vrLoc = 24149; 138 | }; 139 | 1259B90513C6E8F6003D54BA /* PBXTextBookmark */ = { 140 | isa = PBXTextBookmark; 141 | fRef = CE6725A20EF078B100FAFBED /* VoodooHDAEngine.cpp */; 142 | name = "VoodooHDAEngine.cpp: 837"; 143 | rLen = 13; 144 | rLoc = 24367; 145 | rType = 0; 146 | vrLen = 944; 147 | vrLoc = 24757; 148 | }; 149 | 12B21F1612464EEC002948CA /* emmintrin.h */ = { 150 | uiCtxt = { 151 | sepNavIntBoundsRect = "{{0, 0}, {848, 25922}}"; 152 | sepNavSelRange = "{28855, 23}"; 153 | sepNavVisRange = "{28448, 807}"; 154 | }; 155 | }; 156 | 12B21F1B12464EEC002948CA /* xmmintrin.h */ = { 157 | uiCtxt = { 158 | sepNavIntBoundsRect = "{{0, 0}, {453, 22498}}"; 159 | sepNavSelRange = "{1683, 23}"; 160 | sepNavVisRect = "{{0, 897}, {453, 201}}"; 161 | }; 162 | }; 163 | 12BDC91012440B5D00B327AE /* AppleAudioClip.cpp */ = { 164 | uiCtxt = { 165 | sepNavIntBoundsRect = "{{0, 0}, {848, 53391}}"; 166 | sepNavSelRange = "{122751, 0}"; 167 | sepNavVisRange = "{123572, 788}"; 168 | sepNavWindowFrame = "{{15, 59}, {862, 814}}"; 169 | }; 170 | }; 171 | 12BDC91112440B5D00B327AE /* AppleAudioClip.h */ = { 172 | uiCtxt = { 173 | sepNavIntBoundsRect = "{{0, 0}, {959, 1235}}"; 174 | sepNavSelRange = "{1742, 0}"; 175 | sepNavVisRange = "{468, 960}"; 176 | }; 177 | }; 178 | 12BEC4ED15AB13E50055A99E /* PBXTextBookmark */ = { 179 | isa = PBXTextBookmark; 180 | fRef = 089C167EFE841241C02AAC07 /* English */; 181 | name = "InfoPlist.strings: 1"; 182 | rLen = 0; 183 | rLoc = 0; 184 | rType = 0; 185 | vrLen = 45; 186 | vrLoc = 0; 187 | }; 188 | 12BEC50C15AB14730055A99E /* OSBase.h */ = { 189 | isa = PBXFileReference; 190 | lastKnownFileType = sourcecode.c.h; 191 | name = OSBase.h; 192 | path = /System/Library/Frameworks/Kernel.framework/PrivateHeaders/libkern/OSBase.h; 193 | sourceTree = ""; 194 | }; 195 | 12C142BA1563E8BC00C5A9FB /* PBXTextBookmark */ = { 196 | isa = PBXTextBookmark; 197 | fRef = 12BDC91012440B5D00B327AE /* AppleAudioClip.cpp */; 198 | name = "AppleAudioClip.cpp: 3937"; 199 | rLen = 0; 200 | rLoc = 122751; 201 | rType = 0; 202 | vrLen = 756; 203 | vrLoc = 123610; 204 | }; 205 | 12C142BB1563E8BC00C5A9FB /* PlistBookmark */ = { 206 | isa = PlistBookmark; 207 | fRef = A54ED8370FEE91E700CA5717 /* version.plist */; 208 | fallbackIsa = PBXBookmark; 209 | isK = 0; 210 | kPath = ( 211 | ); 212 | name = /Users/slice/Projects/VoodooHDA/tranc/version.plist; 213 | rLen = 0; 214 | rLoc = 9223372036854775808; 215 | }; 216 | 12C142BC1563E8BC00C5A9FB /* PlistBookmark */ = { 217 | isa = PlistBookmark; 218 | fRef = 32D94FCF0562CBF700B6AF17 /* Info.plist */; 219 | fallbackIsa = PBXBookmark; 220 | isK = 0; 221 | kPath = ( 222 | IOKitPersonalities, 223 | VoodooHDA, 224 | VoodooHDAEnableVolumeChangeFix, 225 | ); 226 | name = /Users/slice/Projects/VoodooHDA/tranc/Info.plist; 227 | rLen = 0; 228 | rLoc = 9223372036854775808; 229 | }; 230 | 12E06E8115D000210069E011 /* PBXTextBookmark */ = { 231 | isa = PBXTextBookmark; 232 | fRef = 12BEC50C15AB14730055A99E /* OSBase.h */; 233 | name = "OSBase.h: 52"; 234 | rLen = 0; 235 | rLoc = 1620; 236 | rType = 0; 237 | vrLen = 612; 238 | vrLoc = 1416; 239 | }; 240 | 12E06E9D15D0034D0069E011 /* PBXTextBookmark */ = { 241 | isa = PBXTextBookmark; 242 | fRef = CE9337FC0EF226E000776BCD /* Tables.c */; 243 | name = "Tables.c: 40"; 244 | rLen = 18; 245 | rLoc = 1465; 246 | rType = 0; 247 | vrLen = 1604; 248 | vrLoc = 222; 249 | }; 250 | 12E06EDE15D132E80069E011 /* PBXTextBookmark */ = { 251 | isa = PBXTextBookmark; 252 | fRef = CE45220E0EF210FD00600B68 /* Models.h */; 253 | name = "Models.h: 59"; 254 | rLen = 18; 255 | rLoc = 2845; 256 | rType = 0; 257 | vrLen = 2085; 258 | vrLoc = 557; 259 | }; 260 | 12E06EFA15D1390F0069E011 /* PBXTextBookmark */ = { 261 | isa = PBXTextBookmark; 262 | fRef = CE6725A00EF078B100FAFBED /* VoodooHDADevice.cpp */; 263 | rLen = 15; 264 | rLoc = 55405; 265 | rType = 0; 266 | }; 267 | 12E06F0515D13A800069E011 /* PBXTextBookmark */ = { 268 | isa = PBXTextBookmark; 269 | fRef = CE6725A00EF078B100FAFBED /* VoodooHDADevice.cpp */; 270 | name = "VoodooHDADevice.cpp: 2006"; 271 | rLen = 15; 272 | rLoc = 55405; 273 | rType = 0; 274 | vrLen = 1047; 275 | vrLoc = 54818; 276 | }; 277 | 12F6C0C81243DB5B00B39552 /* Source Control */ = { 278 | isa = PBXSourceControlManager; 279 | fallbackIsa = XCSourceControlManager; 280 | isSCMEnabled = 1; 281 | scmConfiguration = { 282 | repositoryNamesForRoots = { 283 | "" = voodoohda; 284 | }; 285 | }; 286 | scmType = scm.subversion; 287 | }; 288 | 12F6C0C91243DB5B00B39552 /* Code sense */ = { 289 | isa = PBXCodeSenseManager; 290 | indexTemplatePath = ""; 291 | }; 292 | 32D94FC30562CBF700B6AF17 /* VoodooHDA */ = { 293 | activeExec = 0; 294 | }; 295 | CE45220E0EF210FD00600B68 /* Models.h */ = { 296 | uiCtxt = { 297 | sepNavIntBoundsRect = "{{0, 0}, {848, 6084}}"; 298 | sepNavSelRange = "{2845, 18}"; 299 | sepNavVisRange = "{557, 2085}"; 300 | sepNavVisRect = "{{0, 13}, {633, 575}}"; 301 | sepNavWindowFrame = "{{15, 52}, {678, 689}}"; 302 | }; 303 | }; 304 | CE45220F0EF210FD00600B68 /* Private.h */ = { 305 | uiCtxt = { 306 | sepNavIntBoundsRect = "{{0, 0}, {905, 4641}}"; 307 | sepNavSelRange = "{7808, 0}"; 308 | sepNavVisRange = "{7390, 779}"; 309 | }; 310 | }; 311 | CE4522100EF210FD00600B68 /* Registers.h */ = { 312 | uiCtxt = { 313 | sepNavIntBoundsRect = "{{0, 0}, {733, 2938}}"; 314 | sepNavSelRange = "{1898, 4}"; 315 | sepNavVisRange = "{628, 2447}"; 316 | }; 317 | }; 318 | CE4522110EF210FD00600B68 /* Verbs.h */ = { 319 | uiCtxt = { 320 | sepNavIntBoundsRect = "{{0, 0}, {843, 16822}}"; 321 | sepNavSelRange = "{38334, 60}"; 322 | sepNavVisRange = "{37429, 2249}"; 323 | }; 324 | }; 325 | CE4F4C380F04274500AF2B7B /* OssCompat.h */ = { 326 | uiCtxt = { 327 | sepNavIntBoundsRect = "{{0, 0}, {848, 1547}}"; 328 | sepNavSelRange = "{3790, 5}"; 329 | sepNavVisRange = "{2136, 1552}"; 330 | sepNavVisRect = "{{0, 0}, {633, 575}}"; 331 | sepNavWindowFrame = "{{15, 52}, {678, 689}}"; 332 | }; 333 | }; 334 | CE5D398A0EF4784000140715 /* Parser.cpp */ = { 335 | uiCtxt = { 336 | sepNavIntBoundsRect = "{{0, 0}, {848, 61399}}"; 337 | sepNavSelRange = "{75085, 7}"; 338 | sepNavVisRange = "{24149, 850}"; 339 | sepNavWindowFrame = "{{61, 273}, {750, 558}}"; 340 | }; 341 | }; 342 | CE6725A00EF078B100FAFBED /* VoodooHDADevice.cpp */ = { 343 | uiCtxt = { 344 | sepNavIntBoundsRect = "{{0, 0}, {848, 38974}}"; 345 | sepNavSelRange = "{55405, 15}"; 346 | sepNavVisRange = "{54818, 1047}"; 347 | sepNavVisRect = "{{0, 5144}, {734, 195}}"; 348 | sepNavWindowFrame = "{{84, 252}, {750, 558}}"; 349 | }; 350 | }; 351 | CE6725A10EF078B100FAFBED /* VoodooHDADevice.h */ = { 352 | uiCtxt = { 353 | sepNavIntBoundsRect = "{{0, 0}, {691, 5668}}"; 354 | sepNavSelRange = "{5742, 8}"; 355 | sepNavVisRange = "{5466, 1029}"; 356 | sepNavWindowFrame = "{{38, 294}, {750, 558}}"; 357 | }; 358 | }; 359 | CE6725A20EF078B100FAFBED /* VoodooHDAEngine.cpp */ = { 360 | uiCtxt = { 361 | sepNavIntBoundsRect = "{{0, 0}, {936, 12480}}"; 362 | sepNavSelRange = "{24367, 13}"; 363 | sepNavVisRange = "{25194, 1183}"; 364 | }; 365 | }; 366 | CE6725A30EF078B100FAFBED /* VoodooHDAEngine.h */ = { 367 | uiCtxt = { 368 | sepNavIntBoundsRect = "{{0, 0}, {848, 1508}}"; 369 | sepNavSelRange = "{2554, 22}"; 370 | sepNavVisRange = "{1883, 1482}"; 371 | }; 372 | }; 373 | CE6725AA0EF078CB00FAFBED /* AudioClip.cpp */ = { 374 | uiCtxt = { 375 | sepNavIntBoundsRect = "{{0, 0}, {733, 3705}}"; 376 | sepNavSelRange = "{2405, 23}"; 377 | sepNavVisRange = "{1792, 1349}"; 378 | sepNavWindowFrame = "{{15, 271}, {704, 602}}"; 379 | }; 380 | }; 381 | CE6725D60EF0880E00FAFBED /* Common.h */ = { 382 | uiCtxt = { 383 | sepNavIntBoundsRect = "{{0, 0}, {848, 351}}"; 384 | sepNavSelRange = "{0, 0}"; 385 | sepNavVisRange = "{0, 526}"; 386 | sepNavVisRect = "{{0, 0}, {633, 575}}"; 387 | sepNavWindowFrame = "{{15, 52}, {678, 689}}"; 388 | }; 389 | }; 390 | CE709B4E0EFF2AA400EE77FF /* VoodooHDAUserClient.cpp */ = { 391 | uiCtxt = { 392 | sepNavIntBoundsRect = "{{0, 0}, {733, 3588}}"; 393 | sepNavSelRange = "{6030, 19}"; 394 | sepNavVisRange = "{5730, 1557}"; 395 | }; 396 | }; 397 | CE709B520EFF2AAF00EE77FF /* Shared.h */ = { 398 | uiCtxt = { 399 | sepNavIntBoundsRect = "{{0, 0}, {905, 1053}}"; 400 | sepNavSelRange = "{1580, 76}"; 401 | sepNavVisRange = "{990, 725}"; 402 | sepNavWindowFrame = "{{1, 56}, {862, 814}}"; 403 | }; 404 | }; 405 | CE9337FC0EF226E000776BCD /* Tables.c */ = { 406 | uiCtxt = { 407 | sepNavIntBoundsRect = "{{0, 0}, {848, 5135}}"; 408 | sepNavSelRange = "{1465, 18}"; 409 | sepNavVisRange = "{222, 1604}"; 410 | }; 411 | }; 412 | CEF7C0A40EF74C2700A14C68 /* PCMBlitterLib.cpp */ = { 413 | uiCtxt = { 414 | sepNavIntBoundsRect = "{{0, 0}, {708, 3705}}"; 415 | sepNavSelRange = "{7771, 0}"; 416 | sepNavVisRange = "{7311, 462}"; 417 | }; 418 | }; 419 | CEF7C0A60EF74C2700A14C68 /* PCMBlitterLibDispatch.h */ = { 420 | uiCtxt = { 421 | sepNavIntBoundsRect = "{{0, 0}, {733, 1547}}"; 422 | sepNavSelRange = "{2344, 24}"; 423 | sepNavVisRange = "{1710, 1252}"; 424 | }; 425 | }; 426 | CEF7C0A70EF74C2700A14C68 /* PCMBlitterLibX86.cpp */ = { 427 | uiCtxt = { 428 | sepNavIntBoundsRect = "{{0, 0}, {733, 11453}}"; 429 | sepNavSelRange = "{6460, 24}"; 430 | sepNavVisRange = "{7665, 849}"; 431 | }; 432 | }; 433 | } 434 | -------------------------------------------------------------------------------- /VoodooHDA/VoodooHDAEngine.h: -------------------------------------------------------------------------------- 1 | #include "License.h" 2 | 3 | #ifndef _VOODOO_HDA_ENGINE_H 4 | #define _VOODOO_HDA_ENGINE_H 5 | 6 | #include 7 | 8 | #include 9 | 10 | #include "Private.h" 11 | 12 | class VoodooHDADevice; 13 | 14 | class IOAudioPort; 15 | class IOAudioSelectorControl; 16 | class IOAudioLevelControl; 17 | class IOAudioToggleControl; 18 | 19 | class VoodooHDAEngine : public IOAudioEngine 20 | { 21 | OSDeclareDefaultStructors(VoodooHDAEngine) 22 | 23 | public: 24 | UInt32 mVerbose; 25 | 26 | UInt32 mBufferSize; 27 | UInt32 mSampleSize; 28 | UInt32 mNumSampleFrames; 29 | UInt32 Boost; 30 | /* bool vectorize; 31 | int noiseLevel; 32 | bool useStereo; 33 | int StereoBase;*/ 34 | 35 | Channel *mChannel; 36 | VoodooHDADevice *mDevice; 37 | IOAudioStream *mStream; 38 | bool emptyStream; 39 | float *floatMixBufOld; 40 | 41 | const char *mPortName; 42 | const char *mName; 43 | IOAudioPort *mPort; 44 | 45 | const char *mDescription; 46 | 47 | int mActiveOssDev; 48 | 49 | IOAudioSelectorControl *mSelControl; 50 | IOAudioLevelControl *mVolumeControl; 51 | IOAudioToggleControl *mMuteControl; 52 | 53 | UInt32 oldOutVolumeLeft; 54 | UInt32 oldOutVolumeRight; 55 | UInt32 oldInputGain; 56 | 57 | // cue8chalk: flag for volume change fix 58 | bool mEnableVolumeChangeFix; 59 | // VertexBZ: flag for mute fix 60 | bool mEnableMuteFix; 61 | 62 | void messageHandler(UInt32 type, const char *format, ...) __attribute__ ((format (printf, 3, 4))); 63 | 64 | void setPinName(/*UInt32 type, */const char* name); 65 | // void enumiratePinNames(void); 66 | const char *getPortName(); 67 | const char *getDescription(); 68 | void identifyPaths(); 69 | UInt32 getNumCtls(UInt32 dev); 70 | UInt64 getMinMaxDb(UInt32 dev); 71 | 72 | bool validateOssDev(int ossDev); 73 | const char *getOssDevName(int ossDev); 74 | void setActiveOssDev(int ossDev); 75 | int getActiveOssDev(); 76 | 77 | IOAudioStreamDirection getEngineDirection(); 78 | int getEngineId(); 79 | 80 | bool createAudioStream(IOAudioStreamDirection direction, void *sampleBuffer, 81 | UInt32 sampleBufferSize, UInt32 *pcmRates, 82 | UInt32 supPcmSizeRates, UInt32 supStreamFormats, UInt32 channels); 83 | bool createAudioStream(); 84 | 85 | bool createAudioControls(); 86 | 87 | static IOReturn volumeChangeHandler(IOService *target, IOAudioControl *volumeControl, SInt32 oldValue, SInt32 newValue); 88 | static IOReturn muteChangeHandler(IOService *target, IOAudioControl *muteControl, SInt32 oldValue, SInt32 newValue); 89 | static IOReturn gainChangeHandler(IOService *target, IOAudioControl *gainControl, SInt32 oldValue, SInt32 newValue); 90 | 91 | 92 | IOReturn volumeChanged(IOAudioControl *volumeControl, SInt32 oldValue, SInt32 newValue); 93 | IOReturn muteChanged(IOAudioControl *muteControl, SInt32 oldValue, SInt32 newValue); 94 | IOReturn gainChanged(IOAudioControl *gainControl, SInt32 oldValue, SInt32 newValue); 95 | 96 | virtual bool init(Channel *channel); 97 | virtual void free(); 98 | virtual bool initHardware(IOService *provider); 99 | virtual void stop(IOService *provider); 100 | 101 | virtual IOReturn performAudioEngineStart(); 102 | virtual IOReturn performAudioEngineStop(); 103 | 104 | virtual UInt32 getCurrentSampleFrame(); 105 | 106 | virtual IOReturn performFormatChange(IOAudioStream *audioStream, const IOAudioStreamFormat *newFormat, 107 | const IOAudioSampleRate *newSampleRate); 108 | 109 | virtual IOReturn clipOutputSamples(const void *mixBuf, void *sampleBuf, UInt32 firstSampleFrame, 110 | UInt32 numSampleFrames, const IOAudioStreamFormat *streamFormat, IOAudioStream *audioStream); 111 | virtual IOReturn convertInputSamples(const void *sampleBuf, void *destBuf, UInt32 firstSampleFrame, 112 | UInt32 numSampleFrames, const IOAudioStreamFormat *streamFormat, IOAudioStream *audioStream); 113 | virtual OSString *getLocalUniqueID(); 114 | }; 115 | 116 | #endif 117 | -------------------------------------------------------------------------------- /VoodooHDA/VoodooHDAUserClient.cpp: -------------------------------------------------------------------------------- 1 | #include "License.h" 2 | 3 | // This class represents the user client object for the driver, which 4 | // will be instantiated by IOKit to represent a connection to the client 5 | // process, in response to the client's call to IOServiceOpen(). 6 | // It will be destroyed when the connection is closed or the client 7 | // abnormally terminates, so it should track all the resources allocated 8 | // to the client. 9 | 10 | #include "VoodooHDAUserClient.h" 11 | #include "VoodooHDADevice.h" 12 | #include "Common.h" 13 | 14 | #include "Shared.h" 15 | 16 | #ifdef TIGER 17 | #include "TigerAdditionals.h" 18 | #endif 19 | 20 | 21 | #define super IOUserClient 22 | OSDefineMetaClassAndStructors(VoodooHDAUserClient, IOUserClient); 23 | 24 | #define logMsg(fmt, args...) messageHandler(kVoodooHDAMessageTypeGeneral, fmt, ##args) 25 | #define errorMsg(fmt, args...) messageHandler(kVoodooHDAMessageTypeError, fmt, ##args) 26 | #define dumpMsg(fmt, args...) messageHandler(kVoodooHDAMessageTypeDump, fmt, ##args) 27 | 28 | void VoodooHDAUserClient::messageHandler(UInt32 type, const char *format, ...) 29 | { 30 | va_list args; 31 | va_start(args, format); 32 | if (mDevice) 33 | mDevice->messageHandler(type, format, args); 34 | else if (mVerbose >= 1) 35 | vprintf(format, args); 36 | va_end(args); 37 | } 38 | 39 | bool VoodooHDAUserClient::initWithTask(task_t owningTask, void *securityID, UInt32 type, 40 | OSDictionary *properties) 41 | { 42 | // logMsg("VoodooHDAUserClient[%p]::initWithTask(%ld)\n", this, type); 43 | 44 | return super::initWithTask(owningTask, securityID, type, properties); 45 | } 46 | 47 | bool VoodooHDAUserClient::start(IOService *provider) 48 | { 49 | // logMsg("VoodooHDAUserClient[%p]::start\n", this); 50 | 51 | if (!super::start(provider)) 52 | return false; 53 | 54 | mDevice = OSDynamicCast(VoodooHDADevice, provider); 55 | ASSERT(mDevice); 56 | mDevice->retain(); 57 | 58 | mVerbose = mDevice->mVerbose; 59 | 60 | return true; 61 | } 62 | 63 | bool VoodooHDAUserClient::willTerminate(IOService *provider, IOOptionBits options) 64 | { 65 | // logMsg("VoodooHDAUserClient[%p]::willTerminate\n", this); 66 | 67 | return super::willTerminate(provider, options); 68 | } 69 | 70 | bool VoodooHDAUserClient::didTerminate(IOService *provider, IOOptionBits options, bool *defer) 71 | { 72 | // logMsg("VoodooHDAUserClient[%p]::didTerminate\n", this); 73 | 74 | // if defer is true, stop will not be called on the user client 75 | *defer = false; 76 | 77 | return super::didTerminate(provider, options, defer); 78 | } 79 | 80 | bool VoodooHDAUserClient::terminate(IOOptionBits options) 81 | { 82 | // logMsg("VoodooHDAUserClient[%p]::terminate\n", this); 83 | 84 | return super::terminate(options); 85 | } 86 | 87 | // clientClose is called when the user process calls IOServiceClose 88 | IOReturn VoodooHDAUserClient::clientClose() 89 | { 90 | // logMsg("VoodooHDAUserClient[%p]::clientClose\n", this); 91 | 92 | if (!isInactive()) 93 | terminate(); 94 | 95 | return kIOReturnSuccess; 96 | } 97 | 98 | // clientDied is called when the user process terminates unexpectedly, the default 99 | // implementation simply calls clientClose 100 | IOReturn VoodooHDAUserClient::clientDied() 101 | { 102 | // logMsg("VoodooHDAUserClient[%p]::clientDied\n", this); 103 | 104 | return super::clientDied(); 105 | } 106 | 107 | void VoodooHDAUserClient::free(void) 108 | { 109 | // logMsg("VoodooHDAUserClient[%p]::free\n", this); 110 | 111 | RELEASE(mDevice); 112 | 113 | super::free(); 114 | } 115 | 116 | // stop will be called during the termination process, and should free all resources 117 | // associated with this client 118 | void VoodooHDAUserClient::stop(IOService *provider) 119 | { 120 | // logMsg("VoodooHDAUserClient[%p]::stop\n", this); 121 | 122 | super::stop(provider); 123 | } 124 | 125 | // getTargetAndMethodForIndex looks up the external methods - supply a description of the parameters 126 | // available to be called 127 | IOExternalMethod *VoodooHDAUserClient::getTargetAndMethodForIndex(IOService **targetP, UInt32 index) 128 | { 129 | //logMsg("VoodooHDAUserClient[%p]::getTargetAndMethodForIndex(%ld)\n", this, index); 130 | 131 | static const IOExternalMethod methodDescs[kVoodooHDANumMethods] = { 132 | { NULL, (IOMethod) &VoodooHDAUserClient::actionMethod, kIOUCStructIStructO, 133 | kIOUCVariableStructureSize, kIOUCVariableStructureSize }, 134 | }; 135 | 136 | *targetP = this; 137 | if (index < kVoodooHDANumMethods) 138 | return (IOExternalMethod *) (methodDescs + index); 139 | else 140 | return NULL; 141 | } 142 | 143 | IOReturn VoodooHDAUserClient::actionMethod(UInt32 *dataIn, UInt32 *dataOut, IOByteCount inputSize, 144 | IOByteCount *outputSize) 145 | { 146 | IOReturn result; 147 | UInt32 action; 148 | void *data; 149 | UInt32 dataSize, outputMax; 150 | 151 | //logMsg("VoodooHDAUserClient[%p]::actionMethod(%ld, %ld)\n", this, inputSize, *outputSize); 152 | 153 | if (inputSize != sizeof (UInt32)) 154 | return kIOReturnBadArgument; 155 | action = *dataIn; 156 | 157 | result = mDevice->runAction(action, &dataSize, &data); 158 | 159 | // note: we can only transfer sizeof (io_struct_inband_t) bytes out at a time 160 | 161 | outputMax = *outputSize; 162 | *outputSize = dataSize; 163 | if (dataSize) { 164 | ASSERT(data); 165 | if (outputMax < dataSize) 166 | return kIOReturnNoSpace; 167 | bcopy(data, dataOut, dataSize); 168 | } 169 | 170 | return result; 171 | } 172 | 173 | IOReturn VoodooHDAUserClient::clientMemoryForType(UInt32 type, IOOptionBits *options, 174 | IOMemoryDescriptor **memory) 175 | { 176 | IOReturn result; 177 | IOBufferMemoryDescriptor *memDesc; 178 | char *msgBuffer; 179 | /* 180 | ChannelInfo *channelInfoBuffer; 181 | UInt32 channelInfoBufferSize = 0; 182 | */ 183 | 184 | 185 | // logMsg("VoodooHDAUserClient[%p]::clientMemoryForType(0x%lx)\n", this, type); 186 | 187 | // note: IOConnectUnmapMemory should not be used with this user client 188 | 189 | *options = 0; 190 | *memory = NULL; 191 | 192 | switch (type) { 193 | case kVoodooHDAMemoryMessageBuffer: 194 | mDevice->lockMsgBuffer(); 195 | if (!mDevice->mMsgBufferSize) { 196 | errorMsg("error: message buffer size is zero\n"); 197 | mDevice->unlockMsgBuffer(); 198 | result = kIOReturnUnsupported; 199 | break; 200 | } 201 | memDesc = IOBufferMemoryDescriptor::withOptions(kIOMemoryKernelUserShared, 202 | mDevice->mMsgBufferSize); 203 | if (!memDesc) { 204 | errorMsg("error: couldn't allocate buffer memory descriptor (size: %ld)\n", 205 | mDevice->mMsgBufferSize); 206 | mDevice->unlockMsgBuffer(); 207 | result = kIOReturnVMError; 208 | break; 209 | } 210 | msgBuffer = (char *) memDesc->getBytesNoCopy(); 211 | bcopy(mDevice->mMsgBuffer, msgBuffer, mDevice->mMsgBufferSize); 212 | mDevice->unlockMsgBuffer(); 213 | *options |= kIOMapReadOnly; 214 | *memory = memDesc; // automatically released after memory is mapped into task 215 | result = kIOReturnSuccess; 216 | break; 217 | //Разделяемая память для PrefPanel 218 | case kVoodooHDAMemoryCommand: 219 | mDevice->lockPrefPanelMemoryBuf(); 220 | if (!mDevice->mPrefPanelMemoryBuf) { 221 | errorMsg("error: message buffer size is zero\n"); 222 | mDevice->unlockPrefPanelMemoryBuf(); 223 | result = kIOReturnUnsupported; 224 | break; 225 | } 226 | memDesc = IOBufferMemoryDescriptor::withOptions(kIOMemoryKernelUserShared, 227 | mDevice->mPrefPanelMemoryBufSize); 228 | if (!memDesc) { 229 | errorMsg("error: couldn't allocate buffer memory descriptor (size: %ld)\n", 230 | mDevice->mPrefPanelMemoryBufSize); 231 | mDevice->unlockPrefPanelMemoryBuf(); 232 | result = kIOReturnVMError; 233 | break; 234 | } 235 | msgBuffer = (char *) memDesc->getBytesNoCopy(); 236 | bcopy(mDevice->mPrefPanelMemoryBuf, msgBuffer, mDevice->mPrefPanelMemoryBufSize); 237 | mDevice->unlockPrefPanelMemoryBuf(); 238 | //*options |= kIOMapReadOnly; 239 | *memory = memDesc; // automatically released after memory is mapped into task 240 | result = kIOReturnSuccess; 241 | break; 242 | //Разделяемая память для буфера с текущеми настройками усиления 243 | case kVoodooHDAMemoryExtMessageBuffer: 244 | 245 | /* 246 | channelInfoBuffer = mDevice->getChannelInfo(); 247 | if (!channelInfoBuffer) 248 | return kIOReturnError; 249 | 250 | channelInfoBufferSize = sizeof(*channelInfoBuffer) * channelInfoBuffer->numChannels; 251 | //IOLog("infoBufferSize %ld\n", channelInfoBufferSize); 252 | if (!channelInfoBufferSize) 253 | return kIOReturnError; 254 | */ 255 | 256 | mDevice->lockExtMsgBuffer(); 257 | if (!mDevice->mExtMsgBufferSize) { 258 | errorMsg("error: ext message buffer size is zero\n"); 259 | mDevice->unlockExtMsgBuffer(); 260 | result = kIOReturnUnsupported; 261 | break; 262 | } 263 | 264 | memDesc = IOBufferMemoryDescriptor::withOptions(kIOMemoryKernelUserShared, mDevice->mExtMsgBufferSize); 265 | //memDesc = IOBufferMemoryDescriptor::withOptions(kIOMemoryKernelUserShared, 8); 266 | if (!memDesc) { 267 | errorMsg("error: couldn't allocate buffer memory descriptor (size: %ld)\n", 268 | mDevice->mExtMsgBufferSize); 269 | mDevice->unlockExtMsgBuffer(); 270 | result = kIOReturnVMError; 271 | break; 272 | } 273 | msgBuffer = (char *) memDesc->getBytesNoCopy(); 274 | bcopy(mDevice->mExtMsgBuffer, msgBuffer, mDevice->mExtMsgBufferSize); 275 | //bcopy("test\n\0\0\0\0", msgBuffer, 8); 276 | mDevice->unlockExtMsgBuffer(); 277 | *options |= kIOMapReadOnly; 278 | *memory = memDesc; // automatically released after memory is mapped into task 279 | result = kIOReturnSuccess; 280 | break; 281 | default: 282 | result = kIOReturnBadArgument; 283 | break; 284 | } 285 | 286 | return result; 287 | } 288 | -------------------------------------------------------------------------------- /VoodooHDA/VoodooHDAUserClient.h: -------------------------------------------------------------------------------- 1 | #include "License.h" 2 | 3 | #ifndef _VOODOO_HDA_USER_CLIENT_H 4 | #define _VOODOO_HDA_USER_CLIENT_H 5 | 6 | #include 7 | #include 8 | 9 | class VoodooHDADevice; 10 | 11 | class VoodooHDAUserClient : public IOUserClient 12 | { 13 | OSDeclareDefaultStructors(VoodooHDAUserClient); 14 | 15 | private: 16 | UInt32 mVerbose; 17 | VoodooHDADevice *mDevice; 18 | 19 | public: 20 | void messageHandler(UInt32 type, const char *format, ...) __attribute__ ((format (printf, 3, 4))); 21 | 22 | /* IOService overrides */ 23 | virtual void free(); 24 | virtual bool start(IOService *provider); 25 | virtual void stop(IOService *provider); 26 | 27 | /* IOUserClient overrides */ 28 | virtual bool initWithTask(task_t owningTask, void *securityID, UInt32 type, OSDictionary *properties); 29 | virtual IOReturn clientClose(); 30 | virtual IOReturn clientDied(); 31 | 32 | virtual bool willTerminate(IOService *provider, IOOptionBits options); 33 | virtual bool didTerminate(IOService *provider, IOOptionBits options, bool *defer); 34 | virtual bool terminate(IOOptionBits options = 0); 35 | 36 | virtual IOExternalMethod *getTargetAndMethodForIndex(IOService **targetP, UInt32 index); 37 | 38 | virtual IOReturn clientMemoryForType(UInt32 type, IOOptionBits *options, IOMemoryDescriptor **memory); 39 | 40 | /* External methods */ 41 | IOReturn actionMethod(UInt32 *dataIn, UInt32 *dataOut, IOByteCount inputSize, IOByteCount *outputSize); 42 | }; 43 | 44 | #endif -------------------------------------------------------------------------------- /VoodooHDA/float.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with GCC; see the file COPYING. If not, write to 17 | the Free Software Foundation, 51 Franklin Street, Fifth Floor, 18 | Boston, MA 02110-1301, USA. */ 19 | 20 | /* As a special exception, if you include this header file into source 21 | files compiled by GCC, this header file does not by itself cause 22 | the resulting executable to be covered by the GNU General Public 23 | License. This exception does not however invalidate any other 24 | reasons why the executable file might be covered by the GNU General 25 | Public License. */ 26 | 27 | /* 28 | * ISO C Standard: 5.2.4.2.2 Characteristics of floating types 29 | */ 30 | 31 | #ifndef _FLOAT_H___ 32 | #define _FLOAT_H___ 33 | 34 | /* Radix of exponent representation, b. */ 35 | #undef FLT_RADIX 36 | #define FLT_RADIX __FLT_RADIX__ 37 | 38 | /* Number of base-FLT_RADIX digits in the significand, p. */ 39 | #undef FLT_MANT_DIG 40 | #undef DBL_MANT_DIG 41 | #undef LDBL_MANT_DIG 42 | #define FLT_MANT_DIG __FLT_MANT_DIG__ 43 | #define DBL_MANT_DIG __DBL_MANT_DIG__ 44 | #define LDBL_MANT_DIG __LDBL_MANT_DIG__ 45 | 46 | /* Number of decimal digits, q, such that any floating-point number with q 47 | decimal digits can be rounded into a floating-point number with p radix b 48 | digits and back again without change to the q decimal digits, 49 | 50 | p * log10(b) if b is a power of 10 51 | floor((p - 1) * log10(b)) otherwise 52 | */ 53 | #undef FLT_DIG 54 | #undef DBL_DIG 55 | #undef LDBL_DIG 56 | #define FLT_DIG __FLT_DIG__ 57 | #define DBL_DIG __DBL_DIG__ 58 | #define LDBL_DIG __LDBL_DIG__ 59 | 60 | /* Minimum int x such that FLT_RADIX**(x-1) is a normalized float, emin */ 61 | #undef FLT_MIN_EXP 62 | #undef DBL_MIN_EXP 63 | #undef LDBL_MIN_EXP 64 | #define FLT_MIN_EXP __FLT_MIN_EXP__ 65 | #define DBL_MIN_EXP __DBL_MIN_EXP__ 66 | #define LDBL_MIN_EXP __LDBL_MIN_EXP__ 67 | 68 | /* Minimum negative integer such that 10 raised to that power is in the 69 | range of normalized floating-point numbers, 70 | 71 | ceil(log10(b) * (emin - 1)) 72 | */ 73 | #undef FLT_MIN_10_EXP 74 | #undef DBL_MIN_10_EXP 75 | #undef LDBL_MIN_10_EXP 76 | #define FLT_MIN_10_EXP __FLT_MIN_10_EXP__ 77 | #define DBL_MIN_10_EXP __DBL_MIN_10_EXP__ 78 | #define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ 79 | 80 | /* Maximum int x such that FLT_RADIX**(x-1) is a representable float, emax. */ 81 | #undef FLT_MAX_EXP 82 | #undef DBL_MAX_EXP 83 | #undef LDBL_MAX_EXP 84 | #define FLT_MAX_EXP __FLT_MAX_EXP__ 85 | #define DBL_MAX_EXP __DBL_MAX_EXP__ 86 | #define LDBL_MAX_EXP __LDBL_MAX_EXP__ 87 | 88 | /* Maximum integer such that 10 raised to that power is in the range of 89 | representable finite floating-point numbers, 90 | 91 | floor(log10((1 - b**-p) * b**emax)) 92 | */ 93 | #undef FLT_MAX_10_EXP 94 | #undef DBL_MAX_10_EXP 95 | #undef LDBL_MAX_10_EXP 96 | #define FLT_MAX_10_EXP __FLT_MAX_10_EXP__ 97 | #define DBL_MAX_10_EXP __DBL_MAX_10_EXP__ 98 | #define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ 99 | 100 | /* Maximum representable finite floating-point number, 101 | 102 | (1 - b**-p) * b**emax 103 | */ 104 | #undef FLT_MAX 105 | #undef DBL_MAX 106 | #undef LDBL_MAX 107 | #define FLT_MAX __FLT_MAX__ 108 | #define DBL_MAX __DBL_MAX__ 109 | #define LDBL_MAX __LDBL_MAX__ 110 | 111 | /* The difference between 1 and the least value greater than 1 that is 112 | representable in the given floating point type, b**1-p. */ 113 | #undef FLT_EPSILON 114 | #undef DBL_EPSILON 115 | #undef LDBL_EPSILON 116 | #define FLT_EPSILON __FLT_EPSILON__ 117 | #define DBL_EPSILON __DBL_EPSILON__ 118 | #define LDBL_EPSILON __LDBL_EPSILON__ 119 | 120 | /* Minimum normalized positive floating-point number, b**(emin - 1). */ 121 | #undef FLT_MIN 122 | #undef DBL_MIN 123 | #undef LDBL_MIN 124 | #define FLT_MIN __FLT_MIN__ 125 | #define DBL_MIN __DBL_MIN__ 126 | #define LDBL_MIN __LDBL_MIN__ 127 | 128 | /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown. */ 129 | /* APPLE LOCAL begin 3399553 */ 130 | /* This changes with calls to fesetround in . */ 131 | #undef FLT_ROUNDS 132 | #define FLT_ROUNDS (__builtin_flt_rounds ()) 133 | /* APPLE LOCAL end 3399553 */ 134 | 135 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 136 | /* The floating-point expression evaluation method. 137 | -1 indeterminate 138 | 0 evaluate all operations and constants just to the range and 139 | precision of the type 140 | 1 evaluate operations and constants of type float and double 141 | to the range and precision of the double type, evaluate 142 | long double operations and constants to the range and 143 | precision of the long double type 144 | 2 evaluate all operations and constants to the range and 145 | precision of the long double type 146 | 147 | ??? This ought to change with the setting of the fp control word; 148 | the value provided by the compiler assumes the widest setting. */ 149 | #undef FLT_EVAL_METHOD 150 | #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ 151 | 152 | /* Number of decimal digits, n, such that any floating-point number in the 153 | widest supported floating type with pmax radix b digits can be rounded 154 | to a floating-point number with n decimal digits and back again without 155 | change to the value, 156 | 157 | pmax * log10(b) if b is a power of 10 158 | ceil(1 + pmax * log10(b)) otherwise 159 | */ 160 | #undef DECIMAL_DIG 161 | #define DECIMAL_DIG __DECIMAL_DIG__ 162 | 163 | #endif /* C99 */ 164 | #endif /* _FLOAT_H___ */ 165 | -------------------------------------------------------------------------------- /VoodooHDA/getdump.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #define SOUND_MIXER_NRDEVICES 25 8 | #include "Shared.h" 9 | 10 | void printMsgBuffer(io_service_t service) 11 | { 12 | kern_return_t ret; 13 | io_connect_t connect = 0; 14 | #if __LP64__ 15 | mach_vm_address_t address; 16 | mach_vm_size_t size; 17 | #else 18 | vm_address_t address; 19 | vm_size_t size; 20 | #endif 21 | 22 | ret = IOServiceOpen(service, mach_task_self(), 0, &connect); 23 | if (ret != KERN_SUCCESS) { 24 | printf("error: IOServiceOpen returned 0x%08x\n", ret); 25 | goto failure; 26 | } 27 | 28 | ret = IOConnectMapMemory(connect, kVoodooHDAMemoryMessageBuffer, mach_task_self(), &address, &size, 29 | kIOMapAnywhere | kIOMapDefaultCache); 30 | if (ret != kIOReturnSuccess) { 31 | printf("error: IOConnectMapMemory returned 0x%08x\n", ret); 32 | goto failure; 33 | } 34 | 35 | printf("%s\n", (char *) address); 36 | 37 | failure: 38 | if (connect) { 39 | ret = IOServiceClose(connect); 40 | if (ret != KERN_SUCCESS) 41 | printf("warning: IOServiceClose returned 0x%08x\n", ret); 42 | } 43 | } 44 | 45 | int main() 46 | { 47 | mach_port_t masterPort; 48 | io_iterator_t iter; 49 | io_service_t service = 0; 50 | kern_return_t ret; 51 | io_string_t path; 52 | 53 | ret = IOMasterPort(MACH_PORT_NULL, &masterPort); 54 | if (ret != KERN_SUCCESS) { 55 | printf("error: IOMasterPort returned 0x%08x\n", ret); 56 | goto failure; 57 | } 58 | 59 | ret = IOServiceGetMatchingServices(masterPort, IOServiceMatching(kVoodooHDAClassName), &iter); 60 | if (ret != KERN_SUCCESS) { 61 | printf("error: IOServiceGetMatchingServices returned 0x%08x\n", ret); 62 | goto failure; 63 | } 64 | service = IOIteratorNext(iter); 65 | IOObjectRelease(iter); 66 | 67 | ret = IORegistryEntryGetPath(service, kIOServicePlane, path); 68 | if (ret != KERN_SUCCESS) { 69 | printf("error: IORegistryEntryGetPath returned 0x%08x\n", ret); 70 | goto failure; 71 | } 72 | printf("Found a device of class "kVoodooHDAClassName": %s\n\n", path); 73 | 74 | printMsgBuffer(service); 75 | 76 | failure: 77 | if (service) 78 | IOObjectRelease(service); 79 | 80 | return 0; 81 | } 82 | -------------------------------------------------------------------------------- /VoodooHDA/helper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | VERSION="0.2.2" 4 | RELFILE="VoodooHDA-$VERSION.tar.bz2" 5 | ACTION="$1" 6 | TARGET="Debug" 7 | KEXT="build/$TARGET/VoodooHDA.kext" 8 | TMPDIR="tmp" 9 | TMPKEXT="$TMPDIR/VoodooHDA.kext" 10 | 11 | if [ "$ACTION" = "clean" ]; then 12 | set -x 13 | rm -rf release $RELFILE getdump build 14 | [ -e $TMPDIR ] && sudo rm -rf $TMPDIR 15 | elif [ "$ACTION" = "build" ]; then 16 | set -x 17 | xcodebuild -configuration $TARGET -target FloatSupport -target VoodooHDA 18 | gcc getdump.c -o getdump -framework IOKit -framework CoreFoundation -Wall -Wextra -Werror 19 | elif [ "$ACTION" = "release" ]; then 20 | if [ ! -e $KEXT ] || [ ! -e getdump ]; then 21 | echo "please run with 'build' argument first" 22 | exit 23 | fi 24 | set -x 25 | rm -rf release 26 | mkdir release 27 | cp getdump release 28 | cp License.h release/License.txt 29 | cp Readme.txt release/Readme.txt 30 | cp -r $KEXT release 31 | COPYFILE_DISABLE=true tar --owner root --group wheel -C release -c . | bzip2 -9 > $RELFILE 32 | rm -rf release 33 | elif [ "$ACTION" = "load" ]; then 34 | if [ ! -e $KEXT ]; then 35 | echo "please run with 'build' argument first" 36 | exit 37 | fi 38 | set -x 39 | sudo rm -rf $TMPDIR 40 | mkdir $TMPDIR 41 | cp -r $KEXT $TMPKEXT 42 | sudo chown -R root:wheel $TMPKEXT 43 | sync 44 | sudo kextunload $TMPKEXT 45 | sudo kextunload $TMPKEXT 46 | sync 47 | sudo kextload $TMPKEXT 48 | elif [ "$ACTION" = "unload" ]; then 49 | if [ ! -e $TMPKEXT ]; then 50 | echo "driver is either not loaded or the build was cleaned" 51 | exit 52 | fi 53 | set -x 54 | sync 55 | sudo kextunload $TMPKEXT 56 | sudo kextunload $TMPKEXT 57 | sudo rm -rf $TMPDIR 58 | else 59 | echo "usage: $0 [clean|build|release|load|unload]" 60 | fi 61 | -------------------------------------------------------------------------------- /VoodooHDA/iSubTypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1998-2008 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | //----------------------------------------------------------- 25 | // iSubTypes.h 26 | // AppleUSBAudio 27 | // 28 | // Types used in engines, clip routines 29 | // 30 | // Created by Aram Lindahl on Fri Mar 01 2002. 31 | // Copyright (c) 2002 Apple Computer. All rights reserved. 32 | //----------------------------------------------------------- 33 | #ifndef __ISUB_TYPES__ 34 | #define __ISUB_TYPES__ 35 | 36 | // describes the interfaces the iSub supports 37 | typedef enum { 38 | e_iSubAltInterface_8bit_Mono = 1, 39 | e_iSubAltInterface_8bit_Stereo, 40 | e_iSubAltInterface_16bit_Mono, 41 | e_iSubAltInterface_16bit_Stereo, 42 | e_iSubAltInterface_20bit_Mono, 43 | e_iSubAltInterface_20bit_Stereo, 44 | } iSubAltInterfaceType; 45 | 46 | // describes the iSub audio format 47 | typedef struct _iSubAudioFormat { 48 | iSubAltInterfaceType altInterface; 49 | UInt32 numChannels; 50 | UInt32 bytesPerSample; 51 | UInt32 outputSampleRate; 52 | } iSubAudioFormatType; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /VoodooHDA/mm3dnow.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with GCC; see the file COPYING. If not, write to 17 | the Free Software Foundation, 51 Franklin Street, Fifth Floor, 18 | Boston, MA 02110-1301, USA. */ 19 | 20 | /* As a special exception, if you include this header file into source 21 | files compiled by GCC, this header file does not by itself cause 22 | the resulting executable to be covered by the GNU General Public 23 | License. This exception does not however invalidate any other 24 | reasons why the executable file might be covered by the GNU General 25 | Public License. */ 26 | 27 | /* Implemented from the mm3dnow.h (of supposedly AMD origin) included with 28 | MSVC 7.1. */ 29 | 30 | #ifndef _MM3DNOW_H_INCLUDED 31 | #define _MM3DNOW_H_INCLUDED 32 | 33 | #ifdef __3dNOW__ 34 | 35 | #include 36 | 37 | /* Internal data types for implementing the intrinsics. */ 38 | typedef float __v2sf __attribute__ ((__vector_size__ (8))); 39 | 40 | static __inline void 41 | _m_femms (void) 42 | { 43 | __builtin_ia32_femms(); 44 | } 45 | 46 | static __inline __m64 47 | _m_pavgusb (__m64 __A, __m64 __B) 48 | { 49 | return (__m64)__builtin_ia32_pavgusb ((__v8qi)__A, (__v8qi)__B); 50 | } 51 | 52 | static __inline __m64 53 | _m_pf2id (__m64 __A) 54 | { 55 | return (__m64)__builtin_ia32_pf2id ((__v2sf)__A); 56 | } 57 | 58 | static __inline __m64 59 | _m_pfacc (__m64 __A, __m64 __B) 60 | { 61 | return (__m64)__builtin_ia32_pfacc ((__v2sf)__A, (__v2sf)__B); 62 | } 63 | 64 | static __inline __m64 65 | _m_pfadd (__m64 __A, __m64 __B) 66 | { 67 | return (__m64)__builtin_ia32_pfadd ((__v2sf)__A, (__v2sf)__B); 68 | } 69 | 70 | static __inline __m64 71 | _m_pfcmpeq (__m64 __A, __m64 __B) 72 | { 73 | return (__m64)__builtin_ia32_pfcmpeq ((__v2sf)__A, (__v2sf)__B); 74 | } 75 | 76 | static __inline __m64 77 | _m_pfcmpge (__m64 __A, __m64 __B) 78 | { 79 | return (__m64)__builtin_ia32_pfcmpge ((__v2sf)__A, (__v2sf)__B); 80 | } 81 | 82 | static __inline __m64 83 | _m_pfcmpgt (__m64 __A, __m64 __B) 84 | { 85 | return (__m64)__builtin_ia32_pfcmpgt ((__v2sf)__A, (__v2sf)__B); 86 | } 87 | 88 | static __inline __m64 89 | _m_pfmax (__m64 __A, __m64 __B) 90 | { 91 | return (__m64)__builtin_ia32_pfmax ((__v2sf)__A, (__v2sf)__B); 92 | } 93 | 94 | static __inline __m64 95 | _m_pfmin (__m64 __A, __m64 __B) 96 | { 97 | return (__m64)__builtin_ia32_pfmin ((__v2sf)__A, (__v2sf)__B); 98 | } 99 | 100 | static __inline __m64 101 | _m_pfmul (__m64 __A, __m64 __B) 102 | { 103 | return (__m64)__builtin_ia32_pfmul ((__v2sf)__A, (__v2sf)__B); 104 | } 105 | 106 | static __inline __m64 107 | _m_pfrcp (__m64 __A) 108 | { 109 | return (__m64)__builtin_ia32_pfrcp ((__v2sf)__A); 110 | } 111 | 112 | static __inline __m64 113 | _m_pfrcpit1 (__m64 __A, __m64 __B) 114 | { 115 | return (__m64)__builtin_ia32_pfrcpit1 ((__v2sf)__A, (__v2sf)__B); 116 | } 117 | 118 | static __inline __m64 119 | _m_pfrcpit2 (__m64 __A, __m64 __B) 120 | { 121 | return (__m64)__builtin_ia32_pfrcpit2 ((__v2sf)__A, (__v2sf)__B); 122 | } 123 | 124 | static __inline __m64 125 | _m_pfrsqrt (__m64 __A) 126 | { 127 | return (__m64)__builtin_ia32_pfrsqrt ((__v2sf)__A); 128 | } 129 | 130 | static __inline __m64 131 | _m_pfrsqit1 (__m64 __A, __m64 __B) 132 | { 133 | return (__m64)__builtin_ia32_pfrsqit1 ((__v2sf)__A, (__v2sf)__B); 134 | } 135 | 136 | static __inline __m64 137 | _m_pfsub (__m64 __A, __m64 __B) 138 | { 139 | return (__m64)__builtin_ia32_pfsub ((__v2sf)__A, (__v2sf)__B); 140 | } 141 | 142 | static __inline __m64 143 | _m_pfsubr (__m64 __A, __m64 __B) 144 | { 145 | return (__m64)__builtin_ia32_pfsubr ((__v2sf)__A, (__v2sf)__B); 146 | } 147 | 148 | static __inline __m64 149 | _m_pi2fd (__m64 __A) 150 | { 151 | return (__m64)__builtin_ia32_pi2fd ((__v2si)__A); 152 | } 153 | 154 | static __inline __m64 155 | _m_pmulhrw (__m64 __A, __m64 __B) 156 | { 157 | return (__m64)__builtin_ia32_pmulhrw ((__v4hi)__A, (__v4hi)__B); 158 | } 159 | 160 | static __inline void 161 | _m_prefetch (void *__P) 162 | { 163 | __builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */); 164 | } 165 | 166 | static __inline void 167 | _m_prefetchw (void *__P) 168 | { 169 | __builtin_prefetch (__P, 1, 3 /* _MM_HINT_T0 */); 170 | } 171 | 172 | static __inline __m64 173 | _m_from_float (float __A) 174 | { 175 | return (__m64)(__v2sf){ __A, 0 }; 176 | } 177 | 178 | static __inline float 179 | _m_to_float (__m64 __A) 180 | { 181 | union { __v2sf v; float a[2]; } __tmp = { (__v2sf)__A }; 182 | return __tmp.a[0]; 183 | } 184 | 185 | #ifdef __3dNOW_A__ 186 | 187 | static __inline __m64 188 | _m_pf2iw (__m64 __A) 189 | { 190 | return (__m64)__builtin_ia32_pf2iw ((__v2sf)__A); 191 | } 192 | 193 | static __inline __m64 194 | _m_pfnacc (__m64 __A, __m64 __B) 195 | { 196 | return (__m64)__builtin_ia32_pfnacc ((__v2sf)__A, (__v2sf)__B); 197 | } 198 | 199 | static __inline __m64 200 | _m_pfpnacc (__m64 __A, __m64 __B) 201 | { 202 | return (__m64)__builtin_ia32_pfpnacc ((__v2sf)__A, (__v2sf)__B); 203 | } 204 | 205 | static __inline __m64 206 | _m_pi2fw (__m64 __A) 207 | { 208 | return (__m64)__builtin_ia32_pi2fw ((__v2si)__A); 209 | } 210 | 211 | static __inline __m64 212 | _m_pswapd (__m64 __A) 213 | { 214 | return (__m64)__builtin_ia32_pswapdsf ((__v2sf)__A); 215 | } 216 | 217 | #endif /* __3dNOW_A__ */ 218 | #endif /* __3dNOW__ */ 219 | 220 | #endif /* _MM3DNOW_H_INCLUDED */ 221 | -------------------------------------------------------------------------------- /VoodooHDA/mm_malloc.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with GCC; see the file COPYING. If not, write to 17 | the Free Software Foundation, 51 Franklin Street, Fifth Floor, 18 | Boston, MA 02110-1301, USA. */ 19 | 20 | /* As a special exception, if you include this header file into source 21 | files compiled by GCC, this header file does not by itself cause 22 | the resulting executable to be covered by the GNU General Public 23 | License. This exception does not however invalidate any other 24 | reasons why the executable file might be covered by the GNU General 25 | Public License. */ 26 | 27 | #ifndef _MM_MALLOC_H_INCLUDED 28 | #define _MM_MALLOC_H_INCLUDED 29 | 30 | #include 31 | #include 32 | 33 | static __inline__ void* 34 | _mm_malloc (size_t size, size_t align) 35 | { 36 | void * malloc_ptr; 37 | void * aligned_ptr; 38 | 39 | /* Error if align is not a power of two. */ 40 | if (align & (align - 1)) 41 | { 42 | errno = EINVAL; 43 | return ((void*) 0); 44 | } 45 | 46 | if (size == 0) 47 | return ((void *) 0); 48 | 49 | /* Assume malloc'd pointer is aligned at least to sizeof (void*). 50 | If necessary, add another sizeof (void*) to store the value 51 | returned by malloc. Effectively this enforces a minimum alignment 52 | of sizeof double. */ 53 | if (align < 2 * sizeof (void *)) 54 | align = 2 * sizeof (void *); 55 | 56 | malloc_ptr = malloc (size + align); 57 | if (!malloc_ptr) 58 | return ((void *) 0); 59 | 60 | /* Align We have at least sizeof (void *) space below malloc'd ptr. */ 61 | aligned_ptr = (void *) (((size_t) malloc_ptr + align) 62 | & ~((size_t) (align) - 1)); 63 | 64 | /* Store the original pointer just before p. */ 65 | ((void **) aligned_ptr) [-1] = malloc_ptr; 66 | 67 | return aligned_ptr; 68 | } 69 | 70 | static __inline__ void 71 | _mm_free (void * aligned_ptr) 72 | { 73 | if (aligned_ptr) 74 | free (((void **) aligned_ptr) [-1]); 75 | } 76 | 77 | #endif /* _MM_MALLOC_H_INCLUDED */ 78 | -------------------------------------------------------------------------------- /VoodooHDA/version.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildVersion 6 | 1 7 | CFBundleShortVersionString 8 | $(MODULE_VERSION) 9 | CFBundleVersion 10 | $(MODULE_VERSION) 11 | ProjectName 12 | VoodooHDA 13 | SourceVersion 14 | 0270000 15 | 16 | 17 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/bin/VoodooHdaSettingsLoader.app/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 11C74 7 | CFBundleDevelopmentRegion 8 | en 9 | CFBundleExecutable 10 | VoodooHdaSettingsLoader 11 | CFBundleIdentifier 12 | VoodooHda.VoodooHdaSettingsLoader 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | VoodooHdaSettingsLoader 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | DTCompiler 26 | com.apple.compilers.llvm.clang.1_0 27 | DTPlatformBuild 28 | 4D199 29 | DTPlatformVersion 30 | GM 31 | DTSDKBuild 32 | 11C63 33 | DTSDKName 34 | macosx10.7 35 | DTXcode 36 | 0420 37 | DTXcodeBuild 38 | 4D199 39 | LSMinimumSystemVersion 40 | 10.4 41 | NSHumanReadableCopyright 42 | Copyright © 2011 VoodooHDA. All rights reserved. 43 | NSMainNibFile 44 | MainMenu 45 | NSPrincipalClass 46 | NSApplication 47 | NSUIElement 48 | 1 49 | 50 | 51 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/bin/VoodooHdaSettingsLoader.app/Contents/MacOS/VoodooHdaSettingsLoader: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AppleLife/VoodooHDA/e9708dea706eedb7f07365375e01ec1d67cb6f7d/VoodooHdaSettingsLoader/bin/VoodooHdaSettingsLoader.app/Contents/MacOS/VoodooHdaSettingsLoader -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/bin/VoodooHdaSettingsLoader.app/Contents/PkgInfo: -------------------------------------------------------------------------------- 1 | APPL???? -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/bin/VoodooHdaSettingsLoader.app/Contents/Resources/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/bin/VoodooHdaSettingsLoader.app/Contents/Resources/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AppleLife/VoodooHDA/e9708dea706eedb7f07365375e01ec1d67cb6f7d/VoodooHdaSettingsLoader/bin/VoodooHdaSettingsLoader.app/Contents/Resources/en.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/bin/VoodooHdaSettingsLoader.app/Contents/Resources/en.lproj/MainMenu.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AppleLife/VoodooHDA/e9708dea706eedb7f07365375e01ec1d67cb6f7d/VoodooHdaSettingsLoader/bin/VoodooHdaSettingsLoader.app/Contents/Resources/en.lproj/MainMenu.nib -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B54A6001146C0BB700F354C6 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B54A6000146C0BB700F354C6 /* Cocoa.framework */; }; 11 | B54A600B146C0BB700F354C6 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = B54A6009146C0BB700F354C6 /* InfoPlist.strings */; }; 12 | B54A600D146C0BB700F354C6 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B54A600C146C0BB700F354C6 /* main.m */; }; 13 | B54A6011146C0BB700F354C6 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = B54A600F146C0BB700F354C6 /* Credits.rtf */; }; 14 | B54A6014146C0BB700F354C6 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B54A6013146C0BB700F354C6 /* AppDelegate.m */; }; 15 | B54A6017146C0BB700F354C6 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = B54A6015146C0BB700F354C6 /* MainMenu.xib */; }; 16 | B583ACC4146C0DD700B0CDF4 /* VoodooHdaSettingsLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = B583ACC3146C0DD700B0CDF4 /* VoodooHdaSettingsLoader.m */; }; 17 | B583ACC6146C0E4600B0CDF4 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B583ACC5146C0E4600B0CDF4 /* IOKit.framework */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | B54A5FFC146C0BB700F354C6 /* VoodooHdaSettingsLoader.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VoodooHdaSettingsLoader.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | B54A6000146C0BB700F354C6 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 23 | B54A6003146C0BB700F354C6 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; 24 | B54A6004146C0BB700F354C6 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 25 | B54A6005146C0BB700F354C6 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 26 | B54A6008146C0BB700F354C6 /* VoodooHdaSettingsLoader-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "VoodooHdaSettingsLoader-Info.plist"; sourceTree = ""; }; 27 | B54A600A146C0BB700F354C6 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 28 | B54A600C146C0BB700F354C6 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 29 | B54A600E146C0BB700F354C6 /* VoodooHdaSettingsLoader-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "VoodooHdaSettingsLoader-Prefix.pch"; sourceTree = ""; }; 30 | B54A6010146C0BB700F354C6 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = ""; }; 31 | B54A6012146C0BB700F354C6 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 32 | B54A6013146C0BB700F354C6 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 33 | B54A6016146C0BB700F354C6 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; 34 | B583ACC2146C0DD700B0CDF4 /* VoodooHdaSettingsLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VoodooHdaSettingsLoader.h; sourceTree = ""; }; 35 | B583ACC3146C0DD700B0CDF4 /* VoodooHdaSettingsLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VoodooHdaSettingsLoader.m; sourceTree = ""; }; 36 | B583ACC5146C0E4600B0CDF4 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; 37 | /* End PBXFileReference section */ 38 | 39 | /* Begin PBXFrameworksBuildPhase section */ 40 | B54A5FF9146C0BB700F354C6 /* Frameworks */ = { 41 | isa = PBXFrameworksBuildPhase; 42 | buildActionMask = 2147483647; 43 | files = ( 44 | B583ACC6146C0E4600B0CDF4 /* IOKit.framework in Frameworks */, 45 | B54A6001146C0BB700F354C6 /* Cocoa.framework in Frameworks */, 46 | ); 47 | runOnlyForDeploymentPostprocessing = 0; 48 | }; 49 | /* End PBXFrameworksBuildPhase section */ 50 | 51 | /* Begin PBXGroup section */ 52 | B54A5FF1146C0BB700F354C6 = { 53 | isa = PBXGroup; 54 | children = ( 55 | B54A6006146C0BB700F354C6 /* VoodooHdaSettingsLoader */, 56 | B54A5FFF146C0BB700F354C6 /* Frameworks */, 57 | B54A5FFD146C0BB700F354C6 /* Products */, 58 | ); 59 | sourceTree = ""; 60 | }; 61 | B54A5FFD146C0BB700F354C6 /* Products */ = { 62 | isa = PBXGroup; 63 | children = ( 64 | B54A5FFC146C0BB700F354C6 /* VoodooHdaSettingsLoader.app */, 65 | ); 66 | name = Products; 67 | sourceTree = ""; 68 | }; 69 | B54A5FFF146C0BB700F354C6 /* Frameworks */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | B54A6000146C0BB700F354C6 /* Cocoa.framework */, 73 | B583ACC5146C0E4600B0CDF4 /* IOKit.framework */, 74 | B54A6002146C0BB700F354C6 /* Other Frameworks */, 75 | ); 76 | name = Frameworks; 77 | sourceTree = ""; 78 | }; 79 | B54A6002146C0BB700F354C6 /* Other Frameworks */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | B54A6003146C0BB700F354C6 /* AppKit.framework */, 83 | B54A6004146C0BB700F354C6 /* CoreData.framework */, 84 | B54A6005146C0BB700F354C6 /* Foundation.framework */, 85 | ); 86 | name = "Other Frameworks"; 87 | sourceTree = ""; 88 | }; 89 | B54A6006146C0BB700F354C6 /* VoodooHdaSettingsLoader */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | B583ACC2146C0DD700B0CDF4 /* VoodooHdaSettingsLoader.h */, 93 | B583ACC3146C0DD700B0CDF4 /* VoodooHdaSettingsLoader.m */, 94 | B54A6007146C0BB700F354C6 /* Supporting Files */, 95 | ); 96 | path = VoodooHdaSettingsLoader; 97 | sourceTree = ""; 98 | }; 99 | B54A6007146C0BB700F354C6 /* Supporting Files */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | B54A6012146C0BB700F354C6 /* AppDelegate.h */, 103 | B54A6013146C0BB700F354C6 /* AppDelegate.m */, 104 | B54A6015146C0BB700F354C6 /* MainMenu.xib */, 105 | B54A6008146C0BB700F354C6 /* VoodooHdaSettingsLoader-Info.plist */, 106 | B54A6009146C0BB700F354C6 /* InfoPlist.strings */, 107 | B54A600C146C0BB700F354C6 /* main.m */, 108 | B54A600E146C0BB700F354C6 /* VoodooHdaSettingsLoader-Prefix.pch */, 109 | B54A600F146C0BB700F354C6 /* Credits.rtf */, 110 | ); 111 | name = "Supporting Files"; 112 | sourceTree = ""; 113 | }; 114 | /* End PBXGroup section */ 115 | 116 | /* Begin PBXNativeTarget section */ 117 | B54A5FFB146C0BB700F354C6 /* VoodooHdaSettingsLoader */ = { 118 | isa = PBXNativeTarget; 119 | buildConfigurationList = B54A601A146C0BB700F354C6 /* Build configuration list for PBXNativeTarget "VoodooHdaSettingsLoader" */; 120 | buildPhases = ( 121 | B54A5FF8146C0BB700F354C6 /* Sources */, 122 | B54A5FF9146C0BB700F354C6 /* Frameworks */, 123 | B54A5FFA146C0BB700F354C6 /* Resources */, 124 | ); 125 | buildRules = ( 126 | ); 127 | dependencies = ( 128 | ); 129 | name = VoodooHdaSettingsLoader; 130 | productName = VoodooHdaSettingsLoader; 131 | productReference = B54A5FFC146C0BB700F354C6 /* VoodooHdaSettingsLoader.app */; 132 | productType = "com.apple.product-type.application"; 133 | }; 134 | /* End PBXNativeTarget section */ 135 | 136 | /* Begin PBXProject section */ 137 | B54A5FF3146C0BB700F354C6 /* Project object */ = { 138 | isa = PBXProject; 139 | attributes = { 140 | LastUpgradeCheck = 0420; 141 | }; 142 | buildConfigurationList = B54A5FF6146C0BB700F354C6 /* Build configuration list for PBXProject "VoodooHdaSettingsLoader" */; 143 | compatibilityVersion = "Xcode 3.2"; 144 | developmentRegion = English; 145 | hasScannedForEncodings = 0; 146 | knownRegions = ( 147 | en, 148 | ); 149 | mainGroup = B54A5FF1146C0BB700F354C6; 150 | productRefGroup = B54A5FFD146C0BB700F354C6 /* Products */; 151 | projectDirPath = ""; 152 | projectRoot = ""; 153 | targets = ( 154 | B54A5FFB146C0BB700F354C6 /* VoodooHdaSettingsLoader */, 155 | ); 156 | }; 157 | /* End PBXProject section */ 158 | 159 | /* Begin PBXResourcesBuildPhase section */ 160 | B54A5FFA146C0BB700F354C6 /* Resources */ = { 161 | isa = PBXResourcesBuildPhase; 162 | buildActionMask = 2147483647; 163 | files = ( 164 | B54A600B146C0BB700F354C6 /* InfoPlist.strings in Resources */, 165 | B54A6011146C0BB700F354C6 /* Credits.rtf in Resources */, 166 | B54A6017146C0BB700F354C6 /* MainMenu.xib in Resources */, 167 | ); 168 | runOnlyForDeploymentPostprocessing = 0; 169 | }; 170 | /* End PBXResourcesBuildPhase section */ 171 | 172 | /* Begin PBXSourcesBuildPhase section */ 173 | B54A5FF8146C0BB700F354C6 /* Sources */ = { 174 | isa = PBXSourcesBuildPhase; 175 | buildActionMask = 2147483647; 176 | files = ( 177 | B54A600D146C0BB700F354C6 /* main.m in Sources */, 178 | B54A6014146C0BB700F354C6 /* AppDelegate.m in Sources */, 179 | B583ACC4146C0DD700B0CDF4 /* VoodooHdaSettingsLoader.m in Sources */, 180 | ); 181 | runOnlyForDeploymentPostprocessing = 0; 182 | }; 183 | /* End PBXSourcesBuildPhase section */ 184 | 185 | /* Begin PBXVariantGroup section */ 186 | B54A6009146C0BB700F354C6 /* InfoPlist.strings */ = { 187 | isa = PBXVariantGroup; 188 | children = ( 189 | B54A600A146C0BB700F354C6 /* en */, 190 | ); 191 | name = InfoPlist.strings; 192 | sourceTree = ""; 193 | }; 194 | B54A600F146C0BB700F354C6 /* Credits.rtf */ = { 195 | isa = PBXVariantGroup; 196 | children = ( 197 | B54A6010146C0BB700F354C6 /* en */, 198 | ); 199 | name = Credits.rtf; 200 | sourceTree = ""; 201 | }; 202 | B54A6015146C0BB700F354C6 /* MainMenu.xib */ = { 203 | isa = PBXVariantGroup; 204 | children = ( 205 | B54A6016146C0BB700F354C6 /* en */, 206 | ); 207 | name = MainMenu.xib; 208 | sourceTree = ""; 209 | }; 210 | /* End PBXVariantGroup section */ 211 | 212 | /* Begin XCBuildConfiguration section */ 213 | B54A6018146C0BB700F354C6 /* Debug */ = { 214 | isa = XCBuildConfiguration; 215 | buildSettings = { 216 | ALWAYS_SEARCH_USER_PATHS = NO; 217 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 218 | COPY_PHASE_STRIP = NO; 219 | GCC_C_LANGUAGE_STANDARD = gnu99; 220 | GCC_DYNAMIC_NO_PIC = NO; 221 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 222 | GCC_OPTIMIZATION_LEVEL = 0; 223 | GCC_PREPROCESSOR_DEFINITIONS = ( 224 | "DEBUG=1", 225 | "$(inherited)", 226 | ); 227 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 228 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 229 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 230 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 231 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 232 | GCC_WARN_UNUSED_VARIABLE = YES; 233 | MACOSX_DEPLOYMENT_TARGET = 10.7; 234 | ONLY_ACTIVE_ARCH = YES; 235 | SDKROOT = macosx; 236 | }; 237 | name = Debug; 238 | }; 239 | B54A6019146C0BB700F354C6 /* Release */ = { 240 | isa = XCBuildConfiguration; 241 | buildSettings = { 242 | ALWAYS_SEARCH_USER_PATHS = NO; 243 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 244 | COPY_PHASE_STRIP = YES; 245 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 246 | GCC_C_LANGUAGE_STANDARD = gnu99; 247 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 248 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 249 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 250 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 251 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 252 | GCC_WARN_UNUSED_VARIABLE = YES; 253 | MACOSX_DEPLOYMENT_TARGET = 10.7; 254 | SDKROOT = macosx; 255 | }; 256 | name = Release; 257 | }; 258 | B54A601B146C0BB700F354C6 /* Debug */ = { 259 | isa = XCBuildConfiguration; 260 | buildSettings = { 261 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 262 | GCC_PREFIX_HEADER = "VoodooHdaSettingsLoader/VoodooHdaSettingsLoader-Prefix.pch"; 263 | INFOPLIST_FILE = "VoodooHdaSettingsLoader/VoodooHdaSettingsLoader-Info.plist"; 264 | MACOSX_DEPLOYMENT_TARGET = 10.4; 265 | PRODUCT_NAME = "$(TARGET_NAME)"; 266 | WRAPPER_EXTENSION = app; 267 | }; 268 | name = Debug; 269 | }; 270 | B54A601C146C0BB700F354C6 /* Release */ = { 271 | isa = XCBuildConfiguration; 272 | buildSettings = { 273 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 274 | GCC_PREFIX_HEADER = "VoodooHdaSettingsLoader/VoodooHdaSettingsLoader-Prefix.pch"; 275 | INFOPLIST_FILE = "VoodooHdaSettingsLoader/VoodooHdaSettingsLoader-Info.plist"; 276 | MACOSX_DEPLOYMENT_TARGET = 10.4; 277 | PRODUCT_NAME = "$(TARGET_NAME)"; 278 | WRAPPER_EXTENSION = app; 279 | }; 280 | name = Release; 281 | }; 282 | /* End XCBuildConfiguration section */ 283 | 284 | /* Begin XCConfigurationList section */ 285 | B54A5FF6146C0BB700F354C6 /* Build configuration list for PBXProject "VoodooHdaSettingsLoader" */ = { 286 | isa = XCConfigurationList; 287 | buildConfigurations = ( 288 | B54A6018146C0BB700F354C6 /* Debug */, 289 | B54A6019146C0BB700F354C6 /* Release */, 290 | ); 291 | defaultConfigurationIsVisible = 0; 292 | defaultConfigurationName = Release; 293 | }; 294 | B54A601A146C0BB700F354C6 /* Build configuration list for PBXNativeTarget "VoodooHdaSettingsLoader" */ = { 295 | isa = XCConfigurationList; 296 | buildConfigurations = ( 297 | B54A601B146C0BB700F354C6 /* Debug */, 298 | B54A601C146C0BB700F354C6 /* Release */, 299 | ); 300 | defaultConfigurationIsVisible = 0; 301 | defaultConfigurationName = Release; 302 | }; 303 | /* End XCConfigurationList section */ 304 | }; 305 | rootObject = B54A5FF3146C0BB700F354C6 /* Project object */; 306 | } 307 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader.xcodeproj/project.xcworkspace/xcuserdata/Ben.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AppleLife/VoodooHDA/e9708dea706eedb7f07365375e01ec1d67cb6f7d/VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader.xcodeproj/project.xcworkspace/xcuserdata/Ben.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader.xcodeproj/project.xcworkspace/xcuserdata/Ben.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEWorkspaceUserSettings_HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | IDEWorkspaceUserSettings_SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader.xcodeproj/slice.pbxuser: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | 12C27306146CF712007AD031 /* VoodooHdaSettingsLoader */ = { 4 | isa = PBXExecutable; 5 | activeArgIndices = ( 6 | ); 7 | argumentStrings = ( 8 | ); 9 | autoAttachOnCrash = 1; 10 | breakpointsEnabled = 0; 11 | configStateDict = { 12 | }; 13 | customDataFormattersEnabled = 1; 14 | dataTipCustomDataFormattersEnabled = 1; 15 | dataTipShowTypeColumn = 1; 16 | dataTipSortType = 0; 17 | debuggerPlugin = GDBDebugging; 18 | disassemblyDisplayState = 0; 19 | enableDebugStr = 1; 20 | environmentEntries = ( 21 | ); 22 | executableSystemSymbolLevel = 0; 23 | executableUserSymbolLevel = 0; 24 | libgmallocEnabled = 0; 25 | name = VoodooHdaSettingsLoader; 26 | showTypeColumn = 0; 27 | sourceDirectories = ( 28 | ); 29 | }; 30 | 12C27314146CF733007AD031 /* Source Control */ = { 31 | isa = PBXSourceControlManager; 32 | fallbackIsa = XCSourceControlManager; 33 | isSCMEnabled = 0; 34 | scmConfiguration = { 35 | repositoryNamesForRoots = { 36 | "" = ""; 37 | }; 38 | }; 39 | }; 40 | 12C27315146CF733007AD031 /* Code sense */ = { 41 | isa = PBXCodeSenseManager; 42 | indexTemplatePath = ""; 43 | }; 44 | B54A5FF3146C0BB700F354C6 /* Project object */ = { 45 | activeBuildConfigurationName = Debug; 46 | activeExecutable = 12C27306146CF712007AD031 /* VoodooHdaSettingsLoader */; 47 | activeTarget = B54A5FFB146C0BB700F354C6 /* VoodooHdaSettingsLoader */; 48 | codeSenseManager = 12C27315146CF733007AD031 /* Code sense */; 49 | executables = ( 50 | 12C27306146CF712007AD031 /* VoodooHdaSettingsLoader */, 51 | ); 52 | perUserDictionary = { 53 | PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { 54 | PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; 55 | PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; 56 | PBXFileTableDataSourceColumnWidthsKey = ( 57 | 20, 58 | 341, 59 | 20, 60 | 48.16259765625, 61 | 43, 62 | 43, 63 | 20, 64 | ); 65 | PBXFileTableDataSourceColumnsKey = ( 66 | PBXFileDataSource_FiletypeID, 67 | PBXFileDataSource_Filename_ColumnID, 68 | PBXFileDataSource_Built_ColumnID, 69 | PBXFileDataSource_ObjectSize_ColumnID, 70 | PBXFileDataSource_Errors_ColumnID, 71 | PBXFileDataSource_Warnings_ColumnID, 72 | PBXFileDataSource_Target_ColumnID, 73 | ); 74 | }; 75 | PBXPerProjectTemplateStateSaveDate = 342685458; 76 | PBXWorkspaceStateSaveDate = 342685458; 77 | }; 78 | sourceControlManager = 12C27314146CF733007AD031 /* Source Control */; 79 | userBuildSettings = { 80 | }; 81 | }; 82 | B54A5FFB146C0BB700F354C6 /* VoodooHdaSettingsLoader */ = { 83 | activeExec = 0; 84 | executables = ( 85 | 12C27306146CF712007AD031 /* VoodooHdaSettingsLoader */, 86 | ); 87 | }; 88 | } 89 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader.xcodeproj/xcuserdata/Ben.xcuserdatad/xcschemes/VoodooHdaSettingsLoader.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 38 | 39 | 40 | 41 | 49 | 50 | 56 | 57 | 58 | 59 | 60 | 61 | 67 | 68 | 74 | 75 | 76 | 77 | 79 | 80 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader.xcodeproj/xcuserdata/Ben.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | VoodooHdaSettingsLoader.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | B54A5FFB146C0BB700F354C6 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // VoodooHdaSettingsLoader 4 | // 5 | // Created by Ben on 10/11/11. 6 | // Copyright (c) 2011 VoodooHDA. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject { 12 | 13 | } 14 | 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // VoodooHdaSettingsLoader 4 | // 5 | // Created by Ben on 10/11/11. 6 | // Copyright (c) 2011 VoodooHDA. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "VoodooHdaSettingsLoader.h" 12 | 13 | @implementation AppDelegate 14 | 15 | - (void)dealloc 16 | { 17 | [super dealloc]; 18 | } 19 | 20 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 21 | { 22 | // Insert code here to initialize your application 23 | 24 | VoodooHdaSettingsLoader* loader = [[VoodooHdaSettingsLoader alloc]init]; 25 | [loader load]; 26 | exit(0); 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader/VoodooHdaSettingsLoader-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | VoodooHda.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2011 VoodooHDA. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | NSUIElement 34 | 1 35 | 36 | 37 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader/VoodooHdaSettingsLoader-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'VoodooHdaSettingsLoader' target in the 'VoodooHdaSettingsLoader' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader/VoodooHdaSettingsLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // VoodooHdaSettingsLoader.h 3 | // VoodooHdaSettingsLoader 4 | // 5 | // Created by Ben on 10/11/11. 6 | // Copyright (c) 2011 VoodooHDA. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #define kVoodooHDAClassName "VoodooHDADevice" 13 | #define MAX_SLIDER_TAB_NAME_LENGTH 32 14 | #define SOUND_MIXER_NRDEVICES 25 15 | 16 | typedef union { 17 | struct { 18 | UInt8 action; 19 | UInt8 channel; 20 | UInt8 device; 21 | UInt8 val; 22 | } info; 23 | UInt32 value; 24 | } actionInfo; 25 | 26 | typedef struct _mixerDeviceInfo { 27 | UInt8 mixId; 28 | UInt8 value; 29 | char name[MAX_SLIDER_TAB_NAME_LENGTH]; 30 | bool enabled; 31 | UInt8 non[5]; //align to 8 bytes 32 | } mixerDeviceInfo; 33 | 34 | typedef struct _ChannelInfo { 35 | char name[MAX_SLIDER_TAB_NAME_LENGTH]; 36 | mixerDeviceInfo mixerValues[SOUND_MIXER_NRDEVICES]; 37 | UInt8 numChannels; 38 | bool vectorize; 39 | bool useStereo; 40 | UInt8 noiseLevel; 41 | UInt8 StereoBase; 42 | UInt8 empty[3]; 43 | } ChannelInfo; 44 | 45 | enum { 46 | kVoodooHDAActionMethod = 0, 47 | kVoodooHDANumMethods 48 | }; 49 | 50 | enum { 51 | kVoodooHDAChannelNames = 0x3000 52 | }; 53 | 54 | enum { 55 | kVoodooHDAActionSetMixer = 0x40, 56 | kVoodooHDAActionGetMixers = 0x50, 57 | kVoodooHDAActionSetMath = 0x60 58 | }; 59 | 60 | 61 | @interface VoodooHdaSettingsLoader : NSObject { 62 | } 63 | - (void) load; 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader/VoodooHdaSettingsLoader.m: -------------------------------------------------------------------------------- 1 | // 2 | // VoodooHdaSettingsLoader.m 3 | // VoodooHdaSettingsLoader 4 | // 5 | // Created by Ben on 10/11/11. 6 | // Copyright (c) 2011 VoodooHDA. All rights reserved. 7 | // 8 | 9 | #import "VoodooHdaSettingsLoader.h" 10 | 11 | static io_service_t getService() { 12 | io_service_t service = 0; 13 | mach_port_t masterPort; 14 | io_iterator_t iter; 15 | kern_return_t ret; 16 | io_string_t path; 17 | 18 | ret = IOMasterPort(MACH_PORT_NULL, &masterPort); 19 | if (ret != KERN_SUCCESS) { 20 | NSLog( @"Can't get masterport" ); 21 | goto failure; 22 | } 23 | 24 | ret = IOServiceGetMatchingServices(masterPort, IOServiceMatching(kVoodooHDAClassName), &iter); 25 | if (ret != KERN_SUCCESS) { 26 | NSLog( @"VoodooHDA is not running" ); 27 | goto failure; 28 | } 29 | 30 | service = IOIteratorNext(iter); 31 | IOObjectRelease(iter); 32 | 33 | ret = IORegistryEntryGetPath(service, kIOServicePlane, path); 34 | if (ret != KERN_SUCCESS) { 35 | NSLog( @"Can't get registry-entry path"); 36 | goto failure; 37 | } 38 | 39 | failure: 40 | return service; 41 | } 42 | 43 | static bool sendAction(UInt8 ch, UInt8 dev, UInt8 val) 44 | { 45 | //value of slider to driver 46 | io_service_t service = getService(); 47 | if(!service) 48 | goto failure; 49 | kern_return_t ret; 50 | io_connect_t connect = 0; 51 | ret = IOServiceOpen(service, mach_task_self(), 0, &connect); 52 | if (ret != KERN_SUCCESS) { 53 | NSLog(@"Can't open IO Service"); 54 | goto failure; 55 | } 56 | 57 | actionInfo in, out; 58 | in.value = 0; 59 | in.info.action = (UInt8)kVoodooHDAActionSetMixer; 60 | in.info.channel = ch; 61 | in.info.device = dev; 62 | in.info.val = val; 63 | 64 | size_t outsize = sizeof(UInt32); 65 | //*outsize = sizeof(UInt32); 66 | #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 67 | ret = IOConnectMethodStructureIStructureO( connect, kVoodooHDAActionMethod, 68 | sizeof(in), /* structureInputSize */ 69 | &outsize, /* structureOutputSize */ 70 | &in, /* inputStructure */ 71 | &out); /* ouputStructure */ 72 | #else 73 | 74 | ret = IOConnectCallStructMethod(connect, 75 | kVoodooHDAActionMethod, 76 | &in, 77 | sizeof(in), 78 | &out, 79 | &outsize 80 | ); 81 | #endif 82 | if (ret != KERN_SUCCESS) { 83 | NSLog( @"Can't connect to StructMethod to send commands"); 84 | // goto failure; //anyway 85 | } 86 | 87 | failure: 88 | 89 | if(connect) { 90 | ret = IOServiceClose(connect); 91 | if (ret != KERN_SUCCESS) { 92 | NSLog( @"IOServiceClose failed"); 93 | } 94 | } 95 | 96 | if(service) 97 | IOObjectRelease(service); 98 | 99 | return (ret == KERN_SUCCESS || ret == kIOReturnSuccess)?true:false; 100 | } 101 | 102 | static bool sendMath(UInt8 ch, bool vectorize, bool useStereo,UInt8 noiseLevel,UInt8 stereoBase) 103 | { 104 | //if (!(self->chInfo = updateChannelInfo())) //from driver 105 | // goto failure; 106 | 107 | io_service_t service = getService(); 108 | if(!service) 109 | goto failure; 110 | kern_return_t ret; 111 | io_connect_t connect = 0; 112 | ret = IOServiceOpen(service, mach_task_self(), 0, &connect); 113 | if (ret != KERN_SUCCESS) { 114 | NSLog(@"Can't open IO Service"); 115 | goto failure; 116 | } 117 | 118 | //to driver 119 | actionInfo in, out; 120 | 121 | in.value = 0; 122 | in.info.action = (UInt8)kVoodooHDAActionSetMath; 123 | in.info.channel = ch; 124 | in.info.device = (vectorize?1:0) | (useStereo?2:0); 125 | in.info.val = (noiseLevel & 0x0f) | ((stereoBase & 0x0f) << 4); 126 | // [versionText setStringValue:[NSString stringWithFormat:@"Device=%d Val=0x%04x Volume=%d", 127 | // in.info.device, in.info.val, self->chInfo[ch].mixerValues[24].value]]; 128 | size_t outsize = sizeof(UInt32); 129 | //*outsize = sizeof(UInt32); 130 | #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 131 | ret = IOConnectMethodStructureIStructureO( connect, 132 | kVoodooHDAActionMethod, 133 | sizeof(in), /* structureInputSize */ 134 | &outsize, /* structureOutputSize */ 135 | &in, /* inputStructure */ 136 | &out); /* ouputStructure */ 137 | #else 138 | 139 | ret = IOConnectCallStructMethod(connect, 140 | kVoodooHDAActionMethod, 141 | &in, 142 | sizeof(in), 143 | &out, 144 | &outsize 145 | ); 146 | #endif 147 | if (ret != KERN_SUCCESS) { 148 | NSLog( @"Can't connect to StructMethod to send commands" ); 149 | goto failure; //anyway 150 | } 151 | 152 | //failure: 153 | 154 | if(connect) { 155 | ret = IOServiceClose(connect); 156 | if (ret != KERN_SUCCESS) { 157 | NSLog( @"IOServiceClose failed" ); 158 | } 159 | } 160 | 161 | if(service) 162 | IOObjectRelease(service); 163 | 164 | return TRUE; 165 | failure: 166 | if(service) 167 | IOObjectRelease(service); 168 | 169 | return false; 170 | 171 | } 172 | 173 | //get channel info from driver 174 | static ChannelInfo *getChannelInfoFromDriver() 175 | { 176 | io_service_t service = getService(); 177 | if(!service) 178 | goto failure; 179 | 180 | kern_return_t ret; 181 | io_connect_t connect = 0; 182 | ChannelInfo *info = 0; 183 | #if __LP64__ 184 | mach_vm_address_t address; 185 | mach_vm_size_t size; 186 | #else 187 | vm_address_t address; 188 | vm_size_t size; 189 | #endif 190 | 191 | ret = IOServiceOpen(service, mach_task_self(), 0, &connect); 192 | if (ret != KERN_SUCCESS) { 193 | NSLog( @"Can't open IO Service" ); 194 | goto failure; 195 | } 196 | 197 | ret = IOConnectMapMemory(connect, kVoodooHDAChannelNames, mach_task_self(), &address, &size, 198 | kIOMapAnywhere | kIOMapDefaultCache); 199 | if (ret != kIOReturnSuccess) 200 | { 201 | NSLog( @"Can't map Memory"); 202 | goto failure; 203 | } 204 | 205 | info = (ChannelInfo*)address; 206 | 207 | failure: 208 | #if 0 209 | if(connect) { 210 | ret = IOServiceClose(connect); 211 | if (ret != KERN_SUCCESS) 212 | { 213 | NSLog( @"IOServiceClose failed" ); 214 | } 215 | } 216 | #endif 217 | if(service) 218 | IOObjectRelease(service); 219 | 220 | return info; 221 | //return (ret == KERN_SUCCESS || ret == kIOReturnSuccess)?true:false; 222 | } 223 | 224 | 225 | 226 | 227 | @implementation VoodooHdaSettingsLoader 228 | 229 | 230 | 231 | - (bool) loadSettings 232 | { 233 | bool res = false; 234 | 235 | NSString *nPath = [[NSString stringWithString:@"~/Library/Preferences/VoodooHDA.settings"] stringByExpandingTildeInPath]; 236 | const char *path = [nPath UTF8String]; 237 | FILE *inputFile = fopen(path, "rb+"); 238 | if(!inputFile) { 239 | NSLog(@"Couldn't load settings file (file opening problem: not here, or read protected"); 240 | goto failure; 241 | } 242 | 243 | fseek (inputFile, 0, SEEK_END); 244 | long size= ftell(inputFile); 245 | rewind(inputFile); 246 | 247 | if( ( (size-1) /sizeof(ChannelInfo))*sizeof(ChannelInfo) != (size-1) ) // Remove the \n at the end 248 | { 249 | NSLog(@"Settings file is not compatible with this version of VoodooHdaSettingsLoader (channel sizes are different"); 250 | goto failure; 251 | } 252 | 253 | long channelCount = size/sizeof(ChannelInfo); 254 | NSLog(@"%ld channels to read.",channelCount); 255 | 256 | ChannelInfo* channels = (ChannelInfo*)malloc(channelCount*sizeof(ChannelInfo)); 257 | 258 | int c,d; 259 | 260 | for(c=0;cnumChannels); 276 | if(driverInfo->numChannels != channelCount) 277 | { 278 | NSLog(@"Channel count not matching."); 279 | goto failure; 280 | } 281 | 282 | NSLog(@"Checking all channels devices"); 283 | for(c = 0;c 2 | 3 | 4 | 1070 5 | 11C74 6 | 1938 7 | 1138.23 8 | 567.00 9 | 10 | com.apple.InterfaceBuilder.CocoaPlugin 11 | 1938 12 | 13 | 14 | NSTextField 15 | NSTextFieldCell 16 | NSWindowTemplate 17 | NSView 18 | NSCustomObject 19 | 20 | 21 | com.apple.InterfaceBuilder.CocoaPlugin 22 | 23 | 24 | PluginDependencyRecalculationVersion 25 | 26 | 27 | 28 | 29 | NSApplication 30 | 31 | 32 | FirstResponder 33 | 34 | 35 | NSApplication 36 | 37 | 38 | 15 39 | 2 40 | {{335, 390}, {347, 57}} 41 | 1954021376 42 | VoodooHdaSettingsLoader 43 | NSWindow 44 | 45 | 46 | 47 | 48 | 256 49 | 50 | 51 | 52 | 268 53 | {{17, 20}, {313, 17}} 54 | 55 | 56 | 57 | _NS:3944 58 | YES 59 | 60 | 68288064 61 | 272630784 62 | This app will close as soon as it has done its job. 63 | 64 | LucidaGrande 65 | 13 66 | 1044 67 | 68 | _NS:3944 69 | 70 | 71 | 6 72 | System 73 | controlColor 74 | 75 | 3 76 | MC42NjY2NjY2NjY3AA 77 | 78 | 79 | 80 | 6 81 | System 82 | controlTextColor 83 | 84 | 3 85 | MAA 86 | 87 | 88 | 89 | 90 | 91 | {347, 57} 92 | 93 | 94 | 95 | 96 | {{0, 0}, {1680, 1028}} 97 | {10000000000000, 10000000000000} 98 | YES 99 | 100 | 101 | AppDelegate 102 | 103 | 104 | NSFontManager 105 | 106 | 107 | 108 | 109 | 110 | 111 | delegate 112 | 113 | 114 | 115 | 495 116 | 117 | 118 | 119 | 120 | 121 | 0 122 | 123 | 124 | 125 | 126 | 127 | -2 128 | 129 | 130 | File's Owner 131 | 132 | 133 | -1 134 | 135 | 136 | First Responder 137 | 138 | 139 | -3 140 | 141 | 142 | Application 143 | 144 | 145 | 371 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 372 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 420 162 | 163 | 164 | 165 | 166 | 494 167 | 168 | 169 | 170 | 171 | 536 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 537 180 | 181 | 182 | 183 | 184 | 185 | 186 | com.apple.InterfaceBuilder.CocoaPlugin 187 | com.apple.InterfaceBuilder.CocoaPlugin 188 | com.apple.InterfaceBuilder.CocoaPlugin 189 | com.apple.InterfaceBuilder.CocoaPlugin 190 | {{380, 496}, {480, 360}} 191 | 192 | com.apple.InterfaceBuilder.CocoaPlugin 193 | com.apple.InterfaceBuilder.CocoaPlugin 194 | com.apple.InterfaceBuilder.CocoaPlugin 195 | com.apple.InterfaceBuilder.CocoaPlugin 196 | com.apple.InterfaceBuilder.CocoaPlugin 197 | 198 | 199 | 200 | 201 | 202 | 537 203 | 204 | 205 | 206 | 207 | AppDelegate 208 | NSObject 209 | 210 | window 211 | NSWindow 212 | 213 | 214 | window 215 | 216 | window 217 | NSWindow 218 | 219 | 220 | 221 | IBProjectSource 222 | ./Classes/AppDelegate.h 223 | 224 | 225 | 226 | 227 | 0 228 | IBCocoaFramework 229 | YES 230 | 3 231 | 232 | 233 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // VoodooHdaSettingsLoader 4 | // 5 | // Created by Ben on 10/11/11. 6 | // Copyright (c) 2011 VoodooHDA. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | --------------------------------------------------------------------------------