mirror of
https://github.com/clangen/musikcube.git
synced 2025-03-14 04:18:36 +00:00
Cleaned up some unused stuff in GdiVis and removed time smoothing for now.
This commit is contained in:
parent
f672446ebf
commit
b2e90b8d72
@ -17,9 +17,7 @@
|
||||
#define MILLIS_PER_FRAME (1000LL / MAX_FPS)
|
||||
#define WINDOW_CLASS_NAME L"GdiVis-musikcube"
|
||||
#define DEFAULT_WIDTH 550
|
||||
#define DEFAULT_HEIGHT 120
|
||||
#define TEXTURE_WIDTH 90
|
||||
#define TEXTURE_HEIGHT 80
|
||||
#define DEFAULT_HEIGHT 100
|
||||
|
||||
using namespace std::chrono;
|
||||
|
||||
@ -28,8 +26,6 @@ static std::atomic<bool> thread(false);
|
||||
static std::mutex pcmMutex, threadMutex;
|
||||
static std::condition_variable threadCondition;
|
||||
static HINSTANCE instance;
|
||||
static HBITMAP texture = nullptr;
|
||||
static COLORREF *textureBits = nullptr;
|
||||
static HBRUSH fg = CreateSolidBrush(RGB(255, 0, 0));
|
||||
static COLORREF bg = RGB(24, 24, 24);
|
||||
|
||||
@ -53,15 +49,10 @@ static void renderFrame(HWND hwnd) {
|
||||
|
||||
win32cpp::MemoryDC memDc(hdc, ps.rcPaint);
|
||||
|
||||
for (int n = 0; n < TEXTURE_WIDTH * TEXTURE_HEIGHT - 1; n++) {
|
||||
textureBits[n] = bg;
|
||||
}
|
||||
|
||||
RECT rect;
|
||||
|
||||
int barHeight;
|
||||
const int barWidth = 7;
|
||||
const int barY = 100;
|
||||
const int barY = DEFAULT_HEIGHT - 15;
|
||||
|
||||
int x = 20;
|
||||
int n = spectrumSize / 4;
|
||||
@ -163,22 +154,6 @@ static void threadProc() {
|
||||
return;
|
||||
}
|
||||
|
||||
BITMAPINFO bminfo;
|
||||
ZeroMemory(&bminfo, sizeof(BITMAPINFO));
|
||||
bminfo.bmiHeader.biWidth = TEXTURE_WIDTH;
|
||||
bminfo.bmiHeader.biHeight = TEXTURE_HEIGHT;
|
||||
bminfo.bmiHeader.biPlanes = 1;
|
||||
bminfo.bmiHeader.biBitCount = 32;
|
||||
bminfo.bmiHeader.biCompression = BI_RGB;
|
||||
bminfo.bmiHeader.biXPelsPerMeter = 0;
|
||||
bminfo.bmiHeader.biYPelsPerMeter = 0;
|
||||
bminfo.bmiHeader.biClrUsed = 0;
|
||||
bminfo.bmiHeader.biClrImportant = 0;
|
||||
bminfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bminfo.bmiHeader.biSizeImage = TEXTURE_WIDTH * TEXTURE_HEIGHT * 4;
|
||||
|
||||
texture = CreateDIBSection(NULL, &bminfo, DIB_RGB_COLORS, (void **)&textureBits, NULL, NULL);
|
||||
|
||||
ShowWindow(hwnd, SW_SHOW);
|
||||
|
||||
MSG msg;
|
||||
@ -206,10 +181,6 @@ static void threadProc() {
|
||||
}
|
||||
}
|
||||
|
||||
DeleteObject(texture);
|
||||
texture = nullptr;
|
||||
textureBits = nullptr;
|
||||
|
||||
thread.store(false);
|
||||
|
||||
{
|
||||
|
@ -168,7 +168,7 @@ void GaplessTransport::StopInternal(
|
||||
LockT lock(this->stateMutex);
|
||||
RESET_NEXT_PLAYER(this);
|
||||
|
||||
/* move all but the excluded player to the toDelete set. */
|
||||
/* destroy all but specified player */
|
||||
auto it = this->active.begin();
|
||||
while (it != this->active.end()) {
|
||||
if (*it != exclude) {
|
||||
|
@ -186,10 +186,7 @@ int Player::State() {
|
||||
|
||||
namespace musik { namespace core { namespace audio {
|
||||
void playerThreadLoop(Player* player) {
|
||||
/* fixed size streams are better for visualizations because they provide
|
||||
consistent buffer sizes. dynamic streams are more efficient otherwise
|
||||
because we don't need to worry about manually chunking data, we can just
|
||||
send audio data to the output straight from the decoder. */
|
||||
|
||||
player->stream = Stream::Create();
|
||||
|
||||
BufferPtr buffer;
|
||||
@ -340,7 +337,7 @@ namespace musik { namespace core { namespace audio {
|
||||
} } }
|
||||
|
||||
void Player::ReleaseAllBuffers() {
|
||||
std::unique_lock<std::mutex> lock(this->queueMutex);
|
||||
std::unique_lock<std::mutex> lock(this->queueMutex);
|
||||
this->lockedBuffers.empty();
|
||||
}
|
||||
|
||||
@ -350,7 +347,7 @@ bool Player::PreBuffer() {
|
||||
BufferPtr newBuffer = this->stream->GetNextProcessedOutputBuffer();
|
||||
|
||||
if (newBuffer) {
|
||||
std::unique_lock<std::mutex> lock(this->queueMutex);
|
||||
std::unique_lock<std::mutex> lock(this->queueMutex);
|
||||
this->prebufferQueue.push_back(newBuffer);
|
||||
}
|
||||
|
||||
@ -361,7 +358,7 @@ bool Player::PreBuffer() {
|
||||
}
|
||||
|
||||
bool Player::Exited() {
|
||||
std::unique_lock<std::mutex> lock(this->queueMutex);
|
||||
std::unique_lock<std::mutex> lock(this->queueMutex);
|
||||
return (this->state == Player::Quit);
|
||||
}
|
||||
|
||||
@ -440,7 +437,7 @@ void Player::OnBufferProcessed(IBuffer *buffer) {
|
||||
/* free the buffer */
|
||||
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(this->queueMutex);
|
||||
std::unique_lock<std::mutex> lock(this->queueMutex);
|
||||
|
||||
/* removes the specified buffer from the list of locked buffers, and also
|
||||
lets the stream know it can be recycled. */
|
||||
|
@ -478,7 +478,7 @@ void TransportWindow::Update(TimeMode timeMode) {
|
||||
only works if REFRESH_INTERVAL_MS is 1000. */
|
||||
int secondsCurrent = (int) round(this->lastTime); /* mode == TimeLast */
|
||||
|
||||
if (timeMode == TimeSmooth) {
|
||||
if (false && timeMode == TimeSmooth) {
|
||||
double smoothedTime = this->lastTime += 1.0f; /* 1000 millis */
|
||||
double actualTime = transport.Position();
|
||||
|
||||
@ -491,7 +491,7 @@ void TransportWindow::Update(TimeMode timeMode) {
|
||||
|
||||
secondsCurrent = (int) round(smoothedTime);
|
||||
}
|
||||
else if (timeMode == TimeSync) {
|
||||
else if (true || timeMode == TimeSync) {
|
||||
this->lastTime = transport.Position();
|
||||
secondsCurrent = (int) round(this->lastTime);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user