Browse Source

Allow number of seconds as input

Signed-off-by: falkTX <falktx@falktx.com>
main
falkTX 4 years ago
parent
commit
4b0ee4c808
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 26 additions and 8 deletions
  1. +1
    -3
      src/Makefile
  2. +25
    -5
      src/kuriborosu.c

+ 1
- 3
src/Makefile View File

@@ -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


+ 25
- 5
src/kuriborosu.c View File

@@ -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)
{


Loading…
Cancel
Save