Skip to content

Commit 57e88a1

Browse files
committed
Rework keys
1 parent eb4f61c commit 57e88a1

File tree

3 files changed

+44
-24
lines changed

3 files changed

+44
-24
lines changed

doc/en/sidplayfp.pod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,25 +237,25 @@ Run with no audio output device and no sid emulation.
237237

238238
=item 1-9
239239

240-
Mute/unmute voice.
240+
Mute/unmute voice. 1-3 are for the first chip and so on.
241241

242-
=item q,w,e
242+
=item a,s,d
243243

244-
Mute/unmute samples.
244+
Mute/unmute samples. a for the first chip and so on.
245245

246246
=item f
247247

248248
Toggle filter.
249249

250-
=item p
250+
=item p/space
251251

252252
Pause/unpause playback.
253253

254-
=item h
254+
=item h/F1
255255

256256
Show/hide help.
257257

258-
=item Esc
258+
=item Esc/q
259259

260260
Quit player.
261261

src/keyboard.cpp

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ enum
4949
PCK_RIGHT = '\115',
5050
PCK_END = '\117',
5151
PCK_DOWN = '\120',
52+
PCK_ESC = '\033',
53+
PCK_F1 = '\073',
5254
PCK_EXTENDED = '\340'
5355
};
5456

@@ -63,21 +65,27 @@ static char keytable[] =
6365
PCK_EXTENDED, PCK_DOWN,0, A_DOWN_ARROW,
6466
PCK_EXTENDED, PCK_HOME,0, A_HOME,
6567
PCK_EXTENDED, PCK_END,0, A_END,
68+
PCK_EXTENDED, PCK_F1,0, A_HELP,
69+
PCK_EXTENDED, PCK_ESC,0, A_QUIT,
6670
#else
6771
// Linux Special Keys https://en.wikipedia.org/wiki/ANSI_escape_code#Terminal_input_sequences
68-
ESC,'[','C',0, A_RIGHT_ARROW,
69-
ESC,'[','D',0, A_LEFT_ARROW,
70-
ESC,'[','A',0, A_UP_ARROW,
71-
ESC,'[','B',0, A_DOWN_ARROW,
72-
// Hmm, in console there is:
73-
ESC,'[','1','~',0, A_HOME,
74-
ESC,'[','4','~',0, A_END,
75-
// But in X it's:
76-
ESC,'[','H',0, A_HOME,
77-
ESC,'[','F',0, A_END,
72+
# define CSI ESC,'[' // Control Sequence Introducer
73+
# define SS3 ESC,'O' // Single Shift Three
74+
CSI,'C',0, A_RIGHT_ARROW,
75+
CSI,'D',0, A_LEFT_ARROW,
76+
CSI,'A',0, A_UP_ARROW,
77+
CSI,'B',0, A_DOWN_ARROW,
78+
// vt sequences
79+
CSI,'1','~',0, A_HOME,
80+
CSI,'4','~',0, A_END,
81+
CSI,'1','1','~',0, A_HELP, // F1
82+
// xterm sequences
83+
CSI,'H',0, A_HOME,
84+
CSI,'F',0, A_END,
85+
SS3,'P',0, A_HELP, // F1
7886

79-
ESC,'[','1','0',0, A_INVALID,
80-
ESC,'[','2','0',0, A_INVALID,
87+
CSI,'1','0',0, A_INVALID,
88+
CSI,'2','0',0, A_INVALID,
8189
#endif
8290

8391
/* debug keys. Just use the cursor keys in linux to move in the song */
@@ -91,15 +99,17 @@ static char keytable[] =
9199
'8',0, A_TOGGLE_VOICE8,
92100
'9',0, A_TOGGLE_VOICE9,
93101
#ifdef FEAT_SAMPLE_MUTE
94-
'q',0, A_TOGGLE_SAMPLE1,
95-
'w',0, A_TOGGLE_SAMPLE2,
96-
'e',0, A_TOGGLE_SAMPLE3,
102+
'a',0, A_TOGGLE_SAMPLE1,
103+
's',0, A_TOGGLE_SAMPLE2,
104+
'd',0, A_TOGGLE_SAMPLE3,
97105
#endif
98106
'f',0, A_TOGGLE_FILTER,
99107

100108
// General Keys
101109
'p',0, A_PAUSED,
110+
' ',0, A_PAUSED,
102111
'h',0, A_HELP,
112+
'q',0, A_QUIT,
103113
ESC,ESC,0, A_QUIT,
104114

105115
// Old Keys

src/menu.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,13 +511,23 @@ void ConsolePlayer::menu ()
511511
consoleTable(table_t::separator);
512512
consoleTable(table_t::middle);
513513
consoleColour((m_iniCfg.console()).title);
514-
cerr << " ←/→ Previous/Next 1-9 Toggle voices p Pause" << endl;
514+
#ifndef _WIN32
515+
cerr << " ←/→ Previous/Next 1-9 Toggle voices p Pause" << endl;
515516
consoleTable(table_t::middle);
516517
consoleColour((m_iniCfg.console()).title);
517-
cerr << " ↓/↑ Standard/Fast qwe Toggle sample h Help" << endl;
518+
cerr << " ↓/↑ Play speed asd Toggle samples h Help" << endl;
518519
consoleTable(table_t::middle);
519520
consoleColour((m_iniCfg.console()).title);
520-
cerr << " ⇱/⇲ First/Last f Toggle filter Esc Quit" << endl;
521+
cerr << " ⇱/⇲ First/Last f Toggle filter q Quit" << endl;
522+
#else
523+
cerr << " <-/-> Prev/Next 1-9 Toggle voices p Pause" << endl;
524+
consoleTable(table_t::middle);
525+
consoleColour((m_iniCfg.console()).title);
526+
cerr << " ^/v Play speed asd Toggle samples h Help" << endl;
527+
consoleTable(table_t::middle);
528+
consoleColour((m_iniCfg.console()).title);
529+
cerr << " Hom/End First/Last f Toggle filter q Quit" << endl;
530+
#endif
521531
}
522532

523533
#ifdef FEAT_REGS_DUMP_SID

0 commit comments

Comments
 (0)