fixed: font rendering

This commit is contained in:
Bob van Loosen 2012-12-19 21:21:52 +01:00
parent ae1da3ab99
commit 26811b5d99
2 changed files with 149 additions and 340 deletions

View file

@ -50,18 +50,10 @@ CBitVis::CBitVis(int argc, char *argv[])
m_decay = 0.5; m_decay = 0.5;
m_fontheight = 0; m_fontheight = 0;
for (int i = 0; i < 128; i++) InitChars();
{
const unsigned int* dchar = GetChar(i);
if (dchar)
{
int charheight = CharHeight(dchar);
if (charheight > m_fontheight)
m_fontheight = charheight;
}
}
m_nrlines = 48 - m_fontheight - 1; m_nrlines = 48 - m_fontheight - 1;
m_scrolloffset = 0;
} }
CBitVis::~CBitVis() CBitVis::~CBitVis()
@ -336,24 +328,10 @@ void CBitVis::SendData(int64_t time)
uint8_t text[m_nrcolumns / 4 * m_fontheight]; uint8_t text[m_nrcolumns / 4 * m_fontheight];
memset(text, 0, sizeof(text)); memset(text, 0, sizeof(text));
AddText(text, "Now Playing");
//add an empty line //add an empty line
data.SetData(text, m_nrcolumns / 4, true); data.SetData(text, m_nrcolumns / 4, true);
/*const unsigned int* dchar = GetChar('b'); SetText(text, "Wat? No money? Hier! Suck a cock!");
for (int i = 0; i < m_fontheight; i++)
{
for (int j = 0; j < 4; j++)
{
if (dchar[3 - j] & (1 << (m_fontheight - i - 1)))
text[m_nrcolumns / 4 * i] |= 1 << (j * 2);
if (dchar[7 - j] & (1 << (m_fontheight - i - 1)))
text[m_nrcolumns / 4 * i + 1] |= 1 << (j * 2);
}
}*/
data.SetData(text, sizeof(text), true); data.SetData(text, sizeof(text), true);
uint8_t end[10]; uint8_t end[10];
@ -369,11 +347,37 @@ void CBitVis::SendData(int64_t time)
} }
} }
void CBitVis::AddText(uint8_t* buff, const char* str) void CBitVis::SetText(uint8_t* buff, const char* str, int offset /*= 0*/)
{ {
int length = strlen(str); int length = strlen(str);
for (int currchar = 0; currchar < length; currchar++) int charpos = offset + m_scrolloffset;
int pixlength = 0;
for (int i = 0; i < length; i++)
{
vector<unsigned int>& dchar = m_glyphs[str[i]];
for (size_t j = 0; j < dchar.size(); j++)
{
if (charpos >= 0 && charpos < m_nrcolumns)
{
for (int k = 0; k < m_fontheight; k++)
{
int bit = (dchar[j] >> k) & 1;
buff[charpos / 4 + m_nrcolumns / 4 * (m_fontheight - k - 1)] |= bit << (6 - ((charpos % 4) * 2));
}
}
charpos++;
pixlength++;
}
charpos++;
pixlength++;
}
m_scrolloffset--;
if (m_scrolloffset < -pixlength)
m_scrolloffset = m_nrcolumns;
/*for (int currchar = 0; currchar < length; currchar++)
{ {
const unsigned int* dchar = GetChar(str[currchar]); const unsigned int* dchar = GetChar(str[currchar]);
if (dchar) if (dchar)
@ -390,321 +394,120 @@ void CBitVis::AddText(uint8_t* buff, const char* str)
} }
} }
} }
} }*/
} }
const unsigned int* CBitVis::GetChar(char in) void CBitVis::InitChars()
{ {
static const char letter[] = #define GLYPH(index, pixels)\
{ {\
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', const unsigned int* pixarr = pixels;\
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', std::vector<unsigned int> pixelvec;\
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', int charheight = CharHeight(pixarr);\
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', if (m_fontheight < charheight)\
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ',', '.', '/', m_fontheight = charheight;\
'<', '>', '?', ';', '\'', ':', '"', '[', ']', '\\', '{', '}', '|', for (size_t i = 0; i < sizeof(pixels) / sizeof(pixels[0]); i++)\
'`', '-', '=', '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', {\
')', '_', '+', ' ' pixelvec.push_back(pixarr[i]);\
}; }\
m_glyphs[index].swap(pixelvec);\
}\
static const unsigned int letterData[][8] = GLYPH('a', ((const unsigned int[]){0x18, 0xbc, 0xa4, 0xa4, 0xf8, 0x7c, 0x4}))
{ GLYPH('b', ((const unsigned int[]){0x400, 0x7fc, 0x7fc, 0x84, 0xc4, 0x7c, 0x38}))
{ GLYPH('c', ((const unsigned int[]){0x78, 0xfc, 0x84, 0x84, 0x84, 0xcc, 0x48}))
0x18, 0xbc, 0xa4, 0xa4, 0xf8, 0x7c, 0x4, GLYPH('d', ((const unsigned int[]){0x38, 0x7c, 0xc4, 0x484, 0x7f8, 0x7fc, 0x4}))
}, GLYPH('e', ((const unsigned int[]){0x78, 0xfc, 0xa4, 0xa4, 0xa4, 0xec, 0x68}))
{ GLYPH('f', ((const unsigned int[]){0x44, 0x3fc, 0x7fc, 0x444, 0x600, 0x300}))
0x400, 0x7fc, 0x7fc, 0x84, 0xc4, 0x7c, 0x38, GLYPH('g', ((const unsigned int[]){0x72, 0xfb, 0x89, 0x89, 0x7f, 0xfe, 0x80}))
}, GLYPH('h', ((const unsigned int[]){0x404, 0x7fc, 0x7fc, 0x40, 0x80, 0xfc, 0x7c}))
{ GLYPH('i', ((const unsigned int[]){0x84, 0x6fc, 0x6fc, 0x4}))
0x78, 0xfc, 0x84, 0x84, 0x84, 0xcc, 0x48, GLYPH('j', ((const unsigned int[]){0x6, 0x7, 0x1, 0x81, 0x6ff, 0x6fe}))
}, GLYPH('k', ((const unsigned int[]){0x404, 0x7fc, 0x7fc, 0x20, 0x70, 0xdc, 0x8c}))
{ GLYPH('l', ((const unsigned int[]){0x404, 0x7fc, 0x7fc, 0x4}))
0x38, 0x7c, 0xc4, 0x484, 0x7f8, 0x7fc, 0x4, GLYPH('m', ((const unsigned int[]){0xfc, 0xfc, 0xc0, 0x78, 0xc0, 0xfc, 0x7c}))
}, GLYPH('n', ((const unsigned int[]){0x80, 0xfc, 0x7c, 0x80, 0x80, 0xfc, 0x7c}))
{ GLYPH('o', ((const unsigned int[]){0x78, 0xfc, 0x84, 0x84, 0x84, 0xfc, 0x78}))
0x78, 0xfc, 0xa4, 0xa4, 0xa4, 0xec, 0x68, GLYPH('p', ((const unsigned int[]){0x81, 0xff, 0x7f, 0x89, 0x88, 0xf8, 0x70}))
}, GLYPH('q', ((const unsigned int[]){0x70, 0xf8, 0x88, 0x89, 0x7f, 0xff, 0x81}))
{ GLYPH('r', ((const unsigned int[]){0x84, 0xfc, 0x7c, 0xc4, 0x80, 0xe0, 0x60}))
0x44, 0x3fc, 0x7fc, 0x444, 0x600, 0x300, GLYPH('s', ((const unsigned int[]){0x48, 0xec, 0xa4, 0xb4, 0x94, 0xdc, 0x48}))
}, GLYPH('t', ((const unsigned int[]){0x80, 0x80, 0x3f8, 0x7fc, 0x84, 0x8c, 0x8}))
{ GLYPH('u', ((const unsigned int[]){0xf8, 0xfc, 0x4, 0x4, 0xf8, 0xfc, 0x4}))
0x72, 0xfb, 0x89, 0x89, 0x7f, 0xfe, 0x80, GLYPH('v', ((const unsigned int[]){0xf0, 0xf8, 0xc, 0xc, 0xf8, 0xf0}))
}, GLYPH('w', ((const unsigned int[]){0xf8, 0xfc, 0xc, 0x38, 0xc, 0xfc, 0xf8}))
{ GLYPH('x', ((const unsigned int[]){0x84, 0xcc, 0x78, 0x30, 0x78, 0xcc, 0x84}))
0x404, 0x7fc, 0x7fc, 0x40, 0x80, 0xfc, 0x7c, GLYPH('y', ((const unsigned int[]){0xf1, 0xf9, 0x9, 0x9, 0xb, 0xfe, 0xfc}))
}, GLYPH('z', ((const unsigned int[]){0xc4, 0xcc, 0x9c, 0xb4, 0xe4, 0xcc, 0x8c}))
{ GLYPH('A', ((const unsigned int[]){0xfc, 0x1fc, 0x320, 0x620, 0x320, 0x1fc, 0xfc}))
0x84, 0x6fc, 0x6fc, 0x4, GLYPH('B', ((const unsigned int[]){0x404, 0x7fc, 0x7fc, 0x444, 0x444, 0x7fc, 0x3b8}))
}, GLYPH('C', ((const unsigned int[]){0x1f0, 0x3f8, 0x60c, 0x404, 0x404, 0x60c, 0x318}))
{ GLYPH('D', ((const unsigned int[]){0x404, 0x7fc, 0x7fc, 0x404, 0x60c, 0x3f8, 0x1f0}))
0x6, 0x7, 0x1, 0x81, 0x6ff, 0x6fe, GLYPH('E', ((const unsigned int[]){0x404, 0x7fc, 0x7fc, 0x444, 0x4e4, 0x60c, 0x71c}))
}, GLYPH('F', ((const unsigned int[]){0x404, 0x7fc, 0x7fc, 0x444, 0x4e0, 0x600, 0x700}))
{ GLYPH('G', ((const unsigned int[]){0x1f0, 0x3f8, 0x60c, 0x424, 0x424, 0x638, 0x33c}))
0x404, 0x7fc, 0x7fc, 0x20, 0x70, 0xdc, 0x8c, GLYPH('H', ((const unsigned int[]){0x7fc, 0x7fc, 0x40, 0x40, 0x40, 0x7fc, 0x7fc}))
}, GLYPH('I', ((const unsigned int[]){0x404, 0x7fc, 0x7fc, 0x404}))
{ GLYPH('J', ((const unsigned int[]){0x18, 0x1c, 0x4, 0x404, 0x7fc, 0x7f8, 0x400}))
0x404, 0x7fc, 0x7fc, 0x4, GLYPH('K', ((const unsigned int[]){0x404, 0x7fc, 0x7fc, 0x40, 0x1f0, 0x7bc, 0x60c}))
}, GLYPH('L', ((const unsigned int[]){0x404, 0x7fc, 0x7fc, 0x404, 0x4, 0xc, 0x1c}))
{ GLYPH('M', ((const unsigned int[]){0x7fc, 0x7fc, 0x380, 0x1c0, 0x380, 0x7fc, 0x7fc}))
0xfc, 0xfc, 0xc0, 0x78, 0xc0, 0xfc, 0x7c, GLYPH('N', ((const unsigned int[]){0x7fc, 0x7fc, 0x380, 0x1c0, 0xe0, 0x7fc, 0x7fc}))
}, GLYPH('O', ((const unsigned int[]){0x1f0, 0x3f8, 0x60c, 0x404, 0x60c, 0x3f8, 0x1f0}))
{ GLYPH('P', ((const unsigned int[]){0x404, 0x7fc, 0x7fc, 0x444, 0x440, 0x7c0, 0x380}))
0x80, 0xfc, 0x7c, 0x80, 0x80, 0xfc, 0x7c, GLYPH('Q', ((const unsigned int[]){0x3f0, 0x7f8, 0x408, 0x438, 0x41e, 0x7fe, 0x3f2}))
}, GLYPH('R', ((const unsigned int[]){0x404, 0x7fc, 0x7fc, 0x440, 0x460, 0x7fc, 0x39c}))
{ GLYPH('S', ((const unsigned int[]){0x318, 0x79c, 0x4c4, 0x444, 0x464, 0x73c, 0x318}))
0x78, 0xfc, 0x84, 0x84, 0x84, 0xfc, 0x78, GLYPH('T', ((const unsigned int[]){0x700, 0x604, 0x7fc, 0x7fc, 0x604, 0x700}))
}, GLYPH('U', ((const unsigned int[]){0x7f8, 0x7fc, 0x4, 0x4, 0x4, 0x7fc, 0x7f8}))
{ GLYPH('V', ((const unsigned int[]){0x7e0, 0x7f0, 0x18, 0xc, 0x18, 0x7f0, 0x7e0}))
0x81, 0xff, 0x7f, 0x89, 0x88, 0xf8, 0x70, GLYPH('W', ((const unsigned int[]){0x7f0, 0x7fc, 0x1c, 0x78, 0x1c, 0x7fc, 0x7f0}))
}, GLYPH('X', ((const unsigned int[]){0x60c, 0x71c, 0x1f0, 0xe0, 0x1f0, 0x71c, 0x60c}))
{ GLYPH('Y', ((const unsigned int[]){0x780, 0x7c4, 0x7c, 0x7c, 0x7c4, 0x780}))
0x70, 0xf8, 0x88, 0x89, 0x7f, 0xff, 0x81, GLYPH('Z', ((const unsigned int[]){0x71c, 0x63c, 0x464, 0x4c4, 0x584, 0x70c, 0x61c}))
}, GLYPH('0', ((const unsigned int[]){0x3f8, 0x7fc, 0x464, 0x4c4, 0x584, 0x7fc, 0x3f8}))
{ GLYPH('1', ((const unsigned int[]){0x104, 0x304, 0x7fc, 0x7fc, 0x4, 0x4}))
0x84, 0xfc, 0x7c, 0xc4, 0x80, 0xe0, 0x60, GLYPH('2', ((const unsigned int[]){0x20c, 0x61c, 0x434, 0x464, 0x4c4, 0x78c, 0x30c}))
}, GLYPH('3', ((const unsigned int[]){0x208, 0x60c, 0x444, 0x444, 0x444, 0x7fc, 0x3b8}))
{ GLYPH('4', ((const unsigned int[]){0x60, 0xe0, 0x1a0, 0x324, 0x7fc, 0x7fc, 0x24}))
0x48, 0xec, 0xa4, 0xb4, 0x94, 0xdc, 0x48, GLYPH('5', ((const unsigned int[]){0x7c8, 0x7cc, 0x444, 0x444, 0x444, 0x47c, 0x438}))
}, GLYPH('6', ((const unsigned int[]){0x1f8, 0x3fc, 0x644, 0x444, 0x444, 0x7c, 0x38}))
{ GLYPH('7', ((const unsigned int[]){0x600, 0x600, 0x43c, 0x47c, 0x4c0, 0x780, 0x700}))
0x80, 0x80, 0x3f8, 0x7fc, 0x84, 0x8c, 0x8, GLYPH('8', ((const unsigned int[]){0x3b8, 0x7fc, 0x444, 0x444, 0x444, 0x7fc, 0x3b8}))
}, GLYPH('9', ((const unsigned int[]){0x380, 0x7c4, 0x444, 0x444, 0x44c, 0x7f8, 0x3f0}))
{ GLYPH(',', ((const unsigned int[]){0x4, 0x3c, 0x38}))
0xf8, 0xfc, 0x4, 0x4, 0xf8, 0xfc, 0x4, GLYPH('.', ((const unsigned int[]){0x18, 0x18}))
}, GLYPH('/', ((const unsigned int[]){0x30, 0x60, 0xc0, 0x180, 0x300, 0x600, 0xc00}))
{ GLYPH('<', ((const unsigned int[]){0x80, 0x1c0, 0x360, 0x630, 0xc18, 0x808}))
0xf0, 0xf8, 0xc, 0xc, 0xf8, 0xf0, GLYPH('>', ((const unsigned int[]){0x808, 0xc18, 0x630, 0x360, 0x1c0, 0x80}))
}, GLYPH('?', ((const unsigned int[]){0x600, 0xe00, 0x800, 0x8d8, 0x9d8, 0xf00, 0x600}))
{ GLYPH(';', ((const unsigned int[]){0x8, 0x638, 0x630}))
0xf8, 0xfc, 0xc, 0x38, 0xc, 0xfc, 0xf8, GLYPH('\'', ((const unsigned int[]){0x200, 0x1e00, 0x1c00}))
}, GLYPH(':', ((const unsigned int[]){0x630, 0x630}))
{ GLYPH('"', ((const unsigned int[]){0x1c00, 0x1e00, 0x0, 0x0, 0x1e00, 0x1c00}))
0x84, 0xcc, 0x78, 0x30, 0x78, 0xcc, 0x84, GLYPH('[', ((const unsigned int[]){0xff8, 0xff8, 0x808, 0x808}))
}, GLYPH(']', ((const unsigned int[]){0x808, 0x808, 0xff8, 0xff8}))
{ GLYPH('\\', ((const unsigned int[]){0xe00, 0x700, 0x380, 0x1c0, 0xe0, 0x70, 0x38}))
0xf1, 0xf9, 0x9, 0x9, 0xb, 0xfe, 0xfc, GLYPH('{', ((const unsigned int[]){0x80, 0x80, 0x7f0, 0xf78, 0x808, 0x808}))
}, GLYPH('}', ((const unsigned int[]){0x808, 0x808, 0xf78, 0x7f0, 0x80, 0x80}))
{ GLYPH('|', ((const unsigned int[]){0xf78, 0xf78}))
0xc4, 0xcc, 0x9c, 0xb4, 0xe4, 0xcc, 0x8c, GLYPH('`', ((const unsigned int[]){0x3000, 0x3800, 0x800}))
}, GLYPH('-', ((const unsigned int[]){0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80}))
{ GLYPH('=', ((const unsigned int[]){0x120, 0x120, 0x120, 0x120, 0x120, 0x120}))
0xfc, 0x1fc, 0x320, 0x620, 0x320, 0x1fc, 0xfc, GLYPH('~', ((const unsigned int[]){0x400, 0xc00, 0x800, 0xc00, 0x400, 0xc00, 0x800}))
}, GLYPH('!', ((const unsigned int[]){0x700, 0xfd8, 0xfd8, 0x700}))
{ GLYPH('@', ((const unsigned int[]){0x7f0, 0xff8, 0x808, 0x9e8, 0x9e8, 0xfe8, 0x7c0}))
0x404, 0x7fc, 0x7fc, 0x444, 0x444, 0x7fc, 0x3b8, GLYPH('#', ((const unsigned int[]){0x220, 0xff8, 0xff8, 0x220, 0xff8, 0xff8, 0x220}))
}, GLYPH('$', ((const unsigned int[]){0x730, 0xf98, 0x888, 0x388e, 0x388e, 0xcf8, 0x670}))
{ GLYPH('%', ((const unsigned int[]){0x308, 0x318, 0x30, 0x60, 0xc0, 0x198, 0x318}))
0x1f0, 0x3f8, 0x60c, 0x404, 0x404, 0x60c, 0x318, GLYPH('^', ((const unsigned int[]){0x400, 0xc00, 0x1800, 0x3000, 0x1800, 0xc00, 0x400}))
}, GLYPH('&', ((const unsigned int[]){0x70, 0x6f8, 0xf88, 0x9c8, 0xf70, 0x6f8, 0x88}))
{ GLYPH('*', ((const unsigned int[]){0x80, 0x2a0, 0x3e0, 0x1c0, 0x1c0, 0x3e0, 0x2a0, 0x80}))
0x404, 0x7fc, 0x7fc, 0x404, 0x60c, 0x3f8, 0x1f0, GLYPH('(', ((const unsigned int[]){0x3e0, 0x7f0, 0xc18, 0x808}))
}, GLYPH(')', ((const unsigned int[]){0x808, 0xc18, 0x7f0, 0x3e0}))
{ GLYPH('_', ((const unsigned int[]){0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2}))
0x404, 0x7fc, 0x7fc, 0x444, 0x4e4, 0x60c, 0x71c, GLYPH('+', ((const unsigned int[]){0x80, 0x80, 0x3e0, 0x3e0, 0x80, 0x80}))
}, GLYPH(' ', ((const unsigned int[]){0x0, 0x0, 0x0}))
{
0x404, 0x7fc, 0x7fc, 0x444, 0x4e0, 0x600, 0x700,
},
{
0x1f0, 0x3f8, 0x60c, 0x424, 0x424, 0x638, 0x33c,
},
{
0x7fc, 0x7fc, 0x40, 0x40, 0x40, 0x7fc, 0x7fc,
},
{
0x404, 0x7fc, 0x7fc, 0x404,
},
{
0x18, 0x1c, 0x4, 0x404, 0x7fc, 0x7f8, 0x400,
},
{
0x404, 0x7fc, 0x7fc, 0x40, 0x1f0, 0x7bc, 0x60c,
},
{
0x404, 0x7fc, 0x7fc, 0x404, 0x4, 0xc, 0x1c,
},
{
0x7fc, 0x7fc, 0x380, 0x1c0, 0x380, 0x7fc, 0x7fc,
},
{
0x7fc, 0x7fc, 0x380, 0x1c0, 0xe0, 0x7fc, 0x7fc,
},
{
0x1f0, 0x3f8, 0x60c, 0x404, 0x60c, 0x3f8, 0x1f0,
},
{
0x404, 0x7fc, 0x7fc, 0x444, 0x440, 0x7c0, 0x380,
},
{
0x3f0, 0x7f8, 0x408, 0x438, 0x41e, 0x7fe, 0x3f2,
},
{
0x404, 0x7fc, 0x7fc, 0x440, 0x460, 0x7fc, 0x39c,
},
{
0x318, 0x79c, 0x4c4, 0x444, 0x464, 0x73c, 0x318,
},
{
0x700, 0x604, 0x7fc, 0x7fc, 0x604, 0x700,
},
{
0x7f8, 0x7fc, 0x4, 0x4, 0x4, 0x7fc, 0x7f8,
},
{
0x7e0, 0x7f0, 0x18, 0xc, 0x18, 0x7f0, 0x7e0,
},
{
0x7f0, 0x7fc, 0x1c, 0x78, 0x1c, 0x7fc, 0x7f0,
},
{
0x60c, 0x71c, 0x1f0, 0xe0, 0x1f0, 0x71c, 0x60c,
},
{
0x780, 0x7c4, 0x7c, 0x7c, 0x7c4, 0x780,
},
{
0x71c, 0x63c, 0x464, 0x4c4, 0x584, 0x70c, 0x61c,
},
{
0x3f8, 0x7fc, 0x464, 0x4c4, 0x584, 0x7fc, 0x3f8,
},
{
0x104, 0x304, 0x7fc, 0x7fc, 0x4, 0x4,
},
{
0x20c, 0x61c, 0x434, 0x464, 0x4c4, 0x78c, 0x30c,
},
{
0x208, 0x60c, 0x444, 0x444, 0x444, 0x7fc, 0x3b8,
},
{
0x60, 0xe0, 0x1a0, 0x324, 0x7fc, 0x7fc, 0x24,
},
{
0x7c8, 0x7cc, 0x444, 0x444, 0x444, 0x47c, 0x438,
},
{
0x1f8, 0x3fc, 0x644, 0x444, 0x444, 0x7c, 0x38,
},
{
0x600, 0x600, 0x43c, 0x47c, 0x4c0, 0x780, 0x700,
},
{
0x3b8, 0x7fc, 0x444, 0x444, 0x444, 0x7fc, 0x3b8,
},
{
0x380, 0x7c4, 0x444, 0x444, 0x44c, 0x7f8, 0x3f0,
},
{
0x4, 0x3c, 0x38,
},
{
0x18, 0x18,
},
{
0x30, 0x60, 0xc0, 0x180, 0x300, 0x600, 0xc00,
},
{
0x80, 0x1c0, 0x360, 0x630, 0xc18, 0x808,
},
{
0x808, 0xc18, 0x630, 0x360, 0x1c0, 0x80,
},
{
0x600, 0xe00, 0x800, 0x8d8, 0x9d8, 0xf00, 0x600,
},
{
0x8, 0x638, 0x630,
},
{
0x200, 0x1e00, 0x1c00,
},
{
0x630, 0x630,
},
{
0x1c00, 0x1e00, 0x0, 0x0, 0x1e00, 0x1c00,
},
{
0xff8, 0xff8, 0x808, 0x808,
},
{
0x808, 0x808, 0xff8, 0xff8,
},
{
0xe00, 0x700, 0x380, 0x1c0, 0xe0, 0x70, 0x38,
},
{
0x80, 0x80, 0x7f0, 0xf78, 0x808, 0x808,
},
{
0x808, 0x808, 0xf78, 0x7f0, 0x80, 0x80,
},
{
0xf78, 0xf78,
},
{
0x3000, 0x3800, 0x800,
},
{
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
},
{
0x120, 0x120, 0x120, 0x120, 0x120, 0x120,
},
{
0x400, 0xc00, 0x800, 0xc00, 0x400, 0xc00, 0x800,
},
{
0x700, 0xfd8, 0xfd8, 0x700,
},
{
0x7f0, 0xff8, 0x808, 0x9e8, 0x9e8, 0xfe8, 0x7c0,
},
{
0x220, 0xff8, 0xff8, 0x220, 0xff8, 0xff8, 0x220,
},
{
0x730, 0xf98, 0x888, 0x388e, 0x388e, 0xcf8, 0x670,
},
{
0x308, 0x318, 0x30, 0x60, 0xc0, 0x198, 0x318,
},
{
0x400, 0xc00, 0x1800, 0x3000, 0x1800, 0xc00, 0x400,
},
{
0x70, 0x6f8, 0xf88, 0x9c8, 0xf70, 0x6f8, 0x88,
},
{
0x80, 0x2a0, 0x3e0, 0x1c0, 0x1c0, 0x3e0, 0x2a0, 0x80,
},
{
0x3e0, 0x7f0, 0xc18, 0x808,
},
{
0x808, 0xc18, 0x7f0, 0x3e0,
},
{
0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2,
},
{
0x80, 0x80, 0x3e0, 0x3e0, 0x80, 0x80,
},
{
0x0, 0x0, 0x0,
},
};
assert((sizeof(letter) / sizeof(letter[0])) <= (sizeof(letterData) / sizeof(letterData[0])));
for (size_t i = 0; i < sizeof(letter) / sizeof(letter[0]); i++)
{
if (letter[i] == in)
return letterData[i];
}
return NULL;
} }
int CBitVis::CharHeight(const unsigned int* in) int CBitVis::CharHeight(const unsigned int* in)

View file

@ -19,6 +19,9 @@
#ifndef BITVIS_H #ifndef BITVIS_H
#define BITVIS_H #define BITVIS_H
#include <map>
#include <vector>
#include "jackclient.h" #include "jackclient.h"
#include "fft.h" #include "fft.h"
#include "util/tcpsocket.h" #include "util/tcpsocket.h"
@ -49,6 +52,7 @@ class CBitVis
int m_nrlines; int m_nrlines;
float m_decay; float m_decay;
int m_fontheight; int m_fontheight;
int m_scrolloffset;
struct peak struct peak
{ {
@ -60,13 +64,15 @@ class CBitVis
CTcpClientSocket m_socket; CTcpClientSocket m_socket;
std::map<char, std::vector<unsigned int> > m_glyphs;
void SetupSignals(); void SetupSignals();
void ProcessSignalfd(); void ProcessSignalfd();
void ProcessAudio(); void ProcessAudio();
void SendData(int64_t time); void SendData(int64_t time);
void AddText(uint8_t* buff, const char* str); void SetText(uint8_t* buff, const char* str, int offset = 0);
const unsigned int* GetChar(char in);
int CharHeight(const unsigned int* in); int CharHeight(const unsigned int* in);
void InitChars();
static void JackError(const char* jackerror); static void JackError(const char* jackerror);
static void JackInfo(const char* jackinfo); static void JackInfo(const char* jackinfo);
}; };