@@ -92,9 +92,10 @@ static void usage(char *s, struct options *options)
9292" -S --solo ch-list Set channels to solo mode\n"
9393" -s --start num Start from the specified order\n"
9494" -t --time num Maximum playing time in seconds\n"
95+ " -U --loop-until num Loop until time in seconds exceeded\n"
9596" --vblank Force vblank timing in Amiga modules\n"
9697" -Z --all-sequences Play all sequences (subsongs) in module\n"
97- " -z --sequence num Play the specified sequence (0=main)\n"
98+ " -z --sequence num Play the specified sequence (0=main)\n"
9899"\nMixer options:\n"
99100" -A --amiga Use Paula simulation mixer in Amiga formats\n"
100101" -a --amplify {0|1|2|3} Amplification factor: 0=Normal, 1=x2, 2=x4, 3=x8\n"
@@ -140,6 +141,7 @@ static const struct option lopt[] = {
140141 { "list-formats" , 0 , 0 , 'L' },
141142 { "loop" , 0 , 0 , 'l' },
142143 { "loop-all" , 0 , 0 , OPT_LOOPALL },
144+ { "loop-until" , 1 , 0 , 'U' },
143145 { "mixer-voices" , 1 , 0 , OPT_NUMVOICES },
144146 { "mono" , 0 , 0 , 'm' },
145147 { "mute" , 1 , 0 , 'M' },
@@ -179,8 +181,9 @@ void get_options(int argc, char **argv, struct options *options)
179181 struct player_mode * pm ;
180182 int optidx = 0 ;
181183 int o ;
184+ char const * driver_guess = NULL ;
182185
183- #define OPTIONS "Aa:b:CcD:d:e:Ff:hI:i:LlM:mNo:P:p:qRrS:s:T:t:uVvZz:"
186+ #define OPTIONS "Aa:b:CcD:d:e:Ff:hI:i:LlM:mNo:P:p:qRrS:s:T:t:U: uVvZz:"
184187 while ((o = getopt_long (argc , argv , OPTIONS , lopt , & optidx )) != -1 ) {
185188 switch (o ) {
186189 case 'A' :
@@ -198,7 +201,7 @@ void get_options(int argc, char **argv, struct options *options)
198201 options -> show_comment = 1 ;
199202 break ;
200203 case 'c' :
201- options -> driver_id = "file" ;
204+ driver_guess = "file" ;
202205 options -> out_file = "-" ;
203206 break ;
204207 case 'D' :
@@ -278,12 +281,12 @@ void get_options(int argc, char **argv, struct options *options)
278281 options -> out_file = optarg ;
279282 if (strlen (optarg ) >= 4 &&
280283 !xmp_strcasecmp (optarg + strlen (optarg ) - 4 , ".wav" )) {
281- options -> driver_id = "wav" ;
284+ driver_guess = "wav" ;
282285 } else if (strlen (optarg ) >= 5 &&
283286 !xmp_strcasecmp (optarg + strlen (optarg ) - 5 , ".aiff" )) {
284- options -> driver_id = "aiff" ;
287+ driver_guess = "aiff" ;
285288 } else {
286- options -> driver_id = "file" ;
289+ driver_guess = "file" ;
287290 }
288291 break ;
289292 /*
@@ -353,6 +356,9 @@ void get_options(int argc, char **argv, struct options *options)
353356 case 'u' :
354357 options -> format |= XMP_FORMAT_UNSIGNED ;
355358 break ;
359+ case 'U' :
360+ options -> loop_time = strtoul (optarg , NULL , 0 ) * 1000 ;
361+ break ;
356362 case OPT_VBLANK :
357363 options -> vblank = 1 ;
358364 break ;
@@ -381,4 +387,8 @@ void get_options(int argc, char **argv, struct options *options)
381387 options -> rate = 1000 ; /* Min. rate 1 kHz */
382388 if (options -> rate > 48000 )
383389 options -> rate = 48000 ; /* Max. rate 48 kHz */
390+
391+ /* apply guess if no driver selected */
392+ if (!options -> driver_id )
393+ options -> driver_id = driver_guess ;
384394}
0 commit comments