-
-
Notifications
You must be signed in to change notification settings - Fork 33
API Reference
This will define the object with the given serial method and notification method.
SERIAL_METHOD - the class type of the serial hardware support, usually either HardwareSerial
or SoftwareSerial
.
NOTIFICATION_METHOD - the class type of the notification handler, you must provide this. Please read Implementing a notification method for more details.
serial - the instance of the serial hardware support that matches the provided SERIAL_METHOD.
This will initialize the DFMiniMp3 and prepare it for use. Call this within the sketches setup()
.
This will service the DFMiniMp3, listening for responses from the hardware. Call this often within the sketches loop()
.
This will play the given global track.
track - the global track number. A global track number is the number of the file as enumerated from all folders on the SD card. It has no relationship to the file name. You can use the getTotalTrackCount()
to obtain the number of tracks enumerated.
This will play the track from within the mp3 folder.
An example filename would be sd:/mp3/0013_ThisIsMyFavoriteSong.mp3, and calling playMp3FolderTrack(13)
would play it.
track - the track number as listed in the filename. The filename must start with a four digit, zero padded number and any characters that follow will be ignored.
This will play the track from within the specific numbered folder.
An example filename would be sd:/002/013_ThisIsMyFavoriteSong.mp3, and calling playFolderTrack(2, 13)
would play it.
folder - the folder number as listed in the folder name. The foldername must be a three digit, zero padded number.
track - the track number as listed in the track filename. The filename must start with a three digit, zero padded number and any characters that follow will be ignored.
This will play the track from within the specific numbered folder.
An example filename would be sd:/08/2013_ThisIsMyFavoriteSong.mp3, and calling playFolderTrack16(8, 2013)
would play it.
folder - the folder number as listed in the folder name. The foldername must be a two digit, zero padded number.
track - the track number as listed in the track filename. The filename must start with a four digit, zero padded number and any characters that follow will be ignored.
This will play a random track from all tracks on the SD card. This will include all tracks from all folders including the advertisement folder.
This will cause the current track to stop and the next track to start playing immediately.
This will cause the current track to stop and the previous track to start playing immediately.
This will return the current playing track.
This will set the playback volume.
volume - (0-30) the volume level to set.
This will return the current volume.
This will increase the volume by 1.
This will decrease the volume by 1.
This will start playing the given globalTrack and have it loop continuously. When the song finishes, it will restart at the beginning.
globalTrack - the global track number. A global track number is the number of the file as enumerated from all folders on the SD card. It has no relationship to the file name. You can use the getTotalTrackCount()
to obtain the number of tracks enumerated.
Retreive the current playback mode.
DfMp3_PlaybackMode_Repeat -
DfMp3_PlaybackMode_FolderRepeat -
DfMp3_PlaybackMode_SingleRepeat -
DfMp3_PlaybackMode_Random -
Set the mode to repeat play any file that is playing. If set, the mp3 will loop continuously. If not set, it will play once and then stop.
Set the equalizer mode.
eq One of the equalizer modes.
DfMp3_Eq_Normal -
DfMp3_Eq_Pop -
DfMp3_Eq_Rock -
DfMp3_Eq_Jazz -
DfMp3_Eq_Classic -
DfMp3_Eq_Bass -
Get the current equalizer mode.
returns one of these values.
DfMp3_Eq_Normal -
DfMp3_Eq_Pop -
DfMp3_Eq_Rock -
DfMp3_Eq_Jazz -
DfMp3_Eq_Classic -
DfMp3_Eq_Bass -
Sets the playback source. Generally avoid calling this unless you know what you are doing.
source - One of the following values:
DfMp3_PlaySource_Usb -
DfMp3_PlaySource_Sd - (the default)
DfMp3_PlaySource_Aux -
DfMp3_PlaySource_Sleep -
DfMp3_PlaySource_Flash -
Cause the Mp3 module to go into a very low power mode. This is useful for battery operated devices when long periods of no sound will be needed.
Note: currently the only way to wake up the module that I know of is with reset()
; but this is a slow process and may cause click noises in the audio output.
Reset the hardware module. Calling this method will make the module not available for about one second and may cause noise in the audio output.
This will start playing the current track where it was paused at.
This will pause the current playing track.
This will stop the current playing track.
This will return the current status. The exact meaning of the status isn't well documented.
This will return the count of tracks in the given folder
folder - the folder number to enumerate files within.
This will return the count of tracks in all folders, including advertisements
This will pause the current playing track, then play the given advertisement track, and when the advertisement track is finished, it will resume the original track where it was interrupted.
An example filename would be sd:/advert/0042_BuyHitchHikersGuideFromAmazon.mp3, and calling playAdvertisement(42)
would play it.
track - the track number as listed in the filename. The filename must start with a four digit, zero padded number and any characters that follow will be ignored.
This will stop the current playing advertisement and resume the original interrupted track.
This will disable the onboard DAC.
NOTE: This method does seem to work across most chips used on these modules, but it is not documented for all of them and may not work consistently.
This will enable the onboard DAC.
NOTE: This method does seem to work across some chips used on these modules, but it is not documented for all of them and has been demonstrated to not work consistently.