Advertisement
Guest User

BurnItNow Audio CD Duration

a guest
Dec 3rd, 2012
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.29 KB | None | 0 0
  1. void jpWindow::CalculateSize()
  2. {
  3.     BFile f1;
  4.     char temp_char[1024];
  5.     char what[100];
  6.     uint32 angle_temp[100];
  7.     uint32 tracks, i;
  8.     off_t temp, total_audio, total, total_iso, total_vrcd, total_duration;
  9.  
  10.     total_audio = 0;
  11.     total = 0;
  12.     total_iso = 0;
  13.     total_vrcd = 0;
  14.     total_duration = 0;
  15.     temp = 0;
  16.     nrtracks = 0;
  17.  
  18.     if (BURN_TYPE == 0) {
  19.         sprintf(what, "Data");
  20.         total_vrcd = total = total_iso = total_audio = 0;
  21.         fStatusBar->SetBarColor(black);
  22.         if (fLeftList->CountItems() > 0) {
  23.             LeftListItem* item1 = (LeftListItem*)fLeftList->ItemAt(0);
  24.             if (item1->fIconBitmap == fLeftList->fISOBitmap) {
  25.                 f1.SetTo(&item1->fRef, B_READ_ONLY);
  26.                 f1.GetSize(&temp);
  27.                 total_iso += temp;
  28.                 angle_temp[0] = temp / 1024 / 1024;
  29.                 nrtracks = 1;
  30.             } else if (item1->fIconBitmap == fLeftList->fVRCDBitmap) {
  31.                 nrtracks = 1;
  32.                 total_vrcd = temp = GetVRCDSize();
  33.                 angle_temp[0] = temp / 1024 / 1024;
  34.             }
  35.         }
  36.     } else if (BURN_TYPE == 1) {
  37.         sprintf(what, "AudioCD");
  38.         total_vrcd = total = total_iso = total_audio = temp = 0;
  39.         fStatusBar->SetBarColor(orange);
  40.         if (fLeftList->CountItems() > 0) {
  41.             LeftListItem* item1 = (LeftListItem*)fLeftList->ItemAt(0);
  42.             LeftListItem* item2 = (LeftListItem*)fLeftList->ItemAt(1);
  43.             if (item1->fIconBitmap == fLeftList->fAudioBitmap) {
  44.                 tracks = fLeftList->CountItems();
  45.                 for (i = 0; i < tracks; i++) {
  46.                     item1 = (LeftListItem*)fLeftList->ItemAt(i);
  47.                     f1.SetTo(&item1->fRef, B_READ_ONLY);
  48.                     f1.GetSize(&temp);
  49.                     total_audio += temp;
  50.                     total_duration += item1->fAudioInfo.total_time;
  51.                     angle_temp[i] = temp / 1024 / 1024;
  52.                     nrtracks++;
  53.                 }
  54.             } else if (fLeftList->CountItems() > 1) {
  55.                 if (item2->fIconBitmap == fLeftList->fAudioBitmap) {
  56.                     tracks = fLeftList->CountItems();
  57.                     for (i = 1; i < tracks; i++) {
  58.                         item1 = (LeftListItem*)fLeftList->ItemAt(i);
  59.                         f1.SetTo(&item1->fRef, B_READ_ONLY);
  60.                         f1.GetSize(&temp);
  61.                         total_audio += temp;
  62.                         total_duration += item1->fAudioInfo.total_time;
  63.                         angle_temp[i - 1] = temp / 1024 / 1024;
  64.                         nrtracks++;
  65.                     }
  66.                 }
  67.             }
  68.         }
  69.     } else if (BURN_TYPE == 2) {
  70.         sprintf(what, "MixCD");
  71.         total_vrcd = total = total_iso = total_audio = 0;
  72.         fStatusBar->SetBarColor(greenblue);
  73.         if (fLeftList->CountItems() > 0) {
  74.             LeftListItem* item1 = (LeftListItem*)fLeftList->ItemAt(0);
  75.             LeftListItem* item2 = (LeftListItem*)fLeftList->ItemAt(1);
  76.             if (item1->fIconBitmap == fLeftList->fISOBitmap) {
  77.                 nrtracks = 1;
  78.                 f1.SetTo(&item1->fRef, B_READ_ONLY);
  79.                 f1.GetSize(&temp);
  80.                 total_iso = temp;
  81.                 angle_temp[nrtracks - 1] = temp / 1024 / 1024;
  82.             } else if (item1->fIconBitmap == fLeftList->fVRCDBitmap) {
  83.                 nrtracks = 1;
  84.                 total_vrcd = temp = GetVRCDSize();
  85.                 angle_temp[nrtracks - 1] = temp / 1024 / 1024;
  86.             }
  87.  
  88.             if (item1->fIconBitmap == fLeftList->fAudioBitmap) {
  89.                 tracks = fLeftList->CountItems();
  90.                 for (i = 0; i < tracks; i++) {
  91.                     item1 = (LeftListItem*)fLeftList->ItemAt(i);
  92.                     f1.SetTo(&item1->fRef, B_READ_ONLY);
  93.                     f1.GetSize(&temp);
  94.                     total_audio += temp;
  95.                     nrtracks++;
  96.                     angle_temp[nrtracks - 1] = temp / 1024 / 1024;
  97.  
  98.                 }
  99.             } else if (fLeftList->CountItems() > 1) {
  100.                 if (item2->fIconBitmap == fLeftList->fAudioBitmap) {
  101.                     tracks = fLeftList->CountItems();
  102.                     for (i = 1; i < tracks; i++) {
  103.                         item1 = (LeftListItem*)fLeftList->ItemAt(i);
  104.                         f1.SetTo(&item1->fRef, B_READ_ONLY);
  105.                         f1.GetSize(&temp);
  106.                         total_audio += temp;
  107.                         nrtracks++;
  108.                         angle_temp[nrtracks - 1] = temp / 1024 / 1024;
  109.                     }
  110.                 }
  111.             }
  112.         }
  113.     }
  114.  
  115.     total = total_audio + total_iso + total_vrcd;
  116.     if (BURN_TYPE == 1) {
  117.         // Audio CD
  118.         sprintf(temp_char, "%s - [%lld MB of 700 MB/%lld of 80 min (CD) / 4474 MB (DVD5) / 8140 MB (DVD9)]",
  119.             what, total / 1024 / 1024, total_duration / 1000000);
  120.     } else {
  121.         sprintf(temp_char, "%s - [%lld MB of 700 MB (CD) / 4474 MB (DVD5) / 8140 MB (DVD9)]",
  122.             what, total / 1024 / 1024);
  123.     }
  124.     fStatusBar->Reset();
  125.     fStatusBar->SetMaxValue(CDSIZE);
  126.     fStatusBar->Update((total / 1024 / 1024), temp_char);
  127.  
  128.     for (i = 0; i < nrtracks; i++) {
  129.         if (i == 0)
  130.             angles[i] = ((float)360 / (float)(total / 1024 / 1024)) * (float)angle_temp[i];
  131.         else
  132.             angles[i] = ((float)360 / (float)(total / 1024 / 1024)) * (float)angle_temp[i] + angles[i - 1];
  133.     }
  134. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement