@@ -39,12 +39,14 @@ static void V2mPlayerUsage()
3939 printf (" options:\n " );
4040 printf (" -s N.N start at position (float, optional, in s., default = 0.0)\n " );
4141 printf (" -g N.N gain (float, optional, default = 1.0)\n " );
42+ printf (" -f N frame size for SDL (int, optional, default = 1024)\n " );
4243 printf (" -k key/auto stop (bool, optional, default = false)\n " );
4344 printf (" -o str output v2m newest version (string, optional, default = none)\n " );
4445 printf (" -h this help\n " );
4546}
4647
4748static float gain = 1 .0f ;
49+ static int frame_size = 1024 ;
4850static void sdl_callback (void *userdata, Uint8 * stream, int len) {
4951 float * buf = (float *) stream;
5052 player.Render (buf, len / 8 );
@@ -65,7 +67,7 @@ static bool init_sdl()
6567 SDL_AudioSpec desired, actual;
6668 desired.channels = 2 ;
6769 desired.freq = 44100 ;
68- desired.samples = 1024 ;
70+ desired.samples = frame_size ;
6971 desired.format = AUDIO_F32;
7072 desired.callback = sdl_callback;
7173
@@ -114,7 +116,7 @@ int main(int argc, char** argv)
114116 int fkey = 0 ;
115117 int fhelp = 0 ;
116118 char *foutput;
117- while ((opt = getopt (argc, argv, " ko:hs:g:" )) != -1 )
119+ while ((opt = getopt (argc, argv, " ko:hs:g:f: " )) != -1 )
118120 {
119121 switch (opt)
120122 {
@@ -131,9 +133,13 @@ int main(int argc, char** argv)
131133 case ' g' :
132134 gain = atof (optarg);
133135 break ;
136+ case ' f' :
137+ frame_size = atoi (optarg);
138+ frame_size = (frame_size < 64 ) ? 64 : ((frame_size < 16384 ) ? frame_size : 16384 );
139+ break ;
134140 case ' s' :
135141 startPos = (int )(atof (optarg) * 1000 );
136- startPos = (startPos > 0 ) ? startPos : 0 ;
142+ startPos = (startPos < 0 ) ? 0 : startPos ;
137143 break ;
138144 case ' :' :
139145 printf (" option needs a value\n " );
0 commit comments