Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
EasyPlaybackPWM.h
00001 /* mbed EasyPlaybackPWM Library 00002 * Copyright (C) 2017 dkato 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef __EASY_PLAYBACK_PWM_H__ 00018 #define __EASY_PLAYBACK_PWM_H__ 00019 00020 #include <string> 00021 #include <map> 00022 #include "EasyDecoder.h" 00023 #include "PwmOutSpeaker.h" 00024 00025 class EasyPlaybackPWM 00026 { 00027 public: 00028 EasyPlaybackPWM(PinName pwm_l, PinName pwm_r); 00029 ~EasyPlaybackPWM(); 00030 bool get_tag(const char* filename, char* p_title, char* p_artist, char* p_album, uint16_t tag_size); 00031 bool play(const char* filename); 00032 bool is_paused(void); 00033 void pause(void); 00034 void pause(bool type); 00035 void skip(void); 00036 bool outputVolume(float VolumeOut); 00037 00038 template<typename T> 00039 void add_decoder(const string& extension) { 00040 m_lpDecoders[extension] = &T::inst; 00041 } 00042 00043 private: 00044 #define AUDIO_WRITE_BUFF_SIZE (4096) 00045 PwmOutSpeaker audio; 00046 bool _skip; 00047 bool _pause; 00048 uint8_t *_audio_buf; 00049 std::map<std::string, EasyDecoder*(*)()> m_lpDecoders; 00050 00051 EasyDecoder * create_decoer_class(const char* filename); 00052 }; 00053 00054 #endif
Generated on Thu Jul 14 2022 19:20:17 by
1.7.2