Added argument parameters.
This commit is contained in:
parent
41fd95fde9
commit
5161b37943
19
Makefile
19
Makefile
@ -1,8 +1,25 @@
|
|||||||
|
# Copyright (C) 2019 Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
|
||||||
|
# Author: Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
CC=gcc
|
CC=gcc
|
||||||
DEBUG=0
|
DEBUG=0
|
||||||
INCFLAGS=`pkg-config jack --cflags`
|
INCFLAGS=`pkg-config jack --cflags`
|
||||||
LDFLAGS=`pkg-config jack --libs` -lreadline
|
LDFLAGS=`pkg-config jack --libs` -lreadline
|
||||||
CFLAGS=$(INCFLAGS) -std=c99 -Wall -Wextra -Wfatal-errors -Werror
|
CFLAGS=$(INCFLAGS) -std=c99 -Wall -Wextra -Wfatal-errors -Werror
|
||||||
|
HDRS=src/args.h
|
||||||
OBJS=src/main.o
|
OBJS=src/main.o
|
||||||
|
|
||||||
ifeq ($(DEBUG),1)
|
ifeq ($(DEBUG),1)
|
||||||
@ -11,7 +28,7 @@ else
|
|||||||
CFLAGS+=-O2 -DNDEBUG
|
CFLAGS+=-O2 -DNDEBUG
|
||||||
endif
|
endif
|
||||||
|
|
||||||
%.o:%.c
|
%.o:%.c $(HDRS)
|
||||||
$(CC) -c -o $@ $< $(CFLAGS)
|
$(CC) -c -o $@ $< $(CFLAGS)
|
||||||
|
|
||||||
saus: $(OBJS)
|
saus: $(OBJS)
|
||||||
|
5
README
5
README
@ -1,8 +1,8 @@
|
|||||||
============
|
============
|
||||||
*** SAUS ***
|
*** SAUS ***
|
||||||
============
|
============
|
||||||
Scripted AUdio Software is a command-line tool for real-time audio
|
Scripted AUdio Software is a command-line tool for real-time scripted
|
||||||
scripted filtering via JACK audio inputs. The user writes scripts which
|
audio filtering via JACK audio inputs. The user writes scripts which
|
||||||
modify the frequency and amplitude of the sound waves coming from the
|
modify the frequency and amplitude of the sound waves coming from the
|
||||||
JACK input.
|
JACK input.
|
||||||
|
|
||||||
@ -13,6 +13,7 @@ To build the project you will require the following dependencies:
|
|||||||
* GNU Make
|
* GNU Make
|
||||||
* C99 compatible compiler
|
* C99 compatible compiler
|
||||||
* JACK2
|
* JACK2
|
||||||
|
* GNU Readline
|
||||||
|
|
||||||
## Compiling
|
## Compiling
|
||||||
To compile the project simply run the `make' command in the root
|
To compile the project simply run the `make' command in the root
|
||||||
|
72
src/args.h
Normal file
72
src/args.h
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
|
||||||
|
* Author: Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <argp.h>
|
||||||
|
|
||||||
|
const char *argp_program_version = "SAUS v1.0";
|
||||||
|
const char *argp_program_bug_address = "<nortega@themusicinnoise.net>";
|
||||||
|
|
||||||
|
static char doc[] = "saus -- a command-line tool for real-time "
|
||||||
|
"scripted audio filtering.";
|
||||||
|
|
||||||
|
static char args_doc[] = "[-v] -f FILE | -l FILE";
|
||||||
|
|
||||||
|
static struct argp_option options[] = {
|
||||||
|
{ "verbose", 'v', 0, 0, "Make output verbose", 0 },
|
||||||
|
{ "file", 'f', "FILE", 0, "Script file", 0 },
|
||||||
|
{ "playlist", 'l', "FILE", 0, "Playlist of script files", 0 },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct arguments {
|
||||||
|
int verbose;
|
||||||
|
char *script_file;
|
||||||
|
char *playlist_file;
|
||||||
|
};
|
||||||
|
|
||||||
|
static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
||||||
|
struct arguments *arguments = state->input;
|
||||||
|
|
||||||
|
switch(key)
|
||||||
|
{
|
||||||
|
case 'v':
|
||||||
|
arguments->verbose = 1;
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
arguments->script_file = arg;
|
||||||
|
break;
|
||||||
|
case 'l':
|
||||||
|
arguments->playlist_file = arg;
|
||||||
|
break;
|
||||||
|
/*case ARGP_KEY_ARG:
|
||||||
|
if(state->arg_num > 2)
|
||||||
|
argp_usage(state);
|
||||||
|
break;
|
||||||
|
case ARGP_KEY_END:
|
||||||
|
if(state->arg_num < 1)
|
||||||
|
argp_usage(state);
|
||||||
|
break;*/
|
||||||
|
default:
|
||||||
|
return ARGP_ERR_UNKNOWN;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct argp argp = { options, parse_opt, args_doc, doc, 0, 0, 0 };
|
@ -16,8 +16,17 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "args.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <readline/readline.h>
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
struct arguments arguments;
|
||||||
|
arguments.verbose = 0;
|
||||||
|
arguments.script_file = NULL;
|
||||||
|
arguments.playlist_file = NULL;
|
||||||
|
|
||||||
|
argp_parse(&argp, argc, argv, 0, 0, &arguments);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user