From 75b1c3e10ad44b6353df102f851f31d3abef6015 Mon Sep 17 00:00:00 2001 From: LCID Fire Date: Sat, 26 Apr 2008 13:31:10 +0200 Subject: [PATCH] Move defines for the soundsupport and such to the appropriate files Let the timecoder define it's option for itself --- alsa.c | 2 ++ oss.c | 3 +++ timecoder.c | 26 ++++++++++++++++++++++++++ timecoder.h | 2 ++ xwax.c | 21 +++++---------------- 5 files changed, 38 insertions(+), 16 deletions(-) diff --git a/alsa.c b/alsa.c index 4d66eff..3955eef 100644 --- a/alsa.c +++ b/alsa.c @@ -36,6 +36,8 @@ static gboolean parse_alsa_buffer_time(GOptionContext *context, GOptionGroup *gr return TRUE; } +#define DEFAULT_ALSA_BUFFER 8 /* milliseconds */ + static GOptionEntry alsaOptions[] = { { "device", 'a', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, &parse_alsa_device, "Build a deck connected to ALSA audio device", NULL}, diff --git a/oss.c b/oss.c index 361df06..fa757f3 100644 --- a/oss.c +++ b/oss.c @@ -30,6 +30,9 @@ #include "timecoder.h" #include "player.h" +#define DEFAULT_OSS_BUFFERS 8 +#define DEFAULT_OSS_FRAGMENT 7 + static gboolean parse_oss_device(GOptionContext *context, GOptionGroup *group, gpointer data, GError **error) { return TRUE; diff --git a/timecoder.c b/timecoder.c index caed691..aa802ae 100644 --- a/timecoder.c +++ b/timecoder.c @@ -44,6 +44,32 @@ #define SQ(x) ((x)*(x)) +#define DEFAULT_TIMECODE "serato_2a" + +static gboolean parse_timecode(GOptionContext *context, GOptionGroup *group, gpointer data, GError **error) +{ + return TRUE; +} + +static GOptionEntry timecodeOptions[] = +{ + { "timecode", 't', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, &parse_timecode, "Timecode name (available: [TARRAY])", "TARRAY"}, + { NULL } +}; + +GOptionGroup* get_timecode_option_group() +{ + GOptionGroup* group = g_option_group_new + ( + "timecode", + "Timecode options", + "Show timecode help options", + NULL, + NULL + ); + g_option_group_add_entries(group, timecodeOptions); + return group; +} /* Timecode definitions */ diff --git a/timecoder.h b/timecoder.h index 2c9a9b5..833cd9a 100644 --- a/timecoder.h +++ b/timecoder.h @@ -20,11 +20,13 @@ #ifndef TIMECODER_H #define TIMECODER_H +#include #include "device.h" #define TIMECODER_CHANNELS DEVICE_CHANNELS #define TIMECODER_RATE DEVICE_RATE +GOptionGroup* get_timecode_option_group(); struct timecoder_channel_t { int positive; /* wave is in positive part of cycle */ diff --git a/xwax.c b/xwax.c index 0a78564..eb9fef3 100644 --- a/xwax.c +++ b/xwax.c @@ -41,14 +41,7 @@ #define MAX_DECKS 3 -#define DEFAULT_OSS_BUFFERS 8 -#define DEFAULT_OSS_FRAGMENT 7 - -#define DEFAULT_ALSA_BUFFER 8 /* milliseconds */ - #define DEFAULT_IMPORTER "xwax_import" -#define DEFAULT_TIMECODE "serato_2a" - /* We don't use the full flexibility of a rig, and just have a direct * correspondence between a device, track, player and timecoder */ @@ -146,11 +139,6 @@ static gboolean parse_library(GOptionContext *context, GOptionGroup *group, gpoi return TRUE; } -static gboolean parse_timecode(GOptionContext *context, GOptionGroup *group, gpointer data, GError **error) -{ - return TRUE; -} - static gboolean parse_importer(GOptionContext *context, GOptionGroup *group, gpointer data, GError **error) { return TRUE; @@ -158,10 +146,9 @@ static gboolean parse_importer(GOptionContext *context, GOptionGroup *group, gpo static GOptionEntry mainOptions[] = { - { "library", 'l', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, &parse_library, "Directory to scan for audio tracks", NULL}, - { "timecode", 't', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, &parse_timecode, "Timecode name (available: [TARRAY])", "TARRAY"}, - { "importer", 'i', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, &parse_importer, "Specify external importer (default: 'DI')", "DI"}, - { NULL } + { "library", 'l', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, &parse_library, "Directory to scan for audio tracks", NULL}, + { "importer", 'i', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, &parse_importer, "Specify external importer (default: 'DI')", "DI"}, + { NULL } }; int main(int argc, char *argv[]) @@ -209,6 +196,8 @@ int main(int argc, char *argv[]) #endif g_option_context_add_group(context, get_oss_option_group()); + g_option_context_add_group(context, get_timecode_option_group()); + g_option_context_add_group(context, get_cache_option_group()); if(!g_option_context_parse(context, &argc, &argv, &error)) -- 2.11.4.GIT