ネコミミサーボ調整
- 2008年12月17日(水)
Akiraの作品のBSD Performance Dashboard(2007)をKOF2008で、K*BUGブースで展示させてもらってたんだけど、動きがいまいちだった。
事前に調整する時間がほとんどなかったし、当日ほとんど死んでて、調整する元気もなかったもの。
で、久しぶりに調整してみた。 コードをしっかりと読まずに、適当に調整しているので、そのつもりで。
左側は元々はCPU frequencyなんだけども、うちのマシンでは使えないので、ワイプ動作するようにした。
変更は以下のような感じ。
- bsdashboard2.pl
--- bsdashboard2.pl.20081108 2008-11-08 10:20:56.000000000 +0900
+++ bsdashboard2.pl 2008-12-17 15:33:12.000000000 +0900
@@ -2,8 +2,8 @@
use strict;
##################################
#Machine depend Setting
-my $nofCore=2; # Number of
-my $statHz=133; #you can see your stathz in `sysctl kern.clockrate`
+my $nofCore=1; # Number of
+my $statHz=1000; #you can see your stathz in `sysctl kern.clockrate`
my $clockBase=1660; #Your CPU clock
#(See dev.cpu.0.freq_levels (choice max one))
my $dspFreq=48000; #your audio player sample speed
@@ -29,10 +29,11 @@
return (split(/\s/,`sysctl kern.cp_time`))[5];
}
sub clock{
+ return 797;
return (split(/\s/,`sysctl dev.cpu.0.freq`))[1];
}
-`mixer -f /dev/mixer1 pcm 100`;
-open(PLAY,"|rawplay -f u8 -c 2 -s $dspFreq -B ".$span*$dspFreq*0.5." -d /dev/dsp1.0") or die("cannt play");
+`mixer -f /dev/mixer0 pcm 100`;
+open(PLAY,"|rawplay -f u8 -c 2 -s $dspFreq -B ".$span*$dspFreq*0.5." -d /dev/dsp0.0") or die("cannt play");
select PLAY;
$|=1;
select STDOUT;
@@ -55,14 +56,30 @@
rawPlay(1,1);
+
+my $wipe=0;
+my $wc=0.05;
+my $sign=+1;
+
while(1){
my $idle=idleTime();
my $nowTime=time();
my $realSpan=$nowTime-$oldTime;
my $load=($realSpan*$timeBase - ($idle-$oldIdle) )/($realSpan*$timeBase)*100;
my $freq=100*clock()/$clockBase;
- #print "$load $freq \n";
- rawPlay($load/100,$freq/100);
+
+ $wipe += $wc * $sign;
+ if($wipe >= 1.0) {
+ $wipe=1.0;
+ $sign*=-1;
+ }
+ if($wipe < 0.0) {
+ $wipe=0.0;
+ $sign*=-1;
+ }
+ print "$load $freq \n";
+ print "wipe:$wipe\n";
+ rawPlay($load/25,$wipe);
$oldIdle=$idle;
$oldTime=$nowTime;
}
Last modified: 2008-12-17
Post-it: New Post-it (help)