ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/cfplus
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/cfplus (file contents):
Revision 1.223 by root, Tue Aug 28 01:23:47 2007 UTC vs.
Revision 1.224 by root, Thu Aug 30 07:57:59 2007 UTC

315 315
316 my $NOW = time; 316 my $NOW = time;
317 317
318 if ($MUSIC_PLAYING_META->{stop_time} > $NOW - $MUSIC_RESUME) { 318 if ($MUSIC_PLAYING_META->{stop_time} > $NOW - $MUSIC_RESUME) {
319 my $pos = $MUSIC_PLAYING_META->{stop_pos}; 319 my $pos = $MUSIC_PLAYING_META->{stop_pos};
320 $MUSIC_PLAYER->fade_in_pos (0, 1000, $pos); 320 $MUSIC_PLAYER->fade_in_pos (0, 700, $pos);
321 $MUSIC_START = time - $pos; 321 $MUSIC_START = time - $pos;
322 } else { 322 } else {
323 $MUSIC_PLAYER->play (0); 323 $MUSIC_PLAYER->play (0);
324 $MUSIC_START = time; 324 $MUSIC_START = time;
325 } 325 }
343 my @have = 343 my @have =
344 grep $_ && $_->{data}, 344 grep $_ && $_->{data},
345 map $CONN->{face}[$_], 345 map $CONN->{face}[$_],
346 @$MUSIC_WANT; 346 @$MUSIC_WANT;
347 347
348 # randomize music a bit so that the order is not always the same
349 $_->{stop_time} ||= rand for @have;
350
348 @MUSIC_HAVE = @have 351 @MUSIC_HAVE = @have
349 if @have; 352 if @have;
350 353
351 # default MUSIC_HAVE == MUSIC_DEFAULT 354 # default MUSIC_HAVE == MUSIC_DEFAULT
352 @MUSIC_HAVE = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" } unless @MUSIC_HAVE; 355 @MUSIC_HAVE = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" } unless @MUSIC_HAVE;
353 $fade_out = 1000; 356 $fade_out = 700;
354 } 357 }
355 358
356 # if the currently playing song is acceptable, let it continue 359 # if the currently playing song is acceptable, let it continue
357 return if grep $MUSIC_PLAYING_META == $_, @MUSIC_HAVE; 360 return if grep $MUSIC_PLAYING_META == $_, @MUSIC_HAVE;
358 361
367 @MUSIC_HAVE = sort { $a->{stop_time} <=> $b->{stop_time} } @MUSIC_HAVE; 370 @MUSIC_HAVE = sort { $a->{stop_time} <=> $b->{stop_time} } @MUSIC_HAVE;
368 371
369 # if the most recently-played piece played very recently, 372 # if the most recently-played piece played very recently,
370 # resume it, else choose the oldest piece for rotation. 373 # resume it, else choose the oldest piece for rotation.
371 audio_music_set_meta 374 audio_music_set_meta
372 $MUSIC_HAVE[-1]{stop_time} > $NOW - $MUSIC_RESUME 375 $MUSIC_HAVE[-1]{stop_pos} && $MUSIC_HAVE[-1]{stop_time} > $NOW - $MUSIC_RESUME
373 ? $MUSIC_HAVE[-1] 376 ? $MUSIC_HAVE[-1]
374 : $MUSIC_HAVE[0]; 377 : $MUSIC_HAVE[0];
375 378
376 audio_music_start; 379 audio_music_start;
377 } 380 }
383 $MUSIC_WANT = $songs; 386 $MUSIC_WANT = $songs;
384 audio_music_push; 387 audio_music_push;
385} 388}
386 389
387sub audio_music_finished { 390sub audio_music_finished {
391 if ($MUSIC_PLAYING_META) {
392 $MUSIC_PLAYING_META->{stop_time} = time;
393 }
394
388 # we compress multiple jingles of the same type 395 # we compress multiple jingles of the same type
389 shift @MUSIC_JINGLE 396 shift @MUSIC_JINGLE
390 while @MUSIC_JINGLE && $MUSIC_PLAYING_META == $MUSIC_JINGLE[0]; 397 while @MUSIC_JINGLE && $MUSIC_PLAYING_META == $MUSIC_JINGLE[0];
391 398
392 $MUSIC_PLAYING_WIDGET->clear; 399 $MUSIC_PLAYING_WIDGET->clear;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines