2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
|
Copyright (C) 2007, Christian Schoenebeck |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
8 |
modify it under the terms of the GNU General Public License |
modify it under the terms of the GNU General Public License |
20 |
|
|
21 |
*****************************************************************************/ |
*****************************************************************************/ |
22 |
|
|
|
#include "qsamplerUtilities.h" |
|
23 |
#include "qsamplerAbout.h" |
#include "qsamplerAbout.h" |
24 |
#include "qsamplerInstrument.h" |
#include "qsamplerInstrument.h" |
25 |
|
#include "qsamplerUtilities.h" |
26 |
|
|
27 |
#include "qsamplerMainForm.h" |
#include "qsamplerMainForm.h" |
28 |
|
|
29 |
|
|
30 |
|
using namespace QSampler; |
31 |
|
|
32 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
33 |
// qsamplerInstrument - MIDI instrument map structure. |
// qsamplerInstrument - MIDI instrument map structure. |
34 |
// |
// |
161 |
{ |
{ |
162 |
#ifdef CONFIG_MIDI_INSTRUMENT |
#ifdef CONFIG_MIDI_INSTRUMENT |
163 |
|
|
164 |
qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance(); |
MainForm *pMainForm = MainForm::getInstance(); |
165 |
if (pMainForm == NULL) |
if (pMainForm == NULL) |
166 |
return false; |
return false; |
167 |
if (pMainForm->client() == NULL) |
if (pMainForm->client() == NULL) |
194 |
} |
} |
195 |
|
|
196 |
if (::lscp_map_midi_instrument(pMainForm->client(), &instr, |
if (::lscp_map_midi_instrument(pMainForm->client(), &instr, |
197 |
m_sEngineName.latin1(), |
m_sEngineName.toUtf8().constData(), |
198 |
lscpEscapePath(m_sInstrumentFile).latin1(), |
qsamplerUtilities::lscpEscapePath( |
199 |
m_iInstrumentNr, |
m_sInstrumentFile).toUtf8().constData(), |
200 |
m_fVolume, |
m_iInstrumentNr, m_fVolume, load_mode, |
201 |
load_mode, |
m_sName.toUtf8().constData()) != LSCP_OK) { |
|
m_sName.latin1()) != LSCP_OK) { |
|
202 |
pMainForm->appendMessagesClient("lscp_map_midi_instrument"); |
pMainForm->appendMessagesClient("lscp_map_midi_instrument"); |
203 |
return false; |
return false; |
204 |
} |
} |
220 |
if (m_iMap < 0 || m_iBank < 0 || m_iProg < 0) |
if (m_iMap < 0 || m_iBank < 0 || m_iProg < 0) |
221 |
return false; |
return false; |
222 |
|
|
223 |
qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance(); |
MainForm *pMainForm = MainForm::getInstance(); |
224 |
if (pMainForm == NULL) |
if (pMainForm == NULL) |
225 |
return false; |
return false; |
226 |
if (pMainForm->client() == NULL) |
if (pMainForm->client() == NULL) |
254 |
if (m_iMap < 0 || m_iBank < 0 || m_iProg < 0) |
if (m_iMap < 0 || m_iBank < 0 || m_iProg < 0) |
255 |
return false; |
return false; |
256 |
|
|
257 |
qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance(); |
MainForm *pMainForm = MainForm::getInstance(); |
258 |
if (pMainForm == NULL) |
if (pMainForm == NULL) |
259 |
return false; |
return false; |
260 |
if (pMainForm->client() == NULL) |
if (pMainForm->client() == NULL) |
273 |
return false; |
return false; |
274 |
} |
} |
275 |
|
|
276 |
m_sName = pInstrInfo->name; |
m_sName = qsamplerUtilities::lscpEscapedTextToRaw(pInstrInfo->name); |
277 |
m_sEngineName = pInstrInfo->engine_name; |
m_sEngineName = pInstrInfo->engine_name; |
278 |
m_sInstrumentName = pInstrInfo->instrument_name; |
m_sInstrumentName = qsamplerUtilities::lscpEscapedTextToRaw( |
279 |
m_sInstrumentFile = pInstrInfo->instrument_file; |
pInstrInfo->instrument_name); |
280 |
m_iInstrumentNr = pInstrInfo->instrument_nr; |
m_sInstrumentFile = qsamplerUtilities::lscpEscapedPathToPosix( |
281 |
m_fVolume = pInstrInfo->volume; |
pInstrInfo->instrument_file); |
282 |
|
m_iInstrumentNr = pInstrInfo->instrument_nr; |
283 |
|
m_fVolume = pInstrInfo->volume; |
284 |
|
|
285 |
switch (pInstrInfo->load_mode) { |
switch (pInstrInfo->load_mode) { |
286 |
case LSCP_LOAD_PERSISTENT: |
case LSCP_LOAD_PERSISTENT: |
317 |
{ |
{ |
318 |
QStringList maps; |
QStringList maps; |
319 |
|
|
320 |
qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance(); |
MainForm *pMainForm = MainForm::getInstance(); |
321 |
if (pMainForm == NULL) |
if (pMainForm == NULL) |
322 |
return maps; |
return maps; |
323 |
if (pMainForm->client() == NULL) |
if (pMainForm->client() == NULL) |
345 |
{ |
{ |
346 |
QString sMapName; |
QString sMapName; |
347 |
|
|
348 |
qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance(); |
MainForm *pMainForm = MainForm::getInstance(); |
349 |
if (pMainForm == NULL) |
if (pMainForm == NULL) |
350 |
return sMapName; |
return sMapName; |
351 |
if (pMainForm->client() == NULL) |
if (pMainForm->client() == NULL) |
359 |
if (::lscp_client_get_errno(pMainForm->client())) |
if (::lscp_client_get_errno(pMainForm->client())) |
360 |
pMainForm->appendMessagesClient("lscp_get_midi_instrument_name"); |
pMainForm->appendMessagesClient("lscp_get_midi_instrument_name"); |
361 |
} |
} |
362 |
sMapName = QString("%1 - %2").arg(iMidiMap).arg(pszMapName); |
sMapName = QString("%1 - %2").arg(iMidiMap) |
363 |
|
.arg(qsamplerUtilities::lscpEscapedTextToRaw(pszMapName)); |
364 |
#endif |
#endif |
365 |
|
|
366 |
return sMapName; |
return sMapName; |