contrib-drivers icon indicating copy to clipboard operation
contrib-drivers copied to clipboard

Add duration parameter to Speaker.play(tone) method

Open tomaszrykala opened this issue 8 years ago • 0 comments
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

tomaszrykala avatar Jan 28 '17 01:01 tomaszrykala