Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Allow number of seconds as input
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Jan 31, 2021
1 parent 44a1509 commit 4b0ee4c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
4 changes: 1 addition & 3 deletions src/Makefile
Expand Up @@ -23,12 +23,10 @@ FILES = \
TARGET_DIR = ../bin
BUILD_DIR = ../build/$(NAME)

# BASE_FLAGS += -I.
BASE_FLAGS += $(shell pkg-config --cflags carla-host-plugin sndfile)
LINK_FLAGS += $(shell pkg-config --libs carla-host-plugin sndfile)

# BUILD_C_FLAGS += -I.
# BUILD_CXX_FLAGS += -I.
BASE_FLAGS += -Wno-unused-parameter

# ---------------------------------------------------------------------------------------------------------------------
# Set files to build
Expand Down
30 changes: 25 additions & 5 deletions src/kuriborosu.c
Expand Up @@ -163,14 +163,34 @@ int main(int argc, char* argv[])
goto deactivate;
}

if (! carla_load_file(hhandle, infile))
// TODO read from audio/midi plugin
uint32_t file_frames = 100 * opts_sample_rate;

// Check if input file argument is actually seconds
// FIXME some isalpha() check??
if (strchr(infile, '.') == NULL && strchr(infile, '/') == NULL)
{
fprintf(stderr, "Failed to load input file, error was: %s\n", carla_get_last_error(hhandle));
goto deactivate;
const int seconds = atoi(infile);

if (seconds <= 0 || seconds > 60*60)
{
fprintf(stderr, "Invalid number of seconds %i\n", seconds);
goto deactivate;
}

file_frames = (uint32_t)seconds * opts_sample_rate;
}
else
{
if (! carla_load_file(hhandle, infile))
{
fprintf(stderr, "Failed to load input file, error was: %s\n", carla_get_last_error(hhandle));
goto deactivate;
}

// TODO read from audio/midi plugin
uint32_t file_frames = 100 * opts_sample_rate;
// TODO read from audio/midi plugin
file_frames = 100 * opts_sample_rate;
}

for (int i = 3; i < argc; ++i)
{
Expand Down

0 comments on commit 4b0ee4c

Please sign in to comment.