updated
This commit is contained in:
parent
ad955f0592
commit
0160622031
@ -3,8 +3,8 @@
|
||||
.asoundrc (Должно быть в ~/)
|
||||
Нужно поменять rockchipes8316c, на вашу карту (aplay -L)
|
||||
|
||||
modprobe snd-aloop
|
||||
~ # modprobe snd-aloop
|
||||
|
||||
cc spark_ncurses.c -lm -lncurses -s -ospark
|
||||
chmod +x audio_vis.sh
|
||||
./audio_vis.sh
|
||||
~ $ cc spark_ncurses.c -lm -lncurses -s -ospark
|
||||
~ $ chmod +x audio_vis.sh
|
||||
~ $ ./audio_vis.sh
|
||||
|
@ -1,2 +1,2 @@
|
||||
#!/bin/sh
|
||||
arecord --rate 16000 --buffer-size=1024 -D loopout -MNqc 1 -f S24_LE -t raw | hexdump -e '/4 " %d"' | tr -d '*' | ./spark
|
||||
arecord --rate 10000 --buffer-size=1024 -D loopout -MNqc 1 -f S24_LE -t raw | hexdump -e '/4 " %d"' | tr -d '*' | ./spark
|
||||
|
BIN
img/sshot.jpg
BIN
img/sshot.jpg
Binary file not shown.
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 118 KiB |
@ -12,7 +12,7 @@
|
||||
#define NARGS 4096
|
||||
#define ARG_SIZE 50
|
||||
#define MAX 1000000
|
||||
#define MIN 50000
|
||||
#define MIN 90000
|
||||
|
||||
int args;
|
||||
double values[NARGS + 1];
|
||||
@ -71,31 +71,23 @@ void stdin_read(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void mvprint(int y, int x, int lvl) {
|
||||
char *fmt = "@";
|
||||
if (lvl < 4) {
|
||||
fmt = "/";
|
||||
if (y > ws.ws_row / 2)
|
||||
fmt = "\\";
|
||||
}
|
||||
|
||||
else if (lvl - 4 <= 2)
|
||||
fmt = "+";
|
||||
|
||||
mvprintw(y, x, "%s", fmt);
|
||||
}
|
||||
|
||||
void print(double value, double diff, int col) {
|
||||
size_t m_screen = ws.ws_row / 2;
|
||||
if (col % 2)
|
||||
return;
|
||||
|
||||
if (value >= 0) {
|
||||
int lvl = (int)round((value - MIN + 1) / diff * 2);
|
||||
mvprint(m_screen - lvl, col, lvl);
|
||||
}
|
||||
int lvl = 0;
|
||||
if (value > 0)
|
||||
lvl = (int)round((value - MIN + 1) / diff);
|
||||
|
||||
else {
|
||||
int lvl = (int)round(((value * -1) - MIN + 1) / diff * 2);
|
||||
mvprint(m_screen + lvl, col, lvl);
|
||||
else
|
||||
lvl = (int)round(((value * -1) - MIN + 1) / diff);
|
||||
|
||||
for (int i = 0; i < lvl; i++) {
|
||||
if (value > 0)
|
||||
mvprintw((ws.ws_row / 2) - i, col, "$");
|
||||
|
||||
else
|
||||
mvprintw((ws.ws_row / 2) + i, col, "$");
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,8 +116,9 @@ int main(void) {
|
||||
stdin_read();
|
||||
|
||||
clear();
|
||||
|
||||
for (int i = 1; i < args - 1; i++)
|
||||
print((values[i - 1] + values[i] + values[i + 1]) / 4, diff, i);
|
||||
print((values[i - 1] + values[i] + values[i + 1]) / 3, diff, i);
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user