#!/usr/bin/awk -f
# HP 20030427
# add offset (stereo-samples) to all start times
# usage:
#  toc2toc-offset offset=445074 vossa1ori.toc > vossa1.toc
#  toc2toc-offset offset=427064 vossa2ori.toc > vossa2.toc

{
  if ($1 == "FILE") {
    filename = substr($2,2,length($2)-2);
    split($3,timestr,":");
    if (timestr[2]=="")
      sta = timestr[1]+0;
    else
      sta = (timestr[1]*4500+timestr[2]*75+timestr[3]*1)*588;
    split($4,timestr,":");
    if (timestr[2]=="")
      dur = timestr[1]+0;
    else
      dur = (timestr[1]*4500+timestr[2]*75+timestr[3]*1)*588;
    printf "FILE \"%s\" %d %d\n",filename,sta+offset,dur;
  }
  else
    printf "%s\n",$0;
}

