Skip to content

Commit 9b28352

Browse files
committed
patch 8.1.1565: MS-Windows: no sound support
Problem: MS-Windows: no sound support. Solution: Add sound support for MS-Windows. (Yasuhiro Matsumoto, Ken Takata, closes #4522)
1 parent 394c5d8 commit 9b28352

File tree

6 files changed

+260
-28
lines changed

6 files changed

+260
-28
lines changed

runtime/doc/eval.txt

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim version 8.1. Last change: 2019 Jun 10
1+
*eval.txt* For Vim version 8.1. Last change: 2019 Jun 17
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2183,7 +2183,7 @@ v:val Value of the current item of a |List| or |Dictionary|. Only
21832183

21842184
*v:version* *version-variable*
21852185
v:version Version number of Vim: Major version number times 100 plus
2186-
minor version number. Version 5.0 is 500. Version 5.1 (5.01)
2186+
minor version number. Version 5.0 is 500. Version 5.1
21872187
is 501. Read-only. "version" also works, for backwards
21882188
compatibility, unless |scriptversion| is 3 or higher.
21892189
Use |has()| to check if a certain patch was included, e.g.: >
@@ -2193,10 +2193,10 @@ v:version Version number of Vim: Major version number times 100 plus
21932193
completely different.
21942194

21952195
*v:versionlong* *versionlong-variable*
2196-
v:versionlong Like v:version, but also including the patchlevel. Version
2197-
8.1 with patch 1234 has value 8011234. This can be used like
2198-
this: >
2199-
if v:versionlong >= 8011234
2196+
v:versionlong Like v:version, but also including the patchlevel in the last
2197+
four digits. Version 8.1 with patch 123 has value 8010123.
2198+
This can be used like this: >
2199+
if v:versionlong >= 8010123
22002200
< However, if there are gaps in the list of patches included
22012201
this will not work well. This can happen if a recent patch
22022202
was included into an older version, e.g. for a security fix.
@@ -8123,10 +8123,9 @@ setbufline({expr}, {lnum}, {text}) *setbufline()*
81238123

81248124
{lnum} is used like with |setline()|.
81258125
This works like |setline()| for the specified buffer.
8126-
On success 0 is returned, on failure 1 is returned.
81278126

8128-
If {expr} is not a valid buffer or {lnum} is not valid, an
8129-
error message is given.
8127+
When {expr} is not a valid buffer or {lnum} is not valid then
8128+
1 is returned. On success 0 is returned.
81308129

81318130
setbufvar({expr}, {varname}, {val}) *setbufvar()*
81328131
Set option or local variable {varname} in buffer {expr} to
@@ -8884,7 +8883,7 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702*
88848883
<
88858884
sound_clear() *sound_clear()*
88868885
Stop playing all sounds.
8887-
{only available when compiled with the +sound feature}
8886+
{only available when compiled with the |+sound| feature}
88888887

88898888
*sound_playevent()*
88908889
sound_playevent({name} [, {callback}])
@@ -8893,8 +8892,11 @@ sound_playevent({name} [, {callback}])
88938892
are used. On Ubuntu they may be found in
88948893
/usr/share/sounds/freedesktop/stereo. Example: >
88958894
call sound_playevent('bell')
8895+
< On MS-Windows, {name} can be SystemAsterisk, SystemDefault,
8896+
SystemExclamation, SystemExit, SystemHand, SystemQuestion,
8897+
SystemStart, SystemWelcome, etc.
88968898

8897-
< When {callback} is specified it is invoked when the sound is
8899+
When {callback} is specified it is invoked when the sound is
88988900
finished. The first argument is the sound ID, the second
88998901
argument is the status:
89008902
0 sound was played to the end
@@ -8906,7 +8908,9 @@ sound_playevent({name} [, {callback}])
89068908
endfunc
89078909
call sound_playevent('bell', 'Callback')
89088910
8909-
< Returns the sound ID, which can be passed to `sound_stop()`.
8911+
< MS-Windows: {callback} doesn't work for this function.
8912+
8913+
Returns the sound ID, which can be passed to `sound_stop()`.
89108914
Returns zero if the sound could not be played.
89118915
{only available when compiled with the |+sound| feature}
89128916

@@ -8922,6 +8926,10 @@ sound_playfile({path} [, {callback}])
89228926
sound_stop({id}) *sound_stop()*
89238927
Stop playing sound {id}. {id} must be previously returned by
89248928
`sound_playevent()` or `sound_playfile()`.
8929+
8930+
On MS-Windows, this does not work for event sound started by
8931+
`sound_playevent()`. To stop event sounds, use `sound_clear()`.
8932+
89258933
{only available when compiled with the |+sound| feature}
89268934

89278935
*soundfold()*
@@ -11592,7 +11600,6 @@ text...
1159211600
# Number
1159311601
* Funcref
1159411602

11595-
1159611603
:unl[et][!] {name} ... *:unlet* *:unl* *E108* *E795*
1159711604
Remove the internal variable {name}. Several variable
1159811605
names can be given, they are all removed. The name
@@ -11637,7 +11644,7 @@ text...
1163711644
< This is useful if you want to make sure the variable
1163811645
is not modified.
1163911646
*E995*
11640-
|:const| does not allow to for changing a variable. >
11647+
|:const| does not allow to for changing a variable: >
1164111648
:let x = 1
1164211649
:const x = 2 " Error!
1164311650
< *E996*

src/Make_cyg_ming.mak

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ else
106106
TERMINAL=no
107107
endif
108108

109+
# Set to yes to enable sound support.
110+
ifneq ($(findstring $(FEATURES),BIG HUGE),)
111+
SOUND=yes
112+
else
113+
SOUND=no
114+
endif
115+
109116
ifndef CTAGS
110117
# this assumes ctags is Exuberant ctags
111118
CTAGS = ctags -I INIT+ --fields=+S
@@ -633,6 +640,10 @@ TERM_DEPS = \
633640
libvterm/src/vterm_internal.h
634641
endif
635642

643+
ifeq ($(SOUND),yes)
644+
DEFINES += -DFEAT_SOUND
645+
endif
646+
636647
# DirectWrite (DirectX)
637648
ifeq ($(DIRECTX),yes)
638649
# Only allow DirectWrite for a GUI build.
@@ -849,6 +860,10 @@ OBJ += $(OUTDIR)/terminal.o \
849860
$(OUTDIR)/vterm.o
850861
endif
851862

863+
ifeq ($(SOUND),yes)
864+
OBJ += $(OUTDIR)/sound.o
865+
endif
866+
852867
# Include xdiff
853868
OBJ += $(OUTDIR)/xdiffi.o \
854869
$(OUTDIR)/xemit.o \
@@ -957,6 +972,10 @@ CFLAGS += -I$(ICONV)
957972
DEFINES+=-DDYNAMIC_ICONV
958973
endif
959974

975+
ifeq (yes, $(SOUND))
976+
LIB += -lwinmm
977+
endif
978+
960979
ifeq (yes, $(USE_STDCPLUS))
961980
LINK = $(CXX)
962981
ifeq (yes, $(STATIC_STDCPLUS))

src/Make_mvc.mak

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
# is yes)
3939
# Global IME support: GIME=yes (requires GUI=yes)
4040
#
41-
# Terminal support: TERMINAL=yes (default is yes)
41+
# Terminal support: TERMINAL=yes (default is yes)
42+
#
43+
# Sound support: SOUND=yes (default is yes)
4244
#
4345
# DLL support (EXPERIMENTAL): VIMDLL=yes (default is no)
4446
# Creates vim{32,64}.dll, and stub gvim.exe and vim.exe.
@@ -381,6 +383,14 @@ TERM_DEPS = \
381383
libvterm/src/vterm_internal.h
382384
!endif
383385

386+
!ifndef SOUND
387+
! if "$(FEATURES)"=="HUGE" || "$(FEATURES)"=="BIG"
388+
SOUND = yes
389+
! else
390+
SOUND = no
391+
! endif
392+
!endif
393+
384394
!ifndef NETBEANS
385395
NETBEANS = $(GUI)
386396
!endif
@@ -454,6 +464,13 @@ XPM_INC = -I $(XPM)\include -I $(XPM)\..\include
454464
! endif
455465
!endif # GUI
456466

467+
!if "$(SOUND)" == "yes"
468+
SOUND_PRO = proto/sound.pro
469+
SOUND_OBJ = $(OBJDIR)/sound.obj
470+
SOUND_DEFS = -DFEAT_SOUND
471+
SOUND_LIB = winmm.lib
472+
!endif
473+
457474
!if "$(CHANNEL)" == "yes"
458475
CHANNEL_PRO = proto/channel.pro
459476
CHANNEL_OBJ = $(OBJDIR)/channel.obj
@@ -494,7 +511,7 @@ WINVER = 0x0501
494511
#VIMRUNTIMEDIR = somewhere
495512

496513
CFLAGS = -c /W3 /nologo $(CVARS) -I. -Iproto -DHAVE_PATHDEF -DWIN32 \
497-
$(CSCOPE_DEFS) $(TERM_DEFS) $(NETBEANS_DEFS) $(CHANNEL_DEFS) \
514+
$(CSCOPE_DEFS) $(TERM_DEFS) $(SOUND_DEFS) $(NETBEANS_DEFS) $(CHANNEL_DEFS) \
498515
$(NBDEBUG_DEFS) $(XPM_DEFS) \
499516
$(DEFINES) -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER)
500517

@@ -1217,7 +1234,7 @@ conflags = $(conflags) /map /mapinfo:lines
12171234
LINKARGS1 = $(linkdebug) $(conflags)
12181235
LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(NODEFAULTLIB) $(LIBC) $(OLE_LIB) user32.lib \
12191236
$(LUA_LIB) $(MZSCHEME_LIB) $(PERL_LIB) $(PYTHON_LIB) $(PYTHON3_LIB) $(RUBY_LIB) \
1220-
$(TCL_LIB) $(NETBEANS_LIB) $(XPM_LIB) $(LINK_PDB)
1237+
$(TCL_LIB) $(SOUND_LIB) $(NETBEANS_LIB) $(XPM_LIB) $(LINK_PDB)
12211238

12221239
# Report link time code generation progress if used.
12231240
!ifdef NODEBUG
@@ -1253,12 +1270,12 @@ all: $(MAIN_TARGET) \
12531270

12541271
$(VIMDLLBASE).dll: $(OUTDIR) $(OBJ) $(XDIFF_OBJ) $(GUI_OBJ) $(CUI_OBJ) $(OLE_OBJ) $(OLE_IDL) $(MZSCHEME_OBJ) \
12551272
$(LUA_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(PYTHON3_OBJ) $(RUBY_OBJ) $(TCL_OBJ) \
1256-
$(CSCOPE_OBJ) $(TERM_OBJ) $(NETBEANS_OBJ) $(CHANNEL_OBJ) $(XPM_OBJ) \
1273+
$(CSCOPE_OBJ) $(TERM_OBJ) $(SOUND_OBJ) $(NETBEANS_OBJ) $(CHANNEL_OBJ) $(XPM_OBJ) \
12571274
version.c version.h
12581275
$(CC) $(CFLAGS_OUTDIR) version.c
12591276
$(link) $(LINKARGS1) /dll -out:$(VIMDLLBASE).dll $(OBJ) $(XDIFF_OBJ) $(GUI_OBJ) $(CUI_OBJ) $(OLE_OBJ) \
12601277
$(LUA_OBJ) $(MZSCHEME_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(PYTHON3_OBJ) $(RUBY_OBJ) \
1261-
$(TCL_OBJ) $(CSCOPE_OBJ) $(TERM_OBJ) $(NETBEANS_OBJ) $(CHANNEL_OBJ) \
1278+
$(TCL_OBJ) $(CSCOPE_OBJ) $(TERM_OBJ) $(SOUND_OBJ) $(NETBEANS_OBJ) $(CHANNEL_OBJ) \
12621279
$(XPM_OBJ) $(OUTDIR)\version.obj $(LINKARGS2)
12631280

12641281
$(GVIM).exe: $(OUTDIR) $(EXEOBJG) $(VIMDLLBASE).dll
@@ -1273,12 +1290,12 @@ $(VIM).exe: $(OUTDIR) $(EXEOBJC) $(VIMDLLBASE).dll
12731290

12741291
$(VIM).exe: $(OUTDIR) $(OBJ) $(XDIFF_OBJ) $(GUI_OBJ) $(CUI_OBJ) $(OLE_OBJ) $(OLE_IDL) $(MZSCHEME_OBJ) \
12751292
$(LUA_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(PYTHON3_OBJ) $(RUBY_OBJ) $(TCL_OBJ) \
1276-
$(CSCOPE_OBJ) $(TERM_OBJ) $(NETBEANS_OBJ) $(CHANNEL_OBJ) $(XPM_OBJ) \
1293+
$(CSCOPE_OBJ) $(TERM_OBJ) $(SOUND_OBJ) $(NETBEANS_OBJ) $(CHANNEL_OBJ) $(XPM_OBJ) \
12771294
version.c version.h
12781295
$(CC) $(CFLAGS_OUTDIR) version.c
12791296
$(link) $(LINKARGS1) /subsystem:$(SUBSYSTEM) -out:$(VIM).exe $(OBJ) $(XDIFF_OBJ) $(GUI_OBJ) $(CUI_OBJ) $(OLE_OBJ) \
12801297
$(LUA_OBJ) $(MZSCHEME_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(PYTHON3_OBJ) $(RUBY_OBJ) \
1281-
$(TCL_OBJ) $(CSCOPE_OBJ) $(TERM_OBJ) $(NETBEANS_OBJ) $(CHANNEL_OBJ) \
1298+
$(TCL_OBJ) $(CSCOPE_OBJ) $(TERM_OBJ) $(SOUND_OBJ) $(NETBEANS_OBJ) $(CHANNEL_OBJ) \
12821299
$(XPM_OBJ) $(OUTDIR)\version.obj $(LINKARGS2)
12831300
if exist $(VIM).exe.manifest mt.exe -nologo -manifest $(VIM).exe.manifest -updateresource:$(VIM).exe;1
12841301

@@ -1766,6 +1783,7 @@ proto.h: \
17661783
proto/usercmd.pro \
17671784
proto/userfunc.pro \
17681785
proto/window.pro \
1786+
$(SOUND_PRO) \
17691787
$(NETBEANS_PRO) \
17701788
$(CHANNEL_PRO)
17711789

0 commit comments

Comments
 (0)