|
bool | begin () |
| Begin the mp3 player. This initializes the playback timer and necessary interrupts. More...
|
|
void | setBufferCallback (int(*fun_ptr)(uint8_t *, int)) |
| Set the function the player will call when it's buffers need to be filled. Care must be taken to ensure that the callback function is efficient. If the callback takes too long to fill the buffer, playback will be choppy. More...
|
|
void | setSampleReadyCallback (void(*fun_ptr)(int16_t, int16_t)) |
| Set the function that the player will call when the playback timer fires. The callback is called inside of an ISR, so it should be short and efficient. This will usually just be writing samples to the DAC. More...
|
|
void | play () |
| Play an mp3 file. This function resets the buffers and should only be used when beginning playback of a new mp3 file. If playback has been stopped and you would like to resume playback at the current location, use Adafruit_mp3::resume instead. More...
|
|
void | stop () |
| Stop playback. This function stops the playback timer. More...
|
|
void | resume () |
| Resume playback. This function re-enables the playback timer. If you are starting playback of a new file, use Adafruit_mp3::play instead. More...
|
|
int | tick () |
| The main loop of the mp3 player. This function should be called as fast as possible in the loop() function of your sketch. This checks to see if the buffers need to be filled, and calls the buffer callback function if necessary. It also calls the functions to decode another frame of mp3 data. More...
|
|
◆ begin()
bool Adafruit_mp3::begin |
( |
| ) |
|
Begin the mp3 player. This initializes the playback timer and necessary interrupts.
- Returns
- none
◆ play()
void Adafruit_mp3::play |
( |
| ) |
|
Play an mp3 file. This function resets the buffers and should only be used when beginning playback of a new mp3 file. If playback has been stopped and you would like to resume playback at the current location, use Adafruit_mp3::resume instead.
- Returns
- none
◆ resume()
void Adafruit_mp3::resume |
( |
| ) |
|
Resume playback. This function re-enables the playback timer. If you are starting playback of a new file, use Adafruit_mp3::play instead.
- Returns
- none
◆ setBufferCallback()
void Adafruit_mp3::setBufferCallback |
( |
int(*)(uint8_t *, int) |
fun_ptr | ) |
|
Set the function the player will call when it's buffers need to be filled. Care must be taken to ensure that the callback function is efficient. If the callback takes too long to fill the buffer, playback will be choppy.
- Parameters
-
fun_ptr | the pointer to the callback function. This function must take a pointer to the location the bytes will be written, as well as an integer that represents the maximum possible bytes that can be written. The function should return the actual number of bytes that were written. |
- Returns
- none
◆ setSampleReadyCallback()
void Adafruit_mp3::setSampleReadyCallback |
( |
void(*)(int16_t, int16_t) |
fun_ptr | ) |
|
Set the function that the player will call when the playback timer fires. The callback is called inside of an ISR, so it should be short and efficient. This will usually just be writing samples to the DAC.
- Parameters
-
fun_ptr | the pointer to the callback function. The function must take two unsigned 16 bit integers. The first argument to the callback will be the left channel sample, and the second channel will be the right channel sample. If the played file is mono, only the left channel data is used. |
- Returns
- none
◆ stop()
void Adafruit_mp3::stop |
( |
| ) |
|
Stop playback. This function stops the playback timer.
- Returns
- none
◆ tick()
int Adafruit_mp3::tick |
( |
| ) |
|
The main loop of the mp3 player. This function should be called as fast as possible in the loop() function of your sketch. This checks to see if the buffers need to be filled, and calls the buffer callback function if necessary. It also calls the functions to decode another frame of mp3 data.
- Returns
- none
The documentation for this class was generated from the following files: