diff audioDB.cpp @ 256:4dcb09f5fe85

Commit patch deprecating the --size argument, replacing it with --ntracks, --datadims and --datasize. These names are not ideal, but will serve for now.
author mas01cr
date Wed, 16 Apr 2008 09:59:43 +0000
parents 5682c7d7444b
children 210b2f661b88
line wrap: on
line diff
--- a/audioDB.cpp	Sat Apr 12 13:28:30 2008 +0000
+++ b/audioDB.cpp	Wed Apr 16 09:59:43 2008 +0000
@@ -136,10 +136,32 @@
   }
 
   if(args_info.size_given) {
+    if(args_info.datasize_given) {
+      error("both --size and --datasize given", "");
+    }
+    if(args_info.ntracks_given) {
+      error("both --size and --ntracks given", "");
+    }
+    if(args_info.datadim_given) {
+      error("both --size and --datadim given", "");
+    }
     if (args_info.size_arg < 50 || args_info.size_arg > 32000) {
       error("Size out of range", "");
     }
-    size = (off_t) args_info.size_arg * 1000000;
+    double ratio = (double) args_info.size_arg * 1000000 / ((double) O2_DEFAULTDBSIZE);
+    /* FIXME: what's the safe way of doing this? */
+    datasize = (unsigned int) ceil(datasize * ratio);
+    ntracks = (unsigned int) ceil(ntracks * ratio);
+  } else {
+    if(args_info.datasize_given) {
+      datasize = args_info.datasize_arg;
+    }
+    if(args_info.ntracks_given) {
+      ntracks = args_info.ntracks_arg;
+    }
+    if(args_info.datadim_given) {
+      datadim = args_info.datadim_arg;
+    }
   }
 
   if(args_info.radius_given) {