28 |
#include "drivers/audio/AudioOutputDeviceFactory.h" |
#include "drivers/audio/AudioOutputDeviceFactory.h" |
29 |
#include "network/lscpserver.h" |
#include "network/lscpserver.h" |
30 |
|
|
|
#if 0 |
|
|
#define AUDIO_CHANNELS 2 // stereo |
|
|
#define AUDIO_FRAGMENTS 3 // 3 fragments, if it does not work set it to 2 |
|
|
#define AUDIO_FRAGMENTSIZE 512 // each fragment has 512 frames |
|
|
#define AUDIO_SAMPLERATE 44100 // Hz |
|
|
#endif |
|
|
|
|
31 |
using namespace LinuxSampler; |
using namespace LinuxSampler; |
32 |
|
|
33 |
/*enum patch_format_t { |
Sampler* pSampler = NULL; |
34 |
patch_format_unknown, |
LSCPServer* pLSCPServer = NULL; |
35 |
patch_format_gig, |
pthread_t signalhandlerthread; |
|
patch_format_dls |
|
|
} patch_format = patch_format_unknown;*/ |
|
|
|
|
|
Sampler* pSampler = NULL; |
|
|
LSCPServer* pLSCPServer = NULL; |
|
|
pthread_t signalhandlerthread; |
|
|
/*AudioThread* pEngine = NULL; |
|
|
uint instrument_index = 0; |
|
|
double volume = 0.25; |
|
|
int num_fragments = AUDIO_FRAGMENTS; |
|
|
int fragmentsize = AUDIO_FRAGMENTSIZE; |
|
|
uint samplerate = AUDIO_SAMPLERATE; |
|
|
String input_client; |
|
|
String alsaout = "0,0"; // default card |
|
|
String jack_playback[2] = { "", "" }; |
|
|
bool use_jack = true; |
|
|
bool run_server = false;*/ |
|
|
|
|
36 |
|
|
37 |
void parse_options(int argc, char **argv); |
void parse_options(int argc, char **argv); |
38 |
void signal_handler(int signal); |
void signal_handler(int signal); |
46 |
// parse and assign command line options |
// parse and assign command line options |
47 |
//parse_options(argc, argv); |
//parse_options(argc, argv); |
48 |
|
|
|
/*if (patch_format != patch_format_gig) { |
|
|
printf("Sorry only Gigasampler loading migrated in LinuxSampler so far, use --gig to load a .gig file!\n"); |
|
|
printf("Use 'linuxsampler --help' to see all available options.\n"); |
|
|
return EXIT_FAILURE; |
|
|
}*/ |
|
|
|
|
49 |
dmsg(1,("LinuxSampler %s\n", VERSION)); |
dmsg(1,("LinuxSampler %s\n", VERSION)); |
50 |
dmsg(1,("Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck\n")); |
dmsg(1,("Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck\n")); |
51 |
|
|
57 |
dmsg(1,("Registered MIDI input drivers: %s\n", MidiInputDeviceFactory::AvailableDriversAsString().c_str())); |
dmsg(1,("Registered MIDI input drivers: %s\n", MidiInputDeviceFactory::AvailableDriversAsString().c_str())); |
58 |
dmsg(1,("Registered audio output drivers: %s\n", AudioOutputDeviceFactory::AvailableDriversAsString().c_str())); |
dmsg(1,("Registered audio output drivers: %s\n", AudioOutputDeviceFactory::AvailableDriversAsString().c_str())); |
59 |
|
|
|
// create an audio output device |
|
|
/* bool no_jack = true; |
|
|
#if HAVE_JACK |
|
|
if (use_jack) { |
|
|
dmsg(1,("Creating audio output device (Jack)...")); |
|
|
try { |
|
|
pSampler->CreateAudioOutputDevice(audio_output_type_jack); |
|
|
no_jack = false; |
|
|
} |
|
|
catch (AudioOutputException aoe) { |
|
|
aoe.PrintMessage(); |
|
|
dmsg(1,("Trying to create Alsa output device instead.\n")); |
|
|
} |
|
|
} |
|
|
#endif // HAVE_JACK |
|
|
if (no_jack) { |
|
|
dmsg(1,("Creating audio output device (Alsa)...")); |
|
|
try { |
|
|
pSampler->CreateAudioOutputDevice(audio_output_type_alsa); |
|
|
} |
|
|
catch (AudioOutputException aoe) { |
|
|
aoe.PrintMessage(); |
|
|
dmsg(1,("Trying to create Alsa output device instead.\n")); |
|
|
return EXIT_FAILURE; |
|
|
} |
|
|
} |
|
|
dmsg(1,("OK\n"));*/ |
|
|
|
|
60 |
// start LSCP network server |
// start LSCP network server |
61 |
dmsg(1,("Starting LSCP network server...")); |
dmsg(1,("Starting LSCP network server...")); |
62 |
pLSCPServer = new LSCPServer(pSampler); |
pLSCPServer = new LSCPServer(pSampler); |
63 |
pLSCPServer->StartThread(); |
pLSCPServer->StartThread(); |
64 |
|
pLSCPServer->WaitUntilInitialized(); |
65 |
dmsg(1,("OK\n")); |
dmsg(1,("OK\n")); |
66 |
|
|
67 |
printf("LinuxSampler initialization completed.\n"); |
printf("LinuxSampler initialization completed.\n"); |