Greetings perl-win32-users,
I think that I just experienced the second instance of an odd bug in
perl 5.8 for win32. It took me all day to get a rather simple script
to work. I kept thinking it was my code. Finally, I moved an array
assignment outside of an if statement block and it started working.
Sorry about the terrible formatting but my mail client has a crappy
editor and will make it even worse if I try to edit it.
There are two places where an array element is made undefined and a
new one is pushed on the array to replace it. If both of these
replacements occur in the same program block, all sorts of strange
things happen. The following works fine.
Is there something that I am missing that is wrong that could account
for this? This only happened one time before and I used a similar fix.
my $newtime;
my $newtime2;
my $shiftticks;
my $gapsize;
my $shifted;
my $noroom;
if ( $name eq "note_on" and $vel > 0 and $time > 0 and
$note > $mingaprange and $note < $maxgaprange ){ # a note on and in range
$gapsize = $time -
($on_off_time_array3[$note]);
if (($gapsize < $mingapticks) and
($on_off_time_array1[$note] >= 0 )){
$smallgaps ++;
$notelength = ($on_off_time_array3[$note]) -
($on_off_time_array2[$note]);
$shiftticks =$mingapticks - $gapsize;
if ( ($notelength - $shiftticks) < $minnoteticks
){; # if a short note would be made then shift instead
$shortnotes ++;
if ( ($on_off_time_array2[$note] -
$on_off_time_array1[$note]) > ($mingapticks + $shiftticks) ){ # if room
to shift
$newtime2 = ($on_off_time_array3[$note]) -
($shiftticks) ; # do the beginning
$shifted = 1;
$newtime = ($on_off_time_array2[$note]) -
($shiftticks) ; # do the beginning
$on_off_time_array2[$note] = $newtime;
my @replace2 = ('note_on', $newtime,
$channel, $note, $vel ); # replacement previous off event
${ $tracks->[$i]->events_r }[
$notearray2[$note] ] = undef;
push ( @{ $tracks->[$i]->events_r }, [EMAIL
PROTECTED] );
}
else{
$noroom = 1;
#could not shrink nor shift so don't change any events
$nofixgaps ++;
}
}
$newtime = $time - $mingapticks;
$newtime = $newtime2 if $shifted;
$on_off_time_array3[$note] = $newtime; # save
temporarily so array1 will get the value before updating it
my @replace = ( 'note_on', $newtime, $channel, $note, 0
); # replacement previous off event
push ( @{ $tracks->[$i]->events_r }, [EMAIL PROTECTED]
) unless $noroom;
${ $tracks->[$i]->events_r }[ $notearray3[$note] ] =
undef unless $noroom;
}
}
-- Best regards, Spencer_Lists Chase
mailto:[EMAIL PROTECTED] 67550 Bell Springs Rd. Garberville, CA
95542 Postal service only. Laytonville, CA 95454 UPS only.
[EMAIL PROTECTED] http://www.spencerserolls.com
http://www.spencerserolls.com/MidiValve.htm (707) 984-8356
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs