提交 f6193c47 编写于 作者: V vit9696

OpenCoreAudio: Implement PlayChime control via StartupMute variable

closes acidanthera/bugtracker#1331
上级 5c9e826c
......@@ -21,6 +21,7 @@ OpenCore Changelog
- Added bootloader patch support in `Booter` `Patch` section
- Fixed startup hang on firmwares allowong reentrance for timer functions
- Made pointer control optional for OpenCanopy via `PickerAttributes`
- Added support for `StartupMute` variable in `PlayChime`
#### v0.6.3
- Added support for xml comments in plist files
......
......@@ -5904,16 +5904,24 @@ functioning. Feature highlights:
\item
\texttt{PlayChime}\\
\textbf{Type}: \texttt{plist\ boolean}\\
\textbf{Failsafe}: \texttt{false}\\
\textbf{Type}: \texttt{plist\ string}\\
\textbf{Failsafe}: empty string\\
\textbf{Description}: Play chime sound at startup.
Enabling this setting plays boot chime through builtin audio support. Volume level
is determined by \texttt{MinimumVolume} and \texttt{VolumeAmplifier} settings and
\texttt{SystemAudioVolume} NVRAM variable.
\texttt{SystemAudioVolume} NVRAM variable. Possible values include:
\begin{itemize}
\tightlist
\item \texttt{Auto} --- Enables chime when \texttt{StartupMute} NVRAM variable
is not present or set to \texttt{00}.
\item \texttt{Enabled} --- Enables chime unconditionally.
\item \texttt{Disabled} --- Disables chime unconditionally.
\end{itemize}
\emph{Note}: this setting is separate from \texttt{StartupMute} NVRAM variable
to avoid conflicts when the firmware is able to play boot chime.
\emph{Note}: \texttt{Enabled} can be used in separate from \texttt{StartupMute}
NVRAM variable to avoid conflicts when the firmware is able to play boot chime.
\item
\texttt{VolumeAmplifier}\\
......
\documentclass[]{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL PreviousConfiguration.tex Wed Nov 4 05:07:23 2020
%DIF ADD ../Configuration.tex Sun Dec 6 03:33:13 2020
%DIF ADD ../Configuration.tex Sun Dec 6 03:54:01 2020
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
......@@ -4331,9 +4331,9 @@ troubleshooting:
\item \texttt{debug=VALUE} (debug mask)
\item \texttt{io=VALUE} (\texttt{IOKit} debug mask)
\item \texttt{keepsyms=1} (show panic log debug symbols)
\item \texttt{kextlog=VALUE} (kernel extension loading debug mask\DIFaddbegin \DIFadd{)
}\item \texttt{\DIFadd{nvram-log=1}} \DIFadd{(enables AppleEFINVRAM logs}\DIFaddend )
\item \texttt{nv\_disable=1} (disables NVIDIA GPU acceleration)
\item \texttt{kextlog=VALUE} (kernel extension loading debug mask)
\item \DIFaddbegin \texttt{\DIFadd{nvram-log=1}} \DIFadd{(enables AppleEFINVRAM logs)
}\item \DIFaddend \texttt{nv\_disable=1} (disables NVIDIA GPU acceleration)
\item \texttt{nvda\_drv=1} (legacy way to enable NVIDIA web driver, removed in 10.12)
\item \texttt{npci=0x2000} (\href{https://www.insanelymac.com/forum/topic/260539-1068-officially-released/?do=findComment&comment=1707972}{legacy}, disables \texttt{kIOPCIConfiguratorPFM64})
\item \texttt{lapic\_dont\_panic=1}
......@@ -5990,16 +5990,26 @@ functioning. Feature highlights:
\item
\texttt{PlayChime}\\
\textbf{Type}: \texttt{plist\ boolean}\\
\textbf{Failsafe}: \texttt{false}\\
\textbf{Type}: \texttt{plist\ \DIFdelbegin \DIFdel{boolean}\DIFdelend \DIFaddbegin \DIFadd{string}\DIFaddend }\\
\textbf{Failsafe}: \DIFdelbegin \texttt{\DIFdel{false}}%DIFAUXCMD
\DIFdelend \DIFaddbegin \DIFadd{empty string}\DIFaddend \\
\textbf{Description}: Play chime sound at startup.
Enabling this setting plays boot chime through builtin audio support. Volume level
is determined by \texttt{MinimumVolume} and \texttt{VolumeAmplifier} settings and
\texttt{SystemAudioVolume} NVRAM variable.
\texttt{SystemAudioVolume} NVRAM variable. \DIFaddbegin \DIFadd{Possible values include:
}\DIFaddend
\DIFaddbegin \begin{itemize}
\tightlist
\item \texttt{\DIFadd{Auto}} \DIFadd{--- Enables chime when }\texttt{\DIFadd{StartupMute}} \DIFadd{NVRAM variable
is not present or set to }\texttt{\DIFadd{00}}\DIFadd{.
}\item \texttt{\DIFadd{Enabled}} \DIFadd{--- Enables chime unconditionally.
}\item \texttt{\DIFadd{Disabled}} \DIFadd{--- Disables chime unconditionally.
}\end{itemize}
\emph{Note}: this setting is separate from \texttt{StartupMute} NVRAM variable
to avoid conflicts when the firmware is able to play boot chime.
\DIFaddend \emph{Note}: \DIFdelbegin \DIFdel{this setting is }\DIFdelend \DIFaddbegin \texttt{\DIFadd{Enabled}} \DIFadd{can be used in }\DIFaddend separate from \texttt{StartupMute}
NVRAM variable to avoid conflicts when the firmware is able to play boot chime.
\item
\texttt{VolumeAmplifier}\\
......
......@@ -1039,7 +1039,7 @@
<key>MinimumVolume</key>
<integer>20</integer>
<key>PlayChime</key>
<false/>
<string>Auto</string>
<key>VolumeAmplifier</key>
<integer>0</integer>
</dict>
......
......@@ -1234,7 +1234,7 @@
<key>MinimumVolume</key>
<integer>20</integer>
<key>PlayChime</key>
<false/>
<string>Auto</string>
<key>VolumeAmplifier</key>
<integer>0</integer>
</dict>
......
......@@ -575,9 +575,9 @@ typedef enum {
///
#define OC_UEFI_AUDIO_FIELDS(_, __) \
_(OC_STRING , AudioDevice , , OC_STRING_CONSTR ("", _, __) , OC_DESTR (OC_STRING)) \
_(OC_STRING , PlayChime , , OC_STRING_CONSTR ("", _, __) , OC_DESTR (OC_STRING)) \
_(UINT16 , VolumeAmplifier , , 0 , ()) \
_(BOOLEAN , AudioSupport , , FALSE , ()) \
_(BOOLEAN , PlayChime , , FALSE , ()) \
_(UINT8 , AudioCodec , , 0 , ()) \
_(UINT8 , AudioOut , , 0 , ()) \
_(UINT8 , MinimumVolume , , 0 , ())
......
......@@ -162,7 +162,7 @@ typedef enum {
///
/// System language.
/// String starting with language code (e.g. ru-RU:252).
/// CHAR8[] String starting with language code (e.g. ru-RU:252).
/// gAppleBootVariableGuid
///
#define APPLE_PREV_LANG_KBD_VARIABLE_NAME L"prev-lang:kbd"
......@@ -236,6 +236,13 @@ typedef enum {
///
#define APPLE_RECOVERY_BOOT_MODE_VARIABLE_NAME L"recovery-boot-mode"
///
/// Startup sound configuration variable.
/// UINT8: 00 (for unmuted, default) or 01 (for muted).
/// gAppleBootVariableGuid
///
#define APPLE_STARTUP_MUTE_VARIABLE_NAME L"StartupMute"
///
/// Recovery initiator device path. In general EfiBoot device path that called
/// reboot to recovery.
......
......@@ -707,7 +707,7 @@ mUefiAudioSchema[] = {
OC_SCHEMA_INTEGER_IN ("AudioOut", OC_GLOBAL_CONFIG, Uefi.Audio.AudioOut),
OC_SCHEMA_BOOLEAN_IN ("AudioSupport", OC_GLOBAL_CONFIG, Uefi.Audio.AudioSupport),
OC_SCHEMA_INTEGER_IN ("MinimumVolume", OC_GLOBAL_CONFIG, Uefi.Audio.MinimumVolume),
OC_SCHEMA_BOOLEAN_IN ("PlayChime", OC_GLOBAL_CONFIG, Uefi.Audio.PlayChime),
OC_SCHEMA_STRING_IN ("PlayChime", OC_GLOBAL_CONFIG, Uefi.Audio.PlayChime),
OC_SCHEMA_INTEGER_IN ("VolumeAmplifier", OC_GLOBAL_CONFIG, Uefi.Audio.VolumeAmplifier),
};
......
......@@ -322,6 +322,37 @@ OcAudioReleaseFile (
return EFI_SUCCESS;
}
STATIC
BOOLEAN
OcShouldPlayChime (
IN CONST CHAR8 *Control
)
{
EFI_STATUS Status;
UINT8 Muted;
UINTN Size;
if (Control[0] == '\0' || AsciiStrCmp (Control, "Auto") == 0) {
Muted = 0;
Size = sizeof (Muted);
Status = gRT->GetVariable (
APPLE_STARTUP_MUTE_VARIABLE_NAME,
&gAppleBootVariableGuid,
NULL,
&Size,
&Muted
);
DEBUG ((DEBUG_INFO, "OC: Using StartupMute %d for chime - %r\n", Muted, Status));
return Muted == 0;
}
if (AsciiStrCmp (Control, "Enabled") == 0) {
return TRUE;
}
return FALSE;
}
STATIC
VOID
EFIAPI
......@@ -418,7 +449,8 @@ OcLoadUefiAudioSupport (
OcSetVoiceOverLanguage (NULL);
if (Config->Uefi.Audio.PlayChime && VolumeLevel >= Config->Uefi.Audio.MinimumVolume && !Muted) {
if (OcShouldPlayChime (OC_BLOB_GET (&Config->Uefi.Audio.PlayChime))
&& VolumeLevel >= Config->Uefi.Audio.MinimumVolume && !Muted) {
DEBUG ((DEBUG_INFO, "OC: Starting to play chime...\n"));
Status = OcAudio->PlayFile (
OcAudio,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册