this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: move stuff around so it fits better and move labels to their component

+68 -35
+68 -35
main.cpp
··· 50 50 51 51 // Station tracking 52 52 RadioStation* currentStation; 53 - 53 + 54 54 // VU meter levels (0.0 to 1.0) 55 55 float vuLevelLeft; 56 56 float vuLevelRight; ··· 447 447 DrawVolumeKnob(hdc, 350, 200, 30, g_radio.volume); 448 448 449 449 // Draw signal meter 450 - DrawSignalMeter(hdc, 450, 150, g_radio.signalStrength); 451 - 450 + DrawSignalMeter(hdc, 450, 170, g_radio.signalStrength); 451 + 452 452 // Draw VU meter 453 - DrawVUMeter(hdc, 450, 180, g_audio.vuLevelLeft, g_audio.vuLevelRight); 453 + DrawVUMeter(hdc, 450, 200, g_audio.vuLevelLeft, g_audio.vuLevelRight); 454 454 455 455 // Draw power button 456 456 DrawPowerButton(hdc, 500, 120, 25, g_radio.power); ··· 485 485 DeleteObject(stationFont); 486 486 } 487 487 488 - // Draw labels 489 - SetBkMode(hdc, TRANSPARENT); 490 - SetTextColor(hdc, RGB(255, 255, 255)); 491 - HFONT font = CreateFont(14, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, 492 - DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, 493 - CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, 494 - DEFAULT_PITCH | FF_SWISS, "Arial"); 495 - SelectObject(hdc, font); 496 - 497 - TextOut(hdc, 180, 300, "TUNING", 6); 498 - TextOut(hdc, 330, 260, "VOLUME", 6); 499 - TextOut(hdc, 430, 200, "SIGNAL", 6); 500 - TextOut(hdc, 485, 160, "POWER", 5); 501 - 502 - DeleteObject(font); 503 488 } 504 489 505 490 void DrawFrequencyDisplay(HDC hdc, int x, int y, float frequency) { ··· 628 613 DeleteObject(pointerPen); 629 614 630 615 DeleteObject(smallFont); 616 + 617 + // Draw label below the dial 618 + SetBkMode(hdc, TRANSPARENT); 619 + SetTextColor(hdc, RGB(255, 255, 255)); 620 + HFONT labelFont = CreateFont(14, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, 621 + DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, 622 + CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, 623 + DEFAULT_PITCH | FF_SWISS, "Arial"); 624 + SelectObject(hdc, labelFont); 625 + SetTextAlign(hdc, TA_CENTER); 626 + TextOut(hdc, x, y + radius + 15, "TUNING", 6); 627 + DeleteObject(labelFont); 631 628 } 632 629 633 630 void DrawVolumeKnob(HDC hdc, int x, int y, int radius, float volume) { ··· 653 650 MoveToEx(hdc, x, y, NULL); 654 651 LineTo(hdc, indicatorX, indicatorY); 655 652 DeleteObject(indicatorPen); 653 + 654 + // Draw label below the knob 655 + SetBkMode(hdc, TRANSPARENT); 656 + SetTextColor(hdc, RGB(255, 255, 255)); 657 + HFONT labelFont = CreateFont(14, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, 658 + DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, 659 + CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, 660 + DEFAULT_PITCH | FF_SWISS, "Arial"); 661 + SelectObject(hdc, labelFont); 662 + SetTextAlign(hdc, TA_CENTER); 663 + TextOut(hdc, x, y + radius + 15, "VOLUME", 6); 664 + DeleteObject(labelFont); 656 665 } 657 666 658 667 void DrawSignalMeter(HDC hdc, int x, int y, int strength) { ··· 684 693 FillRect(hdc, &bar, barBrush); 685 694 DeleteObject(barBrush); 686 695 } 696 + 697 + // Draw label above the meter 698 + SetBkMode(hdc, TRANSPARENT); 699 + SetTextColor(hdc, RGB(255, 255, 255)); 700 + HFONT labelFont = CreateFont(14, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, 701 + DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, 702 + CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, 703 + DEFAULT_PITCH | FF_SWISS, "Arial"); 704 + SelectObject(hdc, labelFont); 705 + SetTextAlign(hdc, TA_LEFT); 706 + TextOut(hdc, x, y - 18, "SIGNAL", 6); 707 + DeleteObject(labelFont); 687 708 } 688 709 689 710 void DrawVUMeter(HDC hdc, int x, int y, float leftLevel, float rightLevel) { ··· 707 728 CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, 708 729 DEFAULT_PITCH | FF_SWISS, "Arial"); 709 730 SelectObject(hdc, smallFont); 710 - TextOut(hdc, x + 2, y + 2, "VU", 2); 731 + TextOut(hdc, x + 9, y + 2, "VU", 2); 711 732 712 733 // Draw left channel meter 713 734 int leftWidth = (int)(leftLevel * 70); 714 735 if (leftWidth > 0) { 715 736 RECT leftBar = {x + 5, y + 12, x + 5 + leftWidth, y + 18}; 716 - COLORREF leftColor = leftLevel > 0.8f ? RGB(255, 0, 0) : 737 + COLORREF leftColor = leftLevel > 0.8f ? RGB(255, 0, 0) : 717 738 leftLevel > 0.6f ? RGB(255, 255, 0) : RGB(0, 255, 0); 718 739 HBRUSH leftBrush = CreateSolidBrush(leftColor); 719 740 FillRect(hdc, &leftBar, leftBrush); ··· 724 745 int rightWidth = (int)(rightLevel * 70); 725 746 if (rightWidth > 0) { 726 747 RECT rightBar = {x + 5, y + 22, x + 5 + rightWidth, y + 28}; 727 - COLORREF rightColor = rightLevel > 0.8f ? RGB(255, 0, 0) : 748 + COLORREF rightColor = rightLevel > 0.8f ? RGB(255, 0, 0) : 728 749 rightLevel > 0.6f ? RGB(255, 255, 0) : RGB(0, 255, 0); 729 750 HBRUSH rightBrush = CreateSolidBrush(rightColor); 730 751 FillRect(hdc, &rightBar, rightBrush); 731 752 DeleteObject(rightBrush); 732 753 } 733 754 734 - // Draw channel labels 735 - TextOut(hdc, x + 77, y + 10, "L", 1); 736 - TextOut(hdc, x + 77, y + 20, "R", 1); 755 + // Draw channel labels (better positioned) 756 + TextOut(hdc, x + 77, y + 12, "L", 1); 757 + TextOut(hdc, x + 77, y + 22, "R", 1); 737 758 738 759 // Draw scale marks 739 760 HPEN scalePen = CreatePen(PS_SOLID, 1, RGB(80, 80, 80)); ··· 773 794 774 795 DeleteObject(symbolPen); 775 796 } 797 + 798 + // Draw label above the button 799 + SetBkMode(hdc, TRANSPARENT); 800 + SetTextColor(hdc, RGB(255, 255, 255)); 801 + HFONT labelFont = CreateFont(14, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, 802 + DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, 803 + CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, 804 + DEFAULT_PITCH | FF_SWISS, "Arial"); 805 + SelectObject(hdc, labelFont); 806 + SetTextAlign(hdc, TA_CENTER); 807 + TextOut(hdc, x, y - radius - 18, "POWER", 5); 808 + DeleteObject(labelFont); 776 809 } 777 810 778 811 int IsPointInCircle(int px, int py, int cx, int cy, int radius) { ··· 1025 1058 DWORD CALLBACK StaticStreamProc(HSTREAM handle, void* buffer, DWORD length, void* user) { 1026 1059 short* samples = (short*)buffer; 1027 1060 DWORD sampleCount = length / sizeof(short); 1028 - 1061 + 1029 1062 // Get current time for oscillation 1030 1063 static DWORD startTime = GetTickCount(); 1031 1064 DWORD currentTime = GetTickCount(); 1032 1065 float timeSeconds = (currentTime - startTime) / 1000.0f; 1033 - 1066 + 1034 1067 // Create subtle volume oscillations (5-7% variation) 1035 1068 // Use multiple sine waves at different frequencies for natural variation 1036 1069 float oscillation1 = sin(timeSeconds * 0.7f) * 0.03f; // 3% slow oscillation 1037 - float oscillation2 = sin(timeSeconds * 2.3f) * 0.02f; // 2% medium oscillation 1070 + float oscillation2 = sin(timeSeconds * 2.3f) * 0.02f; // 2% medium oscillation 1038 1071 float oscillation3 = sin(timeSeconds * 5.1f) * 0.015f; // 1.5% fast oscillation 1039 1072 float volumeVariation = 1.0f + oscillation1 + oscillation2 + oscillation3; 1040 - 1073 + 1041 1074 // Generate white noise with volume variation 1042 1075 for (DWORD i = 0; i < sampleCount; i++) { 1043 1076 // Generate random value between -32767 and 32767 1044 1077 short baseNoise = (short)((rand() % 65535) - 32767); 1045 - 1078 + 1046 1079 // Apply volume variation 1047 1080 samples[i] = (short)(baseNoise * volumeVariation); 1048 1081 } 1049 - 1082 + 1050 1083 return length; 1051 1084 } 1052 1085 ··· 1096 1129 // Initialize levels to zero 1097 1130 g_audio.vuLevelLeft = 0.0f; 1098 1131 g_audio.vuLevelRight = 0.0f; 1099 - 1132 + 1100 1133 // Get levels from current stream if playing 1101 1134 if (g_audio.currentStream && BASS_ChannelIsActive(g_audio.currentStream) == BASS_ACTIVE_PLAYING) { 1102 1135 DWORD level = BASS_ChannelGetLevel(g_audio.currentStream); ··· 1106 1139 g_audio.vuLevelRight = (float)HIWORD(level) / 32768.0f; 1107 1140 } 1108 1141 } 1109 - 1142 + 1110 1143 // Add static contribution if static is playing 1111 1144 if (g_audio.staticStream && BASS_ChannelIsActive(g_audio.staticStream) == BASS_ACTIVE_PLAYING) { 1112 1145 DWORD staticLevel = BASS_ChannelGetLevel(g_audio.staticStream); 1113 1146 if (staticLevel != -1) { 1114 1147 float staticLeft = (float)LOWORD(staticLevel) / 32768.0f; 1115 1148 float staticRight = (float)HIWORD(staticLevel) / 32768.0f; 1116 - 1149 + 1117 1150 // Combine with existing levels (simulate mixing) 1118 1151 g_audio.vuLevelLeft = fmin(1.0f, g_audio.vuLevelLeft + staticLeft * 0.3f); 1119 1152 g_audio.vuLevelRight = fmin(1.0f, g_audio.vuLevelRight + staticRight * 0.3f); 1120 1153 } 1121 1154 } 1122 - 1155 + 1123 1156 // Apply some smoothing/decay for more realistic VU behavior 1124 1157 static float lastLeft = 0.0f, lastRight = 0.0f; 1125 1158 g_audio.vuLevelLeft = g_audio.vuLevelLeft * 0.7f + lastLeft * 0.3f;