#ifndef __SYNC__
#define __SYNC__

#include "syncname.h"

struct {
  double t;
  int id;
  const char* nazov;
} Sync[] = {
// casy musia byt utriedene vzostupne
  {   0.0,	SYNC_START,		"start"			},
  {   4.0,      SYNC_START_TESLA1,      "fade in tesla1"},
  {  17.0,      SYNC_GO_IN_BLACK,       "scernenie obrazovky"},
  {  30.5,      SYNC_TUNEL_WAVING,      "tunel sa rozvlni a otoci sa"},
  {  36.8,      SYNC_TUNEL_2ND_CHANGE,	"tunel sa otoci-s5"},
  {  43.2,      SYNC_TUNEL_3RD_CHANGE,	"tunel sa otoci a je zrychleny"},
  {  49.6,      SYNC_TUNEL_4TH_CHANGE,	"tunel sa otoci-s5 a je zrychleny"},
  {  56.0,      SYNC_VLAK1,             "vlak1"},
  {  64.0,      SYNC_VLAK2,             "vlak2"},
  {  70.6,      SYNC_VLAK3,             "vlak3"},
  {  73.5,      SYNC_VLAK_FOV_OUT,      "vlak fov out"},
  {  75.0,      SYNC_STENY_ZACINAJU,    "zacinaju steny"},
  {9999.9,	SYNC_END,		"end"}};

int __numsync = sizeof(Sync)/sizeof(Sync[0]); 


inline int GetSyncNum(double a) {
  for(int i=1; i<=__numsync; i++)
    if(a<Sync[i].t) return i-1;
}

inline void SyncInfo(int n) {
  cout << "Sync " << n << ": " <<endl;
  cout << "  nazov :  "<< Sync[n].nazov << endl;
}


#endif