VirtualBox

Changeset 98032 in vbox for trunk


Ignore:
Timestamp:
Jan 9, 2023 5:27:44 PM (2 years ago)
Author:
vboxsync
Message:

Audio/VBoxManage: Resolved a @todo: Marked the modifyvm "--audio" switch as being deprecated and introduced the switches "--audio-driver" and "--audio-enabled". This allows more flexible control of the audio stack.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/en_US/man_VBoxManage-modifyvm.xml

    r97033 r98032  
    426426          <arg choice="plain"><replaceable>IO-base</replaceable> <replaceable>IRQ</replaceable></arg>
    427427        </group></arg>
    428       <arg>--audio=<group choice="plain">
     428      <arg>--audio-controller=<group choice="plain">
     429          <arg choice="plain">ac97</arg>
     430          <arg choice="plain">hda</arg>
     431          <arg choice="plain">sb16</arg>
     432        </group></arg>
     433      <arg>--audio-codec=<group choice="plain">
     434          <arg choice="plain">stac9700</arg>
     435          <arg choice="plain">ad1980</arg>
     436          <arg choice="plain">stac9221</arg>
     437          <arg choice="plain">sb16</arg>
     438        </group></arg>
     439      <arg>--audio-driver=<group choice="plain">
    429440          <arg choice="plain">none</arg>
    430441          <arg choice="plain">default</arg>
     
    437448          <arg choice="plain">coreaudio</arg>
    438449        </group></arg>
    439       <arg>--audio-controller=<group choice="plain">
    440           <arg choice="plain">ac97</arg>
    441           <arg choice="plain">hda</arg>
    442           <arg choice="plain">sb16</arg>
    443         </group></arg>
    444       <arg>--audio-codec=<group choice="plain">
    445           <arg choice="plain">stac9700</arg>
    446           <arg choice="plain">ad1980</arg>
    447           <arg choice="plain">stac9221</arg>
    448           <arg choice="plain">sb16</arg>
     450      <arg>--audio-enabled=<group choice="plain">
     451          <arg choice="plain">on</arg>
     452          <arg choice="plain">off</arg>
    449453        </group></arg>
    450454      <arg>--audio-in=<group choice="plain">
     
    19351939        </varlistentry>
    19361940        <varlistentry>
    1937           <term><option>--audio=<replaceable>type</replaceable></option></term>
    1938           <listitem><para>
    1939               Specifies whether the VM has audio support, and if so,
    1940               which type. Valid audio type values are:
     1941          <term><option>--audio-controller=<replaceable>controller-type</replaceable></option></term>
     1942          <listitem><para>
     1943              Specifies the audio controller to be used with the VM.
     1944              Valid audio controller type values are:
     1945              <literal>ac97</literal>, <literal>hda</literal>, and
     1946              <literal>sb16</literal>.
     1947            </para></listitem>
     1948        </varlistentry>
     1949        <varlistentry>
     1950          <term><option>--audio-codec=<replaceable>codec-type</replaceable></option></term>
     1951          <listitem><para>
     1952              Specifies the audio codec to be used with the VM. Valid
     1953              audio codec type values are: <literal>stac9700</literal>,
     1954              <literal>ad1980</literal>, <literal>stac9221</literal>,
     1955              and <literal>sb16</literal>.
     1956            </para></listitem>
     1957        </varlistentry>
     1958        <varlistentry>
     1959          <term><option>--audio-driver=<replaceable>type</replaceable></option></term>
     1960          <listitem><para>
     1961              Specifies whether which audio driver (backend) to use.
    19411962              <literal>none</literal>, <literal>default</literal>,
    19421963              <literal>null</literal>, <literal>dsound</literal>,
     
    19451966              <literal>coreaudio</literal>.
    19461967            </para><para>
    1947               Note that the audio types are dependent on the host
     1968              Note that the audio driver are dependent on the host
    19481969              operating system. Use the <command>VBoxManage
    19491970              modifyvm</command> command usage output to determine the
    19501971              supported audio types for your host system.
    1951             </para></listitem>
    1952         </varlistentry>
    1953         <varlistentry>
    1954           <term><option>--audio-controller=<replaceable>controller-type</replaceable></option></term>
    1955           <listitem><para>
    1956               Specifies the audio controller to be used with the VM.
    1957               Valid audio controller type values are:
    1958               <literal>ac97</literal>, <literal>hda</literal>, and
    1959               <literal>sb16</literal>.
    1960             </para></listitem>
    1961         </varlistentry>
    1962         <varlistentry>
    1963           <term><option>--audio-codec=<replaceable>codec-type</replaceable></option></term>
    1964           <listitem><para>
    1965               Specifies the audio codec to be used with the VM. Valid
    1966               audio codec type values are: <literal>stac9700</literal>,
    1967               <literal>ad1980</literal>, <literal>stac9221</literal>,
    1968               and <literal>sb16</literal>.
     1972            </para>
     1973            <para>
     1974              For maximum interoperability between hosts, the default
     1975              audio driver can be used. The VM will then automatically select
     1976              the most appropriate audio driver for the current host available.
     1977            </para></listitem>
     1978        </varlistentry>
     1979        <varlistentry>
     1980          <term><option>--audio-enabled=on|off</option></term>
     1981          <listitem><para>
     1982              Specifies whether to enable or disable audio for the VM.
     1983            </para>
     1984            <para>
     1985              This option has precedence over the --audio-on and --audio-off
     1986              options, i.e. turning off audio via this option will turn off
     1987              both, input and output, audio.
    19691988            </para></listitem>
    19701989        </varlistentry>
  • trunk/doc/manual/ru_RU/man_VBoxManage-modifyvm.xml

    r97033 r98032  
    423423          <arg choice="plain"><replaceable>IO-база</replaceable> <replaceable>IRQ</replaceable></arg>
    424424        </group></arg>
    425       <arg>--audio=<group choice="plain">
     425      <arg>--audio-controller=<group choice="plain">
     426          <arg choice="plain">ac97</arg>
     427          <arg choice="plain">hda</arg>
     428          <arg choice="plain">sb16</arg>
     429        </group></arg>
     430      <arg>--audio-codec=<group choice="plain">
     431          <arg choice="plain">stac9700</arg>
     432          <arg choice="plain">ad1980</arg>
     433          <arg choice="plain">stac9221</arg>
     434          <arg choice="plain">sb16</arg>
     435        </group></arg>
     436      <arg>--audio-driver=<group choice="plain">
    426437          <arg choice="plain">none</arg>
    427438          <arg choice="plain">default</arg>
     
    434445          <arg choice="plain">coreaudio</arg>
    435446        </group></arg>
    436       <arg>--audio-controller=<group choice="plain">
    437           <arg choice="plain">ac97</arg>
    438           <arg choice="plain">hda</arg>
    439           <arg choice="plain">sb16</arg>
    440         </group></arg>
    441       <arg>--audio-codec=<group choice="plain">
    442           <arg choice="plain">stac9700</arg>
    443           <arg choice="plain">ad1980</arg>
    444           <arg choice="plain">stac9221</arg>
    445           <arg choice="plain">sb16</arg>
     447      <arg>--audio-enabled=<group choice="plain">
     448          <arg choice="plain">on</arg>
     449          <arg choice="plain">off</arg>
    446450        </group></arg>
    447451      <arg>--audio-in=<group choice="plain">
     
    18821886        </varlistentry>
    18831887        <varlistentry>
    1884           <term><option>--audio=<replaceable>тип</replaceable></option></term>
     1888          <term><option>--audio-controller=<replaceable>тип-контроллера</replaceable></option></term>
     1889          <listitem><para>
     1890              Задает аудио контроллер, используемый в ВМ.
     1891              Допустимые значения:
     1892              <literal>ac97</literal>, <literal>hda</literal> и
     1893              <literal>sb16</literal>.
     1894            </para></listitem>
     1895        </varlistentry>
     1896        <varlistentry>
     1897          <term><option>--audio-codec=<replaceable>тип-кодека</replaceable></option></term>
     1898          <listitem><para>
     1899              Указывает аудио кодек, используемый в ВМ. Допустимые
     1900              значения: <literal>stac9700</literal>,
     1901              <literal>ad1980</literal>, <literal>stac9221</literal>
     1902              и <literal>sb16</literal>.
     1903            </para></listitem>
     1904        </varlistentry>
     1905        <varlistentry>
     1906          <term><option>--audio-driver=<replaceable>тип</replaceable></option></term>
    18851907          <listitem><para>
    18861908              Указывает, что ВМ имеет поддержку аудио определенного типа.
     
    18961918              modifyvm</command> поможет определить поддерживаемые
    18971919              типы аудио для вашей операционной системы.
    1898             </para></listitem>
    1899         </varlistentry>
    1900         <varlistentry>
    1901           <term><option>--audio-controller=<replaceable>тип-контроллера</replaceable></option></term>
    1902           <listitem><para>
    1903               Задает аудио контроллер, используемый в ВМ.
    1904               Допустимые значения:
    1905               <literal>ac97</literal>, <literal>hda</literal> и
    1906               <literal>sb16</literal>.
    1907             </para></listitem>
    1908         </varlistentry>
    1909         <varlistentry>
    1910           <term><option>--audio-codec=<replaceable>тип-кодека</replaceable></option></term>
    1911           <listitem><para>
    1912               Указывает аудио кодек, используемый в ВМ. Допустимые
    1913               значения: <literal>stac9700</literal>,
    1914               <literal>ad1980</literal>, <literal>stac9221</literal>
    1915               и <literal>sb16</literal>.
     1920            </para>
     1921            <para>
     1922              Для обеспечения максимальной совместимости между хостами можно
     1923              использовать стандартный можно использовать аудиодрайвер по
     1924              умолчанию. Затем виртуальная машина автоматически выберет
     1925              наиболее подходящий аудиодрайвер для текущего доступного хоста.
     1926            </para></listitem>
     1927        </varlistentry>
     1928        <varlistentry>
     1929          <term><option>--audio-enabled=on|off</option></term>
     1930          <listitem><para>
     1931              Указывает, следует ли включить или отключить звук для виртуальной
     1932              машины.
     1933            </para>
     1934            <para>
     1935              Эта опция имеет приоритет над опциями --audio-on и --audio-off
     1936              т.е. отключение звука с помощью этой опции приведет к отключению
     1937              как входной, так и выходной звук.
    19161938            </para></listitem>
    19171939        </varlistentry>
  • trunk/doc/manual/user_ChangeLogImpl.xml

    r97981 r98032  
    119119      </listitem>
    120120
     121      <listitem>
     122        <para>Audio: The "--audio" option in VBoxManage is now marked as
     123          deprecated; please use "--audio-driver" and "--audio-enabled"
     124          instead. This will allow more flexibility when changing the driver
     125          and/or controlling the audio functionality</para>
     126      </listitem>
     127
    121128    </itemizedlist>
    122129  </sect1>
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r96888 r98032  
    178178    MODIFYVM_AUDIOCONTROLLER,
    179179    MODIFYVM_AUDIOCODEC,
    180     MODIFYVM_AUDIO,
     180    MODIFYVM_AUDIODRIVER,
     181    MODIFYVM_AUDIOENABLED,
     182    MODIFYVM_AUDIO,                   /* Deprecated; remove in the next major version. */
    181183    MODIFYVM_AUDIOIN,
    182184    MODIFYVM_AUDIOOUT,
     
    391393    OPT2("--audio-codec",                   "--audiocodec",             MODIFYVM_AUDIOCODEC,                RTGETOPT_REQ_STRING),
    392394    OPT1("--audio",                                                     MODIFYVM_AUDIO,                     RTGETOPT_REQ_STRING),
     395    OPT2("--audio-driver",                  "--audiodriver",            MODIFYVM_AUDIODRIVER,               RTGETOPT_REQ_STRING),
     396    OPT2("--audio-enabled",                 "--audioenabled",           MODIFYVM_AUDIOENABLED,              RTGETOPT_REQ_BOOL_ONOFF),
    393397    OPT2("--audio-in",                      "--audioin",                MODIFYVM_AUDIOIN,                   RTGETOPT_REQ_BOOL_ONOFF),
    394398    OPT2("--audio-out",                     "--audioout",               MODIFYVM_AUDIOOUT,                  RTGETOPT_REQ_BOOL_ONOFF),
     
    25932597            }
    25942598
    2595             case MODIFYVM_AUDIO:
    2596             {
     2599            case MODIFYVM_AUDIODRIVER:
     2600                RT_FALL_THROUGH();
     2601            case MODIFYVM_AUDIO: /** @todo Deprecated; remove. */
     2602            {
     2603                if (c == MODIFYVM_AUDIO)
     2604                    RTStrmPrintf(g_pStdErr,
     2605                                 ModifyVM::tr("Warning: --audio is deprecated and will be removed soon. Use --audio-driver instead!\n"));
     2606
    25972607                ComPtr<IAudioSettings> audioSettings;
    25982608                CHECK_ERROR_BREAK(sessionMachine, COMGETTER(AudioSettings)(audioSettings.asOutParam()));
     
    26002610                CHECK_ERROR_BREAK(audioSettings, COMGETTER(Adapter)(audioAdapter.asOutParam()));
    26012611                ASSERT(audioAdapter);
    2602 /** @todo r=klaus: don't unconditionally bolt together setting the audio driver
    2603  * and enabling the device. Doing this more cleverly allows changing the audio
    2604  * driver for VMs in saved state, which can be very useful when moving VMs
    2605  * between systems with different setup. The driver doesn't leave any traces in
    2606  * saved state. The GUI also might learn this trick if it doesn't use it
    2607  * already. */
    26082612                /* disable? */
    2609                 if (!RTStrICmp(ValueUnion.psz, "none"))
    2610                 {
    2611                     CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(false));
    2612                 }
     2613                if (   !RTStrICmp(ValueUnion.psz, "none")
     2614                    || !RTStrICmp(ValueUnion.psz, "null"))
     2615                    CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Null));
    26132616                else if (!RTStrICmp(ValueUnion.psz, "default"))
    2614                 {
    26152617                    CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Default));
    2616                     CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
    2617                 }
    2618                 else if (!RTStrICmp(ValueUnion.psz, "null"))
    2619                 {
    2620                     CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Null));
    2621                     CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
    2622                 }
    26232618#ifdef RT_OS_WINDOWS
    2624 #ifdef VBOX_WITH_WINMM
     2619# ifdef VBOX_WITH_WINMM
    26252620                else if (!RTStrICmp(ValueUnion.psz, "winmm"))
    2626                 {
    26272621                    CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_WinMM));
    2628                     CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
    2629                 }
    2630 #endif
     2622# endif
    26312623                else if (!RTStrICmp(ValueUnion.psz, "dsound"))
    2632                 {
    26332624                    CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_DirectSound));
    2634                     CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
    2635                 }
    26362625                else if (!RTStrICmp(ValueUnion.psz, "was"))
    2637                 {
    26382626                    CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_WAS));
    2639                     CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
    2640                 }
    26412627#endif /* RT_OS_WINDOWS */
    26422628#ifdef VBOX_WITH_AUDIO_OSS
    26432629                else if (!RTStrICmp(ValueUnion.psz, "oss"))
    2644                 {
    26452630                    CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_OSS));
    2646                     CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
    2647                 }
    26482631#endif
    26492632#ifdef VBOX_WITH_AUDIO_ALSA
    26502633                else if (!RTStrICmp(ValueUnion.psz, "alsa"))
    2651                 {
    26522634                    CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_ALSA));
    2653                     CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
    2654                 }
    26552635#endif
    26562636#ifdef VBOX_WITH_AUDIO_PULSE
    26572637                else if (!RTStrICmp(ValueUnion.psz, "pulse"))
    2658                 {
    26592638                    CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_Pulse));
    2660                     CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
    2661                 }
    26622639#endif
    26632640#ifdef RT_OS_DARWIN
    26642641                else if (!RTStrICmp(ValueUnion.psz, "coreaudio"))
    2665                 {
    26662642                    CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_CoreAudio));
    2667                     CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true));
    2668                 }
    26692643#endif /* !RT_OS_DARWIN */
    26702644                else
    26712645                {
    2672                     errorArgument(ModifyVM::tr("Invalid --audio argument '%s'"), ValueUnion.psz);
     2646                    errorArgument(ModifyVM::tr("Invalid %s argument '%s'"),
     2647                                  c == MODIFYVM_AUDIO ? "--audio" : "--audio-driver", ValueUnion.psz);
    26732648                    hrc = E_FAIL;
    26742649                }
     2650
     2651                if (   SUCCEEDED(hrc)
     2652                    && c == MODIFYVM_AUDIO) /* To keep the original behavior until we remove the command. */
     2653                    CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(RTStrICmp(ValueUnion.psz, "none") == false ? false : true));
     2654
     2655                break;
     2656            }
     2657
     2658            case MODIFYVM_AUDIOENABLED:
     2659            {
     2660                ComPtr<IAudioSettings> audioSettings;
     2661                CHECK_ERROR_BREAK(sessionMachine, COMGETTER(AudioSettings)(audioSettings.asOutParam()));
     2662                ComPtr<IAudioAdapter> audioAdapter;
     2663                CHECK_ERROR_BREAK(audioSettings, COMGETTER(Adapter)(audioAdapter.asOutParam()));
     2664                ASSERT(audioAdapter);
     2665
     2666                CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(ValueUnion.f));
    26752667                break;
    26762668            }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette