93 |
#endif |
#endif |
94 |
|
|
95 |
|
|
96 |
|
//------------------------------------------------------------------------- |
97 |
|
// LADISH Level 1 support stuff. |
98 |
|
|
99 |
|
#if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H) |
100 |
|
|
101 |
|
#include <QSocketNotifier> |
102 |
|
|
103 |
|
#include <sys/types.h> |
104 |
|
#include <sys/socket.h> |
105 |
|
|
106 |
|
#include <signal.h> |
107 |
|
|
108 |
|
// File descriptor for SIGUSR1 notifier. |
109 |
|
static int g_fdUsr1[2]; |
110 |
|
|
111 |
|
// Unix SIGUSR1 signal handler. |
112 |
|
static void qsampler_sigusr1_handler ( int /* signo */ ) |
113 |
|
{ |
114 |
|
char c = 1; |
115 |
|
|
116 |
|
(::write(g_fdUsr1[0], &c, sizeof(c)) > 0); |
117 |
|
} |
118 |
|
|
119 |
|
#endif // HAVE_SIGNAL_H |
120 |
|
|
121 |
|
|
122 |
|
//------------------------------------------------------------------------- |
123 |
|
// qsampler -- namespace |
124 |
|
|
125 |
|
|
126 |
namespace QSampler { |
namespace QSampler { |
127 |
|
|
128 |
// Timer constant stuff. |
// Timer constant stuff. |
137 |
|
|
138 |
// Specialties for thread-callback comunication. |
// Specialties for thread-callback comunication. |
139 |
#define QSAMPLER_LSCP_EVENT QEvent::Type(QEvent::User + 1) |
#define QSAMPLER_LSCP_EVENT QEvent::Type(QEvent::User + 1) |
|
#define QSAMPLER_SAVE_EVENT QEvent::Type(QEvent::User + 2) |
|
140 |
|
|
141 |
|
|
142 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
169 |
|
|
170 |
|
|
171 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
|
// LADISH Level 1 support stuff. |
|
|
|
|
|
void qsampler_on_sigusr1 ( int /*signo*/ ) |
|
|
{ |
|
|
QApplication::postEvent( |
|
|
MainForm::getInstance(), |
|
|
new QEvent(QSAMPLER_SAVE_EVENT)); |
|
|
} |
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------- |
|
172 |
// qsamplerMainForm -- Main window form implementation. |
// qsamplerMainForm -- Main window form implementation. |
173 |
|
|
174 |
// Kind of singleton reference. |
// Kind of singleton reference. |
202 |
|
|
203 |
m_iTimerSlot = 0; |
m_iTimerSlot = 0; |
204 |
|
|
205 |
#ifdef HAVE_SIGNAL_H |
#if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H) |
206 |
|
|
207 |
// Set to ignore any fatal "Broken pipe" signals. |
// Set to ignore any fatal "Broken pipe" signals. |
208 |
::signal(SIGPIPE, SIG_IGN); |
::signal(SIGPIPE, SIG_IGN); |
209 |
|
|
210 |
// LADISH Level 1 suport. |
// LADISH Level 1 suport. |
211 |
::signal(SIGUSR1, qsampler_on_sigusr1); |
|
212 |
#endif |
// Initialize file descriptors for SIGUSR1 socket notifier. |
213 |
|
::socketpair(AF_UNIX, SOCK_STREAM, 0, g_fdUsr1); |
214 |
|
m_pUsr1Notifier |
215 |
|
= new QSocketNotifier(g_fdUsr1[1], QSocketNotifier::Read, this); |
216 |
|
|
217 |
|
QObject::connect(m_pUsr1Notifier, |
218 |
|
SIGNAL(activated(int)), |
219 |
|
SLOT(handle_sigusr1())); |
220 |
|
|
221 |
|
// Install SIGUSR1 signal handler. |
222 |
|
struct sigaction usr1; |
223 |
|
usr1.sa_handler = qsampler_sigusr1_handler; |
224 |
|
sigemptyset(&usr1.sa_mask); |
225 |
|
usr1.sa_flags = 0; |
226 |
|
usr1.sa_flags |= SA_RESTART; |
227 |
|
::sigaction(SIGUSR1, &usr1, NULL); |
228 |
|
|
229 |
|
#else // HAVE_SIGNAL_H |
230 |
|
|
231 |
|
m_pUsr1Notifier = NULL; |
232 |
|
|
233 |
|
#endif // !HAVE_SIGNAL_H |
234 |
|
|
235 |
#ifdef CONFIG_VOLUME |
#ifdef CONFIG_VOLUME |
236 |
// Make some extras into the toolbar... |
// Make some extras into the toolbar... |
403 |
WSACleanup(); |
WSACleanup(); |
404 |
#endif |
#endif |
405 |
|
|
406 |
|
#if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H) |
407 |
|
if (m_pUsr1Notifier) |
408 |
|
delete m_pUsr1Notifier; |
409 |
|
#endif |
410 |
|
|
411 |
// Finally drop any widgets around... |
// Finally drop any widgets around... |
412 |
if (m_pDeviceForm) |
if (m_pDeviceForm) |
413 |
delete m_pDeviceForm; |
delete m_pDeviceForm; |
591 |
QListIterator<QUrl> iter(pMimeData->urls()); |
QListIterator<QUrl> iter(pMimeData->urls()); |
592 |
while (iter.hasNext()) { |
while (iter.hasNext()) { |
593 |
const QString& sPath = iter.next().toLocalFile(); |
const QString& sPath = iter.next().toLocalFile(); |
594 |
if (Channel::isInstrumentFile(sPath)) { |
// if (Channel::isDlsInstrumentFile(sPath)) { |
595 |
|
if (QFileInfo(sPath).exists()) { |
596 |
// Try to create a new channel from instrument file... |
// Try to create a new channel from instrument file... |
597 |
Channel *pChannel = new Channel(); |
Channel *pChannel = new Channel(); |
598 |
if (pChannel == NULL) |
if (pChannel == NULL) |
684 |
.arg(::lscp_event_to_text(pLscpEvent->event())) |
.arg(::lscp_event_to_text(pLscpEvent->event())) |
685 |
.arg(pLscpEvent->data()), "#996699"); |
.arg(pLscpEvent->data()), "#996699"); |
686 |
} |
} |
687 |
} // LADISH1 Level 1 support... |
} |
688 |
else if (pEvent->type() == QSAMPLER_SAVE_EVENT) |
} |
689 |
|
|
690 |
|
|
691 |
|
// LADISH Level 1 -- SIGUSR1 signal handler. |
692 |
|
void MainForm::handle_sigusr1 (void) |
693 |
|
{ |
694 |
|
#if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H) |
695 |
|
|
696 |
|
char c; |
697 |
|
|
698 |
|
if (::read(g_fdUsr1[1], &c, sizeof(c)) > 0) |
699 |
saveSession(false); |
saveSession(false); |
700 |
|
|
701 |
|
#endif |
702 |
} |
} |
703 |
|
|
704 |
|
|