diff options
author | FreeArtMan <dos21h@gmail.com> | 2021-05-28 09:23:32 +0100 |
---|---|---|
committer | FreeArtMan <dos21h@gmail.com> | 2021-05-28 09:23:32 +0100 |
commit | 0ab4ab1ef46d6696243ce5a57a4008eebfde1b20 (patch) | |
tree | fc539fcc5061aa682c35a8077f80dbc2168005fa /md/writeup/linux_pc_speaker.md | |
parent | efa24b220d9633d5d7bfef632b33df180dcb0e74 (diff) | |
download | md-content-0ab4ab1ef46d6696243ce5a57a4008eebfde1b20.tar.gz md-content-0ab4ab1ef46d6696243ce5a57a4008eebfde1b20.zip |
Update last articles
Diffstat (limited to 'md/writeup/linux_pc_speaker.md')
-rw-r--r-- | md/writeup/linux_pc_speaker.md | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/md/writeup/linux_pc_speaker.md b/md/writeup/linux_pc_speaker.md new file mode 100644 index 0000000..1462c1c --- /dev/null +++ b/md/writeup/linux_pc_speaker.md @@ -0,0 +1,42 @@ +title:Linux PC speaker +keywords:pc,linux,speaker,c + +# Linux PC speaker +PC speaker can make sound you whant. Here is small PC speaker player. +Set notes , set time delay and you on. You should run this code under +root if nothing happens. + +```c +int main() +{ + int rc,i; + note *curent_song; + curent_song = song; + struct timespec t1; + rc = syscall(SYS_open,"/dev/console",O_WRONLY,7*8*64+7*8+7); //open cosole + if (rc == 0) + rc = 1; + + ioctl( rc, KIOCSOUND , 0 ); + ioctl( rc , KDSETLED , 7 ); + + i = 0; + while ( curent_song[i].n != 0 ) + { + ioctl( rc , KIOCSOUND , curent_song[i].n ); + msleep( (curent_song[i].t) ); + ioctl( rc , KDSETLED , i&0x0007 ); + i++; + } + ioctl( rc , KDSETLED , 0 ); + ioctl( rc, KIOCSOUND , 0 ); + + return 0; +} +``` + + +## Downloads +linux_pc_speaker.zip - +5KiB - http://archive.main.lv/files/writeup/linux_pc_speaker/linux_pc_speaker.zip + |