├── .gitignore ├── LICENSE ├── VHDAPrefPane └── VoodooHDA │ ├── English.lproj │ └── VoodooHDAPref.xib │ ├── Info.plist │ ├── VoodooHDA-old.xcodeproj │ ├── project.pbxproj │ ├── slice.mode1v3 │ └── slice.pbxuser │ ├── VoodooHDA.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ └── Slice.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ ├── VoodooHDAPref.h │ ├── VoodooHDAPref.icns │ └── VoodooHDAPref.m ├── VoodooHdaSettingsLoader ├── .DS_Store └── src │ ├── VoodooHdaSettingsLoader.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── Slice.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── Slice.xcuserdatad │ │ └── xcschemes │ │ ├── VoodooHdaSettingsLoader.xcscheme │ │ └── xcschememanagement.plist │ └── VoodooHdaSettingsLoader │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── VoodooHdaSettingsLoader-Info.plist │ ├── VoodooHdaSettingsLoader.h │ ├── VoodooHdaSettingsLoader.icns │ ├── VoodooHdaSettingsLoader.m │ ├── en.lproj │ └── MainMenu.xib │ └── main.m ├── branches ├── .DS_Store └── zdev │ ├── .DS_Store │ ├── AppleAudioClip.cpp │ ├── AppleAudioClip.h │ ├── AppleAudioCommon.h │ ├── Common.h │ ├── 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 │ └── project.pbxproj │ ├── VoodooHDADevice.cpp │ ├── VoodooHDADevice.h │ ├── VoodooHDAEngine.cpp │ ├── VoodooHDAEngine.h │ ├── VoodooHDAUserClient.cpp │ ├── VoodooHDAUserClient.h │ ├── VoodooHDA_BS.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ └── sergey.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── sergey.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist │ ├── getdump.c │ ├── getdump.mak │ ├── helper.sh │ ├── iSubTypes.h │ ├── private_xmmintrin.h │ └── version.plist ├── readme.md └── tranc ├── .DS_Store ├── AppleAudioClip.cpp ├── AppleAudioClip.h ├── AppleAudioCommon.h ├── AudioClip.cpp ├── Common.h ├── English.lproj └── InfoPlist.strings ├── Info-HDMI.plist ├── Info-noHDMI.plist ├── 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 ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ ├── Slice.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── sergey.xcuserdatad │ │ └── UserInterfaceState.xcuserstate ├── xcshareddata │ ├── xcschemes │ │ └── VoodooHDA.xcscheme │ └── xcshemes │ │ ├── VoodooHDA.xcscheme │ │ └── xcschememanagement.plist └── xcuserdata │ └── sergey.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── VoodooHDADevice.cpp ├── VoodooHDADevice.h ├── VoodooHDAEngine.cpp ├── VoodooHDAEngine.h ├── VoodooHDAUserClient.cpp ├── VoodooHDAUserClient.h ├── VoodooHDA_BS.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ ├── Slice.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── sergey.xcuserdatad │ │ └── UserInterfaceState.xcuserstate ├── xcshareddata │ └── xcshemes │ │ ├── VoodooHDA.xcscheme │ │ └── xcschememanagement.plist └── xcuserdata │ └── sergey.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── VoodooHDA_old.xcodeproj ├── TemplateIcon.tiff ├── dima.mode1v3 ├── dima.pbxuser ├── project.pbxproj ├── sergey.mode1v3 ├── sergey.pbxuser ├── slice.mode1v3 ├── slice.pbxuser ├── user.mode1v3 └── user.pbxuser ├── alsa_patch_amd_hdmi.txt ├── emmintrin.h ├── float.h ├── getdump.c ├── getdump2.c ├── helper.sh ├── iSubTypes.h ├── mm3dnow.h ├── mm_malloc.h ├── mmintrin.h ├── patches_for_hdmi.txt ├── private_xmmintrin.h └── version.plist /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | Copyright (c) 2022, CloverHackyColor 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /VHDAPrefPane/VoodooHDA/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | VoodooHDAPref 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_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.icns 29 | NSPrefPaneIconLabel 30 | VoodooHDA 31 | NSPrincipalClass 32 | VoodooHDAPref 33 | 34 | 35 | -------------------------------------------------------------------------------- /VHDAPrefPane/VoodooHDA/VoodooHDA-old.xcodeproj/slice.pbxuser: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | 089C1669FE841209C02AAC07 /* Project object */ = { 4 | activeArchitecturePreference = i386; 5 | activeBuildConfigurationName = Release; 6 | activeTarget = 8D202CE80486D31800D8A456 /* VoodooHDA */; 7 | addToTargets = ( 8 | 8D202CE80486D31800D8A456 /* VoodooHDA */, 9 | ); 10 | breakpoints = ( 11 | ); 12 | codeSenseManager = 12E1D8FE121C1F22002EB548 /* Code sense */; 13 | perUserDictionary = { 14 | "PBXConfiguration.PBXBreakpointsDataSource.v1:1CA1AED706398EBD00589147" = { 15 | PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; 16 | PBXFileTableDataSourceColumnSortingKey = PBXBreakpointsDataSource_BreakpointID; 17 | PBXFileTableDataSourceColumnWidthsKey = ( 18 | 20, 19 | 20, 20 | 198, 21 | 20, 22 | 99, 23 | 99, 24 | 29, 25 | 20, 26 | ); 27 | PBXFileTableDataSourceColumnsKey = ( 28 | PBXBreakpointsDataSource_ActionID, 29 | PBXBreakpointsDataSource_TypeID, 30 | PBXBreakpointsDataSource_BreakpointID, 31 | PBXBreakpointsDataSource_UseID, 32 | PBXBreakpointsDataSource_LocationID, 33 | PBXBreakpointsDataSource_ConditionID, 34 | PBXBreakpointsDataSource_IgnoreCountID, 35 | PBXBreakpointsDataSource_ContinueID, 36 | ); 37 | }; 38 | PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { 39 | PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; 40 | PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; 41 | PBXFileTableDataSourceColumnWidthsKey = ( 42 | 20, 43 | 675, 44 | 20, 45 | 48, 46 | 43, 47 | 43, 48 | 20, 49 | ); 50 | PBXFileTableDataSourceColumnsKey = ( 51 | PBXFileDataSource_FiletypeID, 52 | PBXFileDataSource_Filename_ColumnID, 53 | PBXFileDataSource_Built_ColumnID, 54 | PBXFileDataSource_ObjectSize_ColumnID, 55 | PBXFileDataSource_Errors_ColumnID, 56 | PBXFileDataSource_Warnings_ColumnID, 57 | PBXFileDataSource_Target_ColumnID, 58 | ); 59 | }; 60 | PBXConfiguration.PBXFileTableDataSource3.XCSCMDataSource = { 61 | PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; 62 | PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; 63 | PBXFileTableDataSourceColumnWidthsKey = ( 64 | 20, 65 | 20, 66 | 219, 67 | 20, 68 | 48, 69 | 43, 70 | 43, 71 | 20, 72 | ); 73 | PBXFileTableDataSourceColumnsKey = ( 74 | PBXFileDataSource_SCM_ColumnID, 75 | PBXFileDataSource_FiletypeID, 76 | PBXFileDataSource_Filename_ColumnID, 77 | PBXFileDataSource_Built_ColumnID, 78 | PBXFileDataSource_ObjectSize_ColumnID, 79 | PBXFileDataSource_Errors_ColumnID, 80 | PBXFileDataSource_Warnings_ColumnID, 81 | PBXFileDataSource_Target_ColumnID, 82 | ); 83 | }; 84 | PBXPerProjectTemplateStateSaveDate = 379405054; 85 | PBXWorkspaceStateSaveDate = 379405054; 86 | }; 87 | perUserProjectItems = { 88 | 124094DF15D13DD400199B28 /* PBXTextBookmark */ = 124094DF15D13DD400199B28 /* PBXTextBookmark */; 89 | 12A0E1F8169D431A00069706 /* PBXTextBookmark */ = 12A0E1F8169D431A00069706 /* PBXTextBookmark */; 90 | }; 91 | sourceControlManager = 12E1D8FD121C1F22002EB548 /* Source Control */; 92 | userBuildSettings = { 93 | }; 94 | }; 95 | 089C167EFE841241C02AAC07 /* English */ = { 96 | uiCtxt = { 97 | sepNavIntBoundsRect = "{{0, 0}, {853, 391}}"; 98 | sepNavSelRange = "{103, 0}"; 99 | sepNavVisRange = "{0, 107}"; 100 | }; 101 | }; 102 | 124094DF15D13DD400199B28 /* PBXTextBookmark */ = { 103 | isa = PBXTextBookmark; 104 | fRef = F506C03D013D9D7901CA16C8 /* VoodooHDAPref.m */; 105 | name = "VoodooHDAPref.m: 8"; 106 | rLen = 0; 107 | rLoc = 198; 108 | rType = 0; 109 | vrLen = 496; 110 | vrLoc = 10603; 111 | }; 112 | 12A0E1F8169D431A00069706 /* PBXTextBookmark */ = { 113 | isa = PBXTextBookmark; 114 | fRef = F506C03D013D9D7901CA16C8 /* VoodooHDAPref.m */; 115 | name = "VoodooHDAPref.m: 9"; 116 | rLen = 0; 117 | rLoc = 198; 118 | rType = 0; 119 | vrLen = 484; 120 | vrLoc = 10578; 121 | }; 122 | 12E1D8FD121C1F22002EB548 /* Source Control */ = { 123 | isa = PBXSourceControlManager; 124 | fallbackIsa = XCSourceControlManager; 125 | isSCMEnabled = 1; 126 | scmConfiguration = { 127 | repositoryNamesForRoots = { 128 | "" = voodoohda; 129 | }; 130 | }; 131 | scmType = scm.subversion; 132 | }; 133 | 12E1D8FE121C1F22002EB548 /* Code sense */ = { 134 | isa = PBXCodeSenseManager; 135 | indexTemplatePath = ""; 136 | }; 137 | 8D202CE80486D31800D8A456 /* VoodooHDA */ = { 138 | activeExec = 0; 139 | }; 140 | F506C03C013D9D7901CA16C8 /* VoodooHDAPref.h */ = { 141 | uiCtxt = { 142 | sepNavIntBoundsRect = "{{0, 0}, {853, 1456}}"; 143 | sepNavSelRange = "{2226, 13}"; 144 | sepNavVisRange = "{1948, 843}"; 145 | }; 146 | }; 147 | F506C03D013D9D7901CA16C8 /* VoodooHDAPref.m */ = { 148 | uiCtxt = { 149 | sepNavIntBoundsRect = "{{0, 0}, {853, 9802}}"; 150 | sepNavSelRange = "{198, 0}"; 151 | sepNavVisRange = "{10578, 484}"; 152 | sepNavVisRect = "{{0, 4577}, {734, 195}}"; 153 | }; 154 | }; 155 | } 156 | -------------------------------------------------------------------------------- /VHDAPrefPane/VoodooHDA/VoodooHDA.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /VHDAPrefPane/VoodooHDA/VoodooHDA.xcodeproj/project.xcworkspace/xcuserdata/Slice.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CloverHackyColor/VoodooHDA/870a1bb8a24effc93803abfcb5eb9ec00150a972/VHDAPrefPane/VoodooHDA/VoodooHDA.xcodeproj/project.xcworkspace/xcuserdata/Slice.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /VHDAPrefPane/VoodooHDA/VoodooHDAPref.h: -------------------------------------------------------------------------------- 1 | // 2 | // VoodooHDAPref.h 3 | // VoodooHDA 4 | // 5 | // Created by fassl on 15.04.09. 6 | // Copyright (c) 2009-2013 Voodoo. All rights reserved. 7 | // 8 | 9 | 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 | @interface VoodooHDAPref : NSPreferencePane 61 | { 62 | IBOutlet NSTextField *versionText; 63 | IBOutlet NSSlider *sliderAltPCM; 64 | IBOutlet NSSlider *sliderBass; 65 | IBOutlet NSSlider *sliderCD; 66 | IBOutlet NSSlider *sliderDigital1; 67 | IBOutlet NSSlider *sliderDigital2; 68 | IBOutlet NSSlider *sliderDigital3; 69 | IBOutlet NSSlider *sliderIGain; 70 | IBOutlet NSSlider *sliderIMix; 71 | IBOutlet NSSlider *sliderLine; 72 | IBOutlet NSSlider *sliderLine1; 73 | IBOutlet NSSlider *sliderLine2; 74 | IBOutlet NSSlider *sliderLine3; 75 | IBOutlet NSSlider *sliderMic; 76 | IBOutlet NSSlider *sliderMonitor; 77 | IBOutlet NSSlider *sliderOGain; 78 | IBOutlet NSSlider *sliderPCM; 79 | IBOutlet NSSlider *sliderPhoneIn; 80 | IBOutlet NSSlider *sliderPhoneOut; 81 | IBOutlet NSSlider *sliderRadio; 82 | IBOutlet NSSlider *sliderRecLev; 83 | IBOutlet NSSlider *sliderSpeaker; 84 | IBOutlet NSSlider *sliderSynth; 85 | IBOutlet NSSlider *sliderTreble; 86 | IBOutlet NSSlider *sliderVideo; 87 | 88 | IBOutlet NSSlider *sliderNoise; 89 | IBOutlet NSSlider *sliderVolume; 90 | IBOutlet NSSlider *sliderStereo; 91 | 92 | IBOutlet NSButton *soundVector; 93 | IBOutlet NSButton *stereoEnhance; 94 | 95 | IBOutlet NSPopUpButton *selector; 96 | IBOutlet NSPopUpButton *HDAselector; 97 | 98 | NSArray* services; 99 | NSInteger currentService; 100 | UInt8 currentChannel; 101 | ChannelInfo *chInfo; 102 | } 103 | //- (bool) updateChannelInfo; 104 | - (bool) updateMath; 105 | - (bool) updateSliders; 106 | - (void) mainViewDidLoad; 107 | - (void) didUnselect; 108 | - (bool) saveSettings; 109 | - (void) willSelect; 110 | - (void) dealloc; 111 | - (bool) populateHDASelector; 112 | - (bool) populateSelector; 113 | - (IBAction)sliderMoved:(NSSlider *)sender; 114 | - (IBAction)selectorChanged:(NSPopUpButton *)sender; 115 | //- (IBAction)enableAllSLiders:(NSButton *)sender; 116 | - (IBAction)SSEChanged:(NSButton *)sender; 117 | - (IBAction)useStereoEnhance:(NSButton *)sender; 118 | 119 | //- (void) changeVersionText; 120 | 121 | @end 122 | -------------------------------------------------------------------------------- /VHDAPrefPane/VoodooHDA/VoodooHDAPref.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CloverHackyColor/VoodooHDA/870a1bb8a24effc93803abfcb5eb9ec00150a972/VHDAPrefPane/VoodooHDA/VoodooHDAPref.icns -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CloverHackyColor/VoodooHDA/870a1bb8a24effc93803abfcb5eb9ec00150a972/VoodooHdaSettingsLoader/.DS_Store -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader.xcodeproj/project.xcworkspace/xcuserdata/Slice.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CloverHackyColor/VoodooHDA/870a1bb8a24effc93803abfcb5eb9ec00150a972/VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader.xcodeproj/project.xcworkspace/xcuserdata/Slice.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader.xcodeproj/xcuserdata/Slice.xcuserdatad/xcschemes/VoodooHdaSettingsLoader.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader.xcodeproj/xcuserdata/Slice.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-2013 VoodooHDA. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject { 12 | } 13 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // VoodooHdaSettingsLoader 4 | // 5 | // Created by Ben on 10/11/11. 6 | // Copyright (c) 2011-2013 VoodooHDA. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "VoodooHdaSettingsLoader.h" 12 | 13 | @implementation AppDelegate 14 | 15 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 16 | { 17 | VoodooHdaSettingsLoader* loader = [[VoodooHdaSettingsLoader alloc] init]; 18 | [loader load]; 19 | exit(0); 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader/VoodooHdaSettingsLoader-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | VoodooHDASettingsLoader.icns 11 | CFBundleIdentifier 12 | VoodooHda.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | ${DYLIB_CURRENT_VERSION} 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | ${DYLIB_CURRENT_VERSION} 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2011-2014 VoodooHDA. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | NSUIElement 34 | 1 35 | 36 | 37 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader/VoodooHdaSettingsLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // VoodooHdaSettingsLoader.h 3 | // VoodooHdaSettingsLoader 4 | // 5 | // Created by Ben on 10/11/11. 6 | // Copyright (c) 2011-2013 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 | @interface VoodooHdaSettingsLoader : NSObject { 61 | } 62 | - (void) load; 63 | - (bool) loadSettings; 64 | - (bool) tryImportOldSettings; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader/VoodooHdaSettingsLoader.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CloverHackyColor/VoodooHDA/870a1bb8a24effc93803abfcb5eb9ec00150a972/VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader/VoodooHdaSettingsLoader.icns -------------------------------------------------------------------------------- /VoodooHdaSettingsLoader/src/VoodooHdaSettingsLoader/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // VoodooHdaSettingsLoader 4 | // 5 | // Created by Ben on 10/11/11. 6 | // Copyright (c) 2011-2013 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 | -------------------------------------------------------------------------------- /branches/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CloverHackyColor/VoodooHDA/870a1bb8a24effc93803abfcb5eb9ec00150a972/branches/.DS_Store -------------------------------------------------------------------------------- /branches/zdev/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CloverHackyColor/VoodooHDA/870a1bb8a24effc93803abfcb5eb9ec00150a972/branches/zdev/.DS_Store -------------------------------------------------------------------------------- /branches/zdev/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 | -------------------------------------------------------------------------------- /branches/zdev/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 | -------------------------------------------------------------------------------- /branches/zdev/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 | -------------------------------------------------------------------------------- /branches/zdev/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | KEXT 17 | CFBundleShortVersionString 18 | $(MODULE_VERSION) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(MODULE_VERSION) 23 | IOKitPersonalities 24 | 25 | VoodooHDA 26 | 27 | AllowMSI 28 | 29 | Boost 30 | 0 31 | CFBundleIdentifier 32 | org.voodoo.driver.VoodooHDA 33 | DisableInputMonitor 34 | 35 | IOClass 36 | VoodooHDADevice 37 | IOPCIClassMatch 38 | 0x04000000&0xfffc0000 39 | IOProviderClass 40 | IOPCIDevice 41 | IOUserClientClass 42 | VoodooHDAUserClient 43 | InhibitCache 44 | 45 | MixerValues 46 | 47 | Rec 48 | 70 49 | PCM 50 | 100 51 | iMix 52 | 0 53 | iGain 54 | 0 55 | 56 | NodesToPatch 57 | 58 | Noise 59 | 0 60 | Vectorize 61 | 62 | VoodooHDAEnableHalfMicVolumeFix 63 | 64 | VoodooHDAEnableHalfVolumeFix 65 | 66 | VoodooHDAEnableMuteFix 67 | 68 | VoodooHDAEnableVolumeChangeFix 69 | 70 | VoodooHDAVerboseLevel 71 | 0 72 | 73 | 74 | OSBundleLibraries 75 | 76 | com.apple.iokit.IOAudioFamily 77 | 1.1fc9 78 | com.apple.iokit.IOPCIFamily 79 | 2.1 80 | com.apple.kpi.iokit 81 | 9.0.0 82 | com.apple.kpi.libkern 83 | 9.0.0 84 | com.apple.kpi.mach 85 | 9.0.0 86 | com.apple.kpi.unsupported 87 | 9.0.0 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /branches/zdev/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 | -------------------------------------------------------------------------------- /branches/zdev/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 (SOUND_MASK_LINE | SOUND_MASK_MIC | SOUND_MASK_CD | SOUND_MASK_MONITOR) 71 | #define SOUND_MASK_INPUT (SOUND_MASK_LINE | SOUND_MASK_MIC | 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 131 | -------------------------------------------------------------------------------- /branches/zdev/PCMBlitterLib.cpp: -------------------------------------------------------------------------------- 1 | #include "License.h" 2 | 3 | #include "PCMBlitterLibDispatch.h" 4 | 5 | /* 6 | This file contains portable int<->float blitters. 7 | */ 8 | #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 9 | #define TARGET_OS_MAC 1 10 | #endif 11 | #if defined(__i386__) || defined(__x86_64__) 12 | #undef TARGET_CPU_X86 13 | #define TARGET_CPU_X86 1 14 | #undef TARGET_RT_LITTLE_ENDIAN 15 | #define TARGET_RT_LITTLE_ENDIAN 0 16 | #endif 17 | 18 | #if !TARGET_OS_MAC 19 | // we have optimized versions of most of these for Mac OS 20 | 21 | #pragma mark - 22 | #pragma mark 16-bit 23 | // ____________________________________________________________________________ 24 | // 25 | void NativeInt16ToFloat32_Portable(const SInt16 *src, Float32 *dest, unsigned int count) 26 | { 27 | TIntToFloatBlitter blitter(16); 28 | 29 | blitter.Convert(src, dest, count); 30 | } 31 | 32 | void SwapInt16ToFloat32_Portable(const SInt16 *src, Float32 *dest, unsigned int count) 33 | { 34 | TIntToFloatBlitter blitter(16); 35 | 36 | blitter.Convert(src, dest, count); 37 | } 38 | 39 | void Float32ToNativeInt16_Portable(const Float32 *src, SInt16 *dest, unsigned int count) 40 | { 41 | TFloatToIntBlitter blitter(16); 42 | 43 | blitter.Convert(src, dest, count); 44 | } 45 | 46 | void Float32ToSwapInt16_Portable(const Float32 *src, SInt16 *dest, unsigned int count) 47 | { 48 | TFloatToIntBlitter blitter(16); 49 | 50 | blitter.Convert(src, dest, count); 51 | } 52 | 53 | #pragma mark - 54 | #pragma mark 32-bit 55 | // ____________________________________________________________________________ 56 | // 57 | void NativeInt32ToFloat32_Portable(const SInt32 *src, Float32 *dest, unsigned int count) 58 | { 59 | TIntToFloatBlitter blitter(32); 60 | 61 | blitter.Convert(src, dest, count); 62 | } 63 | 64 | void SwapInt32ToFloat32_Portable(const SInt32 *src, Float32 *dest, unsigned int count) 65 | { 66 | TIntToFloatBlitter blitter(32); 67 | 68 | blitter.Convert(src, dest, count); 69 | } 70 | 71 | void Float32ToNativeInt32_Portable(const Float32 *src, SInt32 *dest, unsigned int count) 72 | { 73 | TFloatToIntBlitter blitter(32); 74 | 75 | blitter.Convert(src, dest, count); 76 | } 77 | 78 | void Float32ToSwapInt32_Portable(const Float32 *src, SInt32 *dest, unsigned int count) 79 | { 80 | TFloatToIntBlitter blitter(32); 81 | 82 | blitter.Convert(src, dest, count); 83 | } 84 | 85 | #pragma mark - 86 | #pragma mark 24-bit 87 | 88 | // ____________________________________________________________________________ 89 | // 90 | void Float32ToNativeInt24_Portable(const Float32 *src, UInt8 *vdest, unsigned int nSamples) 91 | { 92 | UInt32 *dest = (UInt32 *)vdest; 93 | double maxInt32 = 2147483648.0; // 1 << 31 94 | double round = 128.0; 95 | double max32 = maxInt32 - 1.0 - round; 96 | double min32 = -2147483648.0; 97 | int shift = 8, count; 98 | 99 | SET_ROUNDMODE 100 | 101 | count = nSamples >> 2; 102 | while (count--) { 103 | double f1 = src[0] * maxInt32 + round; 104 | double f2 = src[1] * maxInt32 + round; 105 | double f3 = src[2] * maxInt32 + round; 106 | double f4 = src[3] * maxInt32 + round; 107 | SInt32 i1 = FloatToInt(f1, min32, max32) >> shift; 108 | SInt32 i2 = FloatToInt(f2, min32, max32) >> shift; 109 | SInt32 i3 = FloatToInt(f3, min32, max32) >> shift; 110 | SInt32 i4 = FloatToInt(f4, min32, max32) >> shift; 111 | // memory: a3 a2 a1 b3 register: b3 a1 a2 a3 112 | dest[0] = (i1 & 0xFFFFFF) | ((i2 & 0xFF) << 24); 113 | // memory: b2 b1 c3 c2 register: c2 c3 b1 b2 114 | dest[1] = (i3 << 16) | ((i2 >> 8) & 0xFFFF); 115 | // memory: c1 d3 d2 d1 register: d1 d2 d3 c1 116 | dest[2] = ((i3 >> 16) & 0xFF) | ((i4 & 0xFFFFFF) << 8); 117 | src += 4; 118 | dest += 3; 119 | } 120 | UInt8 *p = (UInt8 *)dest; 121 | count = nSamples & 3; 122 | while (count--) { 123 | double f1 = *src++ * maxInt32 + round; 124 | SInt32 i1 = FloatToInt(f1, min32, max32) >> shift; 125 | p[0] = UInt8(i1); 126 | p[1] = UInt8(i1 >> 8); 127 | p[2] = UInt8(i1 >> 16); 128 | p += 3; 129 | } 130 | RESTORE_ROUNDMODE 131 | }; 132 | 133 | #endif // !TARGET_OS_MAC 134 | 135 | #if !TARGET_OS_MAC || TARGET_CPU_X86 136 | // These are needed for both non-MacOS and MacOS/X86 137 | 138 | // ____________________________________________________________________________ 139 | // 140 | void Float32ToSwapInt24_Portable(const Float32 *src, UInt8 *vdest, unsigned int nSamples) 141 | { 142 | UInt32 *dest = (UInt32 *)vdest; 143 | double maxInt32 = 2147483648.0; // 1 << 31 144 | double round = 128.0; 145 | double max32 = maxInt32 - 1.0 - round; 146 | double min32 = -2147483648.0; 147 | int shift = 8, count; 148 | 149 | SET_ROUNDMODE 150 | 151 | count = nSamples >> 2; 152 | while (count--) { 153 | double f1 = src[0] * maxInt32 + round; 154 | double f2 = src[1] * maxInt32 + round; 155 | double f3 = src[2] * maxInt32 + round; 156 | double f4 = src[3] * maxInt32 + round; 157 | SInt32 i1 = FloatToInt(f1, min32, max32) >> shift; 158 | SInt32 i2 = FloatToInt(f2, min32, max32) >> shift; 159 | SInt32 i3 = FloatToInt(f3, min32, max32) >> shift; 160 | SInt32 i4 = FloatToInt(f4, min32, max32) >> shift; 161 | // memory: a1 a2 a3 b1 register: b1 a3 a2 a1 162 | dest[0] = ((i2 & 0x00FF0000) << 8) 163 | | ((i1 & 0x000000FF) << 16) 164 | | (i1 & 0x0000FF00) 165 | | ((i1 & 0x00FF0000) >> 16); 166 | // memory: b2 b3 c1 c2 register: c2 c1 b3 b2 167 | dest[1] = ((i3 & 0x0000FF00) << 16) 168 | | (i3 & 0x00FF0000) 169 | | ((i2 & 0x000000FF) << 8) 170 | | ((i2 & 0x0000FF00) >> 8); 171 | // memory: c3 d1 d2 d3 register: d3 d2 d1 c3 172 | dest[2] = ((i4 & 0x000000FF) << 24) 173 | | ((i4 & 0x0000FF00) << 8) 174 | | ((i4 & 0x00FF0000) >> 8) 175 | | (i3 & 0x000000FF); 176 | src += 4; 177 | dest += 3; 178 | } 179 | UInt8 *p = (UInt8 *)dest; 180 | count = nSamples & 3; 181 | while (count--) { 182 | double f1 = *src++ * maxInt32 + round; 183 | SInt32 i1 = FloatToInt(f1, min32, max32) >> shift; 184 | p[0] = UInt8(i1 >> 16); 185 | p[1] = UInt8(i1 >> 8); 186 | p[2] = UInt8(i1); 187 | p += 3; 188 | } 189 | RESTORE_ROUNDMODE 190 | } 191 | 192 | // ____________________________________________________________________________ 193 | // 194 | void NativeInt24ToFloat32_Portable(const UInt8 *vsrc, Float32 *dest, unsigned int count) 195 | { 196 | const UInt32 *src = (const UInt32 *)vsrc; 197 | Float32 scale = (1. / 2147483648.0); 198 | int nSamples4 = count >> 2; 199 | 200 | while (nSamples4--) { 201 | SInt32 lv1 = src[0]; // BE: a1 a2 a3 b1 LE memory: a3 a2 a1 b3 register: b3 a1 a2 a3 202 | SInt32 lv2 = src[1]; // BE: b2 b3 c1 c2 LE memory: b2 b1 c3 c2 register: c2 c3 b1 b2 203 | SInt32 lv3 = src[2]; // BE: c3 d1 d2 d3 LE memory: c1 d3 d2 d1 register: d1 d2 d3 c1 204 | SInt32 lv4; 205 | 206 | // printf("%08X %08X %08X => ", lv1, lv2, lv3); 207 | lv4 = lv3 & 0xFFFFFF00; 208 | lv3 = (lv3 << 24) | ((lv2 & 0xFFFF0000) >> 8); 209 | lv2 = (lv2 << 16) | ((lv1 & 0xFF000000) >> 16); 210 | lv1 = (lv1 << 8); 211 | // printf("%08X %08X %08X %08X\n", lv1, lv2, lv3, lv4); 212 | 213 | dest[0] = lv1 * scale; 214 | dest[1] = lv2 * scale; 215 | dest[2] = lv3 * scale; 216 | dest[3] = lv4 * scale; 217 | 218 | src += 3; 219 | dest += 4; 220 | } 221 | int nSamples = count & 3; 222 | UInt8 *p = (UInt8 *)src; 223 | while (nSamples--) { 224 | SInt32 lv = p[0] | (p[1] << 8) | (p[2] << 16); 225 | lv <<= 8; 226 | p += 3; 227 | *dest++ = lv * scale; 228 | } 229 | } 230 | 231 | // ____________________________________________________________________________ 232 | // 233 | void SwapInt24ToFloat32_Portable(const UInt8 *vsrc, Float32 *dest, unsigned int count) 234 | { 235 | const UInt32 *src = (const UInt32 *)vsrc; 236 | Float32 scale = (1. / 2147483648.0); 237 | int nSamples4 = count >> 2; 238 | 239 | while (nSamples4--) { 240 | SInt32 lv1 = src[0]; // BE: a3 a2 a1 b3 LE memory: a1 a2 a3 b1 register: b1 a3 a2 a1 241 | SInt32 lv2 = src[1]; // BE: b2 b1 c3 c2 LE memory: b2 b3 c1 c2 register: c2 c1 b3 b2 242 | SInt32 lv3 = src[2]; // BE: c1 d3 d2 d1 LE memory: c3 d1 d2 d3 register: d3 d2 d1 c3 243 | SInt32 lv4; 244 | 245 | // printf("%08X %08X %08X => ", lv1, lv2, lv3); 246 | lv4 = ((lv3 & 0x0000FF00) << 16) 247 | | (lv3 & 0x00FF0000) 248 | | ((lv3 & 0xFF000000) >> 16); 249 | lv3 = ((lv2 & 0x00FF0000) << 8) 250 | | ((lv2 & 0xFF000000) >> 8) 251 | | ((lv3 & 0x000000FF) << 8); 252 | lv2 = (lv1 & 0xFF000000) 253 | | ((lv2 & 0x000000FF) << 16) 254 | | (lv2 & 0x0000FF00); 255 | lv1 = (lv1 << 24) 256 | | ((lv1 & 0x0000FF00) << 8) 257 | | ((lv1 & 0x00FF0000) >> 8); 258 | // printf("%08X %08X %08X %08X\n", lv1, lv2, lv3, lv4); 259 | 260 | dest[0] = lv1 * scale; 261 | dest[1] = lv2 * scale; 262 | dest[2] = lv3 * scale; 263 | dest[3] = lv4 * scale; 264 | 265 | src += 3; 266 | dest += 4; 267 | } 268 | int nSamples = count & 3; 269 | UInt8 *p = (UInt8 *)src; 270 | while (nSamples--) { 271 | #if TARGET_RT_LITTLE_ENDIAN 272 | SInt32 lv = (p[0] << 16) | (p[1] << 8) | p[2]; 273 | #else 274 | SInt32 lv = p[0] | (p[1] << 8) | (p[2] << 16); 275 | #endif 276 | lv <<= 8; 277 | p += 3; 278 | *dest++ = lv * scale; 279 | } 280 | } 281 | #endif 282 | 283 | -------------------------------------------------------------------------------- /branches/zdev/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 | -------------------------------------------------------------------------------- /branches/zdev/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 | 19 | #define HDAC_UNSOLQ_MAX 64 20 | #define HDAC_UNSOLQ_READY 0 21 | #define HDAC_UNSOLQ_BUSY 1 22 | 23 | /* Misc constants.. */ 24 | 25 | #define HDA_AMP_VOL_DEFAULT (-1) 26 | #define HDA_AMP_MUTE_DEFAULT (0xffffffff) 27 | #define HDA_AMP_MUTE_NONE (0) 28 | #define HDA_AMP_MUTE_LEFT (1 << 0) 29 | #define HDA_AMP_MUTE_RIGHT (1 << 1) 30 | #define HDA_AMP_MUTE_ALL (HDA_AMP_MUTE_LEFT | HDA_AMP_MUTE_RIGHT) 31 | 32 | #define HDA_AMP_LEFT_MUTED(v) ((v) & (HDA_AMP_MUTE_LEFT)) 33 | #define HDA_AMP_RIGHT_MUTED(v) (((v) & HDA_AMP_MUTE_RIGHT) >> 1) 34 | 35 | #define HDA_ADC_MONITOR (1 << 0) 36 | #define HDAA_IMIX_AS_DST (2 << 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 262144 52 | #define HDA_BUFSZ_DEFAULT HDA_BUFSZ_MAX 53 | 54 | #define HDA_PARSE_MAXDEPTH 10 55 | 56 | #define HDAC_UNSOLTAG_EVENT_HP 0x00 57 | 58 | /* Helper Macros */ 59 | 60 | #define HDAC_ISDCTL(n) (_HDAC_ISDCTL((n), mInStreamsSup, mOutStreamsSup)) 61 | #define HDAC_ISDSTS(n) (_HDAC_ISDSTS((n), mInStreamsSup, mOutStreamsSup)) 62 | #define HDAC_ISDPICB(n) (_HDAC_ISDPICB((n), mInStreamsSup, mOutStreamsSup)) 63 | #define HDAC_ISDCBL(n) (_HDAC_ISDCBL((n), mInStreamsSup, mOutStreamsSup)) 64 | #define HDAC_ISDLVI(n) (_HDAC_ISDLVI((n), mInStreamsSup, mOutStreamsSup)) 65 | #define HDAC_ISDFIFOD(n) (_HDAC_ISDFIFOD((n), mInStreamsSup, mOutStreamsSup)) 66 | #define HDAC_ISDFMT(n) (_HDAC_ISDFMT((n), mInStreamsSup, mOutStreamsSup)) 67 | #define HDAC_ISDBDPL(n) (_HDAC_ISDBDPL((n), mInStreamsSup, mOutStreamsSup)) 68 | #define HDAC_ISDBDPU(n) (_HDAC_ISDBDPU((n), mInStreamsSup, mOutStreamsSup)) 69 | 70 | #define HDAC_OSDCTL(n) (_HDAC_OSDCTL((n), mInStreamsSup, mOutStreamsSup)) 71 | #define HDAC_OSDSTS(n) (_HDAC_OSDSTS((n), mInStreamsSup, mOutStreamsSup)) 72 | #define HDAC_OSDPICB(n) (_HDAC_OSDPICB((n), mInStreamsSup, mOutStreamsSup)) 73 | #define HDAC_OSDCBL(n) (_HDAC_OSDCBL((n), mInStreamsSup, mOutStreamsSup)) 74 | #define HDAC_OSDLVI(n) (_HDAC_OSDLVI((n), mInStreamsSup, mOutStreamsSup)) 75 | #define HDAC_OSDFIFOD(n) (_HDAC_OSDFIFOD((n), mInStreamsSup, mOutStreamsSup)) 76 | #define HDAC_OSDBDPL(n) (_HDAC_OSDBDPL((n), mInStreamsSup, mOutStreamsSup)) 77 | #define HDAC_OSDBDPU(n) (_HDAC_OSDBDPU((n), mInStreamsSup, mOutStreamsSup)) 78 | 79 | #define HDAC_BSDCTL(n) (_HDAC_BSDCTL((n), mInStreamsSup, mOutStreamsSup)) 80 | #define HDAC_BSDSTS(n) (_HDAC_BSDSTS((n), mInStreamsSup, mOutStreamsSup)) 81 | #define HDAC_BSDPICB(n) (_HDAC_BSDPICB((n), mInStreamsSup, mOutStreamsSup)) 82 | #define HDAC_BSDCBL(n) (_HDAC_BSDCBL((n), mInStreamsSup, mOutStreamsSup)) 83 | #define HDAC_BSDLVI(n) (_HDAC_BSDLVI((n), mInStreamsSup, mOutStreamsSup)) 84 | #define HDAC_BSDFIFOD(n) (_HDAC_BSDFIFOD((n), mInStreamsSup, mOutStreamsSup)) 85 | #define HDAC_BSDBDPL(n) (_HDAC_BSDBDPL((n), mInStreamsSup, mOutStreamsSup)) 86 | #define HDAC_BSDBDPU(n) (_HDAC_BSDBDPU((n), mInStreamsSup, mOutStreamsSup)) 87 | 88 | /*************************************************************************************/ 89 | /*************************************************************************************/ 90 | 91 | typedef int nid_t; 92 | 93 | typedef struct _DmaMemory DmaMemory; 94 | 95 | typedef struct _RirbResponse RirbResponse; 96 | typedef struct _CommandList CommandList; 97 | typedef struct _BdlEntry BdlEntry; 98 | 99 | typedef struct _ChannelCaps ChannelCaps; 100 | 101 | typedef struct _Widget Widget; 102 | typedef struct _AudioControl AudioControl; 103 | typedef struct _AudioAssoc AudioAssoc; 104 | typedef struct _PcmDevice PcmDevice; 105 | typedef struct _FunctionGroup FunctionGroup; 106 | typedef struct _Channel Channel; 107 | typedef struct _Codec Codec; 108 | 109 | class IODMACommand; 110 | 111 | typedef struct _DmaMemory { 112 | const char *description; 113 | IOBufferMemoryDescriptor *md; 114 | UInt64 size; 115 | UInt64 physAddr; 116 | IOVirtualAddress virtAddr; 117 | } DmaMemory; 118 | 119 | /* Hold a response from a verb sent to a codec received via the rirb. */ 120 | typedef struct _RirbResponse { 121 | UInt32 response; 122 | UInt32 response_ex; 123 | } RirbResponse; 124 | 125 | #define HDAC_RIRB_RESPONSE_EX_SDATA_IN_MASK 0x0000000f 126 | #define HDAC_RIRB_RESPONSE_EX_SDATA_IN_OFFSET 0 127 | #define HDAC_RIRB_RESPONSE_EX_UNSOLICITED 0x00000010 128 | 129 | #define HDAC_RIRB_RESPONSE_EX_SDATA_IN(response_ex) \ 130 | (((response_ex) & HDAC_RIRB_RESPONSE_EX_SDATA_IN_MASK) >> \ 131 | HDAC_RIRB_RESPONSE_EX_SDATA_IN_OFFSET) 132 | 133 | /* This structure holds the list of verbs that are to be sent to the codec 134 | * via the corb and the responses received via the rirb. It's allocated by 135 | * the codec driver and is owned by it. */ 136 | typedef struct _CommandList { 137 | int numCommands; 138 | UInt32 *verbs; 139 | UInt32 *responses; 140 | } CommandList; 141 | 142 | typedef struct _BdlEntry { 143 | volatile UInt32 addrl; 144 | volatile UInt32 addrh; 145 | volatile UInt32 len; 146 | volatile UInt32 ioc; 147 | } __attribute__((__packed__)) BdlEntry; 148 | 149 | #define HDA_MAX_CONNS 32 150 | #define HDA_MAX_NAMELEN 40 151 | 152 | #define TRACE_DIR_NONE 0 153 | #define TRACE_DIR_IN 1 154 | #define TRACE_DIR_OUT 2 155 | #define TRACE_DIR_INOUT 3 156 | 157 | typedef struct _Widget { 158 | nid_t nid; 159 | int type; 160 | int enable; 161 | int nconns, selconn, connsenabled; 162 | int waspin; 163 | UInt32 pflags; 164 | int bindAssoc; 165 | int bindSeqMask; 166 | int ossdev; 167 | int sense; 168 | UInt32 ossmask; 169 | nid_t conns[HDA_MAX_CONNS]; 170 | UInt8 connsenable[HDA_MAX_CONNS]; 171 | char name[HDA_MAX_NAMELEN]; 172 | FunctionGroup *funcGroup; 173 | UInt8 traceDir; 174 | UInt8 stripecap; 175 | nid_t favoritDAC; 176 | struct { 177 | UInt32 widgetCap; 178 | UInt32 outAmpCap; 179 | UInt32 inAmpCap; 180 | UInt32 supStreamFormats; 181 | UInt32 supPcmSizeRates; 182 | UInt32 eapdBtl; 183 | } params; 184 | struct { 185 | UInt32 config; 186 | UInt32 cap; 187 | UInt32 ctrl; 188 | } pin; /* wclass */ 189 | } Widget; 190 | 191 | typedef struct _AudioControl { 192 | Widget *widget, *childWidget; 193 | int enable; 194 | int index, dir, ndir; 195 | int mute, step, size, offset; 196 | int left, right, forcemute; 197 | UInt32 muted; 198 | UInt32 ossmask, possmask; 199 | } AudioControl; 200 | 201 | typedef struct _NidForSwitch { 202 | nid_t mainNid; 203 | nid_t nextNid; 204 | int connNum; 205 | }NidForSwitch; 206 | 207 | /* Association is a group of pins bound for some special function. */ 208 | typedef struct _AudioAssoc { 209 | UInt8 enable; 210 | UInt8 index; 211 | UInt8 dir; 212 | UInt8 pincnt; 213 | UInt8 fakeredir; 214 | UInt8 digital; 215 | UInt16 pinset; 216 | nid_t hpredir; 217 | nid_t pins[16]; 218 | nid_t dacs[16]; 219 | nid_t activeNid; 220 | int chan; 221 | int dirty; 222 | //AutumnRain 223 | NidForSwitch nidForSwitch[16]; 224 | SInt8 defaultPin; 225 | SInt8 jackPin; 226 | } AudioAssoc; 227 | 228 | typedef struct _PcmDevice { 229 | FunctionGroup *funcGroup; 230 | int index; 231 | bool registered; 232 | int playChanId, recChanId; 233 | UInt8 left[SOUND_MIXER_NRDEVICES]; 234 | UInt8 right[SOUND_MIXER_NRDEVICES]; 235 | UInt32 chanSize; 236 | UInt32 chanNumBlocks; 237 | UInt8 digital; 238 | UInt32 recDevMask, devMask; 239 | } PcmDevice; 240 | 241 | typedef struct _FunctionGroup { 242 | UInt8 nodeType; 243 | nid_t nid; 244 | nid_t startNode, endNode; 245 | int numNodes; 246 | bool mSwitchEnable; 247 | Codec *codec; 248 | Widget *widgets; 249 | struct { 250 | UInt32 outAmpCap; 251 | UInt32 inAmpCap; 252 | UInt32 supStreamFormats; 253 | UInt32 supPcmSizeRates; 254 | int numControls, numAssocs; 255 | AudioControl *controls; 256 | AudioAssoc *assocs; 257 | UInt32 quirks; 258 | UInt32 gpio; 259 | PcmDevice *pcmDevices; 260 | int numPcmDevices; 261 | } audio; /* function */ 262 | /* XXX undefined: modem, hdmi. */ 263 | } FunctionGroup; 264 | 265 | #define HDAC_CHN_RUNNING 0x00000001 266 | #define HDAC_CHN_SUSPEND 0x00000002 267 | 268 | typedef struct _ChannelCaps { 269 | UInt32 minSpeed, maxSpeed; 270 | UInt32 const *formats; 271 | UInt32 caps; 272 | UInt32 channels; 273 | } ChannelCaps; 274 | 275 | typedef struct _Channel { 276 | ChannelCaps caps; 277 | FunctionGroup *funcGroup; 278 | PcmDevice *pcmDevice; 279 | UInt32 speed, format; 280 | UInt32 formats[12], pcmRates[16]; 281 | UInt32 supStreamFormats, supPcmSizeRates; 282 | UInt32 numBlocks, blockSize; 283 | UInt32 *dmaPos; 284 | UInt32 flags; 285 | int direction; 286 | int off; 287 | int streamId; 288 | int bit16, bit32; 289 | int assocNum; 290 | nid_t io[16]; // adc/dac nids 291 | UInt8 stripecap; 292 | UInt8 stripectl; 293 | //Math 294 | bool vectorize; 295 | bool useStereo; 296 | UInt8 noiseLevel; 297 | UInt8 StereoBase; 298 | 299 | UInt16 slack; 300 | DmaMemory *bdlMem; 301 | DmaMemory *buffer; 302 | } Channel; 303 | 304 | #define CODEC_ID(codec) ((((UInt32) (codec)->vendorId & 0xffff) << 16) | \ 305 | ((UInt32) (codec)->deviceId & 0xffff)) 306 | 307 | typedef struct _Codec { 308 | int numVerbsSent; 309 | int numRespReceived; 310 | nid_t cad; 311 | UInt16 vendorId; 312 | UInt16 deviceId; 313 | UInt8 revisionId; 314 | UInt8 steppingId; 315 | CommandList *commands; 316 | FunctionGroup *funcGroups; 317 | int numFuncGroups; 318 | } Codec; 319 | 320 | #endif 321 | -------------------------------------------------------------------------------- /branches/zdev/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 | -------------------------------------------------------------------------------- /branches/zdev/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 const *name; 11 | } ControllerListItem; 12 | 13 | typedef struct { 14 | UInt32 id; 15 | char const *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 const *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 const MixerValueName MixerValueNamesBind[]; 50 | 51 | #define HDA_GPIO_MAX 8 52 | /* 0 - 7 = GPIO , 8 = Flush */ 53 | #define HDA_QUIRK_GPIO0 (1 << 0) 54 | #define HDA_QUIRK_GPIO1 (1 << 1) 55 | #define HDA_QUIRK_GPIO2 (1 << 2) 56 | #define HDA_QUIRK_GPIO3 (1 << 3) 57 | #define HDA_QUIRK_GPIO4 (1 << 4) 58 | #define HDA_QUIRK_GPIO5 (1 << 5) 59 | #define HDA_QUIRK_GPIO6 (1 << 6) 60 | #define HDA_QUIRK_GPIO7 (1 << 7) 61 | #define HDA_QUIRK_GPIOFLUSH (1 << 8) 62 | 63 | /* 9 - 25 = anything else */ 64 | #define HDA_QUIRK_SOFTPCMVOL (1 << 9) 65 | #define HDA_QUIRK_FIXEDRATE (1 << 10) 66 | #define HDA_QUIRK_FORCESTEREO (1 << 11) 67 | #define HDA_QUIRK_EAPDINV (1 << 12) 68 | #define HDA_QUIRK_DMAPOS (1 << 13) 69 | #define HDA_QUIRK_SENSEINV (1 << 14) 70 | 71 | /* 26 - 31 = vrefs */ 72 | #define HDA_QUIRK_IVREF50 (1 << 26) 73 | #define HDA_QUIRK_IVREF80 (1 << 27) 74 | #define HDA_QUIRK_IVREF100 (1 << 28) 75 | #define HDA_QUIRK_OVREF50 (1 << 29) 76 | #define HDA_QUIRK_OVREF80 (1 << 30) 77 | #define HDA_QUIRK_OVREF100 (1 << 31) 78 | 79 | #define HDA_QUIRK_IVREF (HDA_QUIRK_IVREF50 | HDA_QUIRK_IVREF80 | HDA_QUIRK_IVREF100) 80 | #define HDA_QUIRK_OVREF (HDA_QUIRK_OVREF50 | HDA_QUIRK_OVREF80 | HDA_QUIRK_OVREF100) 81 | #define HDA_QUIRK_VREF (HDA_QUIRK_IVREF | HDA_QUIRK_OVREF) 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /branches/zdev/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 | -------------------------------------------------------------------------------- /branches/zdev/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 | -------------------------------------------------------------------------------- /branches/zdev/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 | 31 | Channel *mChannel; 32 | VoodooHDADevice *mDevice; 33 | IOAudioStream *mStream; 34 | bool emptyStream; 35 | 36 | const char *mPortName; 37 | UInt32 mPortType; 38 | 39 | IOAudioSelectorControl *mSelControl; 40 | 41 | UInt32 oldOutVolumeLeft; 42 | UInt32 oldOutVolumeRight; 43 | UInt32 oldInputGain; 44 | 45 | // cue8chalk: flag for volume change fix 46 | bool mEnableVolumeChangeFix; 47 | // VertexBZ: flag for mute fix 48 | bool mEnableMuteFix; 49 | 50 | void messageHandler(UInt32 type, const char *format, ...) __attribute__ ((format (printf, 3, 4))); 51 | 52 | void setPinName(UInt32 pinConfig, const char* name); 53 | const char *getPortName(); 54 | UInt64 getMinMaxDb(UInt32 mask); 55 | bool haveDigitalMuteControl(UInt32 mask); 56 | 57 | IOAudioStreamDirection getEngineDirection(); 58 | int getEngineId(); 59 | 60 | bool publishChannelLayout(IOAudioStreamDirection direction, UInt32 channels); 61 | bool createAudioStream(IOAudioStreamDirection direction, void *sampleBuffer, 62 | UInt32 sampleBufferSize, UInt32 *pcmRates, 63 | UInt32 supPcmSizeRates, UInt32 supStreamFormats, UInt32 channels); 64 | bool createAudioStream(); 65 | 66 | bool createAudioControls(); 67 | 68 | static IOReturn volumeChangeHandler(IOService *target, IOAudioControl *volumeControl, SInt32 oldValue, SInt32 newValue); 69 | static IOReturn muteChangeHandler(IOService *target, IOAudioControl *muteControl, SInt32 oldValue, SInt32 newValue); 70 | 71 | IOReturn volumeChanged(IOAudioControl *volumeControl, SInt32 oldValue, SInt32 newValue); 72 | IOReturn muteChanged(IOAudioControl *muteControl, SInt32 oldValue, SInt32 newValue); 73 | 74 | virtual bool initWithChannel(Channel *channel); 75 | virtual void free(); 76 | virtual bool initHardware(IOService *provider); 77 | 78 | virtual IOReturn performAudioEngineStart(); 79 | virtual IOReturn performAudioEngineStop(); 80 | 81 | virtual UInt32 getCurrentSampleFrame(); 82 | 83 | virtual IOReturn performFormatChange(IOAudioStream *audioStream, const IOAudioStreamFormat *newFormat, 84 | const IOAudioSampleRate *newSampleRate); 85 | 86 | virtual IOReturn clipOutputSamples(const void *mixBuf, void *sampleBuf, UInt32 firstSampleFrame, 87 | UInt32 numSampleFrames, const IOAudioStreamFormat *streamFormat, IOAudioStream *audioStream); 88 | virtual IOReturn convertInputSamples(const void *sampleBuf, void *destBuf, UInt32 firstSampleFrame, 89 | UInt32 numSampleFrames, const IOAudioStreamFormat *streamFormat, IOAudioStream *audioStream); 90 | virtual OSString *getLocalUniqueID(); 91 | }; 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /branches/zdev/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 | __attribute__((visibility("hidden"))) 29 | void VoodooHDAUserClient::messageHandler(UInt32 type, const char *format, ...) 30 | { 31 | va_list args; 32 | va_start(args, format); 33 | if (mDevice) 34 | mDevice->messageHandler(type, format, args); 35 | else if (mVerbose >= 1) 36 | vprintf(format, args); 37 | va_end(args); 38 | } 39 | 40 | bool VoodooHDAUserClient::start(IOService *provider) 41 | { 42 | // logMsg("VoodooHDAUserClient[%p]::start\n", this); 43 | 44 | if (!super::start(provider)) 45 | return false; 46 | 47 | mDevice = OSDynamicCast(VoodooHDADevice, provider); 48 | ASSERT(mDevice); 49 | 50 | mVerbose = mDevice->mVerbose; 51 | 52 | return true; 53 | } 54 | 55 | bool VoodooHDAUserClient::didTerminate(IOService *provider, IOOptionBits options, bool *defer) 56 | { 57 | // logMsg("VoodooHDAUserClient[%p]::didTerminate\n", this); 58 | 59 | // if defer is true, stop will not be called on the user client 60 | *defer = false; 61 | 62 | return super::didTerminate(provider, options, defer); 63 | } 64 | 65 | // clientClose is called when the user process calls IOServiceClose 66 | IOReturn VoodooHDAUserClient::clientClose() 67 | { 68 | // logMsg("VoodooHDAUserClient[%p]::clientClose\n", this); 69 | 70 | if (!isInactive()) 71 | terminate(); 72 | 73 | return kIOReturnSuccess; 74 | } 75 | 76 | // getTargetAndMethodForIndex looks up the external methods - supply a description of the parameters 77 | // available to be called 78 | IOExternalMethod *VoodooHDAUserClient::getTargetAndMethodForIndex(IOService **targetP, UInt32 index) 79 | { 80 | //logMsg("VoodooHDAUserClient[%p]::getTargetAndMethodForIndex(%ld)\n", this, index); 81 | 82 | static const IOExternalMethod methodDescs[kVoodooHDANumMethods] = { 83 | { NULL, (IOMethod) &VoodooHDAUserClient::actionMethod, kIOUCStructIStructO, 84 | kIOUCVariableStructureSize, kIOUCVariableStructureSize }, 85 | }; 86 | 87 | *targetP = this; 88 | if (index < kVoodooHDANumMethods) 89 | return (IOExternalMethod *) (methodDescs + index); 90 | else 91 | return NULL; 92 | } 93 | 94 | __attribute__((visibility("hidden"))) 95 | IOReturn VoodooHDAUserClient::actionMethod(UInt32 *dataIn, UInt32 *dataOut, IOByteCount inputSize, 96 | IOByteCount *outputSize) 97 | { 98 | IOReturn result; 99 | UInt32 action, dataSize; 100 | void *data; 101 | UInt64 outputMax; 102 | 103 | //logMsg("VoodooHDAUserClient[%p]::actionMethod(%ld, %ld)\n", this, inputSize, *outputSize); 104 | 105 | if (inputSize != sizeof (UInt32)) 106 | return kIOReturnBadArgument; 107 | action = *dataIn; 108 | 109 | result = mDevice->runAction(&action, &dataSize, &data); 110 | 111 | // note: we can only transfer sizeof (io_struct_inband_t) bytes out at a time 112 | 113 | outputMax = *outputSize; 114 | *outputSize = dataSize; 115 | if (dataSize) { 116 | ASSERT(data); 117 | if (outputMax < dataSize) 118 | return kIOReturnNoSpace; 119 | bcopy(data, dataOut, dataSize); 120 | } 121 | 122 | return result; 123 | } 124 | 125 | IOReturn VoodooHDAUserClient::clientMemoryForType(UInt32 type, IOOptionBits *options, 126 | IOMemoryDescriptor **memory) 127 | { 128 | IOReturn result; 129 | IOBufferMemoryDescriptor *memDesc; 130 | 131 | // logMsg("VoodooHDAUserClient[%p]::clientMemoryForType(0x%lx)\n", this, type); 132 | 133 | // note: IOConnectUnmapMemory should not be used with this user client 134 | 135 | *options = 0; 136 | *memory = NULL; 137 | 138 | switch (type) { 139 | case kVoodooHDAMemoryMessageBuffer: 140 | mDevice->lockMsgBuffer(); 141 | if (!mDevice->mMsgBufferSize) { 142 | errorMsg("error: message buffer size is zero\n"); 143 | mDevice->unlockMsgBuffer(); 144 | result = kIOReturnUnsupported; 145 | break; 146 | } 147 | memDesc = IOBufferMemoryDescriptor::inTaskWithOptions(0, 148 | kIOMemoryPageable | kIODirectionIn, 149 | mDevice->mMsgBufferSize); 150 | if (!memDesc || 151 | memDesc->prepare() != kIOReturnSuccess) { 152 | errorMsg("error: couldn't allocate buffer memory descriptor (size: %ld)\n", 153 | mDevice->mMsgBufferSize); 154 | mDevice->unlockMsgBuffer(); 155 | result = kIOReturnVMError; 156 | RELEASE(memDesc); 157 | break; 158 | } 159 | memDesc->writeBytes(0U, mDevice->mMsgBuffer, mDevice->mMsgBufferSize); 160 | mDevice->unlockMsgBuffer(); 161 | memDesc->complete(); 162 | *options |= kIOMapReadOnly; 163 | *memory = memDesc; // automatically released after memory is mapped into task 164 | result = kIOReturnSuccess; 165 | break; 166 | //Разделяемая память для PrefPanel 167 | case kVoodooHDAMemoryCommand: 168 | mDevice->lockPrefPanelMemoryBuf(); 169 | if (!mDevice->mPrefPanelMemoryBuf) { 170 | errorMsg("error: message buffer size is zero\n"); 171 | mDevice->unlockPrefPanelMemoryBuf(); 172 | result = kIOReturnUnsupported; 173 | break; 174 | } 175 | memDesc = IOBufferMemoryDescriptor::inTaskWithOptions(0, 176 | kIOMemoryPageable | kIODirectionInOut, 177 | mDevice->mPrefPanelMemoryBufSize); 178 | if (!memDesc || 179 | memDesc->prepare() != kIOReturnSuccess) { 180 | errorMsg("error: couldn't allocate buffer memory descriptor (size: %ld)\n", 181 | mDevice->mPrefPanelMemoryBufSize); 182 | mDevice->unlockPrefPanelMemoryBuf(); 183 | result = kIOReturnVMError; 184 | RELEASE(memDesc); 185 | break; 186 | } 187 | mDevice->updatePrefPanelMemoryBuf(); 188 | memDesc->writeBytes(0U, mDevice->mPrefPanelMemoryBuf, mDevice->mPrefPanelMemoryBufSize); 189 | mDevice->unlockPrefPanelMemoryBuf(); 190 | memDesc->complete(); 191 | *memory = memDesc; // automatically released after memory is mapped into task 192 | result = kIOReturnSuccess; 193 | break; 194 | //Разделяемая память для буфера с текущеми настройками усиления 195 | case kVoodooHDAMemoryExtMessageBuffer: 196 | mDevice->lockExtMsgBuffer(); 197 | if (!mDevice->mExtMsgBufferSize) { 198 | errorMsg("error: ext message buffer size is zero\n"); 199 | mDevice->unlockExtMsgBuffer(); 200 | result = kIOReturnUnsupported; 201 | break; 202 | } 203 | 204 | memDesc = IOBufferMemoryDescriptor::inTaskWithOptions(0, 205 | kIOMemoryPageable | kIODirectionIn, 206 | mDevice->mExtMsgBufferSize); 207 | if (!memDesc || 208 | memDesc->prepare() != kIOReturnSuccess) { 209 | errorMsg("error: couldn't allocate buffer memory descriptor (size: %ld)\n", 210 | mDevice->mExtMsgBufferSize); 211 | mDevice->unlockExtMsgBuffer(); 212 | result = kIOReturnVMError; 213 | RELEASE(memDesc); 214 | break; 215 | } 216 | memDesc->writeBytes(0U, mDevice->mExtMsgBuffer, mDevice->mExtMsgBufferSize); 217 | mDevice->unlockExtMsgBuffer(); 218 | memDesc->complete(); 219 | *options |= kIOMapReadOnly; 220 | *memory = memDesc; // automatically released after memory is mapped into task 221 | result = kIOReturnSuccess; 222 | break; 223 | default: 224 | result = kIOReturnBadArgument; 225 | break; 226 | } 227 | 228 | return result; 229 | } 230 | -------------------------------------------------------------------------------- /branches/zdev/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 bool start(IOService *provider); 24 | 25 | /* IOUserClient overrides */ 26 | virtual IOReturn clientClose(); 27 | 28 | virtual bool didTerminate(IOService *provider, IOOptionBits options, bool *defer); 29 | 30 | virtual IOExternalMethod *getTargetAndMethodForIndex(IOService **targetP, UInt32 index); 31 | 32 | virtual IOReturn clientMemoryForType(UInt32 type, IOOptionBits *options, IOMemoryDescriptor **memory); 33 | 34 | /* External methods */ 35 | IOReturn actionMethod(UInt32 *dataIn, UInt32 *dataOut, IOByteCount inputSize, IOByteCount *outputSize); 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /branches/zdev/VoodooHDA_BS.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /branches/zdev/VoodooHDA_BS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /branches/zdev/VoodooHDA_BS.xcodeproj/project.xcworkspace/xcuserdata/sergey.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CloverHackyColor/VoodooHDA/870a1bb8a24effc93803abfcb5eb9ec00150a972/branches/zdev/VoodooHDA_BS.xcodeproj/project.xcworkspace/xcuserdata/sergey.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /branches/zdev/VoodooHDA_BS.xcodeproj/xcuserdata/sergey.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | VoodooHDA.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /branches/zdev/getdump.c: -------------------------------------------------------------------------------- 1 | /* to compile 2 | clang getdump.c -o getdump -framework IOKit -framework CoreFoundation -Wall -Wextra -Werror 3 | */ 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | #define SOUND_MIXER_NRDEVICES 25 12 | #include "Shared.h" 13 | 14 | void printMsgBuffer(io_service_t service) 15 | { 16 | kern_return_t ret; 17 | io_connect_t connect = 0; 18 | #if __LP64__ 19 | mach_vm_address_t address; 20 | mach_vm_size_t size; 21 | #else 22 | vm_address_t address; 23 | vm_size_t size; 24 | #endif 25 | 26 | ret = IOServiceOpen(service, mach_task_self(), 0, &connect); 27 | if (ret != KERN_SUCCESS) { 28 | printf("error: IOServiceOpen returned %#08x\n", ret); 29 | goto failure; 30 | } 31 | 32 | ret = IOConnectMapMemory(connect, kVoodooHDAMemoryMessageBuffer, mach_task_self(), &address, &size, 33 | kIOMapAnywhere | kIOMapDefaultCache); 34 | if (ret != kIOReturnSuccess) { 35 | printf("error: IOConnectMapMemory returned %#08x\n", ret); 36 | goto failure; 37 | } 38 | 39 | printf("%s\n", (char *) address); 40 | 41 | failure: 42 | if (connect) { 43 | ret = IOServiceClose(connect); 44 | if (ret != KERN_SUCCESS) 45 | printf("warning: IOServiceClose returned %#08x\n", ret); 46 | } 47 | } 48 | 49 | int main() 50 | { 51 | mach_port_t masterPort; 52 | io_iterator_t iter = 0; 53 | io_service_t service = 0; 54 | kern_return_t ret; 55 | io_string_t path; 56 | 57 | ret = IOMasterPort(MACH_PORT_NULL, &masterPort); 58 | if (ret != KERN_SUCCESS) { 59 | printf("error: IOMasterPort returned %#08x\n", ret); 60 | goto failure; 61 | } 62 | 63 | ret = IOServiceGetMatchingServices(masterPort, IOServiceMatching(kVoodooHDAClassName), &iter); 64 | if (ret != KERN_SUCCESS) { 65 | printf("error: IOServiceGetMatchingServices returned %#08x\n", ret); 66 | goto failure; 67 | } 68 | while ((service = IOIteratorNext(iter)) != 0) { 69 | ret = IORegistryEntryGetPath(service, kIOServicePlane, path); 70 | if (ret != KERN_SUCCESS) { 71 | printf("error: IORegistryEntryGetPath returned %#08x\n", ret); 72 | goto failure; 73 | } 74 | printf("Found a device of class "kVoodooHDAClassName": %s\n\n", path); 75 | printMsgBuffer(service); 76 | IOObjectRelease(service); 77 | } 78 | 79 | failure: 80 | if (service) 81 | IOObjectRelease(service); 82 | if (iter) 83 | IOObjectRelease(iter); 84 | 85 | return 0; 86 | } 87 | -------------------------------------------------------------------------------- /branches/zdev/getdump.mak: -------------------------------------------------------------------------------- 1 | CC:=xcrun clang 2 | TARGET_ARCH:=-m64 3 | CFLAGS:=-fvisibility=hidden -fno-stack-protector -O2 -fno-exceptions -Wall -Wextra 4 | LDFLAGS:=-framework IOKit -Wl,-no_function_starts,-no_version_load_command,-no_data_in_code_info,-no_uuid,-no_source_version,-no_dependent_dr_info 5 | getdump: getdump.c 6 | $(LINK.c) -o $@ $^ 7 | /usr/bin/strip -x $@ 8 | -------------------------------------------------------------------------------- /branches/zdev/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 | -------------------------------------------------------------------------------- /branches/zdev/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 | -------------------------------------------------------------------------------- /branches/zdev/private_xmmintrin.h: -------------------------------------------------------------------------------- 1 | // 2 | // private_xmmintrin.h 3 | // VoodooHDA 4 | // 5 | // Created by Zenith432 on November 19th, 2017. 6 | // 7 | 8 | #include "License.h" 9 | 10 | #ifndef private_xmmintrin_h 11 | #define private_xmmintrin_h 12 | 13 | /* 14 | * SSE instructions (from xmmintrin.h) 15 | */ 16 | 17 | typedef int __v4si __attribute__((__vector_size__(16))); 18 | typedef float __m128 __attribute__((__vector_size__(16))); 19 | 20 | #define _mm_load_ps(p) (*(__m128 const*) (p)) 21 | #define _mm_loadu_ps(p) ({ __m128 tmp; __asm__ volatile ("movups %1, %0" : "=x"(tmp) : "m"(*(char const*) (p))); tmp; }) 22 | #define _mm_store_ps(p, a) (*((__m128*) (p)) = (a)) 23 | #define _mm_storeu_ps(p, a) { __asm__ volatile ("movups %1, %0" : "=m"(*(char*) (p)) : "x"((a))); } 24 | #define _mm_mul_ps(a, b) ((a) * (b)) 25 | #define _mm_add_ps(a, b) ((a) + (b)) 26 | #define _mm_max_ps(a, b) __builtin_ia32_maxps((a), (b)) 27 | #define _mm_min_ps(a, b) __builtin_ia32_minps((a), (b)) 28 | 29 | /* 30 | * SSE2 instructions (from emmintrin.h) 31 | */ 32 | 33 | typedef long long __m128i __attribute__((__vector_size__(16))); 34 | 35 | #define _mm_setzero_si128() (__m128i){ 0LL, 0LL } 36 | #define _mm_setr_epi32(i0, i1, i2, i3) (__m128i)(__v4si){ (i0), (i1), (i2), (i3) } 37 | #define _mm_load_si128(p) (*(__m128i const*) (p)) 38 | #define _mm_loadu_si128(p) ({ __m128 tmp; __asm__ volatile ("movups %1, %0" : "=x"(tmp) : "m"(*(char const*) (p))); tmp; }) 39 | #define _mm_store_si128(p, b) (*((__m128i*) (p)) = (b)) 40 | #define _mm_storeu_si128(p, a) { __asm__ volatile ("movups %1, %0" : "=m"(*(char*) (p)) : "x"((a))); } 41 | #define _mm_cvtps_epi32(a) ({ __m128 tmp; __asm__ volatile ("cvtps2dq %1, %0" : "=x"(tmp) : "xm"(a)); tmp; }) 42 | #define _mm_packs_epi32(a, b) __builtin_ia32_packssdw128((a), (b)) 43 | #define _mm_slli_epi16(a, count) (__m128i)__builtin_ia32_psllwi128((a), (count)) 44 | #define _mm_srli_epi16(a, count) (__m128i)__builtin_ia32_psrlwi128((a), (count)) 45 | #define _mm_or_si128(a, b) ((a) | (b)) 46 | #define _mm_and_si128(a, b) ((a) & (b)) 47 | #define _mm_cvtepi32_ps(a) ({ __m128 tmp; __asm__ volatile ("cvtdq2ps %1, %0" : "=x"(tmp) : "xm"(a)); tmp; }) 48 | #define _mm_unpacklo_epi16(a, b) ({ __m128i tmp = (a); __asm__ volatile ("punpcklwd %1, %0" : "+x"(tmp) : "xm"((b))); tmp; }) 49 | #define _mm_unpackhi_epi16(a, b) ({ __m128i tmp = (a); __asm__ volatile ("punpckhwd %1, %0" : "+x"(tmp) : "xm"((b))); tmp; }) 50 | #define _mm_slli_si128(a, imm) ({ __m128i tmp = (a); __asm__ volatile ("pslldq %1, %0" : "+x"(tmp) : "N"((imm))); tmp; }) 51 | #define _mm_srli_si128(a, imm) ({ __m128i tmp = (a); __asm__ volatile ("psrldq %1, %0" : "+x"(tmp) : "N"((imm))); tmp; }) 52 | #define _mm_shufflelo_epi16(a, imm) ({ __m128i tmp; __asm__ volatile ("pshuflw %2, %1, %0" : "=x"(tmp) : "xm"((a)), "N"((imm))); tmp; }) 53 | #define _mm_shufflehi_epi16(a, imm) ({ __m128i tmp; __asm__ volatile ("pshufhw %2, %1, %0" : "=x"(tmp) : "xm"((a)), "N"((imm))); tmp; }) 54 | 55 | #endif /* private_xmmintrin_h */ 56 | -------------------------------------------------------------------------------- /branches/zdev/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 | 0280800 15 | 16 | 17 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | VoodooHDA 2 | ======== 3 | 4 | ### Compilation. 5 | If you are using systems up to Catalina then open project 6 | tranc/VoodooHDA.xcodeproj 7 | 8 | For systems BigSur and up you have to download the project VoodooHDA 9 | also download MacKernelSDK 10 | ~~~~ 11 | git clone https://github.com/joevt/MacKernelSDK.git 12 | ~~~~ 13 | 14 | (this is tested version) 15 | and make a symlink into project 16 | ~~~~ 17 | cd /path_to/VoodooHDA/ 18 | ln -s /path_to/MacKernelSDK MacKernelSDK 19 | ~~~~ 20 | 21 | open project 22 | tranc/VoodooHDA-BS.xcodeproj 23 | and compile 24 | 25 | ### Installation 26 | 27 | 1. Exclude other Audio kexts 28 | 2. Set SIP disable kext or just 29 | ~~~~ 30 | sudo nvram csr-active-config=0xA85 31 | ~~~~ 32 | 33 | 3. Reboot 34 | 4. 35 | ~~~~ 36 | sudo cp -R /path_to/VoodooHDA.kext /Library/Extensions/ 37 | ~~~~ 38 | 39 | 5. Wait while the system saids that the kext must be approved 40 | 6. Go to System Settings and approve the kext. 41 | 7. Reboot. 42 | 8. Enjoy your favorite music. 43 | -------------------------------------------------------------------------------- /tranc/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CloverHackyColor/VoodooHDA/870a1bb8a24effc93803abfcb5eb9ec00150a972/tranc/.DS_Store -------------------------------------------------------------------------------- /tranc/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 | -------------------------------------------------------------------------------- /tranc/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 | -------------------------------------------------------------------------------- /tranc/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 | -------------------------------------------------------------------------------- /tranc/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CloverHackyColor/VoodooHDA/870a1bb8a24effc93803abfcb5eb9ec00150a972/tranc/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /tranc/Info-HDMI.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | KEXT 17 | CFBundleShortVersionString 18 | $(CURRENT_PROJECT_VERSION) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | IOKitPersonalities 24 | 25 | VoodooHDA-HDMI 26 | 27 | AllowMSI 28 | 29 | Boost 30 | 1 31 | CFBundleIdentifier 32 | org.voodoo.driver.VoodooHDA 33 | DisableInputMonitor 34 | 35 | IOClass 36 | VoodooHDADevice 37 | IOMatchCategory 38 | VoodooHDADevice 39 | IOPCIMatch 40 | 0xaaaa1002&0x0000ffff 0xbbbb10de&0x0000ffff 41 | IOPCIClassMatch 42 | 0x04000000&0xfffc0000 43 | IOProviderClass 44 | IOPCIDevice 45 | IOUserClientClass 46 | VoodooHDAUserClient 47 | InhibitCache 48 | 49 | MixerValues 50 | 51 | PCM 52 | 90 53 | Rec 54 | 50 55 | iGain 56 | 90 57 | iMix 58 | 90 59 | 60 | NodesToPatch 61 | 62 | 63 | Codec 64 | 0 65 | Comment 66 | HDMI output in first assoc 67 | Config 68 | 0x18560010 69 | Node 70 | 3 71 | 72 | 73 | Codec 74 | 0 75 | Comment 76 | HDMI output in first assoc 77 | Config 78 | 0x18560011 79 | Node 80 | 5 81 | 82 | 83 | Codec 84 | 0 85 | Comment 86 | HDMI output in first assoc 87 | Config 88 | 0x18560012 89 | Node 90 | 7 91 | 92 | 93 | Codec 94 | 0 95 | Comment 96 | HDMI output in first assoc 97 | Config 98 | 0x18560013 99 | Node 100 | 9 101 | 102 | 103 | Codec 104 | 0 105 | Comment 106 | HDMI output in first assoc 107 | Config 108 | 0x18560014 109 | Node 110 | 11 111 | 112 | 113 | Codec 114 | 0 115 | Comment 116 | HDMI output in first assoc 117 | Config 118 | 0x18560015 119 | Node 120 | 13 121 | 122 | 123 | Noise 124 | 0 125 | Vectorize 126 | 127 | VoodooHDAEnableHalfMicVolumeFix 128 | 129 | VoodooHDAEnableHalfVolumeFix 130 | 131 | VoodooHDAEnableMuteFix 132 | 133 | VoodooHDAEnableVolumeChangeFix 134 | 135 | VoodooHDAVerboseLevel 136 | 0 137 | 138 | VoodooHDA 139 | 140 | AllowMSI 141 | 142 | Boost 143 | 1 144 | CFBundleIdentifier 145 | org.voodoo.driver.VoodooHDA 146 | DisableInputMonitor 147 | 148 | IOClass 149 | VoodooHDADevice 150 | IOMatchCategory 151 | VoodooHDADevice 152 | IOPCIClassMatch 153 | 0x04000000&0xfffc0000 154 | IOPCIMatch 155 | 0xaaaa8086&0x0000ffff 156 | IOProviderClass 157 | IOPCIDevice 158 | IOUserClientClass 159 | VoodooHDAUserClient 160 | InhibitCache 161 | 162 | MixerValues 163 | 164 | PCM 165 | 90 166 | Rec 167 | 90 168 | iGain 169 | 90 170 | iMix 171 | 90 172 | 173 | NodesToPatch 174 | 175 | 176 | Caps 177 | 0x373e 178 | Codec 179 | 4 180 | Comment 181 | Example of possible values 182 | Config 183 | 0x90a70120 184 | Conns 185 | 12,13,24 186 | Control 187 | 20 188 | DAC 189 | 2 190 | Enable 191 | 1 192 | Node 193 | 12 194 | Select 195 | 13 196 | SwitchCh 197 | 0 198 | Type 199 | 4 200 | 201 | 202 | Codec 203 | 2 204 | Comment 205 | To disable back sound on ALC codec set enable=0 206 | Enable 207 | 1 208 | Node 209 | 11 210 | 211 | 212 | Noise 213 | 0 214 | Vectorize 215 | 216 | VoodooHDAEnableHalfMicVolumeFix 217 | 218 | VoodooHDAEnableHalfVolumeFix 219 | 220 | VoodooHDAEnableMuteFix 221 | 222 | VoodooHDAEnableVolumeChangeFix 223 | 224 | VoodooHDAVerboseLevel 225 | 0 226 | 227 | 228 | LSMinimumSystemVersion 229 | 10.9 230 | OSBundleLibraries 231 | 232 | com.apple.iokit.IOAudioFamily 233 | 1.1fc9 234 | com.apple.iokit.IOPCIFamily 235 | 2.1 236 | com.apple.kpi.iokit 237 | 9.0.0 238 | com.apple.kpi.libkern 239 | 9.0.0 240 | com.apple.kpi.mach 241 | 9.0.0 242 | com.apple.kpi.unsupported 243 | 9.0.0 244 | 245 | 246 | 247 | -------------------------------------------------------------------------------- /tranc/Info-noHDMI.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | KEXT 17 | CFBundleShortVersionString 18 | $(MODULE_VERSION) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(MODULE_VERSION) 23 | IOKitPersonalities 24 | 25 | VoodooHDA 26 | 27 | AllowMSI 28 | 29 | Boost 30 | 0 31 | CFBundleIdentifier 32 | org.voodoo.driver.VoodooHDA 33 | DisableInputMonitor 34 | 35 | IOClass 36 | VoodooHDADevice 37 | IONameMatch 38 | HDAS 39 | IOProviderClass 40 | IOPCIDevice 41 | IOUserClientClass 42 | VoodooHDAUserClient 43 | InhibitCache 44 | 45 | MixerValues 46 | 47 | Rec 48 | 70 49 | PCM 50 | 100 51 | iMix 52 | 0 53 | iGain 54 | 0 55 | 56 | NodesToPatch 57 | 58 | Noise 59 | 0 60 | Vectorize 61 | 62 | VoodooHDAEnableHalfMicVolumeFix 63 | 64 | VoodooHDAEnableHalfVolumeFix 65 | 66 | VoodooHDAEnableMuteFix 67 | 68 | VoodooHDAEnableVolumeChangeFix 69 | 70 | VoodooHDAVerboseLevel 71 | 0 72 | 73 | 74 | OSBundleLibraries 75 | 76 | com.apple.iokit.IOAudioFamily 77 | 1.1fc9 78 | com.apple.iokit.IOPCIFamily 79 | 2.1 80 | com.apple.kpi.iokit 81 | 9.0.0 82 | com.apple.kpi.libkern 83 | 9.0.0 84 | com.apple.kpi.mach 85 | 9.0.0 86 | com.apple.kpi.unsupported 87 | 9.0.0 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /tranc/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | KEXT 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | IOKitPersonalities 24 | 25 | VoodooHDA 26 | 27 | AllowMSI 28 | 29 | Boost 30 | 0 31 | CFBundleIdentifier 32 | org.voodoo.driver.VoodooHDA 33 | DisableInputMonitor 34 | 35 | IOClass 36 | VoodooHDADevice 37 | IOPCIClassMatch 38 | 0x04000000&0xfffc0000 39 | IOProviderClass 40 | IOPCIDevice 41 | IOUserClientClass 42 | VoodooHDAUserClient 43 | InhibitCache 44 | 45 | MixerValues 46 | 47 | PCM 48 | 100 49 | Rec 50 | 70 51 | iGain 52 | 0 53 | iMix 54 | 0 55 | 56 | NodesToPatch 57 | 58 | Noise 59 | 0 60 | Vectorize 61 | 62 | VoodooHDAEnableHalfMicVolumeFix 63 | 64 | VoodooHDAEnableHalfVolumeFix 65 | 66 | VoodooHDAEnableMuteFix 67 | 68 | VoodooHDAEnableVolumeChangeFix 69 | 70 | VoodooHDAVerboseLevel 71 | 0 72 | 73 | 74 | OSBundleLibraries 75 | 76 | com.apple.iokit.IOAudioFamily 77 | 1.1fc9 78 | com.apple.iokit.IOPCIFamily 79 | 2.1 80 | com.apple.kpi.iokit 81 | 9.0.0 82 | com.apple.kpi.libkern 83 | 9.0.0 84 | com.apple.kpi.mach 85 | 9.0.0 86 | com.apple.kpi.unsupported 87 | 9.0.0 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /tranc/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 | -------------------------------------------------------------------------------- /tranc/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 (SOUND_MASK_LINE | SOUND_MASK_MIC | SOUND_MASK_CD | SOUND_MASK_MONITOR) 71 | #define SOUND_MASK_INPUT (SOUND_MASK_LINE | SOUND_MASK_MIC | 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 131 | -------------------------------------------------------------------------------- /tranc/PCMBlitterLib.cpp: -------------------------------------------------------------------------------- 1 | #include "License.h" 2 | 3 | #include "PCMBlitterLibDispatch.h" 4 | 5 | /* 6 | This file contains portable int<->float blitters. 7 | */ 8 | #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 9 | #define TARGET_OS_MAC 1 10 | #endif 11 | #if defined(__i386__) || defined(__x86_64__) 12 | #undef TARGET_CPU_X86 13 | #define TARGET_CPU_X86 1 14 | #undef TARGET_RT_LITTLE_ENDIAN 15 | #define TARGET_RT_LITTLE_ENDIAN 0 16 | #endif 17 | 18 | #if !TARGET_OS_MAC 19 | // we have optimized versions of most of these for Mac OS 20 | 21 | #pragma mark - 22 | #pragma mark 16-bit 23 | // ____________________________________________________________________________ 24 | // 25 | void NativeInt16ToFloat32_Portable(const SInt16 *src, Float32 *dest, unsigned int count) 26 | { 27 | TIntToFloatBlitter blitter(16); 28 | 29 | blitter.Convert(src, dest, count); 30 | } 31 | 32 | void SwapInt16ToFloat32_Portable(const SInt16 *src, Float32 *dest, unsigned int count) 33 | { 34 | TIntToFloatBlitter blitter(16); 35 | 36 | blitter.Convert(src, dest, count); 37 | } 38 | 39 | void Float32ToNativeInt16_Portable(const Float32 *src, SInt16 *dest, unsigned int count) 40 | { 41 | TFloatToIntBlitter blitter(16); 42 | 43 | blitter.Convert(src, dest, count); 44 | } 45 | 46 | void Float32ToSwapInt16_Portable(const Float32 *src, SInt16 *dest, unsigned int count) 47 | { 48 | TFloatToIntBlitter blitter(16); 49 | 50 | blitter.Convert(src, dest, count); 51 | } 52 | 53 | #pragma mark - 54 | #pragma mark 32-bit 55 | // ____________________________________________________________________________ 56 | // 57 | void NativeInt32ToFloat32_Portable(const SInt32 *src, Float32 *dest, unsigned int count) 58 | { 59 | TIntToFloatBlitter blitter(32); 60 | 61 | blitter.Convert(src, dest, count); 62 | } 63 | 64 | void SwapInt32ToFloat32_Portable(const SInt32 *src, Float32 *dest, unsigned int count) 65 | { 66 | TIntToFloatBlitter blitter(32); 67 | 68 | blitter.Convert(src, dest, count); 69 | } 70 | 71 | void Float32ToNativeInt32_Portable(const Float32 *src, SInt32 *dest, unsigned int count) 72 | { 73 | TFloatToIntBlitter blitter(32); 74 | 75 | blitter.Convert(src, dest, count); 76 | } 77 | 78 | void Float32ToSwapInt32_Portable(const Float32 *src, SInt32 *dest, unsigned int count) 79 | { 80 | TFloatToIntBlitter blitter(32); 81 | 82 | blitter.Convert(src, dest, count); 83 | } 84 | 85 | #pragma mark - 86 | #pragma mark 24-bit 87 | 88 | // ____________________________________________________________________________ 89 | // 90 | void Float32ToNativeInt24_Portable(const Float32 *src, UInt8 *vdest, unsigned int nSamples) 91 | { 92 | UInt32 *dest = (UInt32 *)vdest; 93 | double maxInt32 = 2147483648.0; // 1 << 31 94 | double round = 128.0; 95 | double max32 = maxInt32 - 1.0 - round; 96 | double min32 = -2147483648.0; 97 | int shift = 8, count; 98 | 99 | SET_ROUNDMODE 100 | 101 | count = nSamples >> 2; 102 | while (count--) { 103 | double f1 = src[0] * maxInt32 + round; 104 | double f2 = src[1] * maxInt32 + round; 105 | double f3 = src[2] * maxInt32 + round; 106 | double f4 = src[3] * maxInt32 + round; 107 | SInt32 i1 = FloatToInt(f1, min32, max32) >> shift; 108 | SInt32 i2 = FloatToInt(f2, min32, max32) >> shift; 109 | SInt32 i3 = FloatToInt(f3, min32, max32) >> shift; 110 | SInt32 i4 = FloatToInt(f4, min32, max32) >> shift; 111 | // memory: a3 a2 a1 b3 register: b3 a1 a2 a3 112 | dest[0] = (i1 & 0xFFFFFF) | ((i2 & 0xFF) << 24); 113 | // memory: b2 b1 c3 c2 register: c2 c3 b1 b2 114 | dest[1] = (i3 << 16) | ((i2 >> 8) & 0xFFFF); 115 | // memory: c1 d3 d2 d1 register: d1 d2 d3 c1 116 | dest[2] = ((i3 >> 16) & 0xFF) | ((i4 & 0xFFFFFF) << 8); 117 | src += 4; 118 | dest += 3; 119 | } 120 | UInt8 *p = (UInt8 *)dest; 121 | count = nSamples & 3; 122 | while (count--) { 123 | double f1 = *src++ * maxInt32 + round; 124 | SInt32 i1 = FloatToInt(f1, min32, max32) >> shift; 125 | p[0] = UInt8(i1); 126 | p[1] = UInt8(i1 >> 8); 127 | p[2] = UInt8(i1 >> 16); 128 | p += 3; 129 | } 130 | RESTORE_ROUNDMODE 131 | }; 132 | 133 | #endif // !TARGET_OS_MAC 134 | 135 | #if !TARGET_OS_MAC || TARGET_CPU_X86 136 | // These are needed for both non-MacOS and MacOS/X86 137 | 138 | // ____________________________________________________________________________ 139 | // 140 | void Float32ToSwapInt24_Portable(const Float32 *src, UInt8 *vdest, unsigned int nSamples) 141 | { 142 | UInt32 *dest = (UInt32 *)vdest; 143 | double maxInt32 = 2147483648.0; // 1 << 31 144 | double round = 128.0; 145 | double max32 = maxInt32 - 1.0 - round; 146 | double min32 = -2147483648.0; 147 | int shift = 8, count; 148 | 149 | SET_ROUNDMODE 150 | 151 | count = nSamples >> 2; 152 | while (count--) { 153 | double f1 = src[0] * maxInt32 + round; 154 | double f2 = src[1] * maxInt32 + round; 155 | double f3 = src[2] * maxInt32 + round; 156 | double f4 = src[3] * maxInt32 + round; 157 | SInt32 i1 = FloatToInt(f1, min32, max32) >> shift; 158 | SInt32 i2 = FloatToInt(f2, min32, max32) >> shift; 159 | SInt32 i3 = FloatToInt(f3, min32, max32) >> shift; 160 | SInt32 i4 = FloatToInt(f4, min32, max32) >> shift; 161 | // memory: a1 a2 a3 b1 register: b1 a3 a2 a1 162 | dest[0] = ((i2 & 0x00FF0000) << 8) 163 | | ((i1 & 0x000000FF) << 16) 164 | | (i1 & 0x0000FF00) 165 | | ((i1 & 0x00FF0000) >> 16); 166 | // memory: b2 b3 c1 c2 register: c2 c1 b3 b2 167 | dest[1] = ((i3 & 0x0000FF00) << 16) 168 | | (i3 & 0x00FF0000) 169 | | ((i2 & 0x000000FF) << 8) 170 | | ((i2 & 0x0000FF00) >> 8); 171 | // memory: c3 d1 d2 d3 register: d3 d2 d1 c3 172 | dest[2] = ((i4 & 0x000000FF) << 24) 173 | | ((i4 & 0x0000FF00) << 8) 174 | | ((i4 & 0x00FF0000) >> 8) 175 | | (i3 & 0x000000FF); 176 | src += 4; 177 | dest += 3; 178 | } 179 | UInt8 *p = (UInt8 *)dest; 180 | count = nSamples & 3; 181 | while (count--) { 182 | double f1 = *src++ * maxInt32 + round; 183 | SInt32 i1 = FloatToInt(f1, min32, max32) >> shift; 184 | p[0] = UInt8(i1 >> 16); 185 | p[1] = UInt8(i1 >> 8); 186 | p[2] = UInt8(i1); 187 | p += 3; 188 | } 189 | RESTORE_ROUNDMODE 190 | } 191 | 192 | // ____________________________________________________________________________ 193 | // 194 | void NativeInt24ToFloat32_Portable(const UInt8 *vsrc, Float32 *dest, unsigned int count) 195 | { 196 | const UInt32 *src = (const UInt32 *)vsrc; 197 | Float32 scale = (1. / 2147483648.0); 198 | int nSamples4 = count >> 2; 199 | 200 | while (nSamples4--) { 201 | SInt32 lv1 = src[0]; // BE: a1 a2 a3 b1 LE memory: a3 a2 a1 b3 register: b3 a1 a2 a3 202 | SInt32 lv2 = src[1]; // BE: b2 b3 c1 c2 LE memory: b2 b1 c3 c2 register: c2 c3 b1 b2 203 | SInt32 lv3 = src[2]; // BE: c3 d1 d2 d3 LE memory: c1 d3 d2 d1 register: d1 d2 d3 c1 204 | SInt32 lv4; 205 | 206 | // printf("%08X %08X %08X => ", lv1, lv2, lv3); 207 | lv4 = lv3 & 0xFFFFFF00; 208 | lv3 = (lv3 << 24) | ((lv2 & 0xFFFF0000) >> 8); 209 | lv2 = (lv2 << 16) | ((lv1 & 0xFF000000) >> 16); 210 | lv1 = (lv1 << 8); 211 | // printf("%08X %08X %08X %08X\n", lv1, lv2, lv3, lv4); 212 | 213 | dest[0] = lv1 * scale; 214 | dest[1] = lv2 * scale; 215 | dest[2] = lv3 * scale; 216 | dest[3] = lv4 * scale; 217 | 218 | src += 3; 219 | dest += 4; 220 | } 221 | int nSamples = count & 3; 222 | UInt8 *p = (UInt8 *)src; 223 | while (nSamples--) { 224 | SInt32 lv = p[0] | (p[1] << 8) | (p[2] << 16); 225 | lv <<= 8; 226 | p += 3; 227 | *dest++ = lv * scale; 228 | } 229 | } 230 | 231 | // ____________________________________________________________________________ 232 | // 233 | void SwapInt24ToFloat32_Portable(const UInt8 *vsrc, Float32 *dest, unsigned int count) 234 | { 235 | const UInt32 *src = (const UInt32 *)vsrc; 236 | Float32 scale = (1. / 2147483648.0); 237 | int nSamples4 = count >> 2; 238 | 239 | while (nSamples4--) { 240 | SInt32 lv1 = src[0]; // BE: a3 a2 a1 b3 LE memory: a1 a2 a3 b1 register: b1 a3 a2 a1 241 | SInt32 lv2 = src[1]; // BE: b2 b1 c3 c2 LE memory: b2 b3 c1 c2 register: c2 c1 b3 b2 242 | SInt32 lv3 = src[2]; // BE: c1 d3 d2 d1 LE memory: c3 d1 d2 d3 register: d3 d2 d1 c3 243 | SInt32 lv4; 244 | 245 | // printf("%08X %08X %08X => ", lv1, lv2, lv3); 246 | lv4 = ((lv3 & 0x0000FF00) << 16) 247 | | (lv3 & 0x00FF0000) 248 | | ((lv3 & 0xFF000000) >> 16); 249 | lv3 = ((lv2 & 0x00FF0000) << 8) 250 | | ((lv2 & 0xFF000000) >> 8) 251 | | ((lv3 & 0x000000FF) << 8); 252 | lv2 = (lv1 & 0xFF000000) 253 | | ((lv2 & 0x000000FF) << 16) 254 | | (lv2 & 0x0000FF00); 255 | lv1 = (lv1 << 24) 256 | | ((lv1 & 0x0000FF00) << 8) 257 | | ((lv1 & 0x00FF0000) >> 8); 258 | // printf("%08X %08X %08X %08X\n", lv1, lv2, lv3, lv4); 259 | 260 | dest[0] = lv1 * scale; 261 | dest[1] = lv2 * scale; 262 | dest[2] = lv3 * scale; 263 | dest[3] = lv4 * scale; 264 | 265 | src += 3; 266 | dest += 4; 267 | } 268 | int nSamples = count & 3; 269 | UInt8 *p = (UInt8 *)src; 270 | while (nSamples--) { 271 | #if TARGET_RT_LITTLE_ENDIAN 272 | SInt32 lv = (p[0] << 16) | (p[1] << 8) | p[2]; 273 | #else 274 | SInt32 lv = p[0] | (p[1] << 8) | (p[2] << 16); 275 | #endif 276 | lv <<= 8; 277 | p += 3; 278 | *dest++ = lv * scale; 279 | } 280 | } 281 | #endif 282 | 283 | -------------------------------------------------------------------------------- /tranc/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 | -------------------------------------------------------------------------------- /tranc/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 | #define HDAA_IMIX_AS_DST (2 << 0) 38 | 39 | #define HDA_CTL_OUT 1 40 | #define HDA_CTL_IN 2 41 | 42 | /*********/ 43 | 44 | #define HDA_BDL_MIN 2 45 | #define HDA_BDL_MAX 256 46 | #define HDA_BDL_DEFAULT HDA_BDL_MIN 47 | 48 | #define HDA_BLK_MIN HDAC_DMA_ALIGNMENT 49 | #define HDA_BLK_ALIGN (~(HDA_BLK_MIN - 1)) 50 | 51 | #define HDA_BUFSZ_MIN 4096 52 | //#define HDA_BUFSZ_MAX 65536 53 | #define HDA_BUFSZ_MAX 262144 54 | #define HDA_BUFSZ_DEFAULT HDA_BUFSZ_MAX 55 | 56 | #define HDA_GPIO_MAX 8 57 | #define HDA_MATCH_ALL 0xffffffff 58 | #define HDA_INVALID 0xffffffff 59 | 60 | #define HDA_PARSE_MAXDEPTH 10 61 | 62 | #define HDAC_UNSOLTAG_EVENT_HP 0x00 63 | 64 | /* Helper Macros */ 65 | 66 | #define HDAC_ISDCTL(n) (_HDAC_ISDCTL((n), mInStreamsSup, mOutStreamsSup)) 67 | #define HDAC_ISDSTS(n) (_HDAC_ISDSTS((n), mInStreamsSup, mOutStreamsSup)) 68 | #define HDAC_ISDPICB(n) (_HDAC_ISDPICB((n), mInStreamsSup, mOutStreamsSup)) 69 | #define HDAC_ISDCBL(n) (_HDAC_ISDCBL((n), mInStreamsSup, mOutStreamsSup)) 70 | #define HDAC_ISDLVI(n) (_HDAC_ISDLVI((n), mInStreamsSup, mOutStreamsSup)) 71 | #define HDAC_ISDFIFOD(n) (_HDAC_ISDFIFOD((n), mInStreamsSup, mOutStreamsSup)) 72 | #define HDAC_ISDFMT(n) (_HDAC_ISDFMT((n), mInStreamsSup, mOutStreamsSup)) 73 | #define HDAC_ISDBDPL(n) (_HDAC_ISDBDPL((n), mInStreamsSup, mOutStreamsSup)) 74 | #define HDAC_ISDBDPU(n) (_HDAC_ISDBDPU((n), mInStreamsSup, mOutStreamsSup)) 75 | 76 | #define HDAC_OSDCTL(n) (_HDAC_OSDCTL((n), mInStreamsSup, mOutStreamsSup)) 77 | #define HDAC_OSDSTS(n) (_HDAC_OSDSTS((n), mInStreamsSup, mOutStreamsSup)) 78 | #define HDAC_OSDPICB(n) (_HDAC_OSDPICB((n), mInStreamsSup, mOutStreamsSup)) 79 | #define HDAC_OSDCBL(n) (_HDAC_OSDCBL((n), mInStreamsSup, mOutStreamsSup)) 80 | #define HDAC_OSDLVI(n) (_HDAC_OSDLVI((n), mInStreamsSup, mOutStreamsSup)) 81 | #define HDAC_OSDFIFOD(n) (_HDAC_OSDFIFOD((n), mInStreamsSup, mOutStreamsSup)) 82 | #define HDAC_OSDBDPL(n) (_HDAC_OSDBDPL((n), mInStreamsSup, mOutStreamsSup)) 83 | #define HDAC_OSDBDPU(n) (_HDAC_OSDBDPU((n), mInStreamsSup, mOutStreamsSup)) 84 | 85 | #define HDAC_BSDCTL(n) (_HDAC_BSDCTL((n), mInStreamsSup, mOutStreamsSup)) 86 | #define HDAC_BSDSTS(n) (_HDAC_BSDSTS((n), mInStreamsSup, mOutStreamsSup)) 87 | #define HDAC_BSDPICB(n) (_HDAC_BSDPICB((n), mInStreamsSup, mOutStreamsSup)) 88 | #define HDAC_BSDCBL(n) (_HDAC_BSDCBL((n), mInStreamsSup, mOutStreamsSup)) 89 | #define HDAC_BSDLVI(n) (_HDAC_BSDLVI((n), mInStreamsSup, mOutStreamsSup)) 90 | #define HDAC_BSDFIFOD(n) (_HDAC_BSDFIFOD((n), mInStreamsSup, mOutStreamsSup)) 91 | #define HDAC_BSDBDPL(n) (_HDAC_BSDBDPL((n), mInStreamsSup, mOutStreamsSup)) 92 | #define HDAC_BSDBDPU(n) (_HDAC_BSDBDPU((n), mInStreamsSup, mOutStreamsSup)) 93 | 94 | /*************************************************************************************/ 95 | /*************************************************************************************/ 96 | 97 | typedef int nid_t; 98 | 99 | typedef struct _DmaMemory DmaMemory; 100 | 101 | typedef struct _RirbResponse RirbResponse; 102 | typedef struct _CommandList CommandList; 103 | typedef struct _BdlEntry BdlEntry; 104 | 105 | typedef struct _ChannelCaps ChannelCaps; 106 | 107 | typedef struct _Widget Widget; 108 | typedef struct _AudioControl AudioControl; 109 | typedef struct _AudioAssoc AudioAssoc; 110 | typedef struct _PcmDevice PcmDevice; 111 | typedef struct _FunctionGroup FunctionGroup; 112 | typedef struct _Channel Channel; 113 | typedef struct _Codec Codec; 114 | 115 | class IODMACommand; 116 | 117 | typedef struct _DmaMemory { 118 | const char *description; 119 | IOBufferMemoryDescriptor *md; 120 | UInt64 size; 121 | UInt64 physAddr; 122 | IOVirtualAddress virtAddr; 123 | } DmaMemory; 124 | 125 | /* Hold a response from a verb sent to a codec received via the rirb. */ 126 | typedef struct _RirbResponse { 127 | UInt32 response; 128 | UInt32 response_ex; 129 | } RirbResponse; 130 | 131 | #define HDAC_RIRB_RESPONSE_EX_SDATA_IN_MASK 0x0000000f 132 | #define HDAC_RIRB_RESPONSE_EX_SDATA_IN_OFFSET 0 133 | #define HDAC_RIRB_RESPONSE_EX_UNSOLICITED 0x00000010 134 | 135 | #define HDAC_RIRB_RESPONSE_EX_SDATA_IN(response_ex) \ 136 | (((response_ex) & HDAC_RIRB_RESPONSE_EX_SDATA_IN_MASK) >> \ 137 | HDAC_RIRB_RESPONSE_EX_SDATA_IN_OFFSET) 138 | 139 | /* This structure holds the list of verbs that are to be sent to the codec 140 | * via the corb and the responses received via the rirb. It's allocated by 141 | * the codec driver and is owned by it. */ 142 | typedef struct _CommandList { 143 | int numCommands; 144 | UInt32 *verbs; 145 | UInt32 *responses; 146 | } CommandList; 147 | 148 | typedef struct _BdlEntry { 149 | volatile UInt32 addrl; 150 | volatile UInt32 addrh; 151 | volatile UInt32 len; 152 | volatile UInt32 ioc; 153 | } __attribute__((__packed__)) BdlEntry; 154 | 155 | #define HDA_MAX_CONNS 32 156 | #define HDA_MAX_NAMELEN 40 157 | 158 | #define TRACE_DIR_NONE 0 159 | #define TRACE_DIR_IN 1 160 | #define TRACE_DIR_OUT 2 161 | #define TRACE_DIR_INOUT 3 162 | 163 | typedef struct _Widget { 164 | nid_t nid; 165 | int type; 166 | int enable; 167 | int nconns, selconn, connsenabled; 168 | int waspin; 169 | UInt32 pflags; 170 | int bindAssoc; 171 | int bindSeqMask; 172 | int ossdev; 173 | int sense; 174 | UInt32 ossmask; 175 | nid_t conns[HDA_MAX_CONNS]; 176 | UInt8 connsenable[HDA_MAX_CONNS]; 177 | char name[HDA_MAX_NAMELEN]; 178 | uint8_t *eld; 179 | int eld_len; 180 | FunctionGroup *funcGroup; 181 | UInt8 traceDir; 182 | UInt8 stripecap; 183 | nid_t favoritDAC; 184 | struct { 185 | UInt32 widgetCap; 186 | UInt32 outAmpCap; 187 | UInt32 inAmpCap; 188 | UInt32 supStreamFormats; 189 | UInt32 supPcmSizeRates; 190 | UInt32 eapdBtl; 191 | } params; 192 | struct { 193 | UInt32 config; 194 | UInt32 cap; 195 | UInt32 ctrl; 196 | } pin; /* wclass */ 197 | } Widget; 198 | 199 | typedef struct _AudioControl { 200 | Widget *widget, *childWidget; 201 | int enable; 202 | int index, dir, ndir; 203 | int mute, step, size, offset; 204 | int left, right, forcemute; 205 | UInt32 muted; 206 | UInt32 ossmask, possmask; 207 | } AudioControl; 208 | 209 | typedef struct _NidForSwitch { 210 | nid_t mainNid; 211 | nid_t nextNid; 212 | int connNum; 213 | }NidForSwitch; 214 | 215 | /* Association is a group of pins bound for some special function. */ 216 | typedef struct _AudioAssoc { 217 | UInt8 enable; 218 | UInt8 index; 219 | UInt8 dir; 220 | UInt8 pincnt; 221 | UInt8 fakeredir; 222 | UInt8 digital; 223 | UInt16 pinset; 224 | nid_t hpredir; 225 | nid_t pins[16]; 226 | nid_t dacs[16]; 227 | nid_t activeNid; 228 | int chan; 229 | int dirty; 230 | //AutumnRain 231 | NidForSwitch nidForSwitch[16]; 232 | SInt8 defaultPin; 233 | SInt8 jackPin; 234 | } AudioAssoc; 235 | 236 | typedef struct _PcmDevice { 237 | FunctionGroup *funcGroup; 238 | int index; 239 | bool registered; 240 | int playChanId, recChanId; 241 | UInt8 left[SOUND_MIXER_NRDEVICES]; 242 | UInt8 right[SOUND_MIXER_NRDEVICES]; 243 | UInt32 chanSize; 244 | UInt32 chanNumBlocks; 245 | UInt8 digital; 246 | UInt32 recDevMask, devMask; 247 | } PcmDevice; 248 | 249 | typedef struct _FunctionGroup { 250 | UInt8 nodeType; 251 | nid_t nid; 252 | nid_t startNode, endNode; 253 | int numNodes; 254 | bool mSwitchEnable; 255 | Codec *codec; 256 | Widget *widgets; 257 | struct { 258 | UInt32 outAmpCap; 259 | UInt32 inAmpCap; 260 | UInt32 supStreamFormats; 261 | UInt32 supPcmSizeRates; 262 | int numControls, numAssocs; 263 | AudioControl *controls; 264 | AudioAssoc *assocs; 265 | UInt32 quirks; 266 | UInt32 gpio; 267 | PcmDevice *pcmDevices; 268 | int numPcmDevices; 269 | } audio; /* function */ 270 | /* XXX undefined: modem, hdmi. */ 271 | } FunctionGroup; 272 | 273 | #define HDAC_CHN_RUNNING 0x00000001 274 | #define HDAC_CHN_SUSPEND 0x00000002 275 | 276 | typedef struct _ChannelCaps { 277 | UInt32 minSpeed, maxSpeed; 278 | UInt32 const *formats; 279 | UInt32 caps; 280 | UInt32 channels; 281 | } ChannelCaps; 282 | 283 | typedef struct _Channel { 284 | ChannelCaps caps; 285 | FunctionGroup *funcGroup; 286 | PcmDevice *pcmDevice; 287 | UInt32 speed, format; 288 | UInt32 formats[12], pcmRates[16]; 289 | UInt32 supStreamFormats, supPcmSizeRates; 290 | UInt32 numBlocks, blockSize; 291 | UInt32 *dmaPos; 292 | UInt32 flags; 293 | int direction; 294 | int off; 295 | int streamId; 296 | int bit16, bit32; 297 | int assocNum; 298 | nid_t io[16]; // adc/dac nids 299 | UInt8 stripecap; 300 | UInt8 stripectl; 301 | //Math 302 | bool vectorize; 303 | bool useStereo; 304 | UInt8 noiseLevel; 305 | UInt8 StereoBase; 306 | 307 | UInt16 slack; 308 | DmaMemory *bdlMem; 309 | DmaMemory *buffer; 310 | } Channel; 311 | 312 | #define CODEC_ID(codec) ((((UInt32) (codec)->vendorId & 0xffff) << 16) | \ 313 | ((UInt32) (codec)->deviceId & 0xffff)) 314 | 315 | typedef struct _Codec { 316 | int numVerbsSent; 317 | int numRespReceived; 318 | nid_t cad; 319 | UInt16 vendorId; 320 | UInt16 deviceId; 321 | UInt8 revisionId; 322 | UInt8 steppingId; 323 | CommandList *commands; 324 | FunctionGroup *funcGroups; 325 | int numFuncGroups; 326 | } Codec; 327 | 328 | #endif 329 | -------------------------------------------------------------------------------- /tranc/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 | -------------------------------------------------------------------------------- /tranc/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 const *name; 11 | } ControllerListItem; 12 | 13 | typedef struct { 14 | UInt32 id; 15 | char const *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 const *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 const MixerValueName MixerValueNamesBind[]; 50 | 51 | #define HDA_GPIO_MAX 8 52 | /* 0 - 7 = GPIO , 8 = Flush */ 53 | #define HDA_QUIRK_GPIO0 (1 << 0) 54 | #define HDA_QUIRK_GPIO1 (1 << 1) 55 | #define HDA_QUIRK_GPIO2 (1 << 2) 56 | #define HDA_QUIRK_GPIO3 (1 << 3) 57 | #define HDA_QUIRK_GPIO4 (1 << 4) 58 | #define HDA_QUIRK_GPIO5 (1 << 5) 59 | #define HDA_QUIRK_GPIO6 (1 << 6) 60 | #define HDA_QUIRK_GPIO7 (1 << 7) 61 | #define HDA_QUIRK_GPIOFLUSH (1 << 8) 62 | 63 | /* 9 - 25 = anything else */ 64 | #define HDA_QUIRK_SOFTPCMVOL (1 << 9) 65 | #define HDA_QUIRK_FIXEDRATE (1 << 10) 66 | #define HDA_QUIRK_FORCESTEREO (1 << 11) 67 | #define HDA_QUIRK_EAPDINV (1 << 12) 68 | #define HDA_QUIRK_DMAPOS (1 << 13) 69 | #define HDA_QUIRK_SENSEINV (1 << 14) 70 | 71 | /* 26 - 31 = vrefs */ 72 | #define HDA_QUIRK_IVREF50 (1 << 26) 73 | #define HDA_QUIRK_IVREF80 (1 << 27) 74 | #define HDA_QUIRK_IVREF100 (1 << 28) 75 | #define HDA_QUIRK_OVREF50 (1 << 29) 76 | #define HDA_QUIRK_OVREF80 (1 << 30) 77 | #define HDA_QUIRK_OVREF100 (1 << 31) 78 | 79 | #define HDA_QUIRK_IVREF (HDA_QUIRK_IVREF50 | HDA_QUIRK_IVREF80 | HDA_QUIRK_IVREF100) 80 | #define HDA_QUIRK_OVREF (HDA_QUIRK_OVREF50 | HDA_QUIRK_OVREF80 | HDA_QUIRK_OVREF100) 81 | #define HDA_QUIRK_VREF (HDA_QUIRK_IVREF | HDA_QUIRK_OVREF) 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /tranc/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 | -------------------------------------------------------------------------------- /tranc/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 | -------------------------------------------------------------------------------- /tranc/VoodooHDA.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /tranc/VoodooHDA.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /tranc/VoodooHDA.xcodeproj/project.xcworkspace/xcuserdata/Slice.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CloverHackyColor/VoodooHDA/870a1bb8a24effc93803abfcb5eb9ec00150a972/tranc/VoodooHDA.xcodeproj/project.xcworkspace/xcuserdata/Slice.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /tranc/VoodooHDA.xcodeproj/project.xcworkspace/xcuserdata/sergey.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CloverHackyColor/VoodooHDA/870a1bb8a24effc93803abfcb5eb9ec00150a972/tranc/VoodooHDA.xcodeproj/project.xcworkspace/xcuserdata/sergey.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /tranc/VoodooHDA.xcodeproj/xcshareddata/xcschemes/VoodooHDA.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 57 | 58 | 59 | 60 | 62 | 63 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /tranc/VoodooHDA.xcodeproj/xcshareddata/xcshemes/VoodooHDA.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 44 | 45 | 51 | 52 | 54 | 55 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /tranc/VoodooHDA.xcodeproj/xcshareddata/xcshemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | VoodooHDA.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 32D94FC30562CBF700B6AF17 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tranc/VoodooHDA.xcodeproj/xcuserdata/sergey.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | VoodooHDA.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 32D94FC30562CBF700B6AF17 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tranc/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 | 31 | Channel *mChannel; 32 | VoodooHDADevice *mDevice; 33 | IOAudioStream *mStream; 34 | bool emptyStream; 35 | 36 | const char *mPortName; 37 | UInt32 mPortType; 38 | 39 | IOAudioSelectorControl *mSelControl; 40 | 41 | UInt32 oldOutVolumeLeft; 42 | UInt32 oldOutVolumeRight; 43 | UInt32 oldInputGain; 44 | 45 | // cue8chalk: flag for volume change fix 46 | bool mEnableVolumeChangeFix; 47 | // VertexBZ: flag for mute fix 48 | bool mEnableMuteFix; 49 | 50 | void messageHandler(UInt32 type, const char *format, ...) __attribute__ ((format (printf, 3, 4))); 51 | 52 | void setPinName(UInt32 pinConfig, const char* name); 53 | const char *getPortName(); 54 | UInt64 getMinMaxDb(UInt32 mask); 55 | bool haveDigitalMuteControl(UInt32 mask); 56 | 57 | IOAudioStreamDirection getEngineDirection(); 58 | int getEngineId(); 59 | 60 | bool publishChannelLayout(IOAudioStreamDirection direction, UInt32 channels); 61 | bool createAudioStream(IOAudioStreamDirection direction, void *sampleBuffer, 62 | UInt32 sampleBufferSize, UInt32 *pcmRates, 63 | UInt32 supPcmSizeRates, UInt32 supStreamFormats, UInt32 channels); 64 | bool createAudioStream(); 65 | 66 | bool createAudioControls(); 67 | 68 | static IOReturn volumeChangeHandler(IOService *target, IOAudioControl *volumeControl, SInt32 oldValue, SInt32 newValue); 69 | static IOReturn muteChangeHandler(IOService *target, IOAudioControl *muteControl, SInt32 oldValue, SInt32 newValue); 70 | 71 | IOReturn volumeChanged(IOAudioControl *volumeControl, SInt32 oldValue, SInt32 newValue); 72 | IOReturn muteChanged(IOAudioControl *muteControl, SInt32 oldValue, SInt32 newValue); 73 | 74 | virtual bool initWithChannel(Channel *channel); 75 | virtual void free(); 76 | virtual bool initHardware(IOService *provider); 77 | 78 | virtual IOReturn performAudioEngineStart(); 79 | virtual IOReturn performAudioEngineStop(); 80 | 81 | virtual UInt32 getCurrentSampleFrame(); 82 | 83 | virtual IOReturn performFormatChange(IOAudioStream *audioStream, const IOAudioStreamFormat *newFormat, 84 | const IOAudioSampleRate *newSampleRate); 85 | 86 | virtual IOReturn clipOutputSamples(const void *mixBuf, void *sampleBuf, UInt32 firstSampleFrame, 87 | UInt32 numSampleFrames, const IOAudioStreamFormat *streamFormat, IOAudioStream *audioStream); 88 | virtual IOReturn convertInputSamples(const void *sampleBuf, void *destBuf, UInt32 firstSampleFrame, 89 | UInt32 numSampleFrames, const IOAudioStreamFormat *streamFormat, IOAudioStream *audioStream); 90 | virtual OSString *getLocalUniqueID(); 91 | }; 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /tranc/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 | __attribute__((visibility("hidden"))) 29 | void VoodooHDAUserClient::messageHandler(UInt32 type, const char *format, ...) 30 | { 31 | va_list args; 32 | va_start(args, format); 33 | if (mDevice) 34 | mDevice->messageHandler(type, format, args); 35 | else if (mVerbose >= 1) 36 | vprintf(format, args); 37 | va_end(args); 38 | } 39 | 40 | bool VoodooHDAUserClient::start(IOService *provider) 41 | { 42 | // logMsg("VoodooHDAUserClient[%p]::start\n", this); 43 | 44 | if (!super::start(provider)) 45 | return false; 46 | 47 | mDevice = OSDynamicCast(VoodooHDADevice, provider); 48 | ASSERT(mDevice); 49 | 50 | mVerbose = mDevice->mVerbose; 51 | 52 | return true; 53 | } 54 | 55 | bool VoodooHDAUserClient::didTerminate(IOService *provider, IOOptionBits options, bool *defer) 56 | { 57 | // logMsg("VoodooHDAUserClient[%p]::didTerminate\n", this); 58 | 59 | // if defer is true, stop will not be called on the user client 60 | *defer = false; 61 | 62 | return super::didTerminate(provider, options, defer); 63 | } 64 | 65 | // clientClose is called when the user process calls IOServiceClose 66 | IOReturn VoodooHDAUserClient::clientClose() 67 | { 68 | // logMsg("VoodooHDAUserClient[%p]::clientClose\n", this); 69 | 70 | if (!isInactive()) 71 | terminate(); 72 | 73 | return kIOReturnSuccess; 74 | } 75 | 76 | // getTargetAndMethodForIndex looks up the external methods - supply a description of the parameters 77 | // available to be called 78 | IOExternalMethod *VoodooHDAUserClient::getTargetAndMethodForIndex(IOService **targetP, UInt32 index) 79 | { 80 | //logMsg("VoodooHDAUserClient[%p]::getTargetAndMethodForIndex(%ld)\n", this, index); 81 | 82 | static const IOExternalMethod methodDescs[kVoodooHDANumMethods] = { 83 | { NULL, (IOMethod) &VoodooHDAUserClient::actionMethod, kIOUCStructIStructO, 84 | kIOUCVariableStructureSize, kIOUCVariableStructureSize }, 85 | }; 86 | 87 | *targetP = this; 88 | if (index < kVoodooHDANumMethods) 89 | return (IOExternalMethod *) (methodDescs + index); 90 | else 91 | return NULL; 92 | } 93 | 94 | __attribute__((visibility("hidden"))) 95 | IOReturn VoodooHDAUserClient::actionMethod(UInt32 *dataIn, UInt32 *dataOut, IOByteCount inputSize, 96 | IOByteCount *outputSize) 97 | { 98 | IOReturn result; 99 | UInt32 action, dataSize; 100 | void *data; 101 | UInt64 outputMax; 102 | 103 | //logMsg("VoodooHDAUserClient[%p]::actionMethod(%ld, %ld)\n", this, inputSize, *outputSize); 104 | 105 | if (inputSize != sizeof (UInt32)) 106 | return kIOReturnBadArgument; 107 | action = *dataIn; 108 | 109 | result = mDevice->runAction(&action, &dataSize, &data); 110 | 111 | // note: we can only transfer sizeof (io_struct_inband_t) bytes out at a time 112 | 113 | outputMax = *outputSize; 114 | *outputSize = dataSize; 115 | if (dataSize) { 116 | ASSERT(data); 117 | if (outputMax < dataSize) 118 | return kIOReturnNoSpace; 119 | bcopy(data, dataOut, dataSize); 120 | } 121 | 122 | return result; 123 | } 124 | 125 | IOReturn VoodooHDAUserClient::clientMemoryForType(UInt32 type, IOOptionBits *options, 126 | IOMemoryDescriptor **memory) 127 | { 128 | IOReturn result; 129 | IOBufferMemoryDescriptor *memDesc; 130 | 131 | // logMsg("VoodooHDAUserClient[%p]::clientMemoryForType(0x%lx)\n", this, type); 132 | 133 | // note: IOConnectUnmapMemory should not be used with this user client 134 | 135 | *options = 0; 136 | *memory = NULL; 137 | 138 | switch (type) { 139 | case kVoodooHDAMemoryMessageBuffer: 140 | mDevice->lockMsgBuffer(); 141 | if (!mDevice->mMsgBufferSize) { 142 | errorMsg("error: message buffer size is zero\n"); 143 | mDevice->unlockMsgBuffer(); 144 | result = kIOReturnUnsupported; 145 | break; 146 | } 147 | memDesc = IOBufferMemoryDescriptor::inTaskWithOptions(0, 148 | kIOMemoryPageable | kIODirectionIn, 149 | mDevice->mMsgBufferSize); 150 | if (!memDesc || 151 | memDesc->prepare() != kIOReturnSuccess) { 152 | errorMsg("error: couldn't allocate buffer memory descriptor (size: %ld)\n", 153 | mDevice->mMsgBufferSize); 154 | mDevice->unlockMsgBuffer(); 155 | result = kIOReturnVMError; 156 | RELEASE(memDesc); 157 | break; 158 | } 159 | memDesc->writeBytes(0U, mDevice->mMsgBuffer, mDevice->mMsgBufferSize); 160 | mDevice->unlockMsgBuffer(); 161 | memDesc->complete(); 162 | *options |= kIOMapReadOnly; 163 | *memory = memDesc; // automatically released after memory is mapped into task 164 | result = kIOReturnSuccess; 165 | break; 166 | //Разделяемая память для PrefPanel 167 | case kVoodooHDAMemoryCommand: 168 | mDevice->lockPrefPanelMemoryBuf(); 169 | if (!mDevice->mPrefPanelMemoryBuf) { 170 | errorMsg("error: message buffer size is zero\n"); 171 | mDevice->unlockPrefPanelMemoryBuf(); 172 | result = kIOReturnUnsupported; 173 | break; 174 | } 175 | memDesc = IOBufferMemoryDescriptor::inTaskWithOptions(0, 176 | kIOMemoryPageable | kIODirectionInOut, 177 | mDevice->mPrefPanelMemoryBufSize); 178 | if (!memDesc || 179 | memDesc->prepare() != kIOReturnSuccess) { 180 | errorMsg("error: couldn't allocate buffer memory descriptor (size: %ld)\n", 181 | mDevice->mPrefPanelMemoryBufSize); 182 | mDevice->unlockPrefPanelMemoryBuf(); 183 | result = kIOReturnVMError; 184 | RELEASE(memDesc); 185 | break; 186 | } 187 | mDevice->updatePrefPanelMemoryBuf(); 188 | memDesc->writeBytes(0U, mDevice->mPrefPanelMemoryBuf, mDevice->mPrefPanelMemoryBufSize); 189 | mDevice->unlockPrefPanelMemoryBuf(); 190 | memDesc->complete(); 191 | *memory = memDesc; // automatically released after memory is mapped into task 192 | result = kIOReturnSuccess; 193 | break; 194 | //Разделяемая память для буфера с текущеми настройками усиления 195 | case kVoodooHDAMemoryExtMessageBuffer: 196 | mDevice->lockExtMsgBuffer(); 197 | if (!mDevice->mExtMsgBufferSize) { 198 | errorMsg("error: ext message buffer size is zero\n"); 199 | mDevice->unlockExtMsgBuffer(); 200 | result = kIOReturnUnsupported; 201 | break; 202 | } 203 | 204 | memDesc = IOBufferMemoryDescriptor::inTaskWithOptions(0, 205 | kIOMemoryPageable | kIODirectionIn, 206 | mDevice->mExtMsgBufferSize); 207 | if (!memDesc || 208 | memDesc->prepare() != kIOReturnSuccess) { 209 | errorMsg("error: couldn't allocate buffer memory descriptor (size: %ld)\n", 210 | mDevice->mExtMsgBufferSize); 211 | mDevice->unlockExtMsgBuffer(); 212 | result = kIOReturnVMError; 213 | RELEASE(memDesc); 214 | break; 215 | } 216 | memDesc->writeBytes(0U, mDevice->mExtMsgBuffer, mDevice->mExtMsgBufferSize); 217 | mDevice->unlockExtMsgBuffer(); 218 | memDesc->complete(); 219 | *options |= kIOMapReadOnly; 220 | *memory = memDesc; // automatically released after memory is mapped into task 221 | result = kIOReturnSuccess; 222 | break; 223 | default: 224 | result = kIOReturnBadArgument; 225 | break; 226 | } 227 | 228 | return result; 229 | } 230 | -------------------------------------------------------------------------------- /tranc/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 bool start(IOService *provider); 24 | 25 | /* IOUserClient overrides */ 26 | virtual IOReturn clientClose(); 27 | 28 | virtual bool didTerminate(IOService *provider, IOOptionBits options, bool *defer); 29 | 30 | virtual IOExternalMethod *getTargetAndMethodForIndex(IOService **targetP, UInt32 index); 31 | 32 | virtual IOReturn clientMemoryForType(UInt32 type, IOOptionBits *options, IOMemoryDescriptor **memory); 33 | 34 | /* External methods */ 35 | IOReturn actionMethod(UInt32 *dataIn, UInt32 *dataOut, IOByteCount inputSize, IOByteCount *outputSize); 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /tranc/VoodooHDA_BS.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /tranc/VoodooHDA_BS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /tranc/VoodooHDA_BS.xcodeproj/project.xcworkspace/xcuserdata/Slice.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CloverHackyColor/VoodooHDA/870a1bb8a24effc93803abfcb5eb9ec00150a972/tranc/VoodooHDA_BS.xcodeproj/project.xcworkspace/xcuserdata/Slice.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /tranc/VoodooHDA_BS.xcodeproj/project.xcworkspace/xcuserdata/sergey.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CloverHackyColor/VoodooHDA/870a1bb8a24effc93803abfcb5eb9ec00150a972/tranc/VoodooHDA_BS.xcodeproj/project.xcworkspace/xcuserdata/sergey.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /tranc/VoodooHDA_BS.xcodeproj/xcshareddata/xcshemes/VoodooHDA.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 44 | 45 | 51 | 52 | 54 | 55 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /tranc/VoodooHDA_BS.xcodeproj/xcshareddata/xcshemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | VoodooHDA.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 32D94FC30562CBF700B6AF17 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tranc/VoodooHDA_BS.xcodeproj/xcuserdata/sergey.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | VoodooHDA.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /tranc/VoodooHDA_old.xcodeproj/TemplateIcon.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CloverHackyColor/VoodooHDA/870a1bb8a24effc93803abfcb5eb9ec00150a972/tranc/VoodooHDA_old.xcodeproj/TemplateIcon.tiff -------------------------------------------------------------------------------- /tranc/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 | -------------------------------------------------------------------------------- /tranc/getdump.c: -------------------------------------------------------------------------------- 1 | /* to compile 2 | clang getdump.c -o getdump -framework IOKit -framework CoreFoundation -Wall -Wextra -Werror 3 | */ 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | //#include 12 | #define SOUND_MIXER_NRDEVICES 25 13 | #include "Shared.h" 14 | 15 | void printMsgBuffer(io_service_t service) 16 | { 17 | kern_return_t ret; 18 | io_connect_t connect = 0; 19 | #if __LP64__ 20 | mach_vm_address_t address; 21 | mach_vm_size_t size; 22 | #else 23 | vm_address_t address; 24 | vm_size_t size; 25 | #endif 26 | 27 | ret = IOServiceOpen(service, mach_task_self(), 0, &connect); 28 | if (ret != KERN_SUCCESS) { 29 | printf("error: IOServiceOpen returned 0x%08x\n", ret); 30 | goto failure; 31 | } 32 | 33 | ret = IOConnectMapMemory(connect, kVoodooHDAMemoryMessageBuffer, mach_task_self(), &address, &size, 34 | kIOMapAnywhere | kIOMapDefaultCache); 35 | if (ret != kIOReturnSuccess) { 36 | printf("error: IOConnectMapMemory returned 0x%08x\n", ret); 37 | goto failure; 38 | } 39 | 40 | printf("%s\n", (char *) address); 41 | 42 | failure: 43 | if (connect) { 44 | ret = IOServiceClose(connect); 45 | if (ret != KERN_SUCCESS) 46 | printf("warning: IOServiceClose returned 0x%08x\n", ret); 47 | } 48 | } 49 | 50 | int main() 51 | { 52 | mach_port_t masterPort; 53 | io_iterator_t iter = 0; 54 | io_service_t service = 0; 55 | kern_return_t ret; 56 | io_string_t path; 57 | 58 | ret = IOMasterPort(MACH_PORT_NULL, &masterPort); 59 | if (ret != KERN_SUCCESS) { 60 | printf("error: IOMasterPort returned 0x%08x\n", ret); 61 | goto failure; 62 | } 63 | 64 | ret = IOServiceGetMatchingServices(masterPort, IOServiceMatching(kVoodooHDAClassName), &iter); 65 | if (ret != KERN_SUCCESS) { 66 | printf("error: IOServiceGetMatchingServices returned 0x%08x\n", ret); 67 | goto failure; 68 | } 69 | while ((service = IOIteratorNext(iter)) != 0) { 70 | ret = IORegistryEntryGetPath(service, kIOServicePlane, path); 71 | if (ret != KERN_SUCCESS) { 72 | printf("error: IORegistryEntryGetPath returned 0x%08x\n", ret); 73 | goto failure; 74 | } 75 | printf("Found a device of class "kVoodooHDAClassName": %s\n\n", path); 76 | printMsgBuffer(service); 77 | IOObjectRelease(service); 78 | } 79 | 80 | failure: 81 | if (service) 82 | IOObjectRelease(service); 83 | if (iter) 84 | IOObjectRelease(iter); 85 | 86 | return 0; 87 | } 88 | -------------------------------------------------------------------------------- /tranc/getdump2.c: -------------------------------------------------------------------------------- 1 | /* to compile 2 | clang getdump.c -o getdump -framework IOKit -framework CoreFoundation -Wall -Wextra -Werror 3 | * -Wno-deprecated-declarations 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | //#include 13 | #define SOUND_MIXER_NRDEVICES 25 14 | #include "Shared.h" 15 | 16 | void printMsgBuffer(io_service_t service) 17 | { 18 | kern_return_t ret; 19 | io_connect_t connect = 0; 20 | #if __LP64__ 21 | mach_vm_address_t address; 22 | mach_vm_size_t size; 23 | #else 24 | vm_address_t address; 25 | vm_size_t size; 26 | #endif 27 | 28 | ret = IOServiceOpen(service, mach_task_self(), 0, &connect); 29 | if (ret != KERN_SUCCESS) { 30 | printf("error: IOServiceOpen returned 0x%08x\n", ret); 31 | goto failure; 32 | } 33 | 34 | ret = IOConnectMapMemory(connect, kVoodooHDAMemoryMessageBuffer, mach_task_self(), &address, &size, 35 | kIOMapAnywhere | kIOMapDefaultCache); 36 | if (ret != kIOReturnSuccess) { 37 | printf("error: IOConnectMapMemory returned 0x%08x\n", ret); 38 | goto failure; 39 | } 40 | 41 | printf("%s\n", (char *) address); 42 | 43 | failure: 44 | if (connect) { 45 | ret = IOServiceClose(connect); 46 | if (ret != KERN_SUCCESS) 47 | printf("warning: IOServiceClose returned 0x%08x\n", ret); 48 | } 49 | } 50 | 51 | int main() 52 | { 53 | // mach_port_t masterPort; 54 | io_iterator_t iter = 0; 55 | io_service_t service = 0; 56 | kern_return_t ret; 57 | io_string_t path; 58 | 59 | // ret = IOMasterPort(MACH_PORT_NULL, &masterPort); 60 | // if (ret != KERN_SUCCESS) { 61 | // printf("error: IOMasterPort returned 0x%08x\n", ret); 62 | // goto failure; 63 | // } 64 | 65 | ret = IOServiceGetMatchingServices(kIOMainPortDefault, IOServiceMatching(kVoodooHDAClassName), &iter); 66 | if (ret != KERN_SUCCESS) { 67 | printf("error: IOServiceGetMatchingServices returned 0x%08x\n", ret); 68 | goto failure; 69 | } 70 | while ((service = IOIteratorNext(iter)) != 0) { 71 | ret = IORegistryEntryGetPath(service, kIOServicePlane, path); 72 | if (ret != KERN_SUCCESS) { 73 | printf("error: IORegistryEntryGetPath returned 0x%08x\n", ret); 74 | goto failure; 75 | } 76 | printf("Found a device of class "kVoodooHDAClassName": %s\n\n", path); 77 | printMsgBuffer(service); 78 | IOObjectRelease(service); 79 | } 80 | 81 | failure: 82 | if (service) 83 | IOObjectRelease(service); 84 | if (iter) 85 | IOObjectRelease(iter); 86 | 87 | return 0; 88 | } 89 | -------------------------------------------------------------------------------- /tranc/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 | -------------------------------------------------------------------------------- /tranc/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 | -------------------------------------------------------------------------------- /tranc/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 | -------------------------------------------------------------------------------- /tranc/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 | -------------------------------------------------------------------------------- /tranc/private_xmmintrin.h: -------------------------------------------------------------------------------- 1 | // 2 | // private_xmmintrin.h 3 | // VoodooHDA 4 | // 5 | // Created by Zenith432 on November 19th, 2017. 6 | // 7 | 8 | #include "License.h" 9 | 10 | #ifndef private_xmmintrin_h 11 | #define private_xmmintrin_h 12 | 13 | /* 14 | * SSE instructions (from xmmintrin.h) 15 | */ 16 | 17 | typedef int __v4si __attribute__((__vector_size__(16))); 18 | typedef float __m128 __attribute__((__vector_size__(16))); 19 | 20 | #define _mm_load_ps(p) (*(__m128 const*) (p)) 21 | #define _mm_loadu_ps(p) ({ __m128 tmp; __asm__ volatile ("movups %1, %0" : "=x"(tmp) : "m"(*(char const*) (p))); tmp; }) 22 | #define _mm_store_ps(p, a) (*((__m128*) (p)) = (a)) 23 | #define _mm_storeu_ps(p, a) { __asm__ volatile ("movups %1, %0" : "=m"(*(char*) (p)) : "x"((a))); } 24 | #define _mm_mul_ps(a, b) ((a) * (b)) 25 | #define _mm_add_ps(a, b) ((a) + (b)) 26 | #define _mm_max_ps(a, b) __builtin_ia32_maxps((a), (b)) 27 | #define _mm_min_ps(a, b) __builtin_ia32_minps((a), (b)) 28 | 29 | /* 30 | * SSE2 instructions (from emmintrin.h) 31 | */ 32 | 33 | typedef long long __m128i __attribute__((__vector_size__(16))); 34 | 35 | #define _mm_setzero_si128() (__m128i){ 0LL, 0LL } 36 | #define _mm_setr_epi32(i0, i1, i2, i3) (__m128i)(__v4si){ (i0), (i1), (i2), (i3) } 37 | #define _mm_load_si128(p) (*(__m128i const*) (p)) 38 | #define _mm_loadu_si128(p) ({ __m128 tmp; __asm__ volatile ("movups %1, %0" : "=x"(tmp) : "m"(*(char const*) (p))); tmp; }) 39 | #define _mm_store_si128(p, b) (*((__m128i*) (p)) = (b)) 40 | #define _mm_storeu_si128(p, a) { __asm__ volatile ("movups %1, %0" : "=m"(*(char*) (p)) : "x"((a))); } 41 | #define _mm_cvtps_epi32(a) ({ __m128 tmp; __asm__ volatile ("cvtps2dq %1, %0" : "=x"(tmp) : "xm"(a)); tmp; }) 42 | #define _mm_packs_epi32(a, b) __builtin_ia32_packssdw128((a), (b)) 43 | #define _mm_slli_epi16(a, count) (__m128i)__builtin_ia32_psllwi128((a), (count)) 44 | #define _mm_srli_epi16(a, count) (__m128i)__builtin_ia32_psrlwi128((a), (count)) 45 | #define _mm_or_si128(a, b) ((a) | (b)) 46 | #define _mm_and_si128(a, b) ((a) & (b)) 47 | #define _mm_cvtepi32_ps(a) ({ __m128 tmp; __asm__ volatile ("cvtdq2ps %1, %0" : "=x"(tmp) : "xm"(a)); tmp; }) 48 | #define _mm_unpacklo_epi16(a, b) ({ __m128i tmp = (a); __asm__ volatile ("punpcklwd %1, %0" : "+x"(tmp) : "xm"((b))); tmp; }) 49 | #define _mm_unpackhi_epi16(a, b) ({ __m128i tmp = (a); __asm__ volatile ("punpckhwd %1, %0" : "+x"(tmp) : "xm"((b))); tmp; }) 50 | #define _mm_slli_si128(a, imm) ({ __m128i tmp = (a); __asm__ volatile ("pslldq %1, %0" : "+x"(tmp) : "N"((imm))); tmp; }) 51 | #define _mm_srli_si128(a, imm) ({ __m128i tmp = (a); __asm__ volatile ("psrldq %1, %0" : "+x"(tmp) : "N"((imm))); tmp; }) 52 | #define _mm_shufflelo_epi16(a, imm) ({ __m128i tmp; __asm__ volatile ("pshuflw %2, %1, %0" : "=x"(tmp) : "xm"((a)), "N"((imm))); tmp; }) 53 | #define _mm_shufflehi_epi16(a, imm) ({ __m128i tmp; __asm__ volatile ("pshufhw %2, %1, %0" : "=x"(tmp) : "xm"((a)), "N"((imm))); tmp; }) 54 | 55 | #endif /* private_xmmintrin_h */ 56 | -------------------------------------------------------------------------------- /tranc/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 | 0280800 15 | 16 | 17 | --------------------------------------------------------------------------------