Overview | API
See also
Namespace : AL
#include <alproxies/alaudioplayerproxy.h>
See also
Returns the position in seconds in the file currently played. The Id of the playing task will be returned when calling a play method (eg. ALAudioPlayerProxy::play) in a non-blocking manner. See below for an example in Python.
import sys
import time
from naoqi import ALProxy
if (len(sys.argv) < 2):
print "Usage: 'python audioplayer_play.py IP [PORT]'"
sys.exit(1)
IP = sys.argv[1]
PORT = 9559
if (len(sys.argv) > 2):
PORT = sys.argv[2]
try:
aup = ALProxy("ALAudioPlayer", IP, PORT)
except Exception,e:
print "Could not create proxy to ALAudioPlayer"
print "Error was: ",e
sys.exit(1)
#plays a file and get the current position 5 seconds later
fileId = aup.post.playFile("/usr/share/naoqi/wav/random.wav")
time.sleep(5)
#currentPos should be near 5 secs
currentPos = aup.getCurrentPosition(fileId)
Parameters: |
|
---|---|
Returns: | Current position in seconds |
Returns the length in second of the file that is currently played.
Parameters: |
|
---|---|
Returns: | Length of the file in seconds |
Returns an array containing the task Ids corresponding to the currently loaded files. File can be loaded using ALAudioPlayerProxy::loadFile.
Returns: | Array of task Ids |
---|
Returns an array containing the filenames (absolute paths) of the currently loaded files. File can be loaded using ALAudioPlayerProxy::loadFile.
Returns: | Array of filenames |
---|
Returns the master volume used by ALAudioPlayer for playback. This volume can be set by using ALAudioPlayerProxy::setMasterVolume. This volume is independent of the system volume that can be set through ALAudioDevice.
Returns: | Volume [0.0 - 1.0] |
---|
Returns the volume level at which the specified task should be played. This volume is independent of the master volume set with ALAudioPlayerProxy::setMasterVolume. This task dependent volume can be set by using ALAudioPlayerProxy::setVolume.
Parameters: |
|
---|---|
Returns: | Volume - [0.0 - 1.0] |
Jumps to a given position in second in the specified file.
Parameters: |
|
---|
import sys
import time
from naoqi import ALProxy
if (len(sys.argv) < 2):
print "Usage: 'python audioplayer_goto.py IP [PORT]'"
sys.exit(1)
IP = sys.argv[1]
PORT = 9559
if (len(sys.argv) > 2):
PORT = sys.argv[2]
try:
aup = ALProxy("ALAudioPlayer", IP, PORT)
except Exception,e:
print "Could not create proxy to ALAudioPlayer"
print "Error was: ",e
sys.exit(1)
#Launchs the playing of a file, waits for 2 seconds, and goes to the 5th second
fileId = aup.post.playFile("/usr/share/naoqi/wav/random.wav")
time.sleep(1)
aup.goTo(fileId,2)
PreLoads a file but does not play it yet. Preloading a file is a way to reduce the time necessary to actually start the playback when a “play” function is called. The playback of a loaded file can be started by calling ALAudioPlayerProxy::play.
Parameters: |
|
---|---|
Returns: | Id of the task handling the playing of the file |
Pause the playback of the specified task. The pause can be resume by calling ALAudioPlayerProxy::play.
Parameters: |
|
---|
Starts the playback of the specified task.
Parameters: |
|
---|
import sys
import time
from naoqi import ALProxy
if (len(sys.argv) < 2):
print "Usage: 'python audioplayer_play.py IP [PORT]'"
sys.exit(1)
IP = sys.argv[1]
PORT = 9559
if (len(sys.argv) > 2):
PORT = sys.argv[2]
try:
aup = ALProxy("ALAudioPlayer", IP, PORT)
except Exception,e:
print "Could not create proxy to ALAudioPlayer"
print "Error was: ",e
sys.exit(1)
#Loads a file and launchs the playing 5 seconds later
fileId = aup.loadFile("/usr/share/naoqi/wav/random.wav")
time.sleep(5)
aup.play(fileId)
Starts the playback of the specified task, with a specific volume and stero panorama. This task has for example been created using ALAudioPlayerProxy::loadFile.
Parameters: |
|
---|
import sys
import time
from naoqi import ALProxy
if (len(sys.argv) < 2):
print "Usage: 'python audioplayer_play.py IP [PORT]'"
sys.exit(1)
IP = sys.argv[1]
PORT = 9559
if (len(sys.argv) > 2):
PORT = sys.argv[2]
try:
aup = ALProxy("ALAudioPlayer", IP, PORT)
except Exception,e:
print "Could not create proxy to ALAudioPlayer"
print "Error was: ",e
sys.exit(1)
#Loads a file and launchs the playing 5 seconds later
fileId = aup.loadFile("/usr/share/naoqi/wav/random.wav")
time.sleep(5)
aup.play(fileId)
Starts the playback of the specified file. This call is equivalent to calling successively ALAudioPlayerProxy::loadFile and ALAudioPlayerProxy::play.
Parameters: |
|
---|
import sys
import time
from naoqi import ALProxy
if (len(sys.argv) < 2):
print "Usage: 'python audioplayer_playfile.py IP [PORT]'"
sys.exit(1)
IP = sys.argv[1]
PORT = 9559
if (len(sys.argv) > 2):
PORT = sys.argv[2]
try:
aup = ALProxy("ALAudioPlayer", IP, PORT)
except Exception,e:
print "Could not create proxy to ALAudioPlayer"
print "Error was: ",e
sys.exit(1)
#Launchs the playing of a file
aup.playFile("/usr/share/naoqi/wav/random.wav")
time.sleep(1.0)
#Launchs the playing of a file on the left speaker to a volume of 50%
aup.playFile("/usr/share/naoqi/wav/random.wav",0.5,-1.0)
Starts the playback of the specified file. This call is equivalent to calling successively ALAudioPlayerProxy::loadFile and ALAudioPlayerProxy::play with specific volume and pan.
Parameters: |
|
---|
import sys
import time
from naoqi import ALProxy
if (len(sys.argv) < 2):
print "Usage: 'python audioplayer_playfile.py IP [PORT]'"
sys.exit(1)
IP = sys.argv[1]
PORT = 9559
if (len(sys.argv) > 2):
PORT = sys.argv[2]
try:
aup = ALProxy("ALAudioPlayer", IP, PORT)
except Exception,e:
print "Could not create proxy to ALAudioPlayer"
print "Error was: ",e
sys.exit(1)
#Launchs the playing of a file
aup.playFile("/usr/share/naoqi/wav/random.wav")
time.sleep(1.0)
#Launchs the playing of a file on the left speaker to a volume of 50%
aup.playFile("/usr/share/naoqi/wav/random.wav",0.5,-1.0)
Starts the playback of the specified file from a given position in second.
Parameters: |
|
---|
Starts the playback of the specified file from a given position in second with a given volume and pan.
Parameters: |
|
---|
Starts the playback of the specified file and loop. The playback can then be stopped by calling stop(const int & taskId).
Parameters: |
|
---|
Starts the playback of the specified file and loop, with specific volume and pan. The playback can then be stopped by calling stop(const int & taskId).
Parameters: |
|
---|
Starts the playback of the specified task and loop.
Parameters: |
|
---|
Plays a wav or mp3 file in loop, with specific volume and audio balance
Parameters: |
|
---|
Play a sine wave which the specified caracteristics.
Parameters: |
|
---|
Starts the playback of a web audio stream.
Parameters: |
|
---|
Sets the master volume used by ALAudioPlayer for playback. This volume is independent of the system volume that can be set through ALAudioDevice.
Parameters: |
|
---|
Sets the stereo panorama for all the playback tasks handled by ALAudioPlayer.
Parameters: |
|
---|
Sets the volume level at which the specified task should be played. This volume is independent of the master volume set with ALAudioPlayerProxy::setMasterVolume.
Parameters: |
|
---|
Unloads a file previously loaded with ALAudioPlayerProxy::loadFile.
Parameters: |
|
---|