Skip to content
Permalink
Browse files

patch 8.1.1502: cannot play any sound

Problem:    Cannot play any sound.
Solution:   Use libcanberra if available.  Add sound functions.
  • Loading branch information...
brammool committed Jun 9, 2019
1 parent 260addf commit 427f5b66ce0abe19daed9291b1693f6e8aae6552
@@ -77,6 +77,7 @@ addons:
- clang
- lcov
- gettext
- libcanberra-dev
- libperl-dev
- python-dev
- python3-dev
@@ -88,6 +88,7 @@ SRC_ALL = \
src/search.c \
src/sha256.c \
src/sign.c \
src/sound.c \
src/spell.c \
src/spell.h \
src/spellfile.c \
@@ -150,6 +151,7 @@ SRC_ALL = \
src/testdir/samples/test000 \
src/testdir/if_ver*.vim \
src/testdir/color_ramp.vim \
src/testdir/silent.wav \
src/proto.h \
src/protodef.h \
src/proto/arabic.pro \
@@ -209,6 +211,7 @@ SRC_ALL = \
src/proto/search.pro \
src/proto/sha256.pro \
src/proto/sign.pro \
src/proto/sound.pro \
src/proto/spell.pro \
src/proto/spellfile.pro \
src/proto/syntax.pro \
@@ -2622,6 +2622,12 @@ sin({expr}) Float sine of {expr}
sinh({expr}) Float hyperbolic sine of {expr}
sort({list} [, {func} [, {dict}]])
List sort {list}, using {func} to compare
sound_playevent({name} [, {callback}])
Number play an event sound
sound_playfile({name} [, {callback}])
Number play a sound file
sound_stop({id}) none stop playing sound {id}
sound_stopall() none stop playing all sounds
soundfold({word}) String sound-fold {word}
spellbadword() String badly spelled word at cursor
spellsuggest({word} [, {max} [, {capital}]])
@@ -8837,6 +8843,49 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702*
return a:i1 - a:i2
endfunc
<
*sound_playevent()*
sound_playevent({name} [, {callback}])
Play a sound identified by {name}. Which event names are
supported depends on the system. Often the XDG sound names
are used. On Ubuntu they may be found in
/usr/share/sounds/freedesktop/stereo. Example: >
call sound_playevent('bell')

< When {callback} is specified it is invoked when the sound is
finished. The first argument is the sound ID, the second
argument is the status:
0 sound was played to the end
1 sound was interruped
2 error occured after sound started
Example: >
func Callback(id, status)
echomsg "sound " .. a:id .. " finished with " .. a:status
endfunc
call sound_playevent('bell', 'Callback')

< Returns the sound ID, which can be passed to `sound_stop()`.
Returns zero if the sound could not be played.
{only available when compiled with the +sound feature}

*sound_playfile()*
sound_playfile({name} [, {callback}])
Like `sound_playevent()` but play sound file {name}. {name}
must be a full path. On Ubuntu you may find files to play
with this command: >
:!find /usr/share/sounds -type f | grep -v index.theme

< {only available when compiled with the +sound feature}


sound_stop({id}) *sound_stop()*
Stop playing sound {id}. {id} must be previously returned by
`sound_playevent()` or `sound_playfile()`.
{only available when compiled with the +sound feature}

sound_stopall() *sound_stopall()*
Stop playing all sounds.
{only available when compiled with the +sound feature}

*soundfold()*
soundfold({word})
Return the sound-folded equivalent of {word}. Uses the first
@@ -10756,6 +10805,7 @@ scrollbind Compiled with 'scrollbind' support. (always true)
showcmd Compiled with 'showcmd' support.
signs Compiled with |:sign| support.
smartindent Compiled with 'smartindent' support.
sound Compiled with sound support, e.g. `sound_playevent()`
spell Compiled with spell checking support |spell|.
startuptime Compiled with |--startuptime| support.
statusline Compiled with support for 'statusline', 'rulerformat'
@@ -1628,6 +1628,7 @@ BASIC_SRC = \
search.c \
sha256.c \
sign.c \
sound.c \
spell.c \
spellfile.c \
syntax.c \
@@ -1743,6 +1744,7 @@ OBJ_COMMON = \
objects/search.o \
objects/sha256.o \
objects/sign.o \
objects/sound.o \
objects/spell.o \
objects/spellfile.o \
objects/syntax.o \
@@ -1883,6 +1885,7 @@ PRO_AUTO = \
search.pro \
sha256.pro \
sign.pro \
sound.pro \
spell.pro \
spellfile.pro \
syntax.pro \
@@ -3235,6 +3238,9 @@ objects/sha256.o: sha256.c
objects/sign.o: sign.c
$(CCC) -o $@ sign.c

objects/sound.o: sound.c
$(CCC) -o $@ sound.c

objects/spell.o: spell.c
$(CCC) -o $@ spell.c

@@ -3650,6 +3656,10 @@ objects/sign.o: sign.c vim.h protodef.h auto/config.h feature.h os_unix.h \
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
proto.h globals.h
objects/sound.o: spell.c vim.h protodef.h auto/config.h feature.h os_unix.h \
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
proto.h globals.h
objects/spell.o: spell.c vim.h protodef.h auto/config.h feature.h os_unix.h \
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
@@ -9303,28 +9303,8 @@ fi




if test -z "$SKIP_GTK2"; then

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-gtktest argument" >&5
$as_echo_n "checking --disable-gtktest argument... " >&6; }
# Check whether --enable-gtktest was given.
if test "${enable_gtktest+set}" = set; then :
enableval=$enable_gtktest;
else
enable_gtktest=yes
fi

if test "x$enable_gtktest" = "xyes" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: gtk test enabled" >&5
$as_echo "gtk test enabled" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: gtk test disabled" >&5
$as_echo "gtk test disabled" >&6; }
fi

if test "X$PKG_CONFIG" = "X"; then
if test -n "$ac_tool_prefix"; then
if test "X$PKG_CONFIG" = "X"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -9422,6 +9402,26 @@ else
PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
fi

fi


if test -z "$SKIP_GTK2"; then

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-gtktest argument" >&5
$as_echo_n "checking --disable-gtktest argument... " >&6; }
# Check whether --enable-gtktest was given.
if test "${enable_gtktest+set}" = set; then :
enableval=$enable_gtktest;
else
enable_gtktest=yes
fi

if test "x$enable_gtktest" = "xyes" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: gtk test enabled" >&5
$as_echo "gtk test enabled" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: gtk test disabled" >&5
$as_echo "gtk test disabled" >&6; }
fi

if test "x$PKG_CONFIG" != "xno"; then
@@ -9677,107 +9677,6 @@ $as_echo "gtk test enabled" >&6; }
$as_echo "gtk test disabled" >&6; }
fi

if test "X$PKG_CONFIG" = "X"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PKG_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS

;;
esac
fi
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
$as_echo "$PKG_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


fi
if test -z "$ac_cv_path_PKG_CONFIG"; then
ac_pt_PKG_CONFIG=$PKG_CONFIG
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ac_pt_PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS

;;
esac
fi
ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
if test -n "$ac_pt_PKG_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
$as_echo "$ac_pt_PKG_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi

if test "x$ac_pt_PKG_CONFIG" = x; then
PKG_CONFIG="no"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
PKG_CONFIG=$ac_pt_PKG_CONFIG
fi
else
PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
fi

fi

if test "x$PKG_CONFIG" != "xno"; then

if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
@@ -13026,6 +12925,56 @@ rm -rf conftest*
fi



if test "x$PKG_CONFIG" != "xno"; then
canberra_lib=`$PKG_CONFIG --libs libcanberrax 2>/dev/null`
canberra_cflags=`$PKG_CONFIG --cflags libcanberrax 2>/dev/null`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: canberra_lib: $canberra_lib" >&5
$as_echo "canberra_lib: $canberra_lib" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: canberra_cflags: $canberra_cflags" >&5
$as_echo "canberra_cflags: $canberra_cflags" >&6; }
fi
if test "x$canberra_lib" = "x"; then
canberra_lib=-lcanberra
canberra_cflags=-D_REENTRANT
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: canberra_lib: $canberra_lib" >&5
$as_echo "canberra_lib: $canberra_lib" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: canberra_cflags: $canberra_cflags" >&5
$as_echo "canberra_cflags: $canberra_cflags" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcanberra" >&5
$as_echo_n "checking for libcanberra... " >&6; }
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $canberra_cflags"
LIBS="$LIBS $canberra_lib"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
# include <canberra.h>
int
main ()
{
ca_context *hello;
ca_context_create(&hello);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }; $as_echo "#define HAVE_CANBERRA 1" >>confdefs.h

else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }; CFLAGS="$ac_save_CFLAGS"; LIBS="$ac_save_LIBS"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for st_blksize" >&5
$as_echo_n "checking for st_blksize... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -207,6 +207,7 @@
#undef HAVE_STRNICMP
#undef HAVE_STRPBRK
#undef HAVE_STRTOL
#undef HAVE_CANBERRA
#undef HAVE_ST_BLKSIZE
#undef HAVE_SYSCONF
#undef HAVE_SYSCTL

0 comments on commit 427f5b6

Please sign in to comment.
You can’t perform that action at this time.