Advertisement
alexdubovyck

[НЕ УДАЛЯТЬ!] перезалив - SoundCardAnalysis.ahk

Feb 4th, 2018
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.88 KB | None | 0 0
  1. ; SOUNDCARD ANALYSIS
  2. ; Use the following script to discover your soundcard's capabilities (component types and control types).
  3. ; It displays the results in a simple ListView.
  4.  
  5. SetBatchLines -1
  6. SplashTextOn,,, Gathering Soundcard Info...
  7.  
  8. ; Most of the pure numbers below probably don't exist in any mixer, but they're queried for completeness.
  9. ; The numbers correspond to the following items (in order): CUSTOM, BOOLEANMETER, SIGNEDMETER, PEAKMETER,
  10. ; UNSIGNEDMETER, BOOLEAN, BUTTON, DECIBELS, SIGNED, UNSIGNED, PERCENT, SLIDER, FADER, SINGLESELECT, MUX,
  11. ; MULTIPLESELECT, MIXER, MICROTIME, MILLITIME
  12. ControlTypes = VOLUME,ONOFF,MUTE,MONO,LOUDNESS,STEREOENH,BASSBOOST,PAN,QSOUNDPAN,BASS,TREBLE,EQUALIZER,0x00000000, 0x10010000,0x10020000,0x10020001,0x10030000,0x20010000,0x21010000,0x30040000,0x30020000,0x30030000,0x30050000,0x40020000,0x50030000,0x70010000,0x70010001,0x71010000,0x71010001,0x60030000,0x61030000
  13.  
  14. ComponentTypes = MASTER,HEADPHONES,DIGITAL,LINE,MICROPHONE,SYNTH,CD,TELEPHONE,PCSPEAKER,WAVE,AUX,ANALOG,N/A
  15.  
  16. ; Create a ListView and prepare for the main loop:
  17. Gui, Add, Listview, w400 h400 vMyListView, Component Type|Control Type|Setting|Mixer
  18. LV_ModifyCol(4, "Integer")
  19. SetFormat, Float, 0.2 ; Limit number of decimal places in percentages to two.
  20.  
  21. Loop ; For each mixer number that exists in the system, query its capabilities.
  22. {
  23. CurrMixer := A_Index
  24. SoundGet, Setting,,, %CurrMixer%
  25. if ErrorLevel = Can't Open Specified Mixer ; Any error other than this indicates that the mixer exists.
  26. break
  27.  
  28. ; For each component type that exists in this mixer, query its instances and control types:
  29. Loop, parse, ComponentTypes, `,
  30. {
  31. CurrComponent := A_LoopField
  32. ; First check if this component type even exists in the mixer:
  33. SoundGet, Setting, %CurrComponent%,, %CurrMixer%
  34. if ErrorLevel = Mixer Doesn't Support This Component Type
  35. continue ; Start a new iteration to move on to the next component type.
  36. Loop ; For each instance of this component type, query its control types.
  37. {
  38. CurrInstance := A_Index
  39. ; First check if this instance of this instance even exists in the mixer:
  40. SoundGet, Setting, %CurrComponent%:%CurrInstance%,, %CurrMixer%
  41. ; Checking for both of the following errors allows this script to run on older versions:
  42. if ErrorLevel in Mixer Doesn't Have That Many of That Component Type,Invalid Control Type or Component Type
  43. break ; No more instances of this component type.
  44. ; Get the current setting of each control type that exists in this instance of this component:
  45. Loop, parse, ControlTypes, `,
  46. {
  47. CurrControl := A_LoopField
  48. SoundGet, Setting, %CurrComponent%:%CurrInstance%, %CurrControl%, %CurrMixer%
  49. ; Checking for both of the following errors allows this script to run on older versions:
  50. if ErrorLevel in Component Doesn't Support This Control Type,Invalid Control Type or Component Type
  51. continue
  52. if ErrorLevel ; Some other error, which is unexpected so show it in the results.
  53. Setting := ErrorLevel
  54. ComponentString := CurrComponent . ":" . CurrInstance
  55. if CurrInstance > 1
  56. ComponentString = %ComponentString%:%CurrInstance%
  57. LV_Add("", ComponentString, CurrControl, Setting, CurrMixer)
  58. } ; For each control type.
  59. } ; For each component instance.
  60. } ; For each component type.
  61. } ; For each mixer.
  62.  
  63. Loop % LV_GetCount("Col") ; Auto-size each column to fit its contents.
  64. LV_ModifyCol(A_Index, "AutoHdr")
  65.  
  66. SplashTextOff
  67. Gui, Show
  68. return
  69.  
  70. GuiClose:
  71. ExitApp
  72.  
  73. Оригинал: https://github.com/PProvost/AutoHotKey/blob/master/SoundCardAnalysis.ahk
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement