代码拉取完成,页面将自动刷新
同步操作将从 mingyee/Arduino_ESP32_LyricBox 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include <Arduino.h>
#include "MusicSpectrum.h"
NS_DT_BEGIN
const uint8_t icon_music[] PROGMEM =
{
0x00,0x3F,0x21,0x21,0x21,0xE7,0xE7,0x00
};
// uint8_t frame_freq_spec[20][32] = {
// {1,2,5,4,7,4,4,1,7,5,1,0,2,1,1,5,7,0,7,4,1,1,2,2,1,0,2,3,1,1,2,0},
// {1,2,2,3,7,1,0,1,4,7,3,3,0,4,3,1,6,2,0,4,2,3,4,3,0,1,3,4,3,2,1,1},
// {3,4,2,4,7,5,1,0,7,3,2,4,0,4,0,3,3,0,2,2,3,2,2,4,2,3,2,4,2,2,3,0},
// {2,1,5,5,0,2,1,1,3,6,3,2,0,4,4,0,2,3,3,1,1,2,1,1,3,2,7,3,4,1,4,2},
// {1,6,3,2,7,3,0,3,2,3,5,1,1,3,3,4,2,3,3,1,2,1,2,0,3,1,0,1,2,0,1,0},
// {4,7,6,5,2,4,5,1,2,3,1,1,1,1,2,4,2,1,3,2,4,1,0,2,2,3,0,1,1,4,1,2},
// {4,6,1,4,7,5,2,4,2,4,4,6,3,5,4,2,3,0,1,3,2,1,2,1,0,1,2,1,2,2,3,1},
// {4,2,4,3,7,2,6,2,1,1,1,1,0,3,2,1,0,1,3,3,1,2,1,2,2,1,1,2,0,2,4,2},
// {4,2,4,0,3,7,1,2,3,5,6,7,3,2,0,1,2,4,1,2,2,1,7,2,0,3,2,2,1,1,1,3},
// {4,1,0,4,3,7,1,1,3,2,4,5,2,5,5,1,2,0,4,4,0,1,1,1,3,7,2,1,1,2,5,3},
// {4,2,1,1,1,6,7,4,3,3,1,3,3,2,1,5,6,3,2,1,1,0,3,3,2,2,2,2,1,3,1,4},
// {4,4,1,3,0,3,7,5,3,5,4,3,0,3,2,2,5,6,4,1,1,3,1,4,1,1,2,2,2,2,2,2},
// {0,3,3,1,1,7,7,2,2,5,1,1,1,0,2,7,3,1,4,1,2,0,5,2,1,1,3,1,2,0,1,0},
// {6,2,4,5,2,6,3,5,3,2,3,3,3,1,3,1,5,2,1,2,2,1,4,2,2,4,3,2,3,4,5,1},
// {2,7,5,0,2,3,5,1,6,4,4,3,4,5,1,2,2,3,2,2,4,0,1,3,1,3,1,0,2,3,1,1},
// {6,2,1,2,2,6,2,2,2,2,3,4,3,5,5,2,5,5,2,3,1,1,2,3,2,1,1,2,1,1,0,5},
// {6,3,3,7,2,3,3,4,2,4,3,2,0,4,5,3,3,0,4,3,2,3,4,0,3,2,0,0,1,3,3,4},
// {4,7,2,3,3,2,1,1,0,3,1,1,1,1,2,1,1,3,2,1,0,2,1,3,0,3,2,3,1,3,3,1},
// {4,6,2,7,5,5,1,3,3,7,2,1,4,4,5,2,1,1,0,4,4,0,1,0,3,1,1,1,2,2,2,1},
// {2,1,3,5,7,0,4,4,5,2,2,4,4,5,4,1,2,3,2,3,4,0,1,1,2,3,0,2,1,4,2,1}
// };
bool MusicSpectrum::init()
{
MusicSpectrumLayer *rootLayer = MusicSpectrumLayer::create();
rootLayer->setContentSize(Size(MATRIX_WIDTH,MATRIX_HEIGHT));
this->addChild(rootLayer);
rootLayer->initLayer();
return true;
}
MusicSpectrumLayer::~MusicSpectrumLayer()
{
}
bool MusicSpectrumLayer::initLayer()
{
Size size = this->getContentSize();
CanvasSprite *canvasSprite = CanvasSprite::create(size.width,size.height);
this->addChild(canvasSprite);
//this->scheduleUpdate();
canvas = canvasSprite->getSpriteCanvas();
canvas->drawPixel(8,0,DTRGB(0xff,0,0));
canvas->drawPixel(8,7,DTRGB(0x00,0xff,0));
canvas->drawPixel(47,15,DTRGB(0x00,0x00,0xff));
// canvas->fillScreen(DTRGB(0xEE,0x6A,0x50));
// MoveBy *move1 = MoveBy::create(6,Vec2(-47,0));
// MoveBy *move2 = MoveBy::create(6,Vec2(47,0));
// Sequence *seq = Sequence::createWithTwoActions(move1,move2);
// RepeatForever *rep = RepeatForever::create(seq);
// canvasSprite->runAction(rep);
// this->scheduleUpdate();
return true;
}
uint8_t peak_height[32];
uint8_t spec_height[32];
void MusicSpectrumLayer::update(float dt)
{
static uint8_t frame = 0;
uint8_t i = 0;
}
NS_DT_END
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。