Zachary Kotlarek 13 лет назад
Родитель
Сommit
964bbe1047
1 измененных файлов с 7 добавлено и 9 удалено
  1. 7 9
      dmx/Audio.pm

+ 7 - 9
dmx/Audio.pm

@@ -47,7 +47,7 @@ sub addLoad($$) {
 sub add($$) {
 	my ($name, $path) = @_;
 	if ($DEBUG) {
-		print STDERR 'Audio::add(): ' . $name . "\n";
+		print STDERR 'Audio::add(): ' . $name . ', ' . $path . "\n";
 	}
 
 	# Construct an absolute file path
@@ -167,13 +167,12 @@ sub position($$) {
 		die('Invalid QT document: ' . $name . "\n");
 	}
 
-	# Optionally set the audio position
+	# Set or get the audio position
 	if ($new) {
 		runApplescript('tell application "QuickTime Player" to set current time of document ' . $FILES{$name}->{'name'} . ' to ' . $new);
+	} else {		
+		return runApplescript('tell application "QuickTime Player" to get current time of document ' . $FILES{$name}->{'name'});
 	}
-
-	# Get the current playback position from QT
-	return runApplescript('tell application "QuickTime Player" to get current time of document ' . $FILES{$name}->{'name'});
 }
 
 sub rate($$) {
@@ -185,13 +184,12 @@ sub rate($$) {
 		die('Invalid QT document: ' . $name . "\n");
 	}
 
-	# Optionally set the playback rate
+	# Set or get the playback rate
 	if ($new) {
 		runApplescript('tell application "QuickTime Player" to set rate of document ' . $FILES{$name}->{'name'} . ' to ' . $new);
+	} else {
+		return runApplescript('tell application "QuickTime Player" to get rate of document ' . $FILES{$name}->{'name'});		
 	}
-
-	# Get the current playback position from QT
-	return runApplescript('tell application "QuickTime Player" to get rate of document ' . $FILES{$name}->{'name'});
 }
 
 sub pause($) {