Skip to content

Commit 5d5217e

Browse files
committed
- fixed chat word wrapping
- added sounds for sent, received, whisper chats ('/sound' to turn on) - /timestamp to turn chat time stamps on and off now
1 parent 28a2014 commit 5d5217e

File tree

7 files changed

+25
-58
lines changed

7 files changed

+25
-58
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div align="center">
2-
<img src="hypermind2.svg" width="150" alt="Hypermind Logo" />
2+
<img src="hypernode.svg" width="150" alt="Hypermind Logo" />
33
<h1>Hypermind</h1>
44
</div>
55

hypernode.svg

Lines changed: 1 addition & 0 deletions
Loading

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hypermind",
3-
"version": "0.9.1",
3+
"version": "0.10.0",
44
"description": "A decentralized P2P counter of active deployments",
55
"main": "server.js",
66
"scripts": {

public/hypernode.svg

Lines changed: 1 addition & 0 deletions
Loading

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<head>
55
<title>Hypermind</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1" />
7-
<link rel="icon" href="/favicon.ico" />
7+
<link rel="icon" href="/hypernode.svg" />
88
<link rel="stylesheet"
99
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&icon_names=palette" />
1010
<script>

public/js/sound-manager.js

Lines changed: 16 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
class SoundManager {
32
constructor() {
43
this.ctx = null;
@@ -12,7 +11,7 @@ class SoundManager {
1211
this.ctx = new AudioContext();
1312
}
1413
}
15-
// Resume context if it's suspended (browsers auto-suspend)
14+
1615
if (this.ctx && this.ctx.state === "suspended") {
1716
this.ctx.resume();
1817
}
@@ -24,72 +23,34 @@ class SoundManager {
2423
return this.enabled;
2524
}
2625

27-
// Helper to play a tone
28-
playTone(freq, type, duration, volume = 0.1) {
26+
blip(freq, dur) {
2927
if (!this.enabled) return;
3028
this.init();
3129
if (!this.ctx) return;
3230

33-
const osc = this.ctx.createOscillator();
34-
const gain = this.ctx.createGain();
35-
36-
osc.type = type;
37-
osc.frequency.setValueAtTime(freq, this.ctx.currentTime);
38-
39-
gain.gain.setValueAtTime(volume, this.ctx.currentTime);
40-
gain.gain.exponentialRampToValueAtTime(0.01, this.ctx.currentTime + duration);
41-
42-
osc.connect(gain);
43-
gain.connect(this.ctx.destination);
44-
45-
osc.start();
46-
osc.stop(this.ctx.currentTime + duration);
31+
const o = this.ctx.createOscillator();
32+
const g = this.ctx.createGain();
33+
o.type = "sine";
34+
o.frequency.value = freq;
35+
o.connect(g);
36+
g.connect(this.ctx.destination);
37+
g.gain.setValueAtTime(0.0001, this.ctx.currentTime);
38+
g.gain.exponentialRampToValueAtTime(0.2, this.ctx.currentTime + 0.005);
39+
g.gain.exponentialRampToValueAtTime(0.0001, this.ctx.currentTime + dur);
40+
o.start();
41+
o.stop(this.ctx.currentTime + dur);
4742
}
4843

4944
playSent() {
50-
// Satisfying "pop" or "click" for sending
51-
// Sine wave starting at 600Hz dropping fast
52-
if (!this.enabled) return;
53-
this.playTone(600, "sine", 0.15, 0.1);
45+
this.blip(832, 0.05);
5446
}
5547

5648
playReceived() {
57-
// Soft "bloop" for receiving
58-
// Sine wave starting at 400Hz
59-
if (!this.enabled) return;
60-
this.playTone(400, "sine", 0.15, 0.1);
49+
this.blip(624, 0.05);
6150
}
6251

6352
playWhisper() {
64-
// Distinct "ding" for whispers
65-
// Two tones slightly separated
66-
if (!this.enabled) return;
67-
this.init();
68-
if (!this.ctx) return;
69-
70-
const now = this.ctx.currentTime;
71-
72-
// Tone 1
73-
const osc1 = this.ctx.createOscillator();
74-
const gain1 = this.ctx.createGain();
75-
osc1.frequency.setValueAtTime(800, now);
76-
gain1.gain.setValueAtTime(0.1, now);
77-
gain1.gain.exponentialRampToValueAtTime(0.01, now + 0.3);
78-
osc1.connect(gain1);
79-
gain1.connect(this.ctx.destination);
80-
osc1.start(now);
81-
osc1.stop(now + 0.3);
82-
83-
// Tone 2 (higher)
84-
const osc2 = this.ctx.createOscillator();
85-
const gain2 = this.ctx.createGain();
86-
osc2.frequency.setValueAtTime(1200, now + 0.1);
87-
gain2.gain.setValueAtTime(0.1, now + 0.1);
88-
gain2.gain.exponentialRampToValueAtTime(0.01, now + 0.4);
89-
osc2.connect(gain2);
90-
gain2.connect(this.ctx.destination);
91-
osc2.start(now + 0.1);
92-
osc2.stop(now + 0.4);
53+
this.blip(1872, 1.5);
9354
}
9455
}
9556

public/style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ a { color: var(--color-text-anchor-link); text-decoration: none; border-bottom:
282282
gap: 2px;
283283
scrollbar-width: thin;
284284
scrollbar-color: var(--color-terminal-scrollbar) transparent;
285+
word-wrap: break-word;
286+
overflow-wrap: break-word;
285287
}
286288

287289
.terminal-output::-webkit-scrollbar {
@@ -336,6 +338,8 @@ a { color: var(--color-text-anchor-link); text-decoration: none; border-bottom:
336338

337339
.msg-content {
338340
color: var(--color-terminal-output-message);
341+
word-wrap: break-word;
342+
overflow-wrap: break-word;
339343
}
340344

341345
.timestamp {

0 commit comments

Comments
 (0)