const struct sync_track *sync_get_track(struct sync_device *d, const char *name) { struct sync_track *t; int idx = sync_find_track(&d->data, name); if (idx >= 0) return d->data.tracks[idx]; idx = sync_create_track(&d->data, name); t = d->data.tracks[idx]; get_track_data(d, t); return t; }
int TrackData_createGetTrack(TrackData* trackData, const char* name) { int index = sync_find_track(&trackData->syncData, name); if (index < 0) { index = sync_create_track(&trackData->syncData, name); memset(&trackData->tracks[index], 0, sizeof(Track)); trackData->tracks[index].index = index; trackData->tracks[index].color = TrackData_getNextColor(trackData); } if (trackData->syncData.tracks) Commands_init(trackData->syncData.tracks, trackData); return index; }