mirror of
https://github.com/game-stop/veejay.git
synced 2025-12-22 15:50:01 +01:00
implement commandline option for reloaded to load midi configuration file
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/* gveejay - Linux VeeJay - GVeejay GTK+-2/Glade User Interface
|
/* gveejay - Linux VeeJay - GVeejay GTK+-2/Glade User Interface
|
||||||
* (C) 2002-2005 Niels Elburg <nwelburg@gmail.com>
|
* (C) 2002-2011 Niels Elburg <nwelburg@gmail.com>
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
static int selected_skin = 0;
|
static int selected_skin = 0;
|
||||||
extern int mt_get_max_tracks();
|
extern int mt_get_max_tracks();
|
||||||
|
static int load_midi = 0;
|
||||||
static int port_num = 3490;
|
static int port_num = 3490;
|
||||||
static char hostname[255];
|
static char hostname[255];
|
||||||
static int gveejay_theme = 1;
|
static int gveejay_theme = 1;
|
||||||
@@ -47,6 +47,7 @@ static int pw = 176;
|
|||||||
static int ph = 144;
|
static int ph = 144;
|
||||||
static int preview = 0; // off
|
static int preview = 0; // off
|
||||||
static int use_threads = 0;
|
static int use_threads = 0;
|
||||||
|
static char midi_file[1024];
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
char *file;
|
char *file;
|
||||||
@@ -72,6 +73,7 @@ static void usage(char *progname)
|
|||||||
printf( "-X\t\tSet number of tracks\n");
|
printf( "-X\t\tSet number of tracks\n");
|
||||||
printf( "-l\t\tChoose layout (0=large screen, 1=small screens)\n");
|
printf( "-l\t\tChoose layout (0=large screen, 1=small screens)\n");
|
||||||
printf( "-V\t\tShow version, data directory and exit.\n");
|
printf( "-V\t\tShow version, data directory and exit.\n");
|
||||||
|
printf( "-m <file>\tMIDI configuration file.\n");
|
||||||
printf( "\n\n");
|
printf( "\n\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
@@ -124,6 +126,10 @@ static int set_option( const char *name, char *value )
|
|||||||
fprintf(stdout, "data directory: %s\n", get_gveejay_dir());
|
fprintf(stdout, "data directory: %s\n", get_gveejay_dir());
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
else if (strcmp( name, "m" ) == 0 ) {
|
||||||
|
strcpy(midi_file, optarg);
|
||||||
|
load_midi = 1;
|
||||||
|
}
|
||||||
else if (strcmp(name, "P" ) == 0 || strcmp(name, "preview" ) == 0 )
|
else if (strcmp(name, "P" ) == 0 || strcmp(name, "preview" ) == 0 )
|
||||||
{
|
{
|
||||||
preview = atoi(optarg);
|
preview = atoi(optarg);
|
||||||
@@ -198,7 +204,7 @@ int main(int argc, char *argv[]) {
|
|||||||
// default host to connect to
|
// default host to connect to
|
||||||
sprintf(hostname, "127.0.0.1");
|
sprintf(hostname, "127.0.0.1");
|
||||||
|
|
||||||
while( ( n = getopt( argc, argv, "s:h:p:tnvHf:X:P:Vl:T:")) != EOF )
|
while( ( n = getopt( argc, argv, "s:h:p:tnvHf:X:P:Vl:T:m:")) != EOF )
|
||||||
{
|
{
|
||||||
sprintf(option, "%c", n );
|
sprintf(option, "%c", n );
|
||||||
err += set_option( option, optarg);
|
err += set_option( option, optarg);
|
||||||
@@ -235,7 +241,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
register_signals();
|
register_signals();
|
||||||
|
|
||||||
vj_gui_init( skins[selected_skin].file, launcher, hostname, port_num, use_threads );
|
vj_gui_init( skins[selected_skin].file, launcher, hostname, port_num, use_threads, load_midi, midi_file );
|
||||||
vj_gui_style_setup();
|
vj_gui_style_setup();
|
||||||
|
|
||||||
|
|
||||||
@@ -245,7 +251,6 @@ int main(int argc, char *argv[]) {
|
|||||||
gveejay_preview(preview);
|
gveejay_preview(preview);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( launcher )
|
if( launcher )
|
||||||
{
|
{
|
||||||
reloaded_launcher( hostname, port_num );
|
reloaded_launcher( hostname, port_num );
|
||||||
|
|||||||
@@ -6805,7 +6805,7 @@ static void debug_spinboxes()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void vj_gui_init(char *glade_file, int launcher, char *hostname, int port_num, int use_threads)
|
void vj_gui_init(char *glade_file, int launcher, char *hostname, int port_num, int use_threads, int load_midi , char *midi_file)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char text[100];
|
char text[100];
|
||||||
@@ -7023,6 +7023,9 @@ void vj_gui_init(char *glade_file, int launcher, char *hostname, int port_num,
|
|||||||
update_slider_range( "speed_slider", -25,25,1,0);
|
update_slider_range( "speed_slider", -25,25,1,0);
|
||||||
update_slider_range( "slow_slider",1,MAX_SLOW,1,0);
|
update_slider_range( "slow_slider",1,MAX_SLOW,1,0);
|
||||||
|
|
||||||
|
|
||||||
|
if( load_midi )
|
||||||
|
vj_midi_load(info->midi,midi_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vj_gui_preview(void)
|
void vj_gui_preview(void)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#define VJAPI_H
|
#define VJAPI_H
|
||||||
int veejay_tick();
|
int veejay_tick();
|
||||||
void *get_ui_info();
|
void *get_ui_info();
|
||||||
void vj_gui_init(char *glade_file, int launcher, char *hostname, int port_num, int threads);
|
void vj_gui_init(char *glade_file, int launcher, char *hostname, int port_num, int threads,int load_midi, char *midi_file);
|
||||||
int vj_gui_reconnect( char *host, char *group, int port);
|
int vj_gui_reconnect( char *host, char *group, int port);
|
||||||
void vj_gui_free();
|
void vj_gui_free();
|
||||||
void vj_fork_or_connect_veejay();
|
void vj_fork_or_connect_veejay();
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ void vj_midi_load(void *vv, const char *filename)
|
|||||||
struct stat t;
|
struct stat t;
|
||||||
if( fstat( fd, &t) != 0 )
|
if( fstat( fd, &t) != 0 )
|
||||||
{
|
{
|
||||||
|
veejay_msg(0, "Error loading MIDI config '%s':%s",filename,strerror(errno));
|
||||||
vj_msg(VEEJAY_MSG_ERROR,"Unable to load %s: %s", filename, strerror(errno));
|
vj_msg(VEEJAY_MSG_ERROR,"Unable to load %s: %s", filename, strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -229,6 +230,7 @@ void vj_midi_load(void *vv, const char *filename)
|
|||||||
|
|
||||||
}
|
}
|
||||||
free(buf);
|
free(buf);
|
||||||
|
veejay_msg(VEEJAY_MSG_INFO, "loaded %d midi events from %s",count,filename);
|
||||||
vj_msg(VEEJAY_MSG_INFO, "Loaded %d MIDI events from %s", count ,filename);
|
vj_msg(VEEJAY_MSG_INFO, "Loaded %d MIDI events from %s", count ,filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user