KSP-KOS / KOS

Fully programmable autopilot mod for KSP. Originally By Nivekk
Other
697 stars 230 forks source link

Add a "beep" command. #979

Open benthor opened 9 years ago

benthor commented 9 years ago

It would be really awesome to get a "beep" command, possibly with different pitches/tones to have auditory feedback when certain code parts are triggered.

abenkovskii commented 9 years ago

Nice idea. But don't expect it to be implemented soon. For now you can use print and hudtext commands to display visual feedback. You also can make a part that has a "beep" option in it's context menu and activate it through PartModule interface: http://ksp-kos.github.io/KOS_DOC/structures/vessels/partmodule.html.

abenkovskii commented 9 years ago

I also don't know how if it's possible to make beep command work with TELNET interface. Our goal is to make TELNET exactly match kOS terminal.

Dunbaratu commented 9 years ago

Beep is the easiest sound to do via telnet. Just send the character control-G, otherwise known as Ascii code 7, or mnemonically, BEL.

In fact, right now, its ONLY doable via telnet, as the built-in terminal doesn't pick up on the beep character and do anything with it.

I would have no problem making a magic character constant BEEP and having it be prinable, as in:

print "Hey" + BEEP + " pay atenion to me.".

However, once you add different pitches and tones to it... then that can't be done by telnet - it does one beep only, and it's the client side that chooses what it sounds like.

Dunbaratu commented 9 years ago

Actually with sound in general, you have to ask the question - is this sound a program terminal thing or is it an in-game sound effect thing? If it's an in-game sound effect thing then it doesn't have to happen over telnet because its like the engine sound, or the sound of detaching a decoupler.

But if it's meant to represent the terminal doing a thing, then it needs to be restricted to just one kind of beep, most likely.

Dunbaratu commented 9 years ago

While on the subject, most hardware terminals had some means of turning on a keyclick clacker that goes 'tick tick tick' as you type. It's a local thing, part of the terminal, not something sent across the line. It's implemented in the terminal hardware as just being the beep speaker being activated for much shorter duration, at lower pitch, than when its used for beeping. While at times annoying, it is quite interesting if we want to have that sort of feel. Things like Putty can already do it (I think), but on the gui side, it might be interesting to make that an option on the in-game terminal too, while we're talking about beeps.

abenkovskii commented 9 years ago

@Dunbaratu

  1. If you are going to add this feature it's probably better to make it escape sequence than adding another reserved variable: "\b" (beep, bell) or may be "\a" (alert, like in c++) like "\n", "\"" and "\\".
  2. It looks like I found one more character to add to my "specchar.ksm" library.
erendrake commented 9 years ago

@abenkovskii i would rather see a reserved binding than a some kind escape sequence.

@dunbaratu i would think that this would be a single terminal sound.

abenkovskii commented 9 years ago

@erendrake But it's a special symbol. If I understand it right we are going to use escape sequences for other special symbols. Aren't we?

abenkovskii commented 9 years ago

Either we use the same approach as for other control characters or abstract it out by adding a beep. command that prints the BEL symbol.

abenkovskii commented 9 years ago

As a temporary solution: https://github.com/KSP-KOS/KSLib/pull/61

Dunbaratu commented 9 years ago

I favor printing a 0x0007 character and putting the logic in the gui terminal to read it and make a beep. (for the telnet, just pass it through as-is and the client should beep). Whether that's done as:

print "One ping only" + BEEP.

or as

print "One ping only\a".

Depends on what we want to do with \n, \", etc. If we want them backslashed then alarm bell should match. If we want the longhand name, then alarm bell should match. They should be the same.

Dunbaratu commented 9 years ago

Regardless of how the beep character gets implemented, it still does need some work in the GUI terminal to implement it, as until that's done this is an area where the telnet terminal differs (the telnet terminal will already respond to ascii 7 with a beep, out of the box).

Basic0 commented 8 years ago

FWIW I want a beep for use as an in-game alert when something goes horribly wrong. So for my use case, it should be the part making the noise and in no way tied to either the terminal or telnet (and should sound even if the terminal is closed).

I suspect there will be others with similar use-cases.

Dunbaratu commented 8 years ago

I have considered opening the ability for scripters to play their own sound file clips via the script. There's already an infrastructure in place for it that we use for our own error beep sound.

Basic0 commented 8 years ago

That would cover my use case and seems like a nice feature. Is there a ticket I can follow?