Skip to content

Commit de09708

Browse files
committed
Add some sounds
1 parent 8b3ced2 commit de09708

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

tetrix.nelua

+33-3
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,31 @@ function Game:clear_lines()
347347
points = 40
348348
end
349349
if points > 0 then
350-
-- PlaySound(self.lineclear_sound)
350+
riv_waveform(riv_waveform_desc{
351+
type = RIV_WAVEFORM_NOISE,
352+
attack = 0.1,
353+
decay = 0.05,
354+
sustain = 0.1,
355+
release = 0.05,
356+
start_frequency = 220,
357+
end_frequency = 40,
358+
amplitude = 0.25,
359+
sustain_level = 0.8,
360+
})
351361
self.lines = self.lines + num_lines
352362
local level = 1 + (self.lines // 10)
353363
if self.level ~= level then
354-
-- PlaySound(self.levelup_sound)
364+
riv_waveform(riv_waveform_desc{
365+
type = RIV_WAVEFORM_PULSE,
366+
attack = 0.015,
367+
decay = 0.05,
368+
sustain = 0.4,
369+
release = 0.8,
370+
start_frequency = 80,
371+
end_frequency = 440,
372+
amplitude = 0.25,
373+
sustain_level = 0.5,
374+
})
355375
self.level = level
356376
end
357377
self.score = self.score + points
@@ -413,7 +433,17 @@ function Game:rotate_current_piece(left: boolean): boolean
413433
end
414434

415435
function Game:place_current_piece()
416-
-- PlaySound(self.hit_sound)
436+
riv_waveform(riv_waveform_desc{
437+
type = RIV_WAVEFORM_SINE,
438+
attack = 0.01,
439+
decay = 0.04,
440+
sustain = 0.05,
441+
release = 0.05,
442+
start_frequency = 440,
443+
end_frequency = 600,
444+
amplitude = 0.25,
445+
sustain_level = 0.5,
446+
})
417447
self.board:place_piece(self.cur_piece)
418448
self:clear_lines()
419449
if not self:spawn_piece() then

0 commit comments

Comments
 (0)