3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005 Christian Schoenebeck * |
* Copyright (C) 2005, 2006 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
38 |
Sampler* pSampler = NULL; |
Sampler* pSampler = NULL; |
39 |
LSCPServer* pLSCPServer = NULL; |
LSCPServer* pLSCPServer = NULL; |
40 |
pthread_t main_thread; |
pthread_t main_thread; |
41 |
|
pid_t main_pid; |
42 |
bool bPrintStatistics = false; |
bool bPrintStatistics = false; |
43 |
bool profile = false; |
bool profile = false; |
44 |
bool tune = true; |
bool tune = true; |
54 |
// initialize the stack trace mechanism with our binary file |
// initialize the stack trace mechanism with our binary file |
55 |
StackTraceInit(argv[0], -1); |
StackTraceInit(argv[0], -1); |
56 |
|
|
57 |
|
main_pid = getpid(); |
58 |
main_thread = pthread_self(); |
main_thread = pthread_self(); |
59 |
|
|
60 |
|
|
61 |
|
|
62 |
// setting signal handler for catching SIGINT (thus e.g. <CTRL><C>) |
// setting signal handler for catching SIGINT (thus e.g. <CTRL><C>) |
63 |
signal(SIGINT, signal_handler); |
signal(SIGINT, signal_handler); |
64 |
|
|
83 |
|
|
84 |
dmsg(1,("LinuxSampler %s\n", VERSION)); |
dmsg(1,("LinuxSampler %s\n", VERSION)); |
85 |
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")); |
86 |
dmsg(1,("Copyright (C) 2005 Christian Schoenebeck\n")); |
dmsg(1,("Copyright (C) 2005, 2006 Christian Schoenebeck\n")); |
87 |
|
|
88 |
if (tune) { |
if (tune) { |
89 |
// detect and print system / CPU specific features |
// detect and print system / CPU specific features |
115 |
dmsg(1,("Calibrating profiler...")); |
dmsg(1,("Calibrating profiler...")); |
116 |
gig::Profiler::Calibrate(); |
gig::Profiler::Calibrate(); |
117 |
gig::Profiler::Reset(); |
gig::Profiler::Reset(); |
118 |
|
gig::Profiler::enable(); |
119 |
dmsg(1,("OK\n")); |
dmsg(1,("OK\n")); |
120 |
} |
} |
121 |
|
|
125 |
rtEvents.push_back(LSCPEvent::event_voice_count); |
rtEvents.push_back(LSCPEvent::event_voice_count); |
126 |
rtEvents.push_back(LSCPEvent::event_stream_count); |
rtEvents.push_back(LSCPEvent::event_stream_count); |
127 |
rtEvents.push_back(LSCPEvent::event_buffer_fill); |
rtEvents.push_back(LSCPEvent::event_buffer_fill); |
128 |
|
rtEvents.push_back(LSCPEvent::event_total_voice_count); |
129 |
|
|
130 |
while (true) { |
while (true) { |
131 |
if (bPrintStatistics) { |
if (bPrintStatistics) { |
167 |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_voice_count, iter->first, pEngine->VoiceCount())); |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_voice_count, iter->first, pEngine->VoiceCount())); |
168 |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_stream_count, iter->first, pEngine->DiskStreamCount())); |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_stream_count, iter->first, pEngine->DiskStreamCount())); |
169 |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_buffer_fill, iter->first, pEngine->DiskStreamBufferFillPercentage())); |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_buffer_fill, iter->first, pEngine->DiskStreamBufferFillPercentage())); |
170 |
|
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_total_voice_count, pSampler->GetVoiceCount())); |
171 |
} |
} |
172 |
LSCPServer::UnlockRTNotify(); |
LSCPServer::UnlockRTNotify(); |
173 |
} |
} |
223 |
} |
} |
224 |
|
|
225 |
void kill_app() { |
void kill_app() { |
226 |
kill(main_thread, SIGKILL); |
kill(main_pid, SIGKILL); |
227 |
} |
} |
228 |
|
|
229 |
void parse_options(int argc, char **argv) { |
void parse_options(int argc, char **argv) { |