77 pCommonStrings->getGeneralButton(),
false, QSize(),
78 tr(
"Show instrument properties" ) );
85 pCommonStrings->getLayersButton(),
false, QSize(),
86 tr(
"Show layers properties" ) );
107 pCommonStrings->getMidiOutLabel() );
108 pMidiOutLbl->move( 22, 281 );
118 pCommonStrings->getMidiOutChannelLabel() );
129 pCommonStrings->getMidiOutNoteLabel() );
140 pCommonStrings->getPitchLabel() );
143 const float fFinePitch = 0.5;
145 tr(
"Pitch offset (Coarse)" ),
true,
153 pCommonStrings->getPitchCoarseLabel() );
157 tr(
"Pitch offset (Fine)" ),
false,
158 -fFinePitch, fFinePitch );
164 pCommonStrings->getPitchFineLabel() );
170 tr(
"Random pitch factor" ),
false );
175 pCommonStrings->getPitchRandomLabel() );
180 "", pCommonStrings->getBypassButton(),
true,
181 QSize( 0, 0 ),
"",
false,
true );
187 tr(
"Filter Cutoff" ),
false );
192 pCommonStrings->getCutoffLabel() );
196 tr(
"Filter resonance" ),
false );
200 pCommonStrings->getResonanceLabel() );
209 tr(
"Length of Attack phase.\n\nValue" ),
false );
211 tr(
"Length of Decay phase.\n\nValue" ),
false );
213 tr(
"Sample volume in Sustain phase.\n\nValue" ),
false );
216 tr(
"Length of Release phase.\n\nValue" ),
false );
232 pCommonStrings->getAttackLabel() );
235 pCommonStrings->getDecayLabel() );
238 pCommonStrings->getSustainLabel() );
241 pCommonStrings->getReleaseLabel() );
248 tr(
"Instrument gain" ),
false, 0.0, 5.0 );
255 pCommonStrings->getGainLabel() );
266 pCommonStrings->getMuteGroupLabel() );
273 m_pIsStopNoteCheckBox->setToolTip( tr(
"Stop the current playing instrument-note before trigger the next note sample" ) );
278 pCommonStrings->getIsStopNoteLabel() );
285 m_pApplyVelocity->setToolTip( tr(
"Don't change the layers' gain based on velocity" ) );
290 pCommonStrings->getApplyVelocityLabel() );
303 pCommonStrings->getHihatGroupLabel() );
312 pCommonStrings->getHihatMinRangeLabel() );
321 pCommonStrings->getHihatMaxRangeLabel() );
330 m_pLayerProp->setPixmap(
"/instrumentEditor/layerTabsupernew.png" );
341 false, QSize( 12, 12 ) );
371 "", pCommonStrings->getLoadLayerButton() );
376 "", pCommonStrings->getDeleteLayerButton() );
381 "", pCommonStrings->getEditLayerButton() );
394 tr(
"Layer gain" ),
false , 0.0, 5.0);
399 pCommonStrings->getLayerGainLabel() );
404 tr(
"Component volume" ),
false, 0.0, 5.0 );
409 pCommonStrings->getComponentGainLabel() );
415 pCommonStrings->getPitchLabel() );
419 tr(
"Layer pitch (Coarse)" ),
true,
425 pCommonStrings->getPitchCoarseLabel() );
429 tr(
"Layer pitch (Fine)" ),
true, -50.0, 50.0 );
433 pCommonStrings->getPitchFineLabel() );
457 pCommonStrings->getSampleSelectionLabel() );
466 connect(
popCompo, SIGNAL( triggered(QAction*) ),
507 std::shared_ptr<Song> pSong = pHydrogen->
getSong();
508 auto pCompoList = pSong->getComponents();
514 pCompoList !=
nullptr && pCompoList->size() > 0 ) {
521 float fTmp =
m_pInstrument->get_adsr()->getRelease() - 256.0;
575 for (
const auto& pComponent : *pSong->getComponents() ) {
576 if ( !
itemsCompo.contains( pComponent->get_name() ) ) {
588 for (
const auto& ppComponent : *pCompoList ) {
600 assert(pTmpComponent);
607 if ( pComponent !=
nullptr ) {
610 sprintf( tmp,
"%#.2f", pComponent->get_gain());
616 if ( pLayer !=
nullptr ) {
632 m_pNameLbl->setText( QString(
"NULL Instrument..." ) );
648 if (
m_pInstrument == pInstrumentList->get( nInstrumentNumber ) ||
649 nInstrumentNumber == -1 ) {
672 m_pNameLbl->setText( QString(
"NULL Instrument..." ) );
681 const QString sNewPitch = QString(
"%1" )
714 const float fFinePitch =
m_pInstrument->get_pitch_offset() - fCoarsePitch;
728 auto pCoreActionController =
732 if ( pSong ==
nullptr ) {
745 pCoreActionController->setInstrumentPitch(
751 pCoreActionController->setInstrumentPitch(
759 if ( fVal > 0.95f ) {
765 m_pInstrument->get_adsr()->setAttack( fVal * fVal * 100000 );
774 m_pInstrument->get_adsr()->setRelease( 256.0 + fVal * fVal * 100000 );
778 sprintf( tmp,
"%#.2f", fVal );
785 pLayer->set_gain( fVal );
792 sprintf( tmp,
"%#.2f", fVal );
796 pCompo->set_gain( fVal );
807 pLayer->set_pitch( fCoarse + fFine );
819 pLayer->set_pitch( fCoarse + fFine );
826 sprintf( tmp,
"%#.2f", fVal );
831 ERRORLOG(
"[rotaryChanged] unhandled rotary" );
858 auto pSample = pLayer->get_sample();
860 if( pSample !=
nullptr ) {
861 QString name = pSample->get_filepath();
876 if ( pLayer !=
nullptr ) {
877 auto pSample = pLayer->get_sample();
878 if ( pSample ==
nullptr ) {
881 QString name = pSample->get_filepath();
891 pHydrogen->getAudioEngine()->lock(
RIGHT_HERE );
895 if( pCompo !=
nullptr ) {
898 pHydrogen->setIsModified(
true );
904 int nNextLayerIndex = 0;
907 auto pLayer = pCompo->get_layer( n );
908 if( pLayer !=
nullptr ){
928 pHydrogen->getAudioEngine()->unlock();
940 QString sFilename =
"";
942 sPath = QDir::homePath();
951 if ( pComponent !=
nullptr ) {
954 if ( pLayer !=
nullptr ) {
955 auto pSample = pLayer->get_sample();
957 if ( pSample !=
nullptr ) {
958 if ( ! pSample->get_filepath().isEmpty() ) {
959 QFileInfo fileInfo( pSample->get_filepath() );
960 sPath = fileInfo.absoluteDir().absolutePath();
961 sFilename = fileInfo.absoluteFilePath();
972 QStringList filename;
973 filename <<
"false" <<
"false" <<
"";
975 if (pFileBrowser->exec() == QDialog::Accepted) {
981 if ( sFilename.isEmpty() ||
989 if ( filename[2].isEmpty() ) {
994 if ( filename[0] ==
"true" ){
999 int firstSelection = selectedLayer;
1008 if (filename.size() > 2) {
1010 for (
int i=2; i < filename.size(); ++i )
1033 auto pLayer = pCompo->get_layer( selectedLayer );
1035 if (pLayer !=
nullptr) {
1037 pLayer->set_sample( pNewSample );
1040 pLayer = std::make_shared<H2Core::InstrumentLayer>( pNewSample );
1045 QString newFilename = filename[i].section(
'/', -1 );
1046 newFilename.replace(
"." + newFilename.section(
'.', -1 ),
"");
1051 if ( filename[1] ==
"true" ){
1073 if ( pCompo ==
nullptr ) {
1080 auto pLayer = pCompo->get_layer( i );
1081 if ( pLayer !=
nullptr ) {
1090 float velocityrange = 1.0 / nLayers;
1094 auto pLayer = pCompo->get_layer( i );
1095 if ( pLayer !=
nullptr ) {
1096 pLayer->set_start_velocity( nLayer * velocityrange);
1097 pLayer->set_end_velocity( nLayer * velocityrange + velocityrange );
1108 if ( pSong ==
nullptr ) {
1112 if ( pComponent ==
nullptr ) {
1115 QString sOldName = pComponent->get_name();
1117 QString sNewName = QInputDialog::getText(
this,
"Hydrogen", tr(
"New component name" ), QLineEdit::Normal, sOldName, &bIsOkPressed );
1119 if ( bIsOkPressed && sOldName != sNewName ) {
1120 pComponent->set_name( sNewName );
1146 QString sNewName = QInputDialog::getText(
this,
"Hydrogen", tr(
"New instrument name" ), QLineEdit::Normal, sOldName, &bIsOkPressed );
1148 if ( bIsOkPressed && sNewName != sOldName ) {
1154 pHydrogen->setIsModified(
true );
1156#ifdef H2CORE_HAVE_JACK
1157 pHydrogen->getAudioEngine()->lock(
RIGHT_HERE );
1158 pHydrogen->renameJackPorts( pHydrogen->getSong() );
1159 pHydrogen->getAudioEngine()->unlock();
1180 if(pComponent && nLayer >= 0 ){
1181 auto pLayer = pComponent->get_layer( nLayer );
1183 if ( pLayer !=
nullptr ) {
1189 sprintf( tmp,
"%#.2f", pLayer->get_gain() );
1194 sprintf( tmp2,
"%#.2f", pComponent->get_gain());
1200 float fCoarsePitch = round( pLayer->get_pitch() );
1201 float fFinePitch = pLayer->get_pitch() - fCoarsePitch;
1209 .arg( fFinePitch * 100, 0,
'f', 0 ) );
1293 if ( fValue != 0.0 ) {
1294 m_pInstrument->set_midi_out_channel( std::max(
static_cast<int>(fValue) - 1,
1312 m_pInstrument->set_midi_out_note(
static_cast<int>(fValue) );
1324 for(
int i = 0; i <
itemsCompo.size(); i++ ) {
1335 bool bFoundFreeSlot =
true;
1337 for (
const auto& pComponent : *pDrumkitComponentList ) {
1338 if ( pComponent->get_id() == startingPoint ) {
1339 bFoundFreeSlot =
false;
1344 if(bFoundFreeSlot) {
1345 return startingPoint;
1353 QString sSelectedAction = pAction->text();
1357 if( sSelectedAction.compare(
"add") == 0 ) {
1360 QString sNewName = QInputDialog::getText(
this,
"Hydrogen", tr(
"Component name" ), QLineEdit::Normal,
"New Component", &bIsOkPressed );
1361 if ( bIsOkPressed ) {
1363 pHydrogen->
getSong()->getComponents()->push_back( pDrumkitComponent );
1370 m_pLayerPreview->set_selected_component( pDrumkitComponent->get_id() );
1377#ifdef H2CORE_HAVE_JACK
1386 else if( sSelectedAction.compare(
"delete") == 0 ) {
1387 auto pDrumkitComponents = pHydrogen->
getSong()->getComponents();
1389 if(pDrumkitComponents->size() == 1){
1390 ERRORLOG(
"There is just a single component remaining. This one can not be deleted." );
1396 auto pInstruments = pHydrogen->
getSong()->getInstrumentList();
1397 for (
int n = (
int )pInstruments->size() - 1; n >= 0; n-- ) {
1398 auto pInstrument = pInstruments->get( n );
1399 for(
int o = 0 ; o < pInstrument->get_components()->size() ; o++ ) {
1400 auto pInstrumentComponent = pInstrument->get_components()->at( o );
1401 if( pInstrumentComponent->get_drumkit_componentID() == pDrumkitComponent->get_id() ) {
1402 pInstrument->get_components()->erase( pInstrument->get_components()->begin() + o );;
1408 for (
int n = 0 ; n < pDrumkitComponents->size() ; n++ ) {
1409 auto pTmpDrumkitComponent = pDrumkitComponents->at( n );
1410 if( pTmpDrumkitComponent->get_id() == pDrumkitComponent->get_id() ) {
1411 pDrumkitComponents->erase( pDrumkitComponents->begin() + n );
1423 else if( sSelectedAction.compare(
"rename") == 0 ) {
1428 auto pDrumkitComponents = pHydrogen->
getSong()->getComponents();
1429 for (
const auto& pComponent : *pDrumkitComponents ) {
1430 if ( pComponent->get_name().compare( sSelectedAction ) == 0) {
1438 INFOLOG(
"Component needs to be added");
1441 pInstrComponent->set_gain( 1.0f );
1443 m_pInstrument->get_components()->push_back( pInstrComponent );
1447#ifdef H2CORE_HAVE_JACK
1465 if ( selected == 0 ){
1468 else if ( selected == 1 ){
1471 else if ( selected == 2){
1502 setStyleSheet( QString(
"QLabel { background: %1 }" )
1503 .arg( pPref->getColorTheme()->m_windowColor.name() ) );
#define RIGHT_HERE
Macro intended to be used for the logging of the locking of the H2Core::AudioEngine.
This dialog is used to preview audiofiles.
QString getSelectedDirectory()
QStringList getSelectedFiles()
Custom QLabel that emits a signal when clicked.
void unlock()
Mutex unlocking of the AudioEngine.
void lock(const char *file, unsigned int line, const char *function)
Mutex locking of the AudioEngine.
static EventQueue * get_instance()
Returns a pointer to the current EventQueue singleton stored in __instance.
void push_event(const EventType type, const int nValue)
Queues the next event into the EventQueue.
static bool dir_readable(const QString &path, bool silent=false)
returns true if the given path is a readable regular directory
void renameJackPorts(std::shared_ptr< Song > pSong)
Calls audioEngine_renameJackPorts() if Preferences::m_bJackTrackOuts is set to true.
std::shared_ptr< Song > getSong() const
Get the current song.
static Hydrogen * get_instance()
Returns the current Hydrogen instance __instance.
AudioEngine * getAudioEngine() const
std::shared_ptr< Instrument > getSelectedInstrument() const
void setIsModified(bool bIsModified)
Wrapper around Song::setIsModified() that checks whether a song is set.
CoreActionController * getCoreActionController() const
static int getMaxLayers()
static constexpr float fPitchMin
Minimum support pitch value.
static constexpr float fPitchMax
Maximum support pitch value.
static Preferences * get_instance()
Returns a pointer to the current Preferences singleton stored in __instance.
void setLastOpenLayerDirectory(QString sPath)
Changes
Bitwise or-able options showing which part of the Preferences were altered using the PreferencesDialo...
@ Colors
At least one of the colors has changed.
QString getLastOpenLayerDirectory() const
static std::shared_ptr< Sample > load(const QString &filepath, const License &license=License())
void addEventListener(EventListener *pListener)
static HydrogenApp * get_instance()
Returns the instance of HydrogenApp class.
std::shared_ptr< CommonStrings > getCommonStrings()
void preferencesChanged(H2Core::Preferences::Changes changes)
Propagates a change in the Preferences through the GUI.
void showSampleEditor(QString name, int mSelectedComponemt, int mSelectedLayer)
void selectLayer(int nLayer)
static InstrumentEditorPanel * get_instance()
Rotary * m_pRandomPitchRotary
void labelCompoClicked(ClickableLabel *pRef)
void onDropDownCompoClicked()
Rotary * m_pPitchFineRotary
ClickableLabel * m_pLayerPitchLbl
PixmapWidget * m_pInstrumentPropTop
LCDSpinBox * m_pMidiOutNoteLCD
Rotary * m_pPitchCoarseRotary
LCDDisplay * m_pInstrumentGainLCD
void sampleSelectionChanged(int)
LCDSpinBox * m_pHihatMaxRangeLCD
void selectLayer(int nLayer)
ClickableLabel * m_pGainLbl
ClickableLabel * m_pMidiOutNoteLbl
Button * m_buttonDropDownCompo
ClickableLabel * m_pLayerGainLbl
void showLayers(bool bShow)
Used by #Shotlist.
Button * m_pSampleEditorBtn
Rotary * m_pLayerGainRotary
ClickableLabel * m_pPitchFineLbl
Rotary * m_pSustainRotary
void removeLayerButtonClicked()
ClickableLabel * m_pMuteGroupLbl
ClickableLabel * m_pCompoNameLbl
void hihatGroupChanged(double fValue)
ClickableLabel * m_pReleaseLbl
Rotary * m_pReleaseRotary
double m_fPreviousMidiOutChannel
In order to allow for enumerations starting at 1 while using -1 to turn off the LCD.
LCDDisplay * m_pLayerPitchFineLCD
void loadLayerBtnClicked()
ClickableLabel * m_pHihatGroupLbl
Rotary * m_pCompoGainRotary
void filterActiveBtnClicked()
void labelClicked(ClickableLabel *pRef)
ClickableLabel * m_pNameLbl
PixmapWidget * m_pInstrumentProp
void muteGroupChanged(double fValue)
Rotary * m_pInstrumentGain
ClickableLabel * m_pCutoffLbl
Button * m_pFilterBypassBtn
ClickableLabel * m_pDecayLbl
void onPreferencesChanged(H2Core::Preferences::Changes changes)
void onIsApplyVelocityCheckBoxClicked(bool on)
void onIsStopNoteCheckBoxClicked(bool on)
ClickableLabel * m_pAttackLbl
void selectComponent(int nComponent)
QCheckBox * m_pApplyVelocity
void compoChangeAddDelete(QAction *)
ClickableLabel * m_pHihatMinRangeLbl
virtual void drumkitLoadedEvent() override
virtual void instrumentParametersChangedEvent(int) override
ClickableLabel * m_pCompoGainLbl
ClickableLabel * m_pLayerPitchFineLbl
LCDDisplay * m_pLayerPitchCoarseLCD
Rotary * m_pLayerPitchCoarseRotary
ClickableLabel * m_pIsStopNoteLbl
Button * m_pShowInstrumentBtn
ClickableLabel * m_pResonanceLbl
PixmapWidget * m_pLayerProp
ClickableLabel * m_pPitchCoarseLbl
WaveDisplay * m_pWaveDisplay
ClickableLabel * m_pApplyVelocityLbl
ClickableLabel * m_pLayerPitchCoarseLbl
virtual void selectedInstrumentChangedEvent() override
ClickableLabel * m_pSustainLbl
virtual void updateSongEvent(int) override
ClickableLabel * m_pHihatMaxRangeLbl
LCDSpinBox * m_pMidiOutChannelLCD
Button * m_pShowLayersBtn
void hihatMinRangeChanged(double fValue)
LayerPreview * m_pLayerPreview
Rotary * m_pLayerPitchFineRotary
static int findFreeDrumkitComponentId(int startingPoint=0)
InstrumentEditor(QWidget *parent)
Button * m_pRemoveLayerBtn
LCDSpinBox * m_pMuteGroupLCD
Rotary * m_pResonanceRotary
LCDDisplay * m_pLayerGainLCD
void hihatMaxRangeChanged(double fValue)
void setInstrumentPitch()
LCDCombo * m_sampleSelectionAlg
LCDDisplay * m_pCompoGainLCD
void rotaryChanged(WidgetWithInput *ref)
ClickableLabel * m_pPitchLbl
LCDSpinBox * m_pHihatMinRangeLCD
std::shared_ptr< H2Core::Instrument > m_pInstrument
QScrollArea * m_pLayerScrollArea
LCDSpinBox * m_pHihatGroupLCD
void midiOutNoteChanged(double fValue)
void waveDisplayDoubleClicked(QWidget *pRef)
void midiOutChannelChanged(double fValue)
QCheckBox * m_pIsStopNoteCheckBox
ClickableLabel * m_pMidiOutChannelLbl
ClickableLabel * m_pSampleSelectionLbl
ClickableLabel * m_pPitchRandomLbl
Non-interactive display used for both numerical values and the status display.
@ Center
The arc features a point at its upmost position.
@ Normal
The arc is of solid red color.
@ EVENT_SELECTED_INSTRUMENT_CHANGED