Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'shell' が pwsh.exe だと sound_playfile() で音が鳴らない #1412

Open
Bakudankun opened this issue May 14, 2023 · 3 comments
Open

'shell' が pwsh.exe だと sound_playfile() で音が鳴らない #1412

Bakudankun opened this issue May 14, 2023 · 3 comments

Comments

@Bakudankun
Copy link

不具合の内容

最近のVimは 'shell'powershell.exepwsh.exe にすると各種オプションをよしなに設定してくれますが(:h dos-pwsh)、その場合 sound_playfile() で音声を再生しようとしても音が鳴らないようです。

現象・ログ

'shell'pwsh.exe にした状態で関数を実行すると、0が返り、音声が再生されません。
sound_playevent() 関数は正常に音声を再生します。
'shell' を変更しなかった( cmd.exe のまま)場合は正常に動作します。

再現手順

  1. vim --clean --cmd "set shell=pwsh.exe"
  2. :call sound_playfile('C:\fullpath-to-sound.wav')

期待動作

正常に音声を再生することを期待します。

Vimのバージョン

9.0.1553 64bit(wingetでインストール)

:version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled May 13 2023 22:47:57)
MS-Windows 64 ビット GUI 版 with OLE サポート
適用済パッチ: 1-1553
Compiled by appveyor@APPVEYOR-VM
Huge 版 with GUI.  機能の一覧 有効(+)/無効(-)
+acl                +ex_extra           +mzscheme/dyn       -tcl
+arabic             +extra_search       +netbeans_intg      -termguicolors
+autocmd            -farsi              +num64              +terminal
+autochdir          +file_in_path       +ole                -termresponse
+autoservername     +find_in_path       +packages           +textobjects
+balloon_eval       +float              +path_extra         +textprop
-balloon_eval_term  +folding            +perl/dyn           -tgetent
+browse             -footer             +persistent_undo    +timers
++builtin_terms     +gettext/dyn        +popupwin           +title
+byte_offset        -hangul_input       -postscript         +toolbar
+channel            +iconv/dyn          +printer            +user_commands
+cindent            +insert_expand      +profile            +vartabs
+clientserver       +ipv6               +python/dyn         +vertsplit
+clipboard          +job                +python3/dyn        +vim9script
+cmdline_compl      +jumplist           +quickfix           +viminfo
+cmdline_hist       +keymap             +reltime            +virtualedit
+cmdline_info       +lambda             +rightleft          +visual
+comments           +langmap            +ruby/dyn           +visualextra
+conceal            +libcall            +scrollbind         +vreplace
+cryptv             +linebreak          +signs              -vtp
+cscope             +lispindent         +smartindent        +wildignore
+cursorbind         +listcmds           +sodium/dyn         +wildmenu
+cursorshape        +localmap           +sound              +windows
+dialog_con_gui     +lua/dyn            +spell              +writebackup
+diff               +menu               +startuptime        -xfontset
+digraphs           +mksession          +statusline         -xim
+directx            +modify_fname       -sun_workshop       +xpm_w32
-dnd                +mouse              +syntax             -xterm_save
-ebcdic             +mouseshape         +tag_binary         
+emacs_tags         +multi_byte_ime/dyn -tag_old_static     
+eval               +multi_lang         -tag_any_white      
      システム vimrc: "$VIM\vimrc"
      ユーザー vimrc: "$HOME\_vimrc"
   第2ユーザー vimrc: "$HOME\vimfiles\vimrc"
   第3ユーザー vimrc: "$VIM\_vimrc"
       ユーザー exrc: "$HOME\_exrc"
    第2ユーザー exrc: "$VIM\_exrc"
     システム gvimrc: "$VIM\gvimrc"
     ユーザー gvimrc: "$HOME\_gvimrc"
  第2ユーザー gvimrc: "$HOME\vimfiles\gvimrc"
  第3ユーザー gvimrc: "$VIM\_gvimrc"
  デフォルトファイル: "$VIMRUNTIME\defaults.vim"
    システムメニュー: "$VIMRUNTIME\menu.vim"
コンパイル: cl -c /W3 /GF /nologo -I. -Iproto -DHAVE_PATHDEF -DWIN32 -DHAVE_STDINT_H  -DFEAT_CSCOPE -DFEAT_TERMINAL -DFEAT_SOUND -DFEAT_NETBEANS_INTG -DFEAT_JOB_CHANNEL -DFEAT_IPV6 -DHAVE_INET_NTOP   -DFEAT_XPM_W32 -DHAVE_SODIUM -DDYNAMIC_SODIUM -DDYNAMIC_SODIUM_DLL=\"libsodium.dll\" /I "C:\projects\vim-win32-installer\dependencies\libsodium\include" -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 /source-charset:utf-8 /MP /Ox /GL -DNDEBUG /Zl /MT /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_GUI_MSWIN -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_LUA -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua54.dll\" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python311.dll\" -DFEAT_MZSCHEME -I "C:\projects\vim-win32-installer\dependencies\racket\include" -DMZ_PRECISE_GC -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libracket3m_dcgt6o.dll\" -DDYNAMIC_MZGC_DLL=\"libracket3m_dcgt6o.dll\" -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl532.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"x64-msvcrt-ruby300.dll\" -DRUBY_VERSION=30 -DFEAT_HUGE /Fd.\ObjGXOULYHRZAMD64/ /Zi
リンク: link /nologo /opt:ref /LTCG /HIGHENTROPYVA:NO oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib  comdlg32.lib ole32.lib netapi32.lib uuid.lib user32.lib  /machine:AMD64 version.lib  winspool.lib comctl32.lib libcmt.lib oleaut32.lib  /nodefaultlib:lua54.lib  /STACK:8388608  /nodefaultlib:python27.lib /nodefaultlib:python311.lib    winmm.lib WSock32.lib Ws2_32.lib xpm\x64\lib-vc14\libXpm.lib  /PDB:gvim.pdb -debug

OSの種類/ディストリ/バージョン

  • Windows 11 Pro 64bit (10.0.22621.1555)
@k-takata
Copy link
Member

おそらくここで vim_strsave_shellescape() を使っているのが原因ですね。
https://github.com/vim/vim/blob/a2c0028fdf8dcf0408e27be730ac0e691ef9559b/src/sound.c#L388
どう直すのがいいのだろう?

@Bakudankun
Copy link
Author

関連スレッド: vim/vim#4522
PlaySound() 使えばいいのではと思っていたけどそうも行かなかったのかしら

@k-takata
Copy link
Member

I think it is possible, but the problem is that PlaySound() cannot stop the sounds individually.
It can stop all the sounds only. Another way is playing only one sound at once. If there is a new call of PlaySound(), stop the old sound.

だそうです。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants