本文整理汇总了C++中Hydrogen类的典型用法代码示例。如果您正苦于以下问题:C++ Hydrogen类的具体用法?C++ Hydrogen怎么用?C++ Hydrogen使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Hydrogen类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QTableWidgetItem
void SongEditorPanelTagWidget::on_okBtn_clicked()
{
Hydrogen* engine = Hydrogen::get_instance();
Timeline* pTimeline = engine->getTimeline();
int patterngroupvectorsize;
patterngroupvectorsize = engine->getSong()->get_pattern_group_vector()->size();
//oldText list contains all old item values. we need them for undo an item
QStringList oldText;
if(pTimeline->m_timelinetagvector.size() > 0){
for (int i = 0; i < patterngroupvectorsize; i++){
oldText << "";
}
for(int i = 0; i < pTimeline->m_timelinetagvector.size(); ++i){
oldText.replace(pTimeline->m_timelinetagvector[i].m_htimelinetagbeat , pTimeline->m_timelinetagvector[i].m_htimelinetag);
}
}
for( int i = 0; i < __theChangedItems.size() ; i++ )
{
QTableWidgetItem *newTagItem = new QTableWidgetItem();
int songPosition = __theChangedItems.value( i ).toInt();
newTagItem = tagTableWidget->item( songPosition, 0 );
if ( newTagItem ) {
SE_editTagAction *action = new SE_editTagAction( newTagItem->text() ,oldText.value( songPosition ), songPosition );
HydrogenApp::get_instance()->m_undoStack->push( action );
}
}
accept();
}
示例2: soloClicked
void Mixer::soloClicked(ComponentMixerLine* ref)
{
Hydrogen *pEngine = Hydrogen::get_instance();
Song *pSong = pEngine->getSong();
std::vector<DrumkitComponent*> pCompoList = *(pSong->get_components());
int nComponents = pCompoList.size();
bool isSoloClicked = ref->isSoloClicked();
int nLine = findCompoMixerLineByRef(ref);
if ( isSoloClicked ) {
for ( int i = 0; i < nComponents ; ++i ) {
ComponentMixerLine* p_tmpCompoMixer = m_pComponentMixerLine[i];
p_tmpCompoMixer->setSoloClicked( false );
p_tmpCompoMixer->setMuteClicked( true );
DrumkitComponent* p_tmpCompo = pCompoList[i];
p_tmpCompo->set_muted( true );
}
ComponentMixerLine* p_tmpCompoMixer = m_pComponentMixerLine[nLine];
p_tmpCompoMixer->setSoloClicked( true );
p_tmpCompoMixer->setMuteClicked( false );
DrumkitComponent* p_tmpCompo = pCompoList[nLine];
p_tmpCompo->set_muted( false );
}
else {
for ( int i = 0; i < nComponents ; ++i ) {
ComponentMixerLine* p_tmpCompoMixer = m_pComponentMixerLine[i];
p_tmpCompoMixer->setSoloClicked( false );
p_tmpCompoMixer->setMuteClicked( false );
DrumkitComponent* p_tmpCompo = pCompoList[i];
p_tmpCompo->set_muted( false );
}
}
}
示例3: findMixerLineByRef
void Mixer::panChanged(MixerLine* ref) {
float panValue = ref->getPan();
float pan_L;
float pan_R;
if (panValue >= 0.5) {
pan_L = (1.0 - panValue) * 2;
pan_R = 1.0;
}
else {
pan_L = 1.0;
pan_R = panValue * 2;
}
int nLine = findMixerLineByRef(ref);
Hydrogen::get_instance()->setSelectedInstrumentNumber( nLine );
Hydrogen *pEngine = Hydrogen::get_instance();
Song *pSong = pEngine->getSong();
InstrumentList *pInstrList = pSong->get_instrument_list();
Instrument *pInstr = pInstrList->get(nLine);
pInstr->set_pan_l( pan_L );
pInstr->set_pan_r( pan_R );
Hydrogen::get_instance()->setSelectedInstrumentNumber(nLine);
}
示例4: UNUSED
void InstrumentEditor::labelClicked( ClickableLabel* pRef )
{
UNUSED( pRef );
if (m_pInstrument) {
QString sOldName = m_pInstrument->get_name();
bool bIsOkPressed;
QString sNewName = QInputDialog::getText( this, "Hydrogen", trUtf8( "New instrument name" ), QLineEdit::Normal, sOldName, &bIsOkPressed );
if ( bIsOkPressed ) {
m_pInstrument->set_name( sNewName );
selectedInstrumentChangedEvent();
#ifdef H2CORE_HAVE_JACK
AudioEngine::get_instance()->lock( RIGHT_HERE );
Hydrogen *engine = Hydrogen::get_instance();
engine->renameJackPorts();
AudioEngine::get_instance()->unlock();
#endif
// this will force an update...
EventQueue::get_instance()->push_event( EVENT_SELECTED_INSTRUMENT_CHANGED, -1 );
}
else {
// user entered nothing or pressed Cancel
}
}
}
示例5: trUtf8
void SoundLibraryPanel::on_songLoadAction()
{
QString songName = __sound_library_tree->currentItem()->text( 0 );
QString sDirectory = Preferences::get_instance()->getDataDirectory() + "songs";
QString sFilename = sDirectory + "/" + songName + ".h2song";
Hydrogen *engine = Hydrogen::get_instance();
if ( engine->getState() == STATE_PLAYING ) {
engine->sequencer_stop();
}
Song *pSong = Song::load( sFilename );
if ( pSong == NULL ) {
QMessageBox::information( this, "Hydrogen", trUtf8("Error loading song.") );
return;
}
// add the new loaded song in the "last used song" vector
Preferences *pPref = Preferences::get_instance();
std::vector<QString> recentFiles = pPref->getRecentFiles();
recentFiles.insert( recentFiles.begin(), sFilename );
pPref->setRecentFiles( recentFiles );
HydrogenApp* h2app = HydrogenApp::get_instance();
h2app->setSong( pSong );
//updateRecentUsedSongList();
engine->setSelectedPatternNumber( 0 );
}
示例6: INFOLOG
HydrogenApp::~HydrogenApp()
{
INFOLOG( "[~HydrogenApp]" );
m_pEventQueueTimer->stop();
//delete the undo tmp directory
cleanupTemporaryFiles();
delete m_pHelpBrowser;
delete m_pAudioEngineInfoForm;
delete m_pMixer;
delete m_pPlaylistDialog;
delete m_pDirector;
delete m_pSampleEditor;
delete SoundLibraryDatabase::get_instance();
Hydrogen *engine = Hydrogen::get_instance();
if (engine) {
H2Core::Song * song = engine->getSong();
// Hydrogen calls removeSong on from its destructor, so here we just delete the objects:
delete engine;
delete song;
}
#ifdef H2CORE_HAVE_LADSPA
for (uint nFX = 0; nFX < MAX_FX; nFX++) {
delete m_pLadspaFXProperties[nFX];
}
#endif
}
示例7: trUtf8
void MasterMixerLine::rotaryChanged( Rotary *pRef )
{
QString sMsg;
double fVal = (double) pRef->getValue();
Hydrogen *pEngine = Hydrogen::get_instance();
AudioEngine::get_instance()->lock( RIGHT_HERE );
if ( pRef == m_pHumanizeTimeRotary ) {
pEngine->getSong()->set_humanize_time_value( fVal );
sMsg = trUtf8( "Set humanize time parameter [%1]").arg( fVal, 0, 'f', 2 );
}
else if ( pRef == m_pHumanizeVelocityRotary ) {
pEngine->getSong()->set_humanize_velocity_value( fVal );
sMsg = trUtf8( "Set humanize velocity parameter [%1]").arg( fVal, 0, 'f', 2 );
}
else if ( pRef == m_pSwingRotary ) {
pEngine->getSong()->set_swing_factor( fVal );
sMsg = trUtf8( "Set swing factor [%1]").arg( fVal, 0, 'f', 2 );
}
else {
ERRORLOG( "[knobChanged] Unhandled knob" );
}
AudioEngine::get_instance()->unlock();
( HydrogenApp::get_instance() )->setStatusBarMessage( sMsg, 2000 );
}
示例8: setSelectedSongNr
/* This method is called by Event dispacher thread ( GUI ) */
bool Playlist::loadSong (int songNumber)
{
Hydrogen* pHydrogen = Hydrogen::get_instance();
Preferences *pPref = Preferences::get_instance();
if ( pHydrogen->getState() == STATE_PLAYING )
pHydrogen->sequencer_stop();
/* Load Song from file */
QString selected = pHydrogen->m_PlayList[ songNumber ].m_hFile;
Song *pSong = Song::load( selected );
if ( ! pSong ) return false;
setSelectedSongNr( songNumber );
setActiveSongNumber( songNumber );
pHydrogen->setSong( pSong );
pPref->setLastSongFilename( pSong->get_filename() );
vector<QString> recentFiles = pPref->getRecentFiles();
recentFiles.insert( recentFiles.begin(), selected );
pPref->setRecentFiles( recentFiles );
execScript( songNumber );
return true;
}
示例9: masterVolumeChanged
void Mixer::masterVolumeChanged(MasterMixerLine* ref)
{
Hydrogen *pEngine = Hydrogen::get_instance();
CoreActionController* pController = pEngine->getCoreActionController();
float Volume = ref->getVolume();
pController->setMasterVolume( Volume );
}
示例10: volumeChanged
void Mixer::volumeChanged(MixerLine* ref)
{
Hydrogen *pEngine = Hydrogen::get_instance();
CoreActionController* pController = pEngine->getCoreActionController();
int nLine = findMixerLineByRef(ref);
pController->setStripVolume( nLine, ref->getVolume() );
}
示例11: findMixerLineByRef
void Mixer::panChanged(MixerLine* ref) {
float panValue = ref->getPan();
int nLine = findMixerLineByRef(ref);
Hydrogen *pEngine = Hydrogen::get_instance();
CoreActionController* pController = pEngine->getCoreActionController();
pController->setStripPan( nLine, panValue );
}
示例12: muteClicked
void InstrumentLine::muteClicked()
{
Hydrogen *engine = Hydrogen::get_instance();
Song *song = engine->getSong();
InstrumentList *instrList = song->get_instrument_list();
Instrument *pInstr = instrList->get(m_nInstrumentNumber);
pInstr->set_muted( !pInstr->is_muted());
}
示例13: addEmptyPattern
void SongEditorPanel::addEmptyPattern( QString newPatternName ,QString newPatternInfo, QString newPatternCategory, int idx )
{
Hydrogen *pEngine = Hydrogen::get_instance();
Song *pSong = pEngine->getSong();
PatternList *pPatternList = pSong->get_pattern_list();
pPatternList->insert( idx, new Pattern( newPatternName, newPatternInfo, newPatternCategory ) );
pSong->set_is_modified( true );
updateAll();
}
示例14: createTheTagTableWidget
void SongEditorPanelTagWidget::createTheTagTableWidget()
{
Hydrogen* engine = Hydrogen::get_instance();
Timeline* pTimeline = engine->getTimeline();
int patterngroupvectorsize;
patterngroupvectorsize = engine->getSong()->get_pattern_group_vector()->size();
for( int i = 0; i < patterngroupvectorsize; i++ )
{
tagTableWidget->insertRow( i );
}
std::vector<Timeline::HTimelineTagVector> timelineTagVector = pTimeline->m_timelinetagvector;
//read the tag vector and fill all tags into items
if( timelineTagVector.size() > 0 ){
for ( unsigned int t = 0; t < timelineTagVector.size(); t++ ){
QTableWidgetItem *newTagItem = new QTableWidgetItem();
newTagItem->setText( QString( "%1" ).arg( timelineTagVector[t].m_htimelinetag ) );
tagTableWidget->setItem( timelineTagVector[t].m_htimelinetagbeat, 0, newTagItem );
tagTableWidget->setCurrentItem( newTagItem );
tagTableWidget->openPersistentEditor( newTagItem );
}
}
//activate the clicked item and
//if you click on an existing tag
//fill in the old contend
if( timelineTagVector.size() > 0 ){
int vpos = -1;
QTableWidgetItem *newTagItem2 = new QTableWidgetItem();
newTagItem2->setText( QString( "" ) );
for ( unsigned int t = 0; t < timelineTagVector.size(); t++ ){
if( timelineTagVector[t].m_htimelinetagbeat == m_stimelineposition){
vpos = t;
}
}
if( vpos >-1 ){
newTagItem2->setText( QString( "%1" ).arg( timelineTagVector[vpos].m_htimelinetag ) );
}
tagTableWidget->setItem( m_stimelineposition , 0, newTagItem2 );
tagTableWidget->setCurrentItem( newTagItem2 );
tagTableWidget->openPersistentEditor( newTagItem2 );
}
//add first tag
if( timelineTagVector.size() == 0 ){
QTableWidgetItem *newTagItem3 = new QTableWidgetItem();
tagTableWidget->setItem( m_stimelineposition , 0, newTagItem3 );
tagTableWidget->setCurrentItem( newTagItem3 );
tagTableWidget->openPersistentEditor( newTagItem3 );
}
}
示例15: UNUSED
///
/// Move up a pattern in the patternList
///
void SongEditorPanel::upBtnClicked( Button* btn )
{
UNUSED( btn );
Hydrogen *pEngine = Hydrogen::get_instance();
if( pEngine->getSelectedPatternNumber() < 0 || !pEngine->getSelectedPatternNumber() ) return;
int nSelectedPatternPos = pEngine->getSelectedPatternNumber();
SE_movePatternListItemAction *action = new SE_movePatternListItemAction( nSelectedPatternPos, nSelectedPatternPos -1 ) ;
HydrogenApp::get_instance()->m_undoStack->push( action );
}