[PATCH v6 0/1] MR11469: conhost: Add beep functionality to write_console.
Fixes https://bugs.winehq.org/show_bug.cgi?id=50109 Signed-off-by: Barath Kannan barathrk11@gmail.com -- v6: conhost: Add beep functionality to write_console. https://gitlab.winehq.org/wine/wine/-/merge_requests/11469
From: Barath Kannan <barathrk11@gmail.com> Signed-off-by: Barath Kannan <barathrk11@gmail.com> --- programs/conhost/Makefile.in | 2 +- programs/conhost/beep.wav | Bin 0 -> 4488 bytes programs/conhost/conhost.c | 17 ++++++++++++++++- programs/conhost/conhost.rc | 4 ++++ 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 programs/conhost/beep.wav diff --git a/programs/conhost/Makefile.in b/programs/conhost/Makefile.in index 773b6e36a29..c365243dd3b 100644 --- a/programs/conhost/Makefile.in +++ b/programs/conhost/Makefile.in @@ -1,6 +1,6 @@ MODULE = conhost.exe IMPORTS = user32 gdi32 advapi32 -DELAYIMPORTS = comctl32 +DELAYIMPORTS = comctl32 winmm EXTRADLLFLAGS = -mwindows -municode diff --git a/programs/conhost/beep.wav b/programs/conhost/beep.wav new file mode 100644 index 0000000000000000000000000000000000000000..f1fe5c11f0d6ed22620f66a3ee07263984907a4d GIT binary patch literal 4488 zcmWIYbaQJEWMBw)40BD(Em06)U|?WmU}SJv!vMyN3>*wTp1~nf3=9mOes2Dr!EPbE z3=9lDiDhYKhI;0Dh6V-<3@M2viB^IP3=NG<Ev;?son75MJ-vN>{ZP=?*W1(G)!EVB z*4o_ESYKCDT~%3LR$5YAR8&|11BHb}#U-U><rS6HHMR8(P0cNB?HwSKkPPbY>xG!q z*4onC*ictnQ&m|3F{u!4638HsNfnh<)wOl?qfQzPrO~uBn&U>xrO~2tv_gSYmZR0~ nXyatGy##HY_K&tIK~3h-w)bccrL=6c(=^((9PNP9f0zOQV|}C9 literal 0 HcmV?d00001 diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index 8298743553f..b855878cd30 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -26,6 +26,7 @@ #include "wine/server.h" #include "wine/debug.h" +#include "mmsystem.h" WINE_DEFAULT_DEBUG_CHANNEL(console); @@ -2103,6 +2104,20 @@ static NTSTATUS set_output_info( struct screen_buffer *screen_buffer, return STATUS_SUCCESS; } +static void play_console_beep(struct console *console) +{ + if (console->is_unix) + { + tty_write( console, "\a", 1 ); + tty_flush( console ); + } + else + { + if(!PlaySoundW(L"console_beep", GetModuleHandleW(NULL), SND_RESOURCE | SND_ASYNC)) + ERR("Failed to play console beep using PlaySoundW\n"); + } +} + static NTSTATUS write_console( struct screen_buffer *screen_buffer, const WCHAR *buffer, size_t len ) { RECT update_rect; @@ -2138,7 +2153,7 @@ static NTSTATUS write_console( struct screen_buffer *screen_buffer, const WCHAR } continue; case '\a': - FIXME( "beep\n" ); + play_console_beep(screen_buffer->console); continue; case '\r': screen_buffer->cursor_x = 0; diff --git a/programs/conhost/conhost.rc b/programs/conhost/conhost.rc index c37ad018345..6c740477cf7 100644 --- a/programs/conhost/conhost.rc +++ b/programs/conhost/conhost.rc @@ -118,3 +118,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL /* @makedep: conhost.manifest */ 1 RT_MANIFEST conhost.manifest + +/* ffmpeg -f lavfi -i "sine=frequency=600" -t 0.1 -ar 44100 -f wav -acodec pcm_u8 test.wav */ +/* @makedep: beep.wav */ +console_beep WAVE beep.wav -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11469
if things go havoc, we could ultimately rate limit sending the '\\a'
alright then
so I suggest introducing a helper function to handle both cases
i have added this in the recent push -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11469#note_147617
* keep style in sync with rest of the code (space after if, space after ( and before ) in function handling...) * IOCTL_CONDRV_BEEP is not handled .... -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11469#note_147645
participants (3)
-
Barath Kannan -
Barath Kannan (@barath_kannan) -
eric pouech (@epo)