irssi-sound/sound.pl

119 lines
4.6 KiB
Perl
Raw Normal View History

2012-10-16 20:21:51 -04:00
use strict;
use vars qw($VERSION %IRSSI);
use Irssi;
$VERSION = '0.0.3';
2012-10-16 20:21:51 -04:00
%IRSSI = (
authors => 'Chrelad',
2012-10-16 20:21:51 -04:00
contact => 'blah@blah.blah',
2016-08-24 16:28:55 -04:00
name => 'sound',
2012-10-16 20:21:51 -04:00
description => 'Play sounds for different events in IRSSI.',
url => 'http://google.com',
2012-10-16 20:21:51 -04:00
license => 'GNU General Public License',
changed => '$Date: 2007-02-07 12:00:00 +0100 (Thu, 7 Feb 2008) $'
);
#--------------------------------------------------------------------
# Created by Chrelad
2012-10-16 20:21:51 -04:00
# Feb 7, 2008
#modified by Storm Dragon
#Added private message sound and the ability to select sound method
2012-10-16 20:21:51 -04:00
#Sounds now play as a background process.
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# The sound playing function for public message
#--------------------------------------------------------------------
2016-08-24 12:31:03 -04:00
sub join_msg {
my ($server,$msg,$nick,$address,$target) = @_;
2016-08-24 12:53:25 -04:00
system("play -qnV0 synth tri 1500 tri 1800 delay 0 .12 fade h 0 .2 remix - &. /dev/null&")
2016-08-24 12:31:03 -04:00
}
sub part_msg {
my ($server,$msg,$nick,$address,$target) = @_;
system("play -qnV0 synth tri 1800 tri 1500 delay 0 .12 fade h 0 .2 remix - &> /dev/null&");
2016-08-24 12:31:03 -04:00
}
2016-08-24 16:28:55 -04:00
sub quit_msg {
my ($server,$msg,$nick,$address,$target) = @_;
system("play -qnV0 synth pi fade h 0 1 1 pad 0 1 reverb overdrive riaa norm -7 &> /dev/null&")
2016-08-24 16:28:55 -04:00
}
2012-10-16 20:21:51 -04:00
sub pub_msg {
my ($server,$msg,$nick,$address,$target) = @_;
2016-08-28 21:04:22 -04:00
system("play -qnV0 synth 0.09 tri E3:B3 &> /dev/null&");
2012-10-16 20:21:51 -04:00
}
2016-08-29 10:04:06 -04:00
sub own_action_msg {
my ($server,$msg,$nick,$address,$target) = @_;
2016-08-29 11:02:39 -04:00
system("play -qnV0 synth 0.25 tri G5:E1 tri B5:D1 remix - norm -5 &> /dev/null&");
2016-08-29 10:04:06 -04:00
}
sub own_private_msg {
my ($server,$msg,$nick,$address,$target) = @_;
2016-08-29 11:02:39 -04:00
system("play -qnV0 synth pl G2 pl G3 pl B2 pl B3 pl D3 pl D4 pl G3 pl G4 pl D4 pl D4 pl G4 pl G4 delay 0 0 0.02 0.02 0.04 0.04 0.06 0.06 0.08 0.08 0.1 0.1 remix - phaser fade p 0 0.5 0.3 reverse &> /dev/null&");
2016-08-29 10:04:06 -04:00
}
2016-08-28 20:39:21 -04:00
sub action_msg {
my ($server,$msg,$nick,$address,$target) = @_;
2016-08-29 11:02:39 -04:00
system("play -qnV0 synth 0.25 tri E1:G5 tri D1:B5 remix - norm -5 &> /dev/null&");
2016-08-28 20:39:21 -04:00
}
sub own_msg {
my ($server,$msg,$nick,$address,$target) = @_;
2016-08-28 21:04:22 -04:00
system("play -qnV0 synth 0.09 tri B3:E3 &> /dev/null&");
2016-08-28 20:39:21 -04:00
}
sub own_notice_msg {
my ($server,$msg,$nick,$address,$target) = @_;
2016-08-29 18:10:35 -04:00
system("play -nqV0 synth pi fade h 0 1 1 norm -15 pad 0 1 reverb overdrive riaa speed 32 repeat 3 &> /dev/null&");
}
sub notice_msg {
my ($server,$msg,$nick,$address,$target) = @_;
2016-08-29 18:10:35 -04:00
system("play -nqV0 synth pi fade h 0 1 1 norm -15 pad 0 1 reverb overdrive riaa speed 32 reverse repeat 3 &> /dev/null&");
}
2012-10-16 20:21:51 -04:00
#--------------------------------------------------------------------
# The sound playing function for private message
#--------------------------------------------------------------------
sub pri_msg {
my ($server,$msg,$nick,$address,$target) = @_;
2016-08-28 21:04:22 -04:00
system("play -qnV0 synth pl G2 pl G3 pl B2 pl B3 pl D3 pl D4 pl G3 pl G4 pl D4 pl D4 pl G4 pl G4 delay 0 0 0.02 0.02 0.04 0.04 0.06 0.06 0.08 0.08 0.1 0.1 remix - phaser fade p 0 0.5 0.3 &> /dev/null&");
2012-10-16 20:21:51 -04:00
}
#--------------------------------------------------------------------
# The sound playing function for nick mensioning message
#--------------------------------------------------------------------
2016-08-25 14:07:36 -04:00
sub hilight {
my ($dest, $text, $stripped) = @_;
my $server = $dest->{server};
my $window = Irssi::active_server();
if (!($server &&
$dest->{level} & (MSGLEVEL_HILIGHT) &&
2016-08-25 14:07:36 -04:00
$server->ischannel($dest->{target}) &&
$window->{refnum} != $dest->{window}->{refnum})) {
return;
}
2016-08-28 21:04:22 -04:00
system("play -qnV0 synth 0.5 tri A3:D3 tri D3:A3 remix - &> /dev/null&");
2016-08-25 14:07:36 -04:00
}
2012-10-16 20:21:51 -04:00
#--------------------------------------------------------------------
# Irssi::signal_add_last / Irssi::command_bind
#--------------------------------------------------------------------
Irssi::signal_add_last("message public", "pub_msg");
Irssi::signal_add_last("message irc action", "action_msg");
Irssi::signal_add_last("message own_public", "own_msg");
2012-10-16 20:21:51 -04:00
Irssi::signal_add_last("message private", "pri_msg");
2016-08-29 10:04:06 -04:00
Irssi::signal_add_last("message own_private", "own_private_msg");
Irssi::signal_add_last("message irc own_action", "own_action_msg");
Irssi::signal_add_last("message irc own_notice", "own_notice_msg");
Irssi::signal_add_last("message irc notice", "notice_msg");
2016-08-25 14:07:36 -04:00
Irssi::signal_add_last('print text', "hilight");
Irssi::signal_add("event join", 'join_msg');
2016-08-24 16:28:55 -04:00
Irssi::signal_add("event quit", 'quit_msg');
Irssi::signal_add("event part", 'part_msg');
2012-10-16 20:21:51 -04:00
#- end