Advertisement
Guest User

Info

a guest
Apr 6th, 2020
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.81 KB | None | 0 0
  1. public static void displayMixerInfo() {
  2.     Mixer.Info[] mixersInfo = AudioSystem.getMixerInfo();
  3.  
  4.     for (Mixer.Info mixerInfo : mixersInfo) {
  5.         System.out.println("Mixer: " + mixerInfo.getName());
  6.  
  7.         Mixer mixer = AudioSystem.getMixer(mixerInfo);
  8.  
  9.         Line.Info[] sourceLineInfo = mixer.getSourceLineInfo();
  10.         for (Line.Info info : sourceLineInfo)
  11.             showLineInfo(info);
  12.  
  13.         Line.Info[] targetLineInfo = mixer.getTargetLineInfo();
  14.         for (Line.Info info : targetLineInfo)
  15.             showLineInfo(info);
  16.     }
  17. }
  18.  
  19. private static void showLineInfo(final Line.Info lineInfo) {
  20.     System.out.println("  " + lineInfo.toString());
  21.  
  22.     if (lineInfo instanceof DataLine.Info) {
  23.         DataLine.Info dataLineInfo = (DataLine.Info) lineInfo;
  24.  
  25.         AudioFormat[] formats = dataLineInfo.getFormats();
  26.         for (final AudioFormat format : formats)
  27.             System.out.println("    " + format.toString());
  28.     }
  29. }
  30.  
  31. displayMixerInfo();
  32.  
  33. //Displays:
  34. //  Mixer: Primary Sound Driver
  35. //    interface SourceDataLine supporting 8 audio formats, and buffers of at least 32 bytes
  36. //      PCM_UNSIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
  37. //      PCM_SIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
  38. //      PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, little-endian
  39. //      PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, big-endian
  40. //      PCM_UNSIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
  41. //      PCM_SIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
  42. //      PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, little-endian
  43. //      PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, big-endian
  44. //    interface Clip supporting 8 audio formats, and buffers of at least 32 bytes
  45. //      PCM_UNSIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
  46. //      PCM_SIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
  47. //      PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, little-endian
  48. //      PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, big-endian
  49. //      PCM_UNSIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
  50. //      PCM_SIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
  51. //      PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, little-endian
  52. //      PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, big-endian
  53. //  Mixer: Speakers (High Definition Audio Device)
  54. //    interface SourceDataLine supporting 8 audio formats, and buffers of at least 32 bytes
  55. //      PCM_UNSIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
  56. //      PCM_SIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
  57. //      PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, little-endian
  58. //      PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, big-endian
  59. //      PCM_UNSIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
  60. //      PCM_SIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
  61. //      PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, little-endian
  62. //      PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, big-endian
  63. //    interface Clip supporting 8 audio formats, and buffers of at least 32 bytes
  64. //      PCM_UNSIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
  65. //      PCM_SIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
  66. //      PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, little-endian
  67. //      PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, big-endian
  68. //      PCM_UNSIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
  69. //      PCM_SIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
  70. //      PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, little-endian
  71. //      PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, big-endian
  72. //  Mixer: Digital Audio (S/PDIF) (High Definition Audio Device)
  73. //    interface SourceDataLine supporting 8 audio formats, and buffers of at least 32 bytes
  74. //      PCM_UNSIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
  75. //      PCM_SIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
  76. //      PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, little-endian
  77. //      PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, big-endian
  78. //      PCM_UNSIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
  79. //      PCM_SIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
  80. //      PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, little-endian
  81. //      PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, big-endian
  82. //    interface Clip supporting 8 audio formats, and buffers of at least 32 bytes
  83. //      PCM_UNSIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
  84. //      PCM_SIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
  85. //      PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, little-endian
  86. //      PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, big-endian
  87. //      PCM_UNSIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
  88. //      PCM_SIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
  89. //      PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, little-endian
  90. //      PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, big-endian
  91. //  Mixer: Digital Audio (S/PDIF) (High Definition Audio Device)
  92. //    interface SourceDataLine supporting 8 audio formats, and buffers of at least 32 bytes
  93. //      PCM_UNSIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
  94. //      PCM_SIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
  95. //      PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, little-endian
  96. //      PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, big-endian
  97. //      PCM_UNSIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
  98. //      PCM_SIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
  99. //      PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, little-endian
  100. //      PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, big-endian
  101. //    interface Clip supporting 8 audio formats, and buffers of at least 32 bytes
  102. //      PCM_UNSIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
  103. //      PCM_SIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
  104. //      PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, little-endian
  105. //      PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, big-endian
  106. //      PCM_UNSIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
  107. //      PCM_SIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
  108. //      PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, little-endian
  109. //      PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, big-endian
  110. //  Mixer: Port Speakers (High Definition Audio
  111. //    SPEAKER target port
  112. //  Mixer: Port Digital Audio (S/PDIF) (High De
  113. //    Master Volume target port
  114. //  Mixer: Port Digital Audio (S/PDIF) (High De
  115. //    Master Volume target port
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement