Basic playback working

This commit is contained in:
Daniel Collin 2012-10-27 17:44:06 +02:00
parent 8a0024415e
commit 376be44f44
3 changed files with 24 additions and 4 deletions

View File

@ -97,6 +97,17 @@ bool Editor_keyDown(int key)
return true; return true;
} }
if (key == ' ')
{
// TODO: Don't start playing if we are in edit mode (but space shouldn't be added in edit mode but we still
// shouldn't start playing if we do
bool paused = !RemoteConnection_isPaused();
RemoteConnection_sendPauseCommand(paused);
return true;
}
return handled_key; return handled_key;
} }
@ -155,7 +166,7 @@ static void processCommands()
case SET_ROW: case SET_ROW:
{ {
RemoteConnection_recv((char*)&newRow, sizeof(int), 0); RemoteConnection_recv((char*)&newRow, sizeof(int), 0);
//trackView->setEditRow(ntohl(newRow)); s_editorData.trackViewInfo.rowPos = htonl(newRow);
break; break;
} }
} }
@ -170,6 +181,11 @@ void Editor_timedUpdate()
while (RemoteConnection_pollRead()) while (RemoteConnection_pollRead())
processCommands(); processCommands();
if (!RemoteConnection_isPaused())
{
Editor_update();
}
} }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -43,7 +43,6 @@ static void printRowNumbers(int x, int y, int rowCount, int rowOffset, int rowSp
} }
} }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static void renderChannel(struct sync_track* track, int startX, int startY, int startPos, int endPos) static void renderChannel(struct sync_track* track, int startX, int startY, int startPos, int endPos)
@ -128,7 +127,7 @@ void TrackView_render(const TrackViewInfo* viewInfo, struct sync_data* syncData)
uint i = 0; //, channel_count = 10; uint i = 0; //, channel_count = 10;
printRowNumbers(2, 42, 40, start_pos, font_size, 8); printRowNumbers(2, 42, 40, start_pos + viewInfo->rowPos, font_size, 8);
if (syncData->num_tracks == 0) if (syncData->num_tracks == 0)
return; return;
@ -141,7 +140,11 @@ void TrackView_render(const TrackViewInfo* viewInfo, struct sync_data* syncData)
//i = 0; //i = 0;
for (i = 0; i < num_tracks; ++i) for (i = 0; i < num_tracks; ++i)
renderChannel(syncData->tracks[i], 40 + (i * 64), 20, start_pos, start_pos + 40); {
renderChannel(syncData->tracks[i], 40 + (i * 64), 20,
(start_pos + viewInfo->rowPos),
(start_pos + viewInfo->rowPos + 40));
}
uint32_t color = Emgui_color32(127, 127, 127, 56); uint32_t color = Emgui_color32(127, 127, 127, 56);

View File

@ -10,6 +10,7 @@ typedef struct TrackViewInfo
int scrollPosX; int scrollPosX;
int windowSizeX; int windowSizeX;
int windowSizeY; int windowSizeY;
int rowPos;
} TrackViewInfo; } TrackViewInfo;