You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

settingsAudio.html 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <!--
  2. Audio Settings
  3. Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
  4. $Id: settingsAudio.html 597 2015-04-20 11:41:28Z imoore76 $
  5. -->
  6. <table class='vboxVertical'>
  7. <tr>
  8. <td colspan='2'><label><input type='checkbox' class='vboxCheckbox vboxEnablerCheckbox' name='vboxSettingsAudioEnabled' /> <span class='translate'>Enable Audio</span></label></td>
  9. </tr>
  10. <tr>
  11. <th><span class='translate'>Host Audio Driver:</span></th>
  12. <td>
  13. <select name='vboxSettingsAudioDriver'>
  14. </select>
  15. </td>
  16. </tr>
  17. <tr>
  18. <th><span class='translate'>Audio Controller:</span></th>
  19. <td>
  20. <select name='vboxSettingsAudioController'>
  21. </select>
  22. </td>
  23. </tr>
  24. </table>
  25. <script type='text/javascript'>
  26. /* Audio */
  27. /*
  28. *
  29. * Static Audio Drivers
  30. *
  31. */
  32. // Not sure if mac returns 'mac' or 'macintosh' or 'apple' for OS name
  33. // Not sure if solaris returns 'solaris' or 'sun' for OS name
  34. // Using just the first letter should take care of this
  35. var vboxSettingsAudioDrivers = {
  36. 'w' : ['Null','WinMM','DirectSound'], // windows
  37. 'l' : ['Null','OSS','ALSA','Pulse'], // linux
  38. 'd' : ['Null','CoreAudio'], // darwin
  39. 'm' : ['Null','CoreAudio'], // mac
  40. 'a' : ['Null','CoreAudio'], // apple
  41. 'o' : ['Null','CoreAudio'], // os x
  42. 's' : ['Null','SolAudio'] // solaris / sun
  43. };
  44. /* Disable non-editable items when VM is running */
  45. $('#vboxSettingsDialog').on('dataLoaded',function(){
  46. /*
  47. * Load audio controller types
  48. */
  49. var ad = $('#vboxSettingsDialog').data('vboxAudioControllerTypes');
  50. // Failsafe
  51. if(!ad) ad = [];
  52. if(jQuery.inArray($('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioController, ad) < 0)
  53. ad[ad.length] = $('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioController;
  54. // clear options first
  55. document.forms['frmVboxSettings'].vboxSettingsAudioController.options.length = 0;
  56. for(var i = 0; i < ad.length; i++) {
  57. var opt = new Option(trans(vboxAudioController(ad[i]),'VBoxGlobal'),ad[i]);
  58. document.forms['frmVboxSettings'].vboxSettingsAudioController.options[document.forms['frmVboxSettings'].vboxSettingsAudioController.options.length] = opt;
  59. }
  60. /*
  61. * Load audio driver types
  62. */
  63. var ad = vboxSettingsAudioDrivers[$('#vboxSettingsDialog').data('vboxHostDetails').operatingSystem.toLowerCase().substring(0,1)];
  64. // Failsafe
  65. if(!ad) {
  66. ad = [$('#vboxPane').data('vboxSystemProperties').defaultAudioDriver];
  67. }
  68. if(jQuery.inArray($('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioDriver, ad) < 0)
  69. ad[ad.length] = $('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioDriver;
  70. for(var i = 0; i < ad.length; i++) {
  71. var opt = new Option(trans(vboxAudioDriver(ad[i]),'VBoxGlobal'),ad[i]);
  72. document.forms['frmVboxSettings'].vboxSettingsAudioDriver.options[document.forms['frmVboxSettings'].vboxSettingsAudioDriver.options.length] = opt;
  73. }
  74. $(document.forms['frmVboxSettings'].vboxSettingsAudioDriver).val($('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioDriver);
  75. $(document.forms['frmVboxSettings'].vboxSettingsAudioController).val($('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioController);
  76. var p = $(document.forms['frmVboxSettings'].vboxSettingsAudioController).closest('table');
  77. if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
  78. $(document.forms['frmVboxSettings'].vboxSettingsAudioEnabled).prop('checked',$('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.enabled).triggerHandler('click');
  79. $(p).find('span').addClass('disabled');
  80. $(p).find('input,select,textarea').prop('disabled',true);
  81. } else {
  82. $(p).find('span').removeClass('disabled');
  83. $(p).find('input,select,textarea').prop('disabled',false);
  84. $(document.forms['frmVboxSettings'].vboxSettingsAudioEnabled).prop('checked',$('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.enabled).triggerHandler('click');
  85. }
  86. });
  87. /* Change settings onSave() */
  88. $('#vboxSettingsDialog').on('save',function(){
  89. $('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioDriver = document.forms['frmVboxSettings'].vboxSettingsAudioDriver.value;
  90. $('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioController = document.forms['frmVboxSettings'].vboxSettingsAudioController.value;
  91. $('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.enabled = document.forms['frmVboxSettings'].vboxSettingsAudioEnabled.checked;
  92. });
  93. </script>