# ecrobot::Speaker Class Reference

NXT speaker class. More...

`#include <Speaker.h>`

List of all members.

## Public Member Functions
| Speaker (void)
| Constructor.
void | playTone (U32 freq, U32 duration, U32 volume)
| Play a tone sound.
S16 | playWav (const CHAR *file, U32 length, U32 volume)
| Play an 8bit monochrome PCM WAV file.
## Static Public Attributes
static const U32 | MIN_TONE_FREQ = 33
| Minimum frequency of tone.
static const U32 | MAX_TONE_FREQ = 1976
| Maximum frequency of tone.

## Detailed Description

NXT speaker class.

## Constructor & Destructor Documentation

ecrobot::Speaker::Speaker | ( | void |  | ) |

Constructor.

Parameters:

  | - |

Returns:
  -

## Member Function Documentation

void ecrobot::Speaker::playTone | ( | U32 | freq,
|  | U32 | duration,
|  | U32 | volume |
| ) |  |  |

Play a tone sound.

Parameters:

  | freq | Tone frequency in Hz. MIN_TONE_FREQ to MAX_TONE_FREQ
  | duration | Tone duration in msec (10msec unit)
  | volume | Tone volume (0 to 100)

Returns:
  -

S16 ecrobot::Speaker::playWav | ( | const CHAR * | file,
|  | U32 | length,
|  | U32 | volume |
| ) |  |  |

Play an 8bit monochrome PCM WAV file.

Parameters:

  | file | Head of a WAV file
  | length | Length of a WAV file
  | volume | Volume of WAV file (0 to 100)

Returns:
  1:succeeded/0:sound resource was busy/-1:unsupported file format

The documentation for this class was generated from the following file:

- device/Speaker.h