contrib-drivers
contrib-drivers copied to clipboard
Add duration parameter to Speaker.play(tone) method
trafficstars
The readme for PWM Speaker used to describe an overloaded play() method that takes a tone and a duration as arguments. The driver however, supplies only a method that allows the tone.
readme source: https://github.com/androidthings/contrib-drivers/tree/master/pwmspeaker
extract:
// Make it play:
try {
mSpeaker.play(440 /* tone */, 3000L /* duration */);
} catch (IOException e) {
// error setting speaker
}
The only currently existing method:
public void play(double frequency) throws IOException, IllegalStateException {
...
}
For the time being the documentation has removed description of the duration parameter, but it has been requested for implementation by @mangini