On 4 Jun 2019, at 15:07, Bram Moolenaar <[email protected]> wrote:
> 
> 
> I have been wondering if it would help if Vim could play a sound.  Think
> of a gentle "ping" to indicate the cursor can't move there, or a
> "tadaa" when a background build finishes successfully.  At least I have
> had times where I didn't notice something that was going on, because I
> was looking in the wrong place.  Currently there only is the annoying
> beep (which I usually have disabled).
> 
> I wonder how useful this would be.  It's probably a matter of taste
> anyway. And it only works locally (unless there is an xterm sequence to
> play a sound?).
> 
> And I wonder if it can be implemented in a way it's portable.  There are
> some audio libraries floating around, but I don't expect the "-dev"
> version to be installed on most systems.  Perhaps MS-Windows has
> something that's always available?
> 
> Another way would be to use a system command (in the background), but
> that could have some latency.

My 2¢ on the topic, as I have been thinking for a while about a plugin for 
playing mechanical sounds on key presses.

- Make an optional plugin for that
- The plugin has an extremely simple API:

  - enableSoundServer(): starts a background process accepting requests to play 
sounds; don’t use system commands, it’s a waste of resources and likely too 
slow;
  - disableSoundServer(): obviously.
  - getSounds(): returns a list of available sound names;
  - play(soundName): asynchronously plays the requested sound.
  - Perhaps, also stopSounds(), to interrupt all playing sounds.
  - Sounds might be searched for in `sounds` directories under packpath (or 
rtp?) when the server starts.

Vim has all the needed infrastructure, IMO: jobs, timers, autocommands… People 
not needing/wanting sounds won’t pay anything (except for some disk space for 
the plugin). It is fundamental that play() returns immediately, so that 
multiple calls result in overlapping sounds.

I have also been searching for small, portable audio libraries, to make the 
plugin self-contained, and I recall having found one that seemed apt, although 
I haven’t tried it. As soon as I find what it was I’ll post the link here.

Life.
  


-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/2140591F-741F-48A4-8CDC-F90FD1B23D1C%40icloud.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui