MCPcopy Create free account
hub / github.com/PABannier/bark.cpp / bark_params_parse

Function bark_params_parse

examples/server/server.cpp:45–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45void bark_params_parse(int argc, char **argv, bark_params &params, server_params &server_params) {
46 bool model_req = false;
47 for (int i = 1; i < argc; i++) {
48 std::string arg = argv[i];
49 if (arg == "-t" || arg == "--threads") {
50 params.n_threads = std::stoi(argv[++i]);
51 } else if (arg == "-m" || arg == "--model") {
52 params.model_path = argv[++i];
53 model_req = true;
54 } else if (arg == "-t" || arg == "--thread") {
55 params.n_threads = std::stoi(argv[++i]);
56 } else if (arg == "-p" || arg == "--port") {
57 server_params.port = std::stoi(argv[++i]);
58 } else if (arg == "-a" || arg == "--address") {
59 server_params.hostname = argv[++i];
60 } else if (arg == "-h" || arg == "--help") {
61 bark_print_usage(argv, params, server_params);
62 exit(0);
63 } else {
64 fprintf(stderr, "error: unknown argument: %s\n", arg.c_str());
65 bark_print_usage(argv, params, server_params);
66 exit(1);
67 }
68 }
69 if (!model_req) {
70 fprintf(stderr, "error: no model path specified\n");
71 bark_print_usage(argv, params, server_params);
72 exit(1);
73 }
74}
75
76bool generate_audio(int n_threads, bark_context *bctx, std::string text, std::string dest) {
77 if (!bark_generate_audio(bctx, text.c_str(), n_threads)) {

Callers 2

mainFunction · 0.70
mainFunction · 0.50

Calls 1

bark_print_usageFunction · 0.70

Tested by

no test coverage detected