123 |
|
|
124 |
|
|
125 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
126 |
// qsampler -- namespace |
// QSampler -- namespace |
127 |
|
|
128 |
|
|
129 |
namespace QSampler { |
namespace QSampler { |
143 |
|
|
144 |
|
|
145 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
146 |
// LscpEvent -- specialty for LSCP callback comunication. |
// QSampler::LscpEvent -- specialty for LSCP callback comunication. |
|
|
|
147 |
|
|
148 |
class LscpEvent : public QEvent |
class LscpEvent : public QEvent |
149 |
{ |
{ |
158 |
} |
} |
159 |
|
|
160 |
// Accessors. |
// Accessors. |
161 |
lscp_event_t event() { return m_event; } |
lscp_event_t event() { return m_event; } |
162 |
QString& data() { return m_data; } |
const QString& data() { return m_data; } |
163 |
|
|
164 |
private: |
private: |
165 |
|
|
171 |
|
|
172 |
|
|
173 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
174 |
// qsamplerMainForm -- Main window form implementation. |
// QSampler::Workspace -- Main window workspace (MDI Area) decl. |
175 |
|
|
176 |
|
class Workspace : public QMdiArea |
177 |
|
{ |
178 |
|
public: |
179 |
|
|
180 |
|
Workspace(MainForm *pMainForm) : QMdiArea(pMainForm) {} |
181 |
|
|
182 |
|
protected: |
183 |
|
|
184 |
|
void resizeEvent(QResizeEvent *) |
185 |
|
{ |
186 |
|
MainForm *pMainForm = static_cast<MainForm *> (parentWidget()); |
187 |
|
if (pMainForm) |
188 |
|
pMainForm->channelsArrangeAuto(); |
189 |
|
} |
190 |
|
}; |
191 |
|
|
192 |
|
|
193 |
|
//------------------------------------------------------------------------- |
194 |
|
// QSampler::MainForm -- Main window form implementation. |
195 |
|
|
196 |
// Kind of singleton reference. |
// Kind of singleton reference. |
197 |
MainForm* MainForm::g_pMainForm = NULL; |
MainForm *MainForm::g_pMainForm = NULL; |
198 |
|
|
199 |
MainForm::MainForm ( QWidget *pParent ) |
MainForm::MainForm ( QWidget *pParent ) |
200 |
: QMainWindow(pParent) |
: QMainWindow(pParent) |
289 |
#endif |
#endif |
290 |
|
|
291 |
// Make it an MDI workspace. |
// Make it an MDI workspace. |
292 |
m_pWorkspace = new QMdiArea(this); |
m_pWorkspace = new Workspace(this); |
293 |
m_pWorkspace->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
m_pWorkspace->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
294 |
m_pWorkspace->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
m_pWorkspace->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
295 |
// Set the activation connection. |
// Set the activation connection. |
714 |
} |
} |
715 |
|
|
716 |
|
|
|
// Window resize event handler. |
|
|
void MainForm::resizeEvent ( QResizeEvent * ) |
|
|
{ |
|
|
if (m_pOptions->bAutoArrange) |
|
|
channelsArrange(); |
|
|
} |
|
|
|
|
|
|
|
717 |
// LADISH Level 1 -- SIGUSR1 signal handler. |
// LADISH Level 1 -- SIGUSR1 signal handler. |
718 |
void MainForm::handle_sigusr1 (void) |
void MainForm::handle_sigusr1 (void) |
719 |
{ |
{ |
753 |
|
|
754 |
|
|
755 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
756 |
// qsamplerMainForm -- Brainless public property accessors. |
// QSampler::MainForm -- Brainless public property accessors. |
757 |
|
|
758 |
// The global options settings property. |
// The global options settings property. |
759 |
Options *MainForm::options (void) const |
Options *MainForm::options (void) const |
777 |
|
|
778 |
|
|
779 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
780 |
// qsamplerMainForm -- Session file stuff. |
// QSampler::MainForm -- Session file stuff. |
781 |
|
|
782 |
// Format the displayable session filename. |
// Format the displayable session filename. |
783 |
QString MainForm::sessionName ( const QString& sFilename ) |
QString MainForm::sessionName ( const QString& sFilename ) |
1046 |
int iErrors = 0; |
int iErrors = 0; |
1047 |
QTextStream ts(&file); |
QTextStream ts(&file); |
1048 |
ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl; |
ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl; |
1049 |
ts << "# " << tr("Version") |
ts << "# " << tr("Version") << ": " CONFIG_BUILD_VERSION << endl; |
1050 |
<< ": " QSAMPLER_VERSION << endl; |
// ts << "# " << tr("Build") << ": " CONFIG_BUILD_DATE << endl; |
|
ts << "# " << tr("Build") |
|
|
<< ": " __DATE__ " " __TIME__ << endl; |
|
1051 |
ts << "#" << endl; |
ts << "#" << endl; |
1052 |
ts << "# " << tr("File") |
ts << "# " << tr("File") |
1053 |
<< ": " << QFileInfo(sFilename).fileName() << endl; |
<< ": " << QFileInfo(sFilename).fileName() << endl; |
1369 |
|
|
1370 |
|
|
1371 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
1372 |
// qsamplerMainForm -- File Action slots. |
// QSampler::MainForm -- File Action slots. |
1373 |
|
|
1374 |
// Create a new sampler session. |
// Create a new sampler session. |
1375 |
void MainForm::fileNew (void) |
void MainForm::fileNew (void) |
1535 |
|
|
1536 |
|
|
1537 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
1538 |
// qsamplerMainForm -- Edit Action slots. |
// QSampler::MainForm -- Edit Action slots. |
1539 |
|
|
1540 |
// Add a new sampler channel. |
// Add a new sampler channel. |
1541 |
void MainForm::editAddChannel (void) |
void MainForm::editAddChannel (void) |
1570 |
} |
} |
1571 |
|
|
1572 |
// Do we auto-arrange? |
// Do we auto-arrange? |
1573 |
if (m_pOptions && m_pOptions->bAutoArrange) |
channelsArrangeAuto(); |
|
channelsArrange(); |
|
1574 |
|
|
1575 |
// Make that an overall update. |
// Make that an overall update. |
1576 |
m_iDirtyCount++; |
m_iDirtyCount++; |
1711 |
|
|
1712 |
|
|
1713 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
1714 |
// qsamplerMainForm -- View Action slots. |
// QSampler::MainForm -- View Action slots. |
1715 |
|
|
1716 |
// Show/hide the main program window menubar. |
// Show/hide the main program window menubar. |
1717 |
void MainForm::viewMenubar ( bool bOn ) |
void MainForm::viewMenubar ( bool bOn ) |
1892 |
|
|
1893 |
|
|
1894 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
1895 |
// qsamplerMainForm -- Channels action slots. |
// QSampler::MainForm -- Channels action slots. |
1896 |
|
|
1897 |
// Arrange channel strips. |
// Arrange channel strips. |
1898 |
void MainForm::channelsArrange (void) |
void MainForm::channelsArrange (void) |
1934 |
m_pOptions->bAutoArrange = bOn; |
m_pOptions->bAutoArrange = bOn; |
1935 |
|
|
1936 |
// If on, update whole workspace... |
// If on, update whole workspace... |
1937 |
if (m_pOptions->bAutoArrange) |
channelsArrangeAuto(); |
1938 |
|
} |
1939 |
|
|
1940 |
|
|
1941 |
|
void MainForm::channelsArrangeAuto (void) |
1942 |
|
{ |
1943 |
|
if (m_pOptions && m_pOptions->bAutoArrange) |
1944 |
channelsArrange(); |
channelsArrange(); |
1945 |
} |
} |
1946 |
|
|
1947 |
|
|
1948 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
1949 |
// qsamplerMainForm -- Help Action slots. |
// QSampler::MainForm -- Help Action slots. |
1950 |
|
|
1951 |
// Show information about the Qt toolkit. |
// Show information about the Qt toolkit. |
1952 |
void MainForm::helpAboutQt (void) |
void MainForm::helpAboutQt (void) |
1958 |
// Show information about application program. |
// Show information about application program. |
1959 |
void MainForm::helpAbout (void) |
void MainForm::helpAbout (void) |
1960 |
{ |
{ |
1961 |
// Stuff the about box text... |
QStringList list; |
|
QString sText = "<p>\n"; |
|
|
sText += "<b>" QSAMPLER_TITLE " - " + tr(QSAMPLER_SUBTITLE) + "</b><br />\n"; |
|
|
sText += "<br />\n"; |
|
|
sText += tr("Version") + ": <b>" QSAMPLER_VERSION "</b><br />\n"; |
|
|
sText += "<small>" + tr("Build") + ": " __DATE__ " " __TIME__ "</small><br />\n"; |
|
1962 |
#ifdef CONFIG_DEBUG |
#ifdef CONFIG_DEBUG |
1963 |
sText += "<small><font color=\"red\">"; |
list << tr("Debugging option enabled."); |
|
sText += tr("Debugging option enabled."); |
|
|
sText += "</font></small><br />"; |
|
1964 |
#endif |
#endif |
1965 |
#ifndef CONFIG_LIBGIG |
#ifndef CONFIG_LIBGIG |
1966 |
sText += "<small><font color=\"red\">"; |
list << tr("GIG (libgig) file support disabled."); |
|
sText += tr("GIG (libgig) file support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1967 |
#endif |
#endif |
1968 |
#ifndef CONFIG_INSTRUMENT_NAME |
#ifndef CONFIG_INSTRUMENT_NAME |
1969 |
sText += "<small><font color=\"red\">"; |
list << tr("LSCP (liblscp) instrument_name support disabled."); |
|
sText += tr("LSCP (liblscp) instrument_name support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1970 |
#endif |
#endif |
1971 |
#ifndef CONFIG_MUTE_SOLO |
#ifndef CONFIG_MUTE_SOLO |
1972 |
sText += "<small><font color=\"red\">"; |
list << tr("Sampler channel Mute/Solo support disabled."); |
|
sText += tr("Sampler channel Mute/Solo support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1973 |
#endif |
#endif |
1974 |
#ifndef CONFIG_AUDIO_ROUTING |
#ifndef CONFIG_AUDIO_ROUTING |
1975 |
sText += "<small><font color=\"red\">"; |
list << tr("LSCP (liblscp) audio_routing support disabled."); |
|
sText += tr("LSCP (liblscp) audio_routing support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1976 |
#endif |
#endif |
1977 |
#ifndef CONFIG_FXSEND |
#ifndef CONFIG_FXSEND |
1978 |
sText += "<small><font color=\"red\">"; |
list << tr("Sampler channel Effect Sends support disabled."); |
|
sText += tr("Sampler channel Effect Sends support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1979 |
#endif |
#endif |
1980 |
#ifndef CONFIG_VOLUME |
#ifndef CONFIG_VOLUME |
1981 |
sText += "<small><font color=\"red\">"; |
list << tr("Global volume support disabled."); |
|
sText += tr("Global volume support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1982 |
#endif |
#endif |
1983 |
#ifndef CONFIG_MIDI_INSTRUMENT |
#ifndef CONFIG_MIDI_INSTRUMENT |
1984 |
sText += "<small><font color=\"red\">"; |
list << tr("MIDI instrument mapping support disabled."); |
|
sText += tr("MIDI instrument mapping support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1985 |
#endif |
#endif |
1986 |
#ifndef CONFIG_EDIT_INSTRUMENT |
#ifndef CONFIG_EDIT_INSTRUMENT |
1987 |
sText += "<small><font color=\"red\">"; |
list << tr("Instrument editing support disabled."); |
|
sText += tr("Instrument editing support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1988 |
#endif |
#endif |
1989 |
#ifndef CONFIG_EVENT_CHANNEL_MIDI |
#ifndef CONFIG_EVENT_CHANNEL_MIDI |
1990 |
sText += "<small><font color=\"red\">"; |
list << tr("Channel MIDI event support disabled."); |
|
sText += tr("Channel MIDI event support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1991 |
#endif |
#endif |
1992 |
#ifndef CONFIG_EVENT_DEVICE_MIDI |
#ifndef CONFIG_EVENT_DEVICE_MIDI |
1993 |
sText += "<small><font color=\"red\">"; |
list << tr("Device MIDI event support disabled."); |
|
sText += tr("Device MIDI event support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1994 |
#endif |
#endif |
1995 |
#ifndef CONFIG_MAX_VOICES |
#ifndef CONFIG_MAX_VOICES |
1996 |
sText += "<small><font color=\"red\">"; |
list << tr("Runtime max. voices / disk streams support disabled."); |
|
sText += tr("Runtime max. voices / disk streams support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1997 |
#endif |
#endif |
1998 |
|
|
1999 |
|
// Stuff the about box text... |
2000 |
|
QString sText = "<p>\n"; |
2001 |
|
sText += "<b>" QSAMPLER_TITLE " - " + tr(QSAMPLER_SUBTITLE) + "</b><br />\n"; |
2002 |
|
sText += "<br />\n"; |
2003 |
|
sText += tr("Version") + ": <b>" CONFIG_BUILD_VERSION "</b><br />\n"; |
2004 |
|
// sText += "<small>" + tr("Build") + ": " CONFIG_BUILD_DATE "</small><br />\n"; |
2005 |
|
if (!list.isEmpty()) { |
2006 |
|
sText += "<small><font color=\"red\">"; |
2007 |
|
sText += list.join("<br />\n"); |
2008 |
|
sText += "</font></small>"; |
2009 |
|
} |
2010 |
sText += "<br />\n"; |
sText += "<br />\n"; |
2011 |
sText += tr("Using") + ": "; |
sText += tr("Using") + ": "; |
2012 |
sText += ::lscp_client_package(); |
sText += ::lscp_client_package(); |
2036 |
|
|
2037 |
|
|
2038 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
2039 |
// qsamplerMainForm -- Main window stabilization. |
// QSampler::MainForm -- Main window stabilization. |
2040 |
|
|
2041 |
void MainForm::stabilizeForm (void) |
void MainForm::stabilizeForm (void) |
2042 |
{ |
{ |
2188 |
updateAllChannelStrips(false); |
updateAllChannelStrips(false); |
2189 |
|
|
2190 |
// Do we auto-arrange? |
// Do we auto-arrange? |
2191 |
if (m_pOptions && m_pOptions->bAutoArrange) |
channelsArrangeAuto(); |
|
channelsArrange(); |
|
2192 |
|
|
2193 |
// Remember to refresh devices and instruments... |
// Remember to refresh devices and instruments... |
2194 |
if (m_pInstrumentListForm) |
if (m_pInstrumentListForm) |
2221 |
createChannelStrip(new Channel(piChannelIDs[iChannel])); |
createChannelStrip(new Channel(piChannelIDs[iChannel])); |
2222 |
} |
} |
2223 |
// Do we auto-arrange? |
// Do we auto-arrange? |
2224 |
if (m_pOptions && m_pOptions->bAutoArrange) |
channelsArrangeAuto(); |
|
channelsArrange(); |
|
2225 |
// remove dead channel strips |
// remove dead channel strips |
2226 |
if (bRemoveDeadStrips) { |
if (bRemoveDeadStrips) { |
2227 |
const QList<QMdiSubWindow *>& wlist |
const QList<QMdiSubWindow *>& wlist |
2413 |
|
|
2414 |
|
|
2415 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
2416 |
// qsamplerMainForm -- Messages window form handlers. |
// QSampler::MainForm -- Messages window form handlers. |
2417 |
|
|
2418 |
// Messages output methods. |
// Messages output methods. |
2419 |
void MainForm::appendMessages( const QString& s ) |
void MainForm::appendMessages( const QString& s ) |
2525 |
|
|
2526 |
|
|
2527 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
2528 |
// qsamplerMainForm -- MDI channel strip management. |
// QSampler::MainForm -- MDI channel strip management. |
2529 |
|
|
2530 |
// The channel strip creation executive. |
// The channel strip creation executive. |
2531 |
ChannelStrip *MainForm::createChannelStrip ( Channel *pChannel ) |
ChannelStrip *MainForm::createChannelStrip ( Channel *pChannel ) |
2585 |
delete pMdiSubWindow; |
delete pMdiSubWindow; |
2586 |
|
|
2587 |
// Do we auto-arrange? |
// Do we auto-arrange? |
2588 |
if (m_pOptions && m_pOptions->bAutoArrange) |
channelsArrangeAuto(); |
|
channelsArrange(); |
|
2589 |
} |
} |
2590 |
|
|
2591 |
|
|
2694 |
|
|
2695 |
|
|
2696 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
2697 |
// qsamplerMainForm -- Timer stuff. |
// QSampler::MainForm -- Timer stuff. |
2698 |
|
|
2699 |
// Set the pseudo-timer delay schedule. |
// Set the pseudo-timer delay schedule. |
2700 |
void MainForm::startSchedule ( int iStartDelay ) |
void MainForm::startSchedule ( int iStartDelay ) |
2767 |
|
|
2768 |
|
|
2769 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
2770 |
// qsamplerMainForm -- Server stuff. |
// QSampler::MainForm -- Server stuff. |
2771 |
|
|
2772 |
// Start linuxsampler server... |
// Start linuxsampler server... |
2773 |
void MainForm::startServer (void) |
void MainForm::startServer (void) |
2931 |
|
|
2932 |
|
|
2933 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
2934 |
// qsamplerMainForm -- Client stuff. |
// QSampler::MainForm -- Client stuff. |
2935 |
|
|
2936 |
// The LSCP client callback procedure. |
// The LSCP client callback procedure. |
2937 |
lscp_status_t qsampler_client_callback ( lscp_client_t */*pClient*/, |
lscp_status_t qsampler_client_callback ( lscp_client_t */*pClient*/, |