diff options
author | Martin Poirier <theeth@yahoo.com> | 2010-01-31 21:32:19 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2010-01-31 21:32:19 +0300 |
commit | 6c584a449a33f090fc490a427d2c5eed0c41264a (patch) | |
tree | 32a9556d2656dcdd09e7477402accaaa2175f12f /source/creator | |
parent | 04991f0ab75d95c85e8c9eeeea81d849058c999d (diff) |
-setaudio argument to force an audio device.
This also means that only -s and -S are accepted to set start frame and scene (before, it would accept anything that started with s or S, you could have done blender -b file.blend -super 1 -Science "scene 2").
We really need better argument parsing...
Diffstat (limited to 'source/creator')
-rw-r--r-- | source/creator/creator.c | 54 |
1 files changed, 40 insertions, 14 deletions
diff --git a/source/creator/creator.c b/source/creator/creator.c index 569425884ca..585a91d7d8c 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -221,6 +221,8 @@ static void print_help(void) printf (" -nojoystick\tDisable joystick support\n"); printf (" -noglsl\tDisable GLSL shading\n"); printf (" -noaudio\tForce sound system to None\n"); + printf (" -setaudio\tForce sound system to a specific device\n"); + printf (" \tNULL SDL OPENAL JACK\n"); printf (" -h\t\tPrint this help text\n"); printf (" -y\t\tDisable automatic python script execution (pydrivers, pyconstraints, pynodes)\n"); printf (" -P <filename>\tRun the given Python script (filename or Blender Text)\n"); @@ -476,7 +478,7 @@ int main(int argc, char **argv) break; case 'n': case 'N': - if (BLI_strcasecmp(argv[a], "-nojoystick") == 0) { + if (BLI_strcaseeq(argv[a], "-nojoystick")) { /** don't initialize joysticks if user doesn't want to use joysticks failed joystick initialization delays over 5 seconds, before game engine start @@ -484,11 +486,18 @@ int main(int argc, char **argv) SYS_WriteCommandLineInt(syshandle,"nojoystick",1); if (G.f & G_DEBUG) printf("disabling nojoystick\n"); } - else if (BLI_strcasecmp(argv[a], "-noglsl") == 0) + else if (BLI_strcaseeq(argv[a], "-noglsl")) GPU_extensions_disable(); - else if (BLI_strcasecmp(argv[a], "-noaudio") == 0) + else if (BLI_strcaseeq(argv[a], "-noaudio")) sound_force_device(0); break; + case 's': + case 'S': + if (BLI_strcaseeq(argv[a], "-setaudio") && a + 1 < argc) { + a++; + sound_force_device(sound_define_from_str(argv[a])); + } + break; } } } @@ -526,9 +535,16 @@ int main(int argc, char **argv) break; case 'n': case 'N': - if (BLI_strcasecmp(argv[a], "-noaudio") == 0) + if (BLI_strcaseeq(argv[a], "-noaudio")) sound_force_device(0); break; + case 's': + case 'S': + if (BLI_strcaseeq(argv[a], "-setaudio") && a + 1 < argc) { + a++; + sound_force_device(sound_define_from_str(argv[a])); + } + break; } } } @@ -664,20 +680,30 @@ int main(int argc, char **argv) } break; case 'S': - if(++a < argc) { - set_scene_name(argv[a]); + if (BLI_strcaseeq(argv[a], "-setaudio") && a + 1 < argc) { + a++; /* already taken care of, just need to swallow the next argument */ + } + else if (argv[a][2] == '\0') { + if(++a < argc) { + set_scene_name(argv[a]); + } } break; case 's': - a++; - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); - if (a < argc) { - int frame = atoi(argv[a]); - (scene->r.sfra) = MIN2(MAXFRAME, MAX2(1, frame)); + if (BLI_strcaseeq(argv[a], "-setaudio") && a + 1 < argc) { + a++; /* already taken care of, just need to swallow the next argument */ + } + else if (argv[a][2] == '\0') { + a++; + if (CTX_data_scene(C)) { + Scene *scene= CTX_data_scene(C); + if (a < argc) { + int frame = atoi(argv[a]); + (scene->r.sfra) = MIN2(MAXFRAME, MAX2(1, frame)); + } + } else { + printf("\nError: no blend loaded. cannot use '-s'.\n"); } - } else { - printf("\nError: no blend loaded. cannot use '-s'.\n"); } break; case 'e': |