--- linuxsampler/trunk/src/linuxsampler.cpp 2009/01/31 11:31:41 1830 +++ linuxsampler/trunk/src/linuxsampler.cpp 2012/01/24 13:00:40 2306 @@ -3,7 +3,7 @@ * LinuxSampler - modular, streaming capable sampler * * * * Copyright (C) 2003-2004 by Benno Senoner and Christian Schoenebeck * - * Copyright (C) 2005-2009 Christian Schoenebeck * + * Copyright (C) 2005-2011 Christian Schoenebeck * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -23,11 +23,17 @@ #include #include +#include #if defined(WIN32) // require at least Windows 2000 for the GlobalMemoryStatusEx() call +#if _WIN32_WINNT < 0x0500 +#ifdef _WIN32_WINNT +#undef _WIN32_WINNT +#endif #define _WIN32_WINNT 0x0500 #endif +#endif #include "Sampler.h" #include "common/global_private.h" @@ -35,6 +41,7 @@ #include "plugins/InstrumentEditorFactory.h" #include "drivers/midi/MidiInputDeviceFactory.h" #include "drivers/audio/AudioOutputDeviceFactory.h" +#include "effects/EffectFactory.h" #include "engines/gig/Profiler.h" #include "network/lscpserver.h" #include "common/stacktrace.h" @@ -66,6 +73,7 @@ static bool bShowStackTrace = false; unsigned long int lscp_addr; unsigned short int lscp_port; +String ExecAfterInit; void parse_options(int argc, char **argv); void signal_handler(int signal); @@ -111,21 +119,22 @@ dmsg(1,("LinuxSampler %s\n", VERSION)); dmsg(1,("Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck\n")); - dmsg(1,("Copyright (C) 2005-2009 Christian Schoenebeck\n")); + dmsg(1,("Copyright (C) 2005-2011 Christian Schoenebeck\n")); #if defined(WIN32) + #if 0 // some WIN32 memory info code which tries to determine the maximum lockable amount of memory (for debug purposes) SYSTEM_INFO siSysInfo; long physical_memory; GetSystemInfo(&siSysInfo); - dmsg(1,("page size=%d\n", siSysInfo.dwPageSize)); + dmsg(2,("page size=%d\n", siSysInfo.dwPageSize)); MEMORYSTATUSEX statex; statex.dwLength = sizeof (statex); GlobalMemoryStatusEx (&statex); - dmsg(1, ("There are %*I64d total Kbytes of physical memory.\n", + dmsg(2, ("There are %*I64d total Kbytes of physical memory.\n", 8, statex.ullTotalPhys)); - dmsg(1, ("There are %*I64d free Kbytes of physical memory.\n", + dmsg(2, ("There are %*I64d free Kbytes of physical memory.\n", 8, statex.ullAvailPhys)); physical_memory = statex.ullTotalPhys; @@ -158,7 +167,8 @@ if(RequestedMinimumWorkingSetSize < DefaultMinimumWorkingSetSize) break; } - dmsg(1,("AFTER GetProcessWorkingSetSize: res = %d MinimumWorkingSetSize=%d, MaximumWorkingSetSize=%d\n", res,MinimumWorkingSetSize, MaximumWorkingSetSize)); + dmsg(2,("AFTER GetProcessWorkingSetSize: res = %d MinimumWorkingSetSize=%d, MaximumWorkingSetSize=%d\n", res,MinimumWorkingSetSize, MaximumWorkingSetSize)); + #endif #endif // WIN32 if (tune) { @@ -180,6 +190,8 @@ dmsg(1,("Registered MIDI input drivers: %s\n", MidiInputDeviceFactory::AvailableDriversAsString().c_str())); dmsg(1,("Registered audio output drivers: %s\n", AudioOutputDeviceFactory::AvailableDriversAsString().c_str())); dmsg(1,("Registered instrument editors: %s\n", InstrumentEditorFactory::AvailableEditorsAsString().c_str())); + dmsg(1,("Registered internal effect systems: %s\n", EffectFactory::AvailableEffectSystemsAsString().c_str())); + dmsg(1,("Registered internal effects: %d\n", EffectFactory::AvailableEffectsCount())); // start LSCP network server struct in_addr addr; @@ -200,6 +212,13 @@ } printf("LinuxSampler initialization completed. :-)\n\n"); + + if (ExecAfterInit != "") { + printf("Executing command: %s\n\n", ExecAfterInit.c_str()); + if (system(ExecAfterInit.c_str()) == -1) { + std::cerr << "Failed to execute the command" << std::endl; + } + } while (atomic_read(&running)) { if (bPrintStatistics) { @@ -304,6 +323,7 @@ {"lscp-addr",1,0,0}, {"lscp-port",1,0,0}, {"stacktrace",0,0,0}, + {"exec-after-init",1,0,0}, {0,0,0,0} }; @@ -329,6 +349,7 @@ printf("--instruments-db-location specifies the instruments DB file\n"); printf("--stacktrace automatically shows stacktrace if crashes\n"); printf(" (broken on most systems at the moment)\n"); + printf("--exec-after-init executes a command after initialization\n"); exit(EXIT_SUCCESS); break; case 1: // --version @@ -337,6 +358,9 @@ break; case 2: // --profile profile = true; + //FIXME: profiling code is currently broken! + std::cerr << "Option '--profile' is currently not supported, since the profiling code is currently broken!" << std::endl; + exit(EXIT_FAILURE); break; case 3: // --no-tune tune = false; @@ -418,6 +442,9 @@ case 9: // --stacktrace bShowStackTrace = true; break; + case 10: // --exec-after-init + ExecAfterInit = optarg; + break; } } }