Merge remote-tracking branch 'origin/stable-0.4' into ghostPeakController
This commit is contained in:
@@ -253,7 +253,7 @@ void AutomatableModel::setRange( const float min, const float max,
|
||||
setStep( step );
|
||||
|
||||
// re-adjust value
|
||||
setInitValue( value<float>() );
|
||||
setValue( value<float>() );
|
||||
|
||||
emit propertiesChanged();
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ AutomationPattern::AutomationPattern( AutomationTrack * _auto_track ) :
|
||||
m_tension( "1.0" ),
|
||||
m_progressionType( DiscreteProgression )
|
||||
{
|
||||
changeLength( midiTime( 1, 0 ) );
|
||||
changeLength( MidiTime( 1, 0 ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ const AutomatableModel * AutomationPattern::firstObject() const
|
||||
|
||||
|
||||
//TODO: Improve this
|
||||
midiTime AutomationPattern::length() const
|
||||
MidiTime AutomationPattern::length() const
|
||||
{
|
||||
tick_t max_length = 0;
|
||||
|
||||
@@ -175,19 +175,19 @@ midiTime AutomationPattern::length() const
|
||||
{
|
||||
max_length = qMax<tick_t>( max_length, it.key() );
|
||||
}
|
||||
return midiTime( qMax( midiTime( max_length ).getTact() + 1, 1 ), 0 );
|
||||
return MidiTime( qMax( MidiTime( max_length ).getTact() + 1, 1 ), 0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
midiTime AutomationPattern::putValue( const midiTime & _time,
|
||||
MidiTime AutomationPattern::putValue( const MidiTime & _time,
|
||||
const float _value,
|
||||
const bool _quant_pos )
|
||||
{
|
||||
cleanObjects();
|
||||
|
||||
midiTime newTime = _quant_pos && engine::automationEditor() ?
|
||||
MidiTime newTime = _quant_pos && engine::automationEditor() ?
|
||||
note::quantized( _time,
|
||||
engine::automationEditor()->quantization() ) :
|
||||
_time;
|
||||
@@ -215,7 +215,7 @@ midiTime AutomationPattern::putValue( const midiTime & _time,
|
||||
|
||||
|
||||
|
||||
void AutomationPattern::removeValue( const midiTime & _time )
|
||||
void AutomationPattern::removeValue( const MidiTime & _time )
|
||||
{
|
||||
cleanObjects();
|
||||
|
||||
@@ -240,7 +240,7 @@ void AutomationPattern::removeValue( const midiTime & _time )
|
||||
|
||||
|
||||
|
||||
float AutomationPattern::valueAt( const midiTime & _time ) const
|
||||
float AutomationPattern::valueAt( const MidiTime & _time ) const
|
||||
{
|
||||
if( m_timeMap.isEmpty() )
|
||||
{
|
||||
@@ -306,7 +306,7 @@ float AutomationPattern::valueAt( timeMap::const_iterator v, int offset ) const
|
||||
|
||||
|
||||
|
||||
float *AutomationPattern::valuesAfter( const midiTime & _time ) const
|
||||
float *AutomationPattern::valuesAfter( const MidiTime & _time ) const
|
||||
{
|
||||
timeMap::ConstIterator v = m_timeMap.lowerBound( _time );
|
||||
if( v == m_timeMap.end() || (v+1) == m_timeMap.end() )
|
||||
@@ -417,7 +417,7 @@ const QString AutomationPattern::name() const
|
||||
|
||||
|
||||
|
||||
void AutomationPattern::processMidiTime( const midiTime & _time )
|
||||
void AutomationPattern::processMidiTime( const MidiTime & _time )
|
||||
{
|
||||
if( _time >= 0 && hasAutomation() )
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* remote-control of AutomatableModels
|
||||
*
|
||||
* Copyright (c) 2008 Paul Giblock <drfaygo/at/gmail.com>
|
||||
* Copyright (c) 2014 Lukas W <lukaswhl/at/gmail.com>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -53,8 +54,30 @@ Controller::Controller( ControllerTypes _type, Model * _parent,
|
||||
if( _type != DummyController && _type != MidiController )
|
||||
{
|
||||
s_controllers.append( this );
|
||||
m_name = QString( tr( "Controller %1" ) )
|
||||
.arg( s_controllers.size() );
|
||||
// Determine which name to use
|
||||
for ( uint i=s_controllers.size(); ; i++ )
|
||||
{
|
||||
QString new_name = QString( tr( "Controller %1" ) )
|
||||
.arg( i );
|
||||
|
||||
// Check if name is already in use
|
||||
bool name_used = false;
|
||||
QVector<Controller *>::const_iterator it;
|
||||
for ( it = s_controllers.constBegin();
|
||||
it != s_controllers.constEnd(); ++it )
|
||||
{
|
||||
if ( (*it)->name() == new_name )
|
||||
{
|
||||
name_used = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( ! name_used )
|
||||
{
|
||||
m_name = new_name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,111 +33,111 @@
|
||||
|
||||
|
||||
|
||||
ChordCreator::ChordTable::Init ChordCreator::ChordTable::s_initTable[] =
|
||||
InstrumentFunctionNoteStacking::ChordTable::Init InstrumentFunctionNoteStacking::ChordTable::s_initTable[] =
|
||||
{
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "octave" ), { 0, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Major" ), { 0, 4, 7, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Majb5" ), { 0, 4, 6, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "minor" ), { 0, 3, 7, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "minb5" ), { 0, 3, 6, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "sus2" ), { 0, 2, 7, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "sus4" ), { 0, 5, 7, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "aug" ), { 0, 4, 8, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "augsus4" ), { 0, 5, 8, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "tri" ), { 0, 3, 6, 9, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "octave" ), { 0, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Major" ), { 0, 4, 7, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Majb5" ), { 0, 4, 6, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "minor" ), { 0, 3, 7, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "minb5" ), { 0, 3, 6, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "sus2" ), { 0, 2, 7, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "sus4" ), { 0, 5, 7, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "aug" ), { 0, 4, 8, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "augsus4" ), { 0, 5, 8, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "tri" ), { 0, 3, 6, 9, -1 } },
|
||||
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "6" ), { 0, 4, 7, 9, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "6sus4" ), { 0, 5, 7, 9, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "6add9" ), { 0, 4, 7, 9, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "m6" ), { 0, 3, 7, 9, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "m6add9" ), { 0, 3, 7, 9, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "6" ), { 0, 4, 7, 9, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "6sus4" ), { 0, 5, 7, 9, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "6add9" ), { 0, 4, 7, 9, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m6" ), { 0, 3, 7, 9, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m6add9" ), { 0, 3, 7, 9, 14, -1 } },
|
||||
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "7" ), { 0, 4, 7, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "7sus4" ), { 0, 5, 7, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "7#5" ), { 0, 4, 8, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "7b5" ), { 0, 4, 6, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "7#9" ), { 0, 4, 7, 10, 15, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "7b9" ), { 0, 4, 7, 10, 13, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "7#5#9" ), { 0, 4, 8, 10, 15, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "7#5b9" ), { 0, 4, 8, 10, 13, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "7b5b9" ), { 0, 4, 6, 10, 13, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "7add11" ), { 0, 4, 7, 10, 17, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "7add13" ), { 0, 4, 7, 10, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "7#11" ), { 0, 4, 7, 10, 18, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Maj7" ), { 0, 4, 7, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Maj7b5" ), { 0, 4, 6, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Maj7#5" ), { 0, 4, 8, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Maj7#11" ), { 0, 4, 7, 11, 18, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Maj7add13" ), { 0, 4, 7, 11, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "m7" ), { 0, 3, 7, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "m7b5" ), { 0, 3, 6, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "m7b9" ), { 0, 3, 7, 10, 13, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "m7add11" ), { 0, 3, 7, 10, 17, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "m7add13" ), { 0, 3, 7, 10, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "m-Maj7" ), { 0, 3, 7, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "m-Maj7add11" ), { 0, 3, 7, 11, 17, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "m-Maj7add13" ), { 0, 3, 7, 11, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7" ), { 0, 4, 7, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7sus4" ), { 0, 5, 7, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7#5" ), { 0, 4, 8, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7b5" ), { 0, 4, 6, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7#9" ), { 0, 4, 7, 10, 15, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7b9" ), { 0, 4, 7, 10, 13, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7#5#9" ), { 0, 4, 8, 10, 15, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7#5b9" ), { 0, 4, 8, 10, 13, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7b5b9" ), { 0, 4, 6, 10, 13, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7add11" ), { 0, 4, 7, 10, 17, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7add13" ), { 0, 4, 7, 10, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "7#11" ), { 0, 4, 7, 10, 18, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj7" ), { 0, 4, 7, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj7b5" ), { 0, 4, 6, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj7#5" ), { 0, 4, 8, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj7#11" ), { 0, 4, 7, 11, 18, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj7add13" ), { 0, 4, 7, 11, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m7" ), { 0, 3, 7, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m7b5" ), { 0, 3, 6, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m7b9" ), { 0, 3, 7, 10, 13, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m7add11" ), { 0, 3, 7, 10, 17, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m7add13" ), { 0, 3, 7, 10, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m-Maj7" ), { 0, 3, 7, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m-Maj7add11" ), { 0, 3, 7, 11, 17, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m-Maj7add13" ), { 0, 3, 7, 11, 21, -1 } },
|
||||
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "9" ), { 0, 4, 7, 10, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "9sus4" ), { 0, 5, 7, 10, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "add9" ), { 0, 4, 7, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "9#5" ), { 0, 4, 8, 10, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "9b5" ), { 0, 4, 6, 10, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "9#11" ), { 0, 4, 7, 10, 14, 18, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "9b13" ), { 0, 4, 7, 10, 14, 20, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Maj9" ), { 0, 4, 7, 11, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Maj9sus4" ), { 0, 5, 7, 11, 15, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Maj9#5" ), { 0, 4, 8, 11, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Maj9#11" ), { 0, 4, 7, 11, 14, 18, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "m9" ), { 0, 3, 7, 10, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "madd9" ), { 0, 3, 7, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "m9b5" ), { 0, 3, 6, 10, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "m9-Maj7" ), { 0, 3, 7, 11, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "9" ), { 0, 4, 7, 10, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "9sus4" ), { 0, 5, 7, 10, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "add9" ), { 0, 4, 7, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "9#5" ), { 0, 4, 8, 10, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "9b5" ), { 0, 4, 6, 10, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "9#11" ), { 0, 4, 7, 10, 14, 18, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "9b13" ), { 0, 4, 7, 10, 14, 20, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj9" ), { 0, 4, 7, 11, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj9sus4" ), { 0, 5, 7, 11, 15, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj9#5" ), { 0, 4, 8, 11, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj9#11" ), { 0, 4, 7, 11, 14, 18, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m9" ), { 0, 3, 7, 10, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "madd9" ), { 0, 3, 7, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m9b5" ), { 0, 3, 6, 10, 14, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m9-Maj7" ), { 0, 3, 7, 11, 14, -1 } },
|
||||
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "11" ), { 0, 4, 7, 10, 14, 17, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "11b9" ), { 0, 4, 7, 10, 13, 17, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Maj11" ), { 0, 4, 7, 11, 14, 17, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "m11" ), { 0, 3, 7, 10, 14, 17, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "m-Maj11" ), { 0, 3, 7, 11, 14, 17, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "11" ), { 0, 4, 7, 10, 14, 17, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "11b9" ), { 0, 4, 7, 10, 13, 17, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj11" ), { 0, 4, 7, 11, 14, 17, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m11" ), { 0, 3, 7, 10, 14, 17, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m-Maj11" ), { 0, 3, 7, 11, 14, 17, -1 } },
|
||||
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "13" ), { 0, 4, 7, 10, 14, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "13#9" ), { 0, 4, 7, 10, 15, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "13b9" ), { 0, 4, 7, 10, 13, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "13b5b9" ), { 0, 4, 6, 10, 13, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Maj13" ), { 0, 4, 7, 11, 14, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "m13" ), { 0, 3, 7, 10, 14, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "m-Maj13" ), { 0, 3, 7, 11, 14, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "13" ), { 0, 4, 7, 10, 14, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "13#9" ), { 0, 4, 7, 10, 15, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "13b9" ), { 0, 4, 7, 10, 13, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "13b5b9" ), { 0, 4, 6, 10, 13, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Maj13" ), { 0, 4, 7, 11, 14, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m13" ), { 0, 3, 7, 10, 14, 21, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "m-Maj13" ), { 0, 3, 7, 11, 14, 21, -1 } },
|
||||
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Major" ), { 0, 2, 4, 5, 7, 9, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Harmonic minor" ), { 0, 2, 3, 5, 7, 8, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Melodic minor" ), { 0, 2, 3, 5, 7, 9, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Whole tone" ), { 0, 2, 4, 6, 8, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Diminished" ), { 0, 2, 3, 5, 6, 8, 9, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Major pentatonic" ), { 0, 2, 4, 7, 9, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Minor pentatonic" ), { 0, 3, 5, 7, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Jap in sen" ), { 0, 1, 5, 7, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Major bebop" ), { 0, 2, 4, 5, 7, 8, 9, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Dominant bebop" ), { 0, 2, 4, 5, 7, 9, 10, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Blues" ), { 0, 3, 5, 6, 7, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Arabic" ), { 0, 1, 4, 5, 7, 8, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Enigmatic" ), { 0, 1, 4, 6, 8, 10, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Neopolitan" ), { 0, 1, 3, 5, 7, 9, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Neopolitan minor" ), { 0, 1, 3, 5, 7, 8, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Hungarian minor" ), { 0, 2, 3, 6, 7, 8, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Dorian" ), { 0, 2, 3, 5, 7, 9, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Phrygolydian" ), { 0, 1, 3, 5, 7, 8, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Lydian" ), { 0, 2, 4, 6, 7, 9, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Mixolydian" ), { 0, 2, 4, 5, 7, 9, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Aeolian" ), { 0, 2, 3, 5, 7, 8, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Locrian" ), { 0, 1, 3, 5, 6, 8, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "ChordCreator", "Minor" ), { 0, 2, 3, 5, 7, 8, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Major" ), { 0, 2, 4, 5, 7, 9, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Harmonic minor" ), { 0, 2, 3, 5, 7, 8, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Melodic minor" ), { 0, 2, 3, 5, 7, 9, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Whole tone" ), { 0, 2, 4, 6, 8, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Diminished" ), { 0, 2, 3, 5, 6, 8, 9, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Major pentatonic" ), { 0, 2, 4, 7, 9, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Minor pentatonic" ), { 0, 3, 5, 7, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Jap in sen" ), { 0, 1, 5, 7, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Major bebop" ), { 0, 2, 4, 5, 7, 8, 9, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Dominant bebop" ), { 0, 2, 4, 5, 7, 9, 10, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Blues" ), { 0, 3, 5, 6, 7, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Arabic" ), { 0, 1, 4, 5, 7, 8, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Enigmatic" ), { 0, 1, 4, 6, 8, 10, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Neopolitan" ), { 0, 1, 3, 5, 7, 9, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Neopolitan minor" ), { 0, 1, 3, 5, 7, 8, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Hungarian minor" ), { 0, 2, 3, 6, 7, 8, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Dorian" ), { 0, 2, 3, 5, 7, 9, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Phrygolydian" ), { 0, 1, 3, 5, 7, 8, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Lydian" ), { 0, 2, 4, 6, 7, 9, 11, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Mixolydian" ), { 0, 2, 4, 5, 7, 9, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Aeolian" ), { 0, 2, 3, 5, 7, 8, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Locrian" ), { 0, 1, 3, 5, 6, 8, 10, -1 } },
|
||||
{ QT_TRANSLATE_NOOP( "InstrumentFunctionNoteStacking", "Minor" ), { 0, 2, 3, 5, 7, 8, 10, -1 } },
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
ChordCreator::Chord::Chord( const char * n, const ChordSemiTones & semi_tones ) :
|
||||
m_name( ChordCreator::tr( n ) )
|
||||
InstrumentFunctionNoteStacking::Chord::Chord( const char * n, const ChordSemiTones & semi_tones ) :
|
||||
m_name( InstrumentFunctionNoteStacking::tr( n ) )
|
||||
{
|
||||
for( m_size = 0; m_size < MAX_CHORD_POLYPHONY; m_size++ )
|
||||
{
|
||||
@@ -153,7 +153,7 @@ ChordCreator::Chord::Chord( const char * n, const ChordSemiTones & semi_tones )
|
||||
|
||||
|
||||
|
||||
bool ChordCreator::Chord::hasSemiTone( int8_t semi_tone ) const
|
||||
bool InstrumentFunctionNoteStacking::Chord::hasSemiTone( int8_t semi_tone ) const
|
||||
{
|
||||
for( int i = 0; i < size(); ++i )
|
||||
{
|
||||
@@ -168,7 +168,7 @@ bool ChordCreator::Chord::hasSemiTone( int8_t semi_tone ) const
|
||||
|
||||
|
||||
|
||||
ChordCreator::ChordTable::ChordTable() :
|
||||
InstrumentFunctionNoteStacking::ChordTable::ChordTable() :
|
||||
QVector<Chord>()
|
||||
{
|
||||
for( int i = 0;
|
||||
@@ -182,7 +182,7 @@ ChordCreator::ChordTable::ChordTable() :
|
||||
|
||||
|
||||
|
||||
const ChordCreator::Chord & ChordCreator::ChordTable::getByName( const QString & name, bool is_scale ) const
|
||||
const InstrumentFunctionNoteStacking::Chord & InstrumentFunctionNoteStacking::ChordTable::getByName( const QString & name, bool is_scale ) const
|
||||
{
|
||||
for( int i = 0; i < size(); i++ )
|
||||
{
|
||||
@@ -197,7 +197,7 @@ const ChordCreator::Chord & ChordCreator::ChordTable::getByName( const QString &
|
||||
|
||||
|
||||
|
||||
ChordCreator::ChordCreator( Model * _parent ) :
|
||||
InstrumentFunctionNoteStacking::InstrumentFunctionNoteStacking( Model * _parent ) :
|
||||
Model( _parent, tr( "Chords" ) ),
|
||||
m_chordsEnabledModel( false, this ),
|
||||
m_chordsModel( this, tr( "Chord type" ) ),
|
||||
@@ -213,14 +213,14 @@ ChordCreator::ChordCreator( Model * _parent ) :
|
||||
|
||||
|
||||
|
||||
ChordCreator::~ChordCreator()
|
||||
InstrumentFunctionNoteStacking::~InstrumentFunctionNoteStacking()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ChordCreator::processNote( notePlayHandle * _n )
|
||||
void InstrumentFunctionNoteStacking::processNote( notePlayHandle * _n )
|
||||
{
|
||||
const int base_note_key = _n->key();
|
||||
const ChordTable & chord_table = ChordTable::getInstance();
|
||||
@@ -229,9 +229,7 @@ void ChordCreator::processNote( notePlayHandle * _n )
|
||||
// at the same time we only add sub-notes if nothing of the note was
|
||||
// played yet, because otherwise we would add chord-subnotes every
|
||||
// time an audio-buffer is rendered...
|
||||
if( ( ( _n->isTopNote() &&
|
||||
_n->instrumentTrack()->isArpeggiatorEnabled() == false ) ||
|
||||
_n->isPartOfArpeggio() ) &&
|
||||
if( ( ( _n->isTopNote() && _n->instrumentTrack()->isArpeggioEnabled() == false ) || _n->isPartOfArpeggio() ) &&
|
||||
_n->totalFramesPlayed() == 0 &&
|
||||
m_chordsEnabledModel.value() == true )
|
||||
{
|
||||
@@ -282,7 +280,7 @@ void ChordCreator::processNote( notePlayHandle * _n )
|
||||
|
||||
|
||||
|
||||
void ChordCreator::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
void InstrumentFunctionNoteStacking::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
{
|
||||
m_chordsEnabledModel.saveSettings( _doc, _this, "chord-enabled" );
|
||||
m_chordsModel.saveSettings( _doc, _this, "chord" );
|
||||
@@ -292,7 +290,7 @@ void ChordCreator::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
|
||||
|
||||
|
||||
void ChordCreator::loadSettings( const QDomElement & _this )
|
||||
void InstrumentFunctionNoteStacking::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
m_chordsEnabledModel.loadSettings( _this, "chord-enabled" );
|
||||
m_chordsModel.loadSettings( _this, "chord" );
|
||||
@@ -305,7 +303,7 @@ void ChordCreator::loadSettings( const QDomElement & _this )
|
||||
|
||||
|
||||
|
||||
Arpeggiator::Arpeggiator( Model * _parent ) :
|
||||
InstrumentFunctionArpeggio::InstrumentFunctionArpeggio( Model * _parent ) :
|
||||
Model( _parent, tr( "Arpeggio" ) ),
|
||||
m_arpEnabledModel( false ),
|
||||
m_arpModel( this, tr( "Arpeggio type" ) ),
|
||||
@@ -317,7 +315,7 @@ Arpeggiator::Arpeggiator( Model * _parent ) :
|
||||
m_arpDirectionModel( this, tr( "Arpeggio direction" ) ),
|
||||
m_arpModeModel( this, tr( "Arpeggio mode" ) )
|
||||
{
|
||||
const ChordCreator::ChordTable & chord_table = ChordCreator::ChordTable::getInstance();
|
||||
const InstrumentFunctionNoteStacking::ChordTable & chord_table = InstrumentFunctionNoteStacking::ChordTable::getInstance();
|
||||
for( int i = 0; i < chord_table.size(); ++i )
|
||||
{
|
||||
m_arpModel.addItem( chord_table[i].getName() );
|
||||
@@ -339,14 +337,14 @@ Arpeggiator::Arpeggiator( Model * _parent ) :
|
||||
|
||||
|
||||
|
||||
Arpeggiator::~Arpeggiator()
|
||||
InstrumentFunctionArpeggio::~InstrumentFunctionArpeggio()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Arpeggiator::processNote( notePlayHandle * _n )
|
||||
void InstrumentFunctionArpeggio::processNote( notePlayHandle * _n )
|
||||
{
|
||||
const int base_note_key = _n->key();
|
||||
if( _n->isTopNote() == false ||
|
||||
@@ -375,7 +373,7 @@ void Arpeggiator::processNote( notePlayHandle * _n )
|
||||
}
|
||||
}
|
||||
|
||||
const ChordCreator::ChordTable & chord_table = ChordCreator::ChordTable::getInstance();
|
||||
const InstrumentFunctionNoteStacking::ChordTable & chord_table = InstrumentFunctionNoteStacking::ChordTable::getInstance();
|
||||
const int cur_chord_size = chord_table[selected_arp].size();
|
||||
const int range = (int)( cur_chord_size * m_arpRangeModel.value() );
|
||||
const int total_range = range * cnphv.size();
|
||||
@@ -479,7 +477,7 @@ void Arpeggiator::processNote( notePlayHandle * _n )
|
||||
}
|
||||
|
||||
// create new arp-note
|
||||
note new_note( midiTime( 0 ), midiTime( 0 ),
|
||||
note new_note( MidiTime( 0 ), MidiTime( 0 ),
|
||||
sub_note_key,
|
||||
(volume_t)
|
||||
qRound( _n->getVolume() * vol_level ),
|
||||
@@ -512,7 +510,7 @@ void Arpeggiator::processNote( notePlayHandle * _n )
|
||||
|
||||
|
||||
|
||||
void Arpeggiator::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
void InstrumentFunctionArpeggio::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
{
|
||||
m_arpEnabledModel.saveSettings( _doc, _this, "arp-enabled" );
|
||||
m_arpModel.saveSettings( _doc, _this, "arp" );
|
||||
@@ -527,7 +525,7 @@ void Arpeggiator::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
|
||||
|
||||
|
||||
void Arpeggiator::loadSettings( const QDomElement & _this )
|
||||
void InstrumentFunctionArpeggio::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
m_arpEnabledModel.loadSettings( _this, "arp-enabled" );
|
||||
m_arpModel.loadSettings( _this, "arp" );
|
||||
|
||||
@@ -326,7 +326,8 @@ f_cnt_t InstrumentSoundShaping::releaseFrames() const
|
||||
{
|
||||
f_cnt_t ret_val = m_envLfoParameters[Volume]->isUsed() ?
|
||||
m_envLfoParameters[Volume]->releaseFrames() : 0;
|
||||
if( m_instrumentTrack->instrument()->desiredReleaseFrames() > ret_val )
|
||||
if( m_instrumentTrack->instrument() &&
|
||||
m_instrumentTrack->instrument()->desiredReleaseFrames() > ret_val )
|
||||
{
|
||||
ret_val = m_instrumentTrack->instrument()->desiredReleaseFrames();
|
||||
}
|
||||
|
||||
@@ -49,7 +49,8 @@ LfoController::LfoController( Model * _parent ) :
|
||||
m_duration( 1000 ),
|
||||
m_phaseCorrection( 0 ),
|
||||
m_phaseOffset( 0 ),
|
||||
m_sampleFunction( &Oscillator::sinSample )
|
||||
m_sampleFunction( &Oscillator::sinSample ),
|
||||
m_userDefSampleBuffer( new SampleBuffer )
|
||||
{
|
||||
|
||||
connect( &m_waveModel, SIGNAL( dataChanged() ),
|
||||
@@ -61,6 +62,7 @@ LfoController::LfoController( Model * _parent ) :
|
||||
|
||||
LfoController::~LfoController()
|
||||
{
|
||||
sharedObject::unref( m_userDefSampleBuffer );
|
||||
m_baseModel.disconnect( this );
|
||||
m_speedModel.disconnect( this );
|
||||
m_amountModel.disconnect( this );
|
||||
@@ -164,7 +166,9 @@ float LfoController::value( int _offset )
|
||||
|
||||
// 44100 frames/sec
|
||||
return m_baseModel.value() + ( m_amountModel.value() *
|
||||
m_sampleFunction(sampleFrame)
|
||||
( m_sampleFunction != NULL ?
|
||||
m_sampleFunction(sampleFrame):
|
||||
m_userDefSampleBuffer->userWaveSample(sampleFrame) )
|
||||
/ 2.0f );
|
||||
}
|
||||
|
||||
@@ -196,6 +200,14 @@ void LfoController::updateSampleFunction()
|
||||
case Oscillator::WhiteNoise:
|
||||
m_sampleFunction = &Oscillator::noiseSample;
|
||||
break;
|
||||
case Oscillator::UserDefinedWave:
|
||||
m_sampleFunction = NULL;
|
||||
/*TODO: If C++11 is allowed, should change the type of
|
||||
m_sampleFunction be std::function<sample_t(const float)>
|
||||
and use the line below:
|
||||
*/
|
||||
//m_sampleFunction = &(m_userDefSampleBuffer->userWaveSample)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
#include "Piano.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "MidiEvent.h"
|
||||
#include "MidiEventProcessor.h"
|
||||
|
||||
|
||||
@@ -96,7 +97,7 @@ void Piano::handleKeyPress( int key, int midiVelocity )
|
||||
{
|
||||
if( isValidKey( key ) )
|
||||
{
|
||||
m_midiEvProc->processInEvent( midiEvent( MidiNoteOn, 0, key, midiVelocity ), midiTime() );
|
||||
m_midiEvProc->processInEvent( MidiEvent( MidiNoteOn, 0, key, midiVelocity ) );
|
||||
m_pressedKeys[key] = true;
|
||||
}
|
||||
}
|
||||
@@ -113,7 +114,7 @@ void Piano::handleKeyRelease( int key )
|
||||
{
|
||||
if( isValidKey( key ) )
|
||||
{
|
||||
m_midiEvProc->processInEvent( midiEvent( MidiNoteOff, 0, key, 0 ), midiTime() );
|
||||
m_midiEvProc->processInEvent( MidiEvent( MidiNoteOff, 0, key, 0 ) );
|
||||
m_pressedKeys[key] = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* RemotePlugin.cpp - base class providing RPC like mechanisms
|
||||
*
|
||||
* Copyright (c) 2008-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -281,14 +281,14 @@ bool RemotePlugin::process( const sampleFrame * _in_buf,
|
||||
|
||||
|
||||
|
||||
void RemotePlugin::processMidiEvent( const midiEvent & _e,
|
||||
void RemotePlugin::processMidiEvent( const MidiEvent & _e,
|
||||
const f_cnt_t _offset )
|
||||
{
|
||||
message m( IdMidiEvent );
|
||||
m.addInt( _e.m_type );
|
||||
m.addInt( _e.m_channel );
|
||||
m.addInt( _e.m_data.m_param[0] );
|
||||
m.addInt( _e.m_data.m_param[1] );
|
||||
m.addInt( _e.type() );
|
||||
m.addInt( _e.channel() );
|
||||
m.addInt( _e.param( 0 ) );
|
||||
m.addInt( _e.param( 1 ) );
|
||||
m.addInt( _offset );
|
||||
lock();
|
||||
sendMessage( m );
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <QtCore/QBuffer>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QPainter>
|
||||
|
||||
@@ -39,6 +38,7 @@
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#define OV_EXCLUDE_STATIC_CALLBACKS
|
||||
#ifdef LMMS_HAVE_OGGVORBIS
|
||||
#include <vorbis/vorbisfile.h>
|
||||
#endif
|
||||
@@ -61,6 +61,8 @@
|
||||
#include "interpolation.h"
|
||||
#include "templates.h"
|
||||
|
||||
#include "FileDialog.h"
|
||||
|
||||
|
||||
SampleBuffer::SampleBuffer( const QString & _audio_file,
|
||||
bool _is_base64_data ) :
|
||||
@@ -829,10 +831,7 @@ void SampleBuffer::visualize( QPainter & _p, const QRect & _dr,
|
||||
|
||||
QString SampleBuffer::openAudioFile() const
|
||||
{
|
||||
QFileDialog ofd( NULL, tr( "Open audio file" ) );
|
||||
#if QT_VERSION >= 0x040806
|
||||
ofd.setOption( QFileDialog::DontUseCustomDirectoryIcons );
|
||||
#endif
|
||||
FileDialog ofd( NULL, tr( "Open audio file" ) );
|
||||
|
||||
QString dir;
|
||||
if( !m_audioFile.isEmpty() )
|
||||
@@ -855,7 +854,7 @@ QString SampleBuffer::openAudioFile() const
|
||||
}
|
||||
// change dir to position of previously opened file
|
||||
ofd.setDirectory( dir );
|
||||
ofd.setFileMode( QFileDialog::ExistingFiles );
|
||||
ofd.setFileMode( FileDialog::ExistingFiles );
|
||||
|
||||
// set filters
|
||||
QStringList types;
|
||||
@@ -894,6 +893,23 @@ QString SampleBuffer::openAudioFile() const
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QString SampleBuffer::openAndSetAudioFile()
|
||||
{
|
||||
QString fileName = this->openAudioFile();
|
||||
|
||||
if(!fileName.isEmpty())
|
||||
{
|
||||
this->setAudioFile( fileName );
|
||||
}
|
||||
|
||||
return fileName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#undef LMMS_HAVE_FLAC_STREAM_ENCODER_H /* not yet... */
|
||||
#undef LMMS_HAVE_FLAC_STREAM_DECODER_H
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ void SampleRecordHandle::play( sampleFrame * /*_working_buffer*/ )
|
||||
writeBuffer( recbuf, frames );
|
||||
m_framesRecorded += frames;
|
||||
|
||||
midiTime len = (tick_t)( m_framesRecorded / engine::framesPerTick() );
|
||||
MidiTime len = (tick_t)( m_framesRecorded / engine::framesPerTick() );
|
||||
if( len > m_minLength )
|
||||
{
|
||||
// m_tco->changeLength( len );
|
||||
|
||||
@@ -54,7 +54,7 @@ bbTrackContainer::~bbTrackContainer()
|
||||
|
||||
|
||||
|
||||
bool bbTrackContainer::play( midiTime _start, fpp_t _frames,
|
||||
bool bbTrackContainer::play( MidiTime _start, fpp_t _frames,
|
||||
f_cnt_t _offset, int _tco_num )
|
||||
{
|
||||
bool played_a_note = false;
|
||||
@@ -63,7 +63,7 @@ bool bbTrackContainer::play( midiTime _start, fpp_t _frames,
|
||||
return false;
|
||||
}
|
||||
|
||||
_start = _start % ( lengthOfBB( _tco_num ) * midiTime::ticksPerTact() );
|
||||
_start = _start % ( lengthOfBB( _tco_num ) * MidiTime::ticksPerTact() );
|
||||
|
||||
TrackList tl = tracks();
|
||||
for( TrackList::iterator it = tl.begin(); it != tl.end(); ++it )
|
||||
@@ -99,7 +99,7 @@ void bbTrackContainer::updateAfterTrackAdd()
|
||||
|
||||
tact_t bbTrackContainer::lengthOfBB( int _bb )
|
||||
{
|
||||
midiTime max_length = midiTime::ticksPerTact();
|
||||
MidiTime max_length = MidiTime::ticksPerTact();
|
||||
|
||||
const TrackList & tl = tracks();
|
||||
for( TrackList::const_iterator it = tl.begin(); it != tl.end(); ++it )
|
||||
@@ -172,7 +172,7 @@ void bbTrackContainer::fixIncorrectPositions()
|
||||
{
|
||||
for( int i = 0; i < numOfBBs(); ++i )
|
||||
{
|
||||
( *it )->getTCO( i )->movePosition( midiTime( i, 0 ) );
|
||||
( *it )->getTCO( i )->movePosition( MidiTime( i, 0 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -252,10 +252,10 @@ void bbTrackContainer::createTCOsForBB( int _bb )
|
||||
{
|
||||
while( tl[i]->numOfTCOs() < _bb + 1 )
|
||||
{
|
||||
midiTime position = midiTime( tl[i]->numOfTCOs(), 0 );
|
||||
MidiTime position = MidiTime( tl[i]->numOfTCOs(), 0 );
|
||||
trackContentObject * tco = tl[i]->createTCO( position );
|
||||
tco->movePosition( position );
|
||||
tco->changeLength( midiTime( 1, 0 ) );
|
||||
tco->changeLength( MidiTime( 1, 0 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "gui_templates.h"
|
||||
#include "song.h"
|
||||
#include "MidiPort.h"
|
||||
#include "MidiTime.h"
|
||||
#include "note.h"
|
||||
|
||||
|
||||
@@ -160,73 +161,70 @@ QString MidiAlsaSeq::probeDevice()
|
||||
|
||||
|
||||
|
||||
void MidiAlsaSeq::processOutEvent( const midiEvent & _me,
|
||||
const midiTime & _time,
|
||||
const MidiPort * _port )
|
||||
void MidiAlsaSeq::processOutEvent( const MidiEvent& event, const MidiTime& time, const MidiPort* port )
|
||||
{
|
||||
// HACK!!! - need a better solution which isn't that easy since we
|
||||
// cannot store const-ptrs in our map because we need to call non-const
|
||||
// methods of MIDI-port - it's a mess...
|
||||
MidiPort * p = const_cast<MidiPort *>( _port );
|
||||
MidiPort* p = const_cast<MidiPort *>( port );
|
||||
|
||||
snd_seq_event_t ev;
|
||||
snd_seq_ev_clear( &ev );
|
||||
snd_seq_ev_set_source( &ev, ( m_portIDs[p][1] != -1 ) ?
|
||||
m_portIDs[p][1] : m_portIDs[p][0] );
|
||||
snd_seq_ev_set_subs( &ev );
|
||||
snd_seq_ev_schedule_tick( &ev, m_queueID, 1, static_cast<int>( _time ) );
|
||||
snd_seq_ev_schedule_tick( &ev, m_queueID, 1, static_cast<int>( time ) );
|
||||
ev.queue = m_queueID;
|
||||
switch( _me.m_type )
|
||||
switch( event.type() )
|
||||
{
|
||||
case MidiNoteOn:
|
||||
snd_seq_ev_set_noteon( &ev,
|
||||
_me.channel(),
|
||||
_me.key() + KeysPerOctave,
|
||||
_me.velocity() );
|
||||
event.channel(),
|
||||
event.key() + KeysPerOctave,
|
||||
event.velocity() );
|
||||
break;
|
||||
|
||||
case MidiNoteOff:
|
||||
snd_seq_ev_set_noteoff( &ev,
|
||||
_me.channel(),
|
||||
_me.key() + KeysPerOctave,
|
||||
_me.velocity() );
|
||||
event.channel(),
|
||||
event.key() + KeysPerOctave,
|
||||
event.velocity() );
|
||||
break;
|
||||
|
||||
case MidiKeyPressure:
|
||||
snd_seq_ev_set_keypress( &ev,
|
||||
_me.channel(),
|
||||
_me.key() + KeysPerOctave,
|
||||
_me.velocity() );
|
||||
event.channel(),
|
||||
event.key() + KeysPerOctave,
|
||||
event.velocity() );
|
||||
break;
|
||||
|
||||
case MidiControlChange:
|
||||
snd_seq_ev_set_controller( &ev,
|
||||
_me.channel(),
|
||||
_me.m_data.m_param[0],
|
||||
_me.m_data.m_param[1] );
|
||||
event.channel(),
|
||||
event.controllerNumber(),
|
||||
event.controllerValue() );
|
||||
break;
|
||||
|
||||
case MidiProgramChange:
|
||||
snd_seq_ev_set_pgmchange( &ev,
|
||||
_me.channel(),
|
||||
_me.m_data.m_param[0] );
|
||||
event.channel(),
|
||||
event.program() );
|
||||
break;
|
||||
|
||||
case MidiChannelPressure:
|
||||
snd_seq_ev_set_chanpress( &ev,
|
||||
_me.channel(),
|
||||
_me.m_data.m_param[0] );
|
||||
event.channel(),
|
||||
event.channelPressure() );
|
||||
break;
|
||||
|
||||
case MidiPitchBend:
|
||||
snd_seq_ev_set_pitchbend( &ev,
|
||||
_me.channel(),
|
||||
_me.m_data.m_param[0] - 8192 );
|
||||
event.channel(),
|
||||
event.param( 0 ) - 8192 );
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf( stderr, "ALSA-sequencer: unhandled output "
|
||||
"event %d\n", (int) _me.m_type );
|
||||
qWarning( "MidiAlsaSeq: unhandled output event %d\n", (int) event.type() );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -353,7 +351,7 @@ void MidiAlsaSeq::removePort( MidiPort * _port )
|
||||
|
||||
|
||||
|
||||
QString MidiAlsaSeq::sourcePortName( const midiEvent & _event ) const
|
||||
QString MidiAlsaSeq::sourcePortName( const MidiEvent & _event ) const
|
||||
{
|
||||
if( _event.sourcePort() )
|
||||
{
|
||||
@@ -535,70 +533,70 @@ void MidiAlsaSeq::run()
|
||||
switch( ev->type )
|
||||
{
|
||||
case SND_SEQ_EVENT_NOTEON:
|
||||
dest->processInEvent( midiEvent( MidiNoteOn,
|
||||
dest->processInEvent( MidiEvent( MidiNoteOn,
|
||||
ev->data.note.channel,
|
||||
ev->data.note.note -
|
||||
KeysPerOctave,
|
||||
ev->data.note.velocity,
|
||||
source
|
||||
),
|
||||
midiTime( ev->time.tick ) );
|
||||
MidiTime( ev->time.tick ) );
|
||||
break;
|
||||
|
||||
case SND_SEQ_EVENT_NOTEOFF:
|
||||
dest->processInEvent( midiEvent( MidiNoteOff,
|
||||
dest->processInEvent( MidiEvent( MidiNoteOff,
|
||||
ev->data.note.channel,
|
||||
ev->data.note.note -
|
||||
KeysPerOctave,
|
||||
ev->data.note.velocity,
|
||||
source
|
||||
),
|
||||
midiTime( ev->time.tick) );
|
||||
MidiTime( ev->time.tick) );
|
||||
break;
|
||||
|
||||
case SND_SEQ_EVENT_KEYPRESS:
|
||||
dest->processInEvent( midiEvent(
|
||||
dest->processInEvent( MidiEvent(
|
||||
MidiKeyPressure,
|
||||
ev->data.note.channel,
|
||||
ev->data.note.note -
|
||||
KeysPerOctave,
|
||||
ev->data.note.velocity,
|
||||
source
|
||||
), midiTime() );
|
||||
), MidiTime() );
|
||||
break;
|
||||
|
||||
case SND_SEQ_EVENT_CONTROLLER:
|
||||
dest->processInEvent( midiEvent(
|
||||
dest->processInEvent( MidiEvent(
|
||||
MidiControlChange,
|
||||
ev->data.control.channel,
|
||||
ev->data.control.param,
|
||||
ev->data.control.value, source ),
|
||||
midiTime() );
|
||||
MidiTime() );
|
||||
break;
|
||||
|
||||
case SND_SEQ_EVENT_PGMCHANGE:
|
||||
dest->processInEvent( midiEvent(
|
||||
dest->processInEvent( MidiEvent(
|
||||
MidiProgramChange,
|
||||
ev->data.control.channel,
|
||||
ev->data.control.param,
|
||||
ev->data.control.value, source ),
|
||||
midiTime() );
|
||||
MidiTime() );
|
||||
break;
|
||||
|
||||
case SND_SEQ_EVENT_CHANPRESS:
|
||||
dest->processInEvent( midiEvent(
|
||||
dest->processInEvent( MidiEvent(
|
||||
MidiChannelPressure,
|
||||
ev->data.control.channel,
|
||||
ev->data.control.param,
|
||||
ev->data.control.value, source ),
|
||||
midiTime() );
|
||||
MidiTime() );
|
||||
break;
|
||||
|
||||
case SND_SEQ_EVENT_PITCHBEND:
|
||||
dest->processInEvent( midiEvent( MidiPitchBend,
|
||||
dest->processInEvent( MidiEvent( MidiPitchBend,
|
||||
ev->data.control.channel,
|
||||
ev->data.control.value + 8192, 0, source ),
|
||||
midiTime() );
|
||||
MidiTime() );
|
||||
break;
|
||||
|
||||
case SND_SEQ_EVENT_SENSING:
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include "MidiClient.h"
|
||||
#include "MidiPort.h"
|
||||
#include "templates.h"
|
||||
#include "note.h"
|
||||
|
||||
|
||||
@@ -44,32 +43,32 @@ MidiClient::~MidiClient()
|
||||
|
||||
|
||||
|
||||
void MidiClient::applyPortMode( MidiPort * )
|
||||
void MidiClient::applyPortMode( MidiPort* )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MidiClient::applyPortName( MidiPort * )
|
||||
void MidiClient::applyPortName( MidiPort* )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MidiClient::addPort( MidiPort * _port )
|
||||
void MidiClient::addPort( MidiPort* port )
|
||||
{
|
||||
m_midiPorts.push_back( _port );
|
||||
m_midiPorts.push_back( port );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MidiClient::removePort( MidiPort * _port )
|
||||
void MidiClient::removePort( MidiPort* port )
|
||||
{
|
||||
QVector<MidiPort *>::Iterator it =
|
||||
qFind( m_midiPorts.begin(), m_midiPorts.end(), _port );
|
||||
qFind( m_midiPorts.begin(), m_midiPorts.end(), port );
|
||||
if( it != m_midiPorts.end() )
|
||||
{
|
||||
m_midiPorts.erase( it );
|
||||
@@ -79,14 +78,14 @@ void MidiClient::removePort( MidiPort * _port )
|
||||
|
||||
|
||||
|
||||
void MidiClient::subscribeReadablePort( MidiPort *, const QString & , bool )
|
||||
void MidiClient::subscribeReadablePort( MidiPort*, const QString& , bool )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MidiClient::subscribeWritablePort( MidiPort * , const QString & , bool )
|
||||
void MidiClient::subscribeWritablePort( MidiPort* , const QString& , bool )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -124,7 +123,7 @@ void MidiClientRaw::parseData( const unsigned char c )
|
||||
{
|
||||
if( c == MidiSystemReset )
|
||||
{
|
||||
m_midiParseData.m_midiEvent.m_type = MidiSystemReset;
|
||||
m_midiParseData.m_midiEvent.setType( MidiSystemReset );
|
||||
m_midiParseData.m_status = 0;
|
||||
processParsedEvent();
|
||||
}
|
||||
@@ -206,34 +205,30 @@ void MidiClientRaw::parseData( const unsigned char c )
|
||||
* We simply keep the status as it is, just reset the parameter counter.
|
||||
* If another status byte comes in, it will overwrite the status.
|
||||
*/
|
||||
m_midiParseData.m_midiEvent.m_type = static_cast<MidiEventTypes>( m_midiParseData.m_status );
|
||||
m_midiParseData.m_midiEvent.m_channel = m_midiParseData.m_channel;
|
||||
m_midiParseData.m_midiEvent.setType( static_cast<MidiEventTypes>( m_midiParseData.m_status ) );
|
||||
m_midiParseData.m_midiEvent.setChannel( m_midiParseData.m_channel );
|
||||
m_midiParseData.m_bytes = 0; /* Related to running status! */
|
||||
switch( m_midiParseData.m_midiEvent.m_type )
|
||||
switch( m_midiParseData.m_midiEvent.type() )
|
||||
{
|
||||
case MidiNoteOff:
|
||||
case MidiNoteOn:
|
||||
case MidiKeyPressure:
|
||||
case MidiProgramChange:
|
||||
case MidiChannelPressure:
|
||||
m_midiParseData.m_midiEvent.m_data.m_param[0] =
|
||||
m_midiParseData.m_buffer[0] - KeysPerOctave;
|
||||
m_midiParseData.m_midiEvent.m_data.m_param[1] =
|
||||
m_midiParseData.m_buffer[1];
|
||||
m_midiParseData.m_midiEvent.setKey( m_midiParseData.m_buffer[0] - KeysPerOctave );
|
||||
m_midiParseData.m_midiEvent.setVelocity( m_midiParseData.m_buffer[1] );
|
||||
break;
|
||||
|
||||
case MidiControlChange:
|
||||
m_midiParseData.m_midiEvent.m_data.m_param[0] = m_midiParseData.m_buffer[0];
|
||||
m_midiParseData.m_midiEvent.m_data.m_param[1] = m_midiParseData.m_buffer[1];
|
||||
m_midiParseData.m_midiEvent.setControllerNumber( m_midiParseData.m_buffer[0] );
|
||||
m_midiParseData.m_midiEvent.setControllerValue( m_midiParseData.m_buffer[1] );
|
||||
break;
|
||||
|
||||
case MidiPitchBend:
|
||||
// Pitch-bend is transmitted with 14-bit precision.
|
||||
// Note: '|' does here the same as '+' (no common bits),
|
||||
// but might be faster
|
||||
m_midiParseData.m_midiEvent.m_data.m_param[0] =
|
||||
( ( m_midiParseData.m_buffer[1] * 128 ) |
|
||||
m_midiParseData.m_buffer[0] );
|
||||
m_midiParseData.m_midiEvent.setPitchBend( ( m_midiParseData.m_buffer[1] * 128 ) | m_midiParseData.m_buffer[0] );
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -251,33 +246,29 @@ void MidiClientRaw::processParsedEvent()
|
||||
{
|
||||
for( int i = 0; i < m_midiPorts.size(); ++i )
|
||||
{
|
||||
m_midiPorts[i]->processInEvent( m_midiParseData.m_midiEvent,
|
||||
midiTime() );
|
||||
m_midiPorts[i]->processInEvent( m_midiParseData.m_midiEvent );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MidiClientRaw::processOutEvent( const midiEvent & _me,
|
||||
const midiTime & ,
|
||||
const MidiPort * _port )
|
||||
void MidiClientRaw::processOutEvent( const MidiEvent& event, const MidiTime & , const MidiPort* port )
|
||||
{
|
||||
// TODO: also evaluate _time and queue event if necessary
|
||||
switch( _me.m_type )
|
||||
switch( event.type() )
|
||||
{
|
||||
case MidiNoteOn:
|
||||
case MidiNoteOff:
|
||||
case MidiKeyPressure:
|
||||
sendByte( _me.m_type | _me.channel() );
|
||||
sendByte( _me.m_data.m_param[0] + KeysPerOctave );
|
||||
sendByte( tLimit( (int) _me.m_data.m_param[1],
|
||||
0, 127 ) );
|
||||
sendByte( event.type() | event.channel() );
|
||||
sendByte( event.key() + KeysPerOctave );
|
||||
sendByte( event.velocity() );
|
||||
break;
|
||||
|
||||
default:
|
||||
qWarning( "MidiClientRaw: unhandled MIDI-event %d\n",
|
||||
(int) _me.m_type );
|
||||
(int) event.type() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,20 +73,19 @@ void MidiController::updateName()
|
||||
|
||||
|
||||
|
||||
void MidiController::processInEvent( const midiEvent & _me,
|
||||
const midiTime & _time )
|
||||
void MidiController::processInEvent( const MidiEvent& event, const MidiTime& time )
|
||||
{
|
||||
unsigned char controllerNum;
|
||||
switch( _me.m_type )
|
||||
switch( event.type() )
|
||||
{
|
||||
case MidiControlChange:
|
||||
controllerNum = _me.m_data.m_bytes[0] & 0x7F;
|
||||
controllerNum = event.controllerNumber();
|
||||
|
||||
if( m_midiPort.inputController() == controllerNum + 1 &&
|
||||
( m_midiPort.inputChannel() == _me.m_channel + 1 ||
|
||||
( m_midiPort.inputChannel() == event.channel() + 1 ||
|
||||
m_midiPort.inputChannel() == 0 ) )
|
||||
{
|
||||
unsigned char val = _me.m_data.m_bytes[2] & 0x7F;
|
||||
unsigned char val = event.controllerValue();
|
||||
m_lastValue = (float)( val ) / 127.0f;
|
||||
emit valueChanged();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* MidiPort.cpp - abstraction of MIDI-ports which are part of LMMS's MIDI-
|
||||
* sequencing system
|
||||
*
|
||||
* Copyright (c) 2005-2013 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -31,31 +31,25 @@
|
||||
|
||||
|
||||
|
||||
MidiPort::MidiPort( const QString & _name, MidiClient * _mc,
|
||||
MidiEventProcessor * _mep, Model * _parent,
|
||||
Modes _mode ) :
|
||||
Model( _parent ),
|
||||
MidiPort::MidiPort( const QString& name,
|
||||
MidiClient* client,
|
||||
MidiEventProcessor* eventProcessor,
|
||||
Model* parent,
|
||||
Mode mode ) :
|
||||
Model( parent ),
|
||||
m_readablePortsMenu( NULL ),
|
||||
m_writablePortsMenu( NULL ),
|
||||
m_midiClient( _mc ),
|
||||
m_midiEventProcessor( _mep ),
|
||||
m_mode( _mode ),
|
||||
m_inputChannelModel( 0, 0, MidiChannelCount, this,
|
||||
tr( "Input channel" ) ),
|
||||
m_outputChannelModel( 1, 1, MidiChannelCount, this,
|
||||
tr( "Output channel" ) ),
|
||||
m_inputControllerModel( 0, 0, MidiControllerCount, this,
|
||||
tr( "Input controller" ) ),
|
||||
m_outputControllerModel( 0, 0, MidiControllerCount, this,
|
||||
tr( "Output controller" ) ),
|
||||
m_fixedInputVelocityModel( -1, -1, MidiMaxVelocity, this,
|
||||
tr( "Fixed input velocity" ) ),
|
||||
m_fixedOutputVelocityModel( -1, -1, MidiMaxVelocity, this,
|
||||
tr( "Fixed output velocity" ) ),
|
||||
m_fixedOutputNoteModel( -1, -1, MidiMaxNote, this,
|
||||
tr( "Fixed output note" ) ),
|
||||
m_outputProgramModel( 1, 1, MidiProgramCount, this,
|
||||
tr( "Output MIDI program" ) ),
|
||||
m_midiClient( client ),
|
||||
m_midiEventProcessor( eventProcessor ),
|
||||
m_mode( mode ),
|
||||
m_inputChannelModel( 0, 0, MidiChannelCount, this, tr( "Input channel" ) ),
|
||||
m_outputChannelModel( 1, 1, MidiChannelCount, this, tr( "Output channel" ) ),
|
||||
m_inputControllerModel( 0, 0, MidiControllerCount, this, tr( "Input controller" ) ),
|
||||
m_outputControllerModel( 0, 0, MidiControllerCount, this, tr( "Output controller" ) ),
|
||||
m_fixedInputVelocityModel( -1, -1, MidiMaxVelocity, this, tr( "Fixed input velocity" ) ),
|
||||
m_fixedOutputVelocityModel( -1, -1, MidiMaxVelocity, this, tr( "Fixed output velocity" ) ),
|
||||
m_fixedOutputNoteModel( -1, -1, MidiMaxNote, this, tr( "Fixed output note" ) ),
|
||||
m_outputProgramModel( 1, 1, MidiProgramCount, this, tr( "Output MIDI program" ) ),
|
||||
m_readableModel( false, this, tr( "Receive MIDI-events" ) ),
|
||||
m_writableModel( false, this, tr( "Send MIDI-events" ) )
|
||||
{
|
||||
@@ -64,12 +58,9 @@ MidiPort::MidiPort( const QString & _name, MidiClient * _mc,
|
||||
m_readableModel.setValue( m_mode == Input || m_mode == Duplex );
|
||||
m_writableModel.setValue( m_mode == Output || m_mode == Duplex );
|
||||
|
||||
connect( &m_readableModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateMidiPortMode() ) );
|
||||
connect( &m_writableModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateMidiPortMode() ) );
|
||||
connect( &m_outputProgramModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateOutputProgram() ) );
|
||||
connect( &m_readableModel, SIGNAL( dataChanged() ), this, SLOT( updateMidiPortMode() ) );
|
||||
connect( &m_writableModel, SIGNAL( dataChanged() ), this, SLOT( updateMidiPortMode() ) );
|
||||
connect( &m_outputProgramModel, SIGNAL( dataChanged() ), this, SLOT( updateOutputProgram() ) );
|
||||
|
||||
|
||||
// when using with non-raw-clients we can provide buttons showing
|
||||
@@ -80,10 +71,8 @@ MidiPort::MidiPort( const QString & _name, MidiClient * _mc,
|
||||
updateWritablePorts();
|
||||
|
||||
// we want to get informed about port-changes!
|
||||
m_midiClient->connectRPChanged( this,
|
||||
SLOT( updateReadablePorts() ) );
|
||||
m_midiClient->connectWPChanged( this,
|
||||
SLOT( updateWritablePorts() ) );
|
||||
m_midiClient->connectRPChanged( this, SLOT( updateReadablePorts() ) );
|
||||
m_midiClient->connectWPChanged( this, SLOT( updateWritablePorts() ) );
|
||||
}
|
||||
|
||||
updateMidiPortMode();
|
||||
@@ -105,109 +94,99 @@ MidiPort::~MidiPort()
|
||||
|
||||
|
||||
|
||||
void MidiPort::setName( const QString & _name )
|
||||
void MidiPort::setName( const QString& name )
|
||||
{
|
||||
setDisplayName( _name );
|
||||
setDisplayName( name );
|
||||
m_midiClient->applyPortName( this );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MidiPort::setMode( Modes _mode )
|
||||
void MidiPort::setMode( Mode mode )
|
||||
{
|
||||
m_mode = _mode;
|
||||
m_mode = mode;
|
||||
m_midiClient->applyPortMode( this );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MidiPort::processInEvent( const midiEvent & _me, const midiTime & _time )
|
||||
void MidiPort::processInEvent( const MidiEvent& event, const MidiTime& time )
|
||||
{
|
||||
// mask event
|
||||
if( inputEnabled() &&
|
||||
( inputChannel()-1 == _me.m_channel || inputChannel() == 0 ) )
|
||||
if( isInputEnabled() &&
|
||||
( inputChannel() == 0 || inputChannel()-1 == event.channel() ) )
|
||||
{
|
||||
midiEvent ev = _me;
|
||||
if( _me.m_type == MidiNoteOn ||
|
||||
_me.m_type == MidiNoteOff ||
|
||||
_me.m_type == MidiKeyPressure )
|
||||
MidiEvent inEvent = event;
|
||||
if( event.type() == MidiNoteOn ||
|
||||
event.type() == MidiNoteOff ||
|
||||
event.type() == MidiKeyPressure )
|
||||
{
|
||||
ev.key() = ev.key() + KeysPerOctave;
|
||||
if( ev.key() < 0 || ev.key() >= NumKeys )
|
||||
inEvent.setKey( inEvent.key() + KeysPerOctave );
|
||||
if( inEvent.key() < 0 || inEvent.key() >= NumKeys )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if( fixedInputVelocity() >= 0 && _me.velocity() > 0 )
|
||||
if( fixedInputVelocity() >= 0 && inEvent.velocity() > 0 )
|
||||
{
|
||||
ev.velocity() = fixedInputVelocity();
|
||||
inEvent.setVelocity( fixedInputVelocity() );
|
||||
}
|
||||
|
||||
ev.setFromMidiPort( true );
|
||||
m_midiEventProcessor->processInEvent( ev, _time );
|
||||
m_midiEventProcessor->processInEvent( inEvent, time );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MidiPort::processOutEvent( const midiEvent & _me, const midiTime & _time )
|
||||
void MidiPort::processOutEvent( const MidiEvent& event, const MidiTime& time )
|
||||
{
|
||||
// mask event
|
||||
if( outputEnabled() && realOutputChannel() == _me.m_channel )
|
||||
if( isOutputEnabled() && realOutputChannel() == event.channel() )
|
||||
{
|
||||
midiEvent ev = _me;
|
||||
// we use/display MIDI channels 1...16 but we need 0...15 for
|
||||
// the outside world
|
||||
// We are already in "real" MIDI channel space here
|
||||
/* if( ev.m_channel > 0 )
|
||||
{
|
||||
--ev.m_channel;
|
||||
} */
|
||||
if( ( _me.m_type == MidiNoteOn || _me.m_type == MidiNoteOff ) &&
|
||||
MidiEvent outEvent = event;
|
||||
|
||||
if( ( event.type() == MidiNoteOn || event.type() == MidiNoteOff ) &&
|
||||
fixedOutputNote() >= 0 )
|
||||
{
|
||||
// Convert MIDI note number (from spinbox) -> LMMS note number
|
||||
// that will be converted back when outputted.
|
||||
ev.key() = fixedOutputNote() - KeysPerOctave;
|
||||
outEvent.setKey( fixedOutputNote() - KeysPerOctave );
|
||||
}
|
||||
if( fixedOutputVelocity() >= 0 && _me.velocity() > 0 &&
|
||||
( _me.m_type == MidiNoteOn ||
|
||||
_me.m_type == MidiKeyPressure ) )
|
||||
|
||||
if( fixedOutputVelocity() >= 0 && event.velocity() > 0 &&
|
||||
( event.type() == MidiNoteOn || event.type() == MidiKeyPressure ) )
|
||||
{
|
||||
ev.velocity() = fixedOutputVelocity();
|
||||
outEvent.setVelocity( fixedOutputVelocity() );
|
||||
}
|
||||
m_midiClient->processOutEvent( ev, _time, this );
|
||||
|
||||
m_midiClient->processOutEvent( outEvent, time, this );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MidiPort::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
void MidiPort::saveSettings( QDomDocument& doc, QDomElement& thisElement )
|
||||
{
|
||||
m_inputChannelModel.saveSettings( _doc, _this, "inputchannel" );
|
||||
m_outputChannelModel.saveSettings( _doc, _this, "outputchannel" );
|
||||
m_inputControllerModel.saveSettings( _doc, _this, "inputcontroller" );
|
||||
m_outputControllerModel.saveSettings( _doc, _this, "outputcontroller" );
|
||||
m_fixedInputVelocityModel.saveSettings( _doc, _this,
|
||||
"fixedinputvelocity" );
|
||||
m_fixedOutputVelocityModel.saveSettings( _doc, _this,
|
||||
"fixedoutputvelocity" );
|
||||
m_fixedOutputNoteModel.saveSettings( _doc, _this,
|
||||
"fixedoutputnote" );
|
||||
m_outputProgramModel.saveSettings( _doc, _this, "outputprogram" );
|
||||
m_readableModel.saveSettings( _doc, _this, "readable" );
|
||||
m_writableModel.saveSettings( _doc, _this, "writable" );
|
||||
m_inputChannelModel.saveSettings( doc, thisElement, "inputchannel" );
|
||||
m_outputChannelModel.saveSettings( doc, thisElement, "outputchannel" );
|
||||
m_inputControllerModel.saveSettings( doc, thisElement, "inputcontroller" );
|
||||
m_outputControllerModel.saveSettings( doc, thisElement, "outputcontroller" );
|
||||
m_fixedInputVelocityModel.saveSettings( doc, thisElement, "fixedinputvelocity" );
|
||||
m_fixedOutputVelocityModel.saveSettings( doc, thisElement, "fixedoutputvelocity" );
|
||||
m_fixedOutputNoteModel.saveSettings( doc, thisElement, "fixedoutputnote" );
|
||||
m_outputProgramModel.saveSettings( doc, thisElement, "outputprogram" );
|
||||
m_readableModel.saveSettings( doc, thisElement, "readable" );
|
||||
m_writableModel.saveSettings( doc, thisElement, "writable" );
|
||||
|
||||
if( inputEnabled() )
|
||||
if( isInputEnabled() )
|
||||
{
|
||||
QString rp;
|
||||
for( Map::ConstIterator it = m_readablePorts.begin();
|
||||
it != m_readablePorts.end(); ++it )
|
||||
for( Map::ConstIterator it = m_readablePorts.begin(); it != m_readablePorts.end(); ++it )
|
||||
{
|
||||
if( it.value() )
|
||||
{
|
||||
@@ -219,14 +198,13 @@ void MidiPort::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
{
|
||||
rp.truncate( rp.length() - 1 );
|
||||
}
|
||||
_this.setAttribute( "inports", rp );
|
||||
thisElement.setAttribute( "inports", rp );
|
||||
}
|
||||
|
||||
if( outputEnabled() )
|
||||
if( isOutputEnabled() )
|
||||
{
|
||||
QString wp;
|
||||
for( Map::ConstIterator it = m_writablePorts.begin();
|
||||
it != m_writablePorts.end(); ++it )
|
||||
for( Map::ConstIterator it = m_writablePorts.begin(); it != m_writablePorts.end(); ++it )
|
||||
{
|
||||
if( it.value() )
|
||||
{
|
||||
@@ -238,32 +216,31 @@ void MidiPort::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
{
|
||||
wp.truncate( wp.length() - 1 );
|
||||
}
|
||||
_this.setAttribute( "outports", wp );
|
||||
thisElement.setAttribute( "outports", wp );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MidiPort::loadSettings( const QDomElement & _this )
|
||||
void MidiPort::loadSettings( const QDomElement& thisElement )
|
||||
{
|
||||
m_inputChannelModel.loadSettings( _this, "inputchannel" );
|
||||
m_outputChannelModel.loadSettings( _this, "outputchannel" );
|
||||
m_inputControllerModel.loadSettings( _this, "inputcontroller" );
|
||||
m_outputControllerModel.loadSettings( _this, "outputcontroller" );
|
||||
m_fixedInputVelocityModel.loadSettings( _this, "fixedinputvelocity" );
|
||||
m_fixedOutputVelocityModel.loadSettings( _this, "fixedoutputvelocity" );
|
||||
m_outputProgramModel.loadSettings( _this, "outputprogram" );
|
||||
m_readableModel.loadSettings( _this, "readable" );
|
||||
m_writableModel.loadSettings( _this, "writable" );
|
||||
m_inputChannelModel.loadSettings( thisElement, "inputchannel" );
|
||||
m_outputChannelModel.loadSettings( thisElement, "outputchannel" );
|
||||
m_inputControllerModel.loadSettings( thisElement, "inputcontroller" );
|
||||
m_outputControllerModel.loadSettings( thisElement, "outputcontroller" );
|
||||
m_fixedInputVelocityModel.loadSettings( thisElement, "fixedinputvelocity" );
|
||||
m_fixedOutputVelocityModel.loadSettings( thisElement, "fixedoutputvelocity" );
|
||||
m_outputProgramModel.loadSettings( thisElement, "outputprogram" );
|
||||
m_readableModel.loadSettings( thisElement, "readable" );
|
||||
m_writableModel.loadSettings( thisElement, "writable" );
|
||||
|
||||
// restore connections
|
||||
|
||||
if( inputEnabled() )
|
||||
if( isInputEnabled() )
|
||||
{
|
||||
QStringList rp = _this.attribute( "inports" ).split( ',' );
|
||||
for( Map::ConstIterator it = m_readablePorts.begin();
|
||||
it != m_readablePorts.end(); ++it )
|
||||
QStringList rp = thisElement.attribute( "inports" ).split( ',' );
|
||||
for( Map::ConstIterator it = m_readablePorts.begin(); it != m_readablePorts.end(); ++it )
|
||||
{
|
||||
if( it.value() != ( rp.indexOf( it.key() ) != -1 ) )
|
||||
{
|
||||
@@ -273,11 +250,10 @@ void MidiPort::loadSettings( const QDomElement & _this )
|
||||
emit readablePortsChanged();
|
||||
}
|
||||
|
||||
if( outputEnabled() )
|
||||
if( isOutputEnabled() )
|
||||
{
|
||||
QStringList wp = _this.attribute( "outports" ).split( ',' );
|
||||
for( Map::ConstIterator it = m_writablePorts.begin();
|
||||
it != m_writablePorts.end(); ++it )
|
||||
QStringList wp = thisElement.attribute( "outports" ).split( ',' );
|
||||
for( Map::ConstIterator it = m_writablePorts.begin(); it != m_writablePorts.end(); ++it )
|
||||
{
|
||||
if( it.value() != ( wp.indexOf( it.key() ) != -1 ) )
|
||||
{
|
||||
@@ -291,35 +267,38 @@ void MidiPort::loadSettings( const QDomElement & _this )
|
||||
|
||||
|
||||
|
||||
void MidiPort::subscribeReadablePort( const QString & _port, bool _subscribe )
|
||||
void MidiPort::subscribeReadablePort( const QString& port, bool subscribe )
|
||||
{
|
||||
m_readablePorts[_port] = _subscribe;
|
||||
m_readablePorts[port] = subscribe;
|
||||
|
||||
// make sure, MIDI-port is configured for input
|
||||
if( _subscribe == true && !inputEnabled() )
|
||||
if( subscribe == true && !isInputEnabled() )
|
||||
{
|
||||
m_readableModel.setValue( true );
|
||||
}
|
||||
m_midiClient->subscribeReadablePort( this, _port, _subscribe );
|
||||
|
||||
m_midiClient->subscribeReadablePort( this, port, subscribe );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MidiPort::subscribeWritablePort( const QString & _port, bool _subscribe )
|
||||
void MidiPort::subscribeWritablePort( const QString& port, bool subscribe )
|
||||
{
|
||||
m_writablePorts[_port] = _subscribe;
|
||||
m_writablePorts[port] = subscribe;
|
||||
|
||||
// make sure, MIDI-port is configured for output
|
||||
if( _subscribe == true && !outputEnabled() )
|
||||
if( subscribe == true && !isOutputEnabled() )
|
||||
{
|
||||
m_writableModel.setValue( true );
|
||||
}
|
||||
m_midiClient->subscribeWritablePort( this, _port, _subscribe );
|
||||
m_midiClient->subscribeWritablePort( this, port, subscribe );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MidiPort::updateMidiPortMode( void )
|
||||
void MidiPort::updateMidiPortMode()
|
||||
{
|
||||
// this small lookup-table makes everything easier
|
||||
static const Modes modeTable[2][2] =
|
||||
@@ -330,10 +309,9 @@ void MidiPort::updateMidiPortMode( void )
|
||||
setMode( modeTable[m_readableModel.value()][m_writableModel.value()] );
|
||||
|
||||
// check whether we have to dis-check items in connection-menu
|
||||
if( !inputEnabled() )
|
||||
if( !isInputEnabled() )
|
||||
{
|
||||
for( Map::ConstIterator it = m_readablePorts.begin();
|
||||
it != m_readablePorts.end(); ++it )
|
||||
for( Map::ConstIterator it = m_readablePorts.begin(); it != m_readablePorts.end(); ++it )
|
||||
{
|
||||
// subscribed?
|
||||
if( it.value() )
|
||||
@@ -343,10 +321,9 @@ void MidiPort::updateMidiPortMode( void )
|
||||
}
|
||||
}
|
||||
|
||||
if( !outputEnabled() )
|
||||
if( !isOutputEnabled() )
|
||||
{
|
||||
for( Map::ConstIterator it = m_writablePorts.begin();
|
||||
it != m_writablePorts.end(); ++it )
|
||||
for( Map::ConstIterator it = m_writablePorts.begin(); it != m_writablePorts.end(); ++it )
|
||||
{
|
||||
// subscribed?
|
||||
if( it.value() )
|
||||
@@ -366,42 +343,41 @@ void MidiPort::updateMidiPortMode( void )
|
||||
|
||||
|
||||
|
||||
void MidiPort::updateReadablePorts( void )
|
||||
void MidiPort::updateReadablePorts()
|
||||
{
|
||||
// first save all selected ports
|
||||
QStringList selected_ports;
|
||||
for( Map::ConstIterator it = m_readablePorts.begin();
|
||||
it != m_readablePorts.end(); ++it )
|
||||
QStringList selectedPorts;
|
||||
for( Map::ConstIterator it = m_readablePorts.begin(); it != m_readablePorts.end(); ++it )
|
||||
{
|
||||
if( it.value() == true )
|
||||
if( it.value() )
|
||||
{
|
||||
selected_ports.push_back( it.key() );
|
||||
selectedPorts.push_back( it.key() );
|
||||
}
|
||||
}
|
||||
|
||||
m_readablePorts.clear();
|
||||
const QStringList & wp = m_midiClient->readablePorts();
|
||||
const QStringList& wp = m_midiClient->readablePorts();
|
||||
// now insert new ports and restore selections
|
||||
for( QStringList::ConstIterator it = wp.begin(); it != wp.end(); ++it )
|
||||
{
|
||||
m_readablePorts[*it] = ( selected_ports.indexOf( *it ) != -1 );
|
||||
m_readablePorts[*it] = ( selectedPorts.indexOf( *it ) != -1 );
|
||||
}
|
||||
|
||||
emit readablePortsChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MidiPort::updateWritablePorts( void )
|
||||
void MidiPort::updateWritablePorts()
|
||||
{
|
||||
// first save all selected ports
|
||||
QStringList selected_ports;
|
||||
for( Map::ConstIterator it = m_writablePorts.begin();
|
||||
it != m_writablePorts.end(); ++it )
|
||||
QStringList selectedPorts;
|
||||
for( Map::ConstIterator it = m_writablePorts.begin(); it != m_writablePorts.end(); ++it )
|
||||
{
|
||||
if( it.value() == true )
|
||||
if( it.value() )
|
||||
{
|
||||
selected_ports.push_back( it.key() );
|
||||
selectedPorts.push_back( it.key() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,19 +386,18 @@ void MidiPort::updateWritablePorts( void )
|
||||
// now insert new ports and restore selections
|
||||
for( QStringList::ConstIterator it = wp.begin(); it != wp.end(); ++it )
|
||||
{
|
||||
m_writablePorts[*it] = ( selected_ports.indexOf( *it ) != -1 );
|
||||
m_writablePorts[*it] = ( selectedPorts.indexOf( *it ) != -1 );
|
||||
}
|
||||
|
||||
emit writablePortsChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MidiPort::updateOutputProgram( void )
|
||||
void MidiPort::updateOutputProgram()
|
||||
{
|
||||
processOutEvent( midiEvent( MidiProgramChange,
|
||||
realOutputChannel(),
|
||||
outputProgram()-1 ), midiTime( 0 ) );
|
||||
processOutEvent( MidiEvent( MidiProgramChange, realOutputChannel(), outputProgram()-1 ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* MidiWinMM.cpp - WinMM MIDI client
|
||||
*
|
||||
* Copyright (c) 2008-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -57,33 +57,28 @@ MidiWinMM::~MidiWinMM()
|
||||
|
||||
|
||||
|
||||
void MidiWinMM::processOutEvent( const midiEvent & _me,
|
||||
const midiTime & _time,
|
||||
const MidiPort * _port )
|
||||
void MidiWinMM::processOutEvent( const MidiEvent& event, const MidiTime& time, const MidiPort* port )
|
||||
{
|
||||
const DWORD shortMsg = ( _me.m_type + _me.channel() ) +
|
||||
( ( _me.m_data.m_param[0] & 0xff ) << 8 ) +
|
||||
( ( _me.m_data.m_param[1] & 0xff ) << 16 );
|
||||
const DWORD shortMsg = ( event.type() + event.channel() ) +
|
||||
( ( event.param( 0 ) & 0xff ) << 8 ) +
|
||||
( ( event.param( 1 ) & 0xff ) << 16 );
|
||||
|
||||
QStringList out_devs;
|
||||
for( SubMap::ConstIterator it = m_outputSubs.begin();
|
||||
it != m_outputSubs.end(); ++it )
|
||||
QStringList outDevs;
|
||||
for( SubMap::ConstIterator it = m_outputSubs.begin(); it != m_outputSubs.end(); ++it )
|
||||
{
|
||||
for( MidiPortList::ConstIterator jt = it.value().begin();
|
||||
jt != it.value().end(); ++jt )
|
||||
for( MidiPortList::ConstIterator jt = it.value().begin(); jt != it.value().end(); ++jt )
|
||||
{
|
||||
if( *jt == _port )
|
||||
if( *jt == port )
|
||||
{
|
||||
out_devs += it.key();
|
||||
outDevs += it.key();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for( QMap<HMIDIOUT, QString>::Iterator it = m_outputDevices.begin();
|
||||
it != m_outputDevices.end(); ++it )
|
||||
for( QMap<HMIDIOUT, QString>::Iterator it = m_outputDevices.begin(); it != m_outputDevices.end(); ++it )
|
||||
{
|
||||
if( out_devs.contains( *it ) )
|
||||
if( outDevs.contains( *it ) )
|
||||
{
|
||||
midiOutShortMsg( it.key(), shortMsg );
|
||||
}
|
||||
@@ -93,25 +88,23 @@ void MidiWinMM::processOutEvent( const midiEvent & _me,
|
||||
|
||||
|
||||
|
||||
void MidiWinMM::applyPortMode( MidiPort * _port )
|
||||
void MidiWinMM::applyPortMode( MidiPort* port )
|
||||
{
|
||||
// make sure no subscriptions exist which are not possible with
|
||||
// current port-mode
|
||||
if( !_port->inputEnabled() )
|
||||
if( !port->isInputEnabled() )
|
||||
{
|
||||
for( SubMap::Iterator it = m_inputSubs.begin();
|
||||
it != m_inputSubs.end(); ++it )
|
||||
for( SubMap::Iterator it = m_inputSubs.begin(); it != m_inputSubs.end(); ++it )
|
||||
{
|
||||
it.value().removeAll( _port );
|
||||
it.value().removeAll( port );
|
||||
}
|
||||
}
|
||||
|
||||
if( !_port->outputEnabled() )
|
||||
if( !port->isOutputEnabled() )
|
||||
{
|
||||
for( SubMap::Iterator it = m_outputSubs.begin();
|
||||
it != m_outputSubs.end(); ++it )
|
||||
for( SubMap::Iterator it = m_outputSubs.begin(); it != m_outputSubs.end(); ++it )
|
||||
{
|
||||
it.value().removeAll( _port );
|
||||
it.value().removeAll( port );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,105 +112,97 @@ void MidiWinMM::applyPortMode( MidiPort * _port )
|
||||
|
||||
|
||||
|
||||
void MidiWinMM::removePort( MidiPort * _port )
|
||||
void MidiWinMM::removePort( MidiPort* port )
|
||||
{
|
||||
for( SubMap::Iterator it = m_inputSubs.begin();
|
||||
it != m_inputSubs.end(); ++it )
|
||||
for( SubMap::Iterator it = m_inputSubs.begin(); it != m_inputSubs.end(); ++it )
|
||||
{
|
||||
it.value().removeAll( _port );
|
||||
it.value().removeAll( port );
|
||||
}
|
||||
for( SubMap::Iterator it = m_outputSubs.begin();
|
||||
it != m_outputSubs.end(); ++it )
|
||||
|
||||
for( SubMap::Iterator it = m_outputSubs.begin(); it != m_outputSubs.end(); ++it )
|
||||
{
|
||||
it.value().removeAll( _port );
|
||||
it.value().removeAll( port );
|
||||
}
|
||||
MidiClient::removePort( _port );
|
||||
|
||||
MidiClient::removePort( port );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QString MidiWinMM::sourcePortName( const midiEvent & _event ) const
|
||||
QString MidiWinMM::sourcePortName( const MidiEvent& event ) const
|
||||
{
|
||||
if( _event.sourcePort() )
|
||||
if( event.sourcePort() )
|
||||
{
|
||||
return m_inputDevices.value( *static_cast<const HMIDIIN *>(
|
||||
_event.sourcePort() ) );
|
||||
return m_inputDevices.value( *static_cast<const HMIDIIN *>( event.sourcePort() ) );
|
||||
}
|
||||
return MidiClient::sourcePortName( _event );
|
||||
|
||||
return MidiClient::sourcePortName( event );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MidiWinMM::subscribeReadablePort( MidiPort * _port,
|
||||
const QString & _dest,
|
||||
bool _subscribe )
|
||||
void MidiWinMM::subscribeReadablePort( MidiPort* port, const QString& dest, bool subscribe )
|
||||
{
|
||||
if( _subscribe && _port->inputEnabled() == false )
|
||||
if( subscribe && port->isInputEnabled() == false )
|
||||
{
|
||||
qWarning( "port %s can't be (un)subscribed!\n",
|
||||
_port->displayName().toAscii().constData() );
|
||||
qWarning( "port %s can't be (un)subscribed!\n", port->displayName().toAscii().constData() );
|
||||
return;
|
||||
}
|
||||
|
||||
m_inputSubs[_dest].removeAll( _port );
|
||||
if( _subscribe )
|
||||
m_inputSubs[dest].removeAll( port );
|
||||
if( subscribe )
|
||||
{
|
||||
m_inputSubs[_dest].push_back( _port );
|
||||
m_inputSubs[dest].push_back( port );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MidiWinMM::subscribeWritablePort( MidiPort * _port,
|
||||
const QString & _dest,
|
||||
bool _subscribe )
|
||||
void MidiWinMM::subscribeWritablePort( MidiPort* port, const QString& dest, bool subscribe )
|
||||
{
|
||||
if( _subscribe && _port->outputEnabled() == false )
|
||||
if( subscribe && port->isOutputEnabled() == false )
|
||||
{
|
||||
qWarning( "port %s can't be (un)subscribed!\n",
|
||||
_port->displayName().toAscii().constData() );
|
||||
qWarning( "port %s can't be (un)subscribed!\n", port->displayName().toAscii().constData() );
|
||||
return;
|
||||
}
|
||||
|
||||
m_outputSubs[_dest].removeAll( _port );
|
||||
if( _subscribe )
|
||||
m_outputSubs[dest].removeAll( port );
|
||||
if( subscribe )
|
||||
{
|
||||
m_outputSubs[_dest].push_back( _port );
|
||||
m_outputSubs[dest].push_back( port );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void WINAPI CALLBACK MidiWinMM::inputCallback( HMIDIIN _hm, UINT _msg, DWORD_PTR _inst,
|
||||
DWORD_PTR _param1, DWORD_PTR _param2 )
|
||||
void WINAPI CALLBACK MidiWinMM::inputCallback( HMIDIIN hm, UINT msg, DWORD_PTR inst, DWORD_PTR param1, DWORD_PTR param2 )
|
||||
{
|
||||
if( _msg == MIM_DATA )
|
||||
if( msg == MIM_DATA )
|
||||
{
|
||||
( (MidiWinMM *) _inst )->handleInputEvent( _hm, _param1 );
|
||||
( (MidiWinMM *) inst )->handleInputEvent( hm, param1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MidiWinMM::handleInputEvent( HMIDIIN _hm, DWORD _ev )
|
||||
void MidiWinMM::handleInputEvent( HMIDIIN hm, DWORD ev )
|
||||
{
|
||||
const int cmd = _ev & 0xff;
|
||||
const int cmd = ev & 0xff;
|
||||
if( cmd == MidiActiveSensing )
|
||||
{
|
||||
return;
|
||||
}
|
||||
const int par1 = ( _ev >> 8 ) & 0xff;
|
||||
const int par2 = _ev >> 16;
|
||||
const MidiEventTypes cmdtype =
|
||||
static_cast<MidiEventTypes>( cmd & 0xf0 );
|
||||
const int par1 = ( ev >> 8 ) & 0xff;
|
||||
const int par2 = ev >> 16;
|
||||
const MidiEventTypes cmdtype = static_cast<MidiEventTypes>( cmd & 0xf0 );
|
||||
const int chan = cmd & 0x0f;
|
||||
|
||||
const QString d = m_inputDevices.value( _hm );
|
||||
const QString d = m_inputDevices.value( hm );
|
||||
if( d.isEmpty() || !m_inputSubs.contains( d ) )
|
||||
{
|
||||
return;
|
||||
@@ -231,28 +216,21 @@ void MidiWinMM::handleInputEvent( HMIDIIN _hm, DWORD _ev )
|
||||
case MidiNoteOn:
|
||||
case MidiNoteOff:
|
||||
case MidiKeyPressure:
|
||||
( *it )->processInEvent(
|
||||
midiEvent( cmdtype, chan, par1 - KeysPerOctave,
|
||||
par2 & 0xff, &_hm ), midiTime() );
|
||||
( *it )->processInEvent( MidiEvent( cmdtype, chan, par1 - KeysPerOctave, par2 & 0xff, &hm ) );
|
||||
break;
|
||||
|
||||
case MidiControlChange:
|
||||
case MidiProgramChange:
|
||||
case MidiChannelPressure:
|
||||
( *it )->processInEvent(
|
||||
midiEvent( cmdtype, chan, par1, par2 & 0xff, &_hm ),
|
||||
midiTime() );
|
||||
( *it )->processInEvent( MidiEvent( cmdtype, chan, par1, par2 & 0xff, &hm ) );
|
||||
break;
|
||||
|
||||
case MidiPitchBend:
|
||||
( *it )->processInEvent(
|
||||
midiEvent( cmdtype, chan, par1 + par2*128, 0, &_hm ),
|
||||
midiTime() );
|
||||
( *it )->processInEvent( MidiEvent( cmdtype, chan, par1 + par2*128, 0, &hm ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
qWarning( "WinMM-MIDI: unhandled input "
|
||||
"event %d\n", cmdtype );
|
||||
qWarning( "MidiWinMM: unhandled input event %d\n", cmdtype );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -265,17 +243,9 @@ void MidiWinMM::updateDeviceList()
|
||||
{
|
||||
closeDevices();
|
||||
openDevices();
|
||||
// if( m_readablePorts != readable_ports )
|
||||
{
|
||||
// m_readablePorts = readable_ports;
|
||||
emit readablePortsChanged();
|
||||
}
|
||||
|
||||
// if( m_writablePorts != writable_ports )
|
||||
{
|
||||
// m_writablePorts = writable_ports;
|
||||
emit writablePortsChanged();
|
||||
}
|
||||
emit readablePortsChanged();
|
||||
emit writablePortsChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -339,8 +309,8 @@ void MidiWinMM::openDevices()
|
||||
|
||||
|
||||
|
||||
MidiWinMM::setupWidget::setupWidget( QWidget * _parent ) :
|
||||
MidiClient::setupWidget( MidiWinMM::name(), _parent )
|
||||
MidiWinMM::setupWidget::setupWidget( QWidget* parent ) :
|
||||
MidiClient::setupWidget( MidiWinMM::name(), parent )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
|
||||
|
||||
note::note( const midiTime & _length, const midiTime & _pos,
|
||||
note::note( const MidiTime & _length, const MidiTime & _pos,
|
||||
int _key, volume_t _volume, panning_t _panning,
|
||||
DetuningHelper * _detuning ) :
|
||||
m_selected( false ),
|
||||
@@ -96,7 +96,7 @@ note::~note()
|
||||
|
||||
|
||||
|
||||
void note::setLength( const midiTime & _length )
|
||||
void note::setLength( const MidiTime & _length )
|
||||
{
|
||||
// addJournalEntry( journalEntry( ChangeLength, m_length - _length ) );
|
||||
m_length = _length;
|
||||
@@ -105,7 +105,7 @@ void note::setLength( const midiTime & _length )
|
||||
|
||||
|
||||
|
||||
void note::setPos( const midiTime & _pos )
|
||||
void note::setPos( const MidiTime & _pos )
|
||||
{
|
||||
// addJournalEntry( journalEntry( ChangePosition, m_pos - _pos ) );
|
||||
m_pos = _pos;
|
||||
@@ -144,7 +144,7 @@ void note::setPanning( const panning_t _panning )
|
||||
|
||||
|
||||
|
||||
midiTime note::quantized( const midiTime & _m, const int _q_grid )
|
||||
MidiTime note::quantized( const MidiTime & _m, const int _q_grid )
|
||||
{
|
||||
float p = ( (float) _m / _q_grid );
|
||||
if( p - floorf( p ) < 0.5f )
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* note_play_handle.cpp - implementation of class notePlayHandle, part of
|
||||
* rendering engine
|
||||
*
|
||||
* Copyright (c) 2004-2012 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "DetuningHelper.h"
|
||||
#include "InstrumentSoundShaping.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "MidiEvent.h"
|
||||
#include "MidiPort.h"
|
||||
#include "song.h"
|
||||
|
||||
@@ -48,7 +49,9 @@ notePlayHandle::notePlayHandle( InstrumentTrack * _it,
|
||||
const f_cnt_t _frames,
|
||||
const note & _n,
|
||||
notePlayHandle *parent,
|
||||
const bool _part_of_arp ) :
|
||||
const bool _part_of_arp,
|
||||
int midiEventChannel,
|
||||
Origin origin ) :
|
||||
playHandle( NotePlayHandle, _offset ),
|
||||
note( _n.length(), _n.pos(), _n.key(),
|
||||
_n.getVolume(), _n.getPanning(), _n.detuning() ),
|
||||
@@ -73,7 +76,9 @@ notePlayHandle::notePlayHandle( InstrumentTrack * _it,
|
||||
m_frequency( 0 ),
|
||||
m_unpitchedFrequency( 0 ),
|
||||
m_baseDetuning( NULL ),
|
||||
m_songGlobalParentOffset( 0 )
|
||||
m_songGlobalParentOffset( 0 ),
|
||||
m_midiChannel( midiEventChannel >= 0 ? midiEventChannel : instrumentTrack()->midiPort()->realOutputChannel() ),
|
||||
m_origin( origin )
|
||||
{
|
||||
if( isTopNote() )
|
||||
{
|
||||
@@ -100,15 +105,18 @@ notePlayHandle::notePlayHandle( InstrumentTrack * _it,
|
||||
|
||||
setFrames( _frames );
|
||||
|
||||
|
||||
if( !isTopNote() || !instrumentTrack()->isArpeggiatorEnabled() )
|
||||
// inform attached components about new MIDI note (used for recording in Piano Roll)
|
||||
if( m_origin == OriginMidiInput )
|
||||
{
|
||||
// send MIDI-note-on-event
|
||||
m_instrumentTrack->processOutEvent( midiEvent( MidiNoteOn,
|
||||
m_instrumentTrack->midiPort()->realOutputChannel(),
|
||||
midiKey(), midiVelocity() ),
|
||||
midiTime::fromFrames( offset(),
|
||||
engine::framesPerTick() ) );
|
||||
m_instrumentTrack->midiNoteOn( *this );
|
||||
}
|
||||
|
||||
if( !isTopNote() || !instrumentTrack()->isArpeggioEnabled() )
|
||||
{
|
||||
// send MidiNoteOn event
|
||||
m_instrumentTrack->processOutEvent(
|
||||
MidiEvent( MidiNoteOn, midiChannel(), midiKey(), midiVelocity() ),
|
||||
MidiTime::fromFrames( offset(), engine::framesPerTick() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,6 +127,13 @@ notePlayHandle::~notePlayHandle()
|
||||
{
|
||||
noteOff( 0 );
|
||||
|
||||
// inform attached components about MIDI finished (used for recording in Piano Roll)
|
||||
if( m_origin == OriginMidiInput )
|
||||
{
|
||||
setLength( MidiTime( static_cast<f_cnt_t>( totalFramesPlayed() / engine::framesPerTick() ) ) );
|
||||
m_instrumentTrack->midiNoteOff( *this );
|
||||
}
|
||||
|
||||
if( isTopNote() )
|
||||
{
|
||||
delete m_baseDetuning;
|
||||
@@ -151,10 +166,21 @@ notePlayHandle::~notePlayHandle()
|
||||
void notePlayHandle::setVolume( const volume_t _volume )
|
||||
{
|
||||
note::setVolume( _volume );
|
||||
m_instrumentTrack->processOutEvent( midiEvent( MidiKeyPressure,
|
||||
m_instrumentTrack->midiPort()->realOutputChannel(),
|
||||
midiKey(), midiVelocity() ), 0 );
|
||||
|
||||
|
||||
m_instrumentTrack->processOutEvent( MidiEvent( MidiKeyPressure, midiChannel(), midiKey(), midiVelocity() ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void notePlayHandle::setPanning( const panning_t panning )
|
||||
{
|
||||
note::setPanning( panning );
|
||||
|
||||
MidiEvent event( MidiMetaEvent, midiChannel(), midiKey(), panningToMidi( panning ) );
|
||||
event.setMetaEvent( MidiNotePanning );
|
||||
|
||||
m_instrumentTrack->processOutEvent( event );
|
||||
}
|
||||
|
||||
|
||||
@@ -279,9 +305,10 @@ void notePlayHandle::play( sampleFrame * _working_buffer )
|
||||
// can set m_releaseFramesDone to m_releaseFramesToDo so that
|
||||
// notePlayHandle::done() returns true and also this base-note is
|
||||
// removed from mixer's active note vector
|
||||
if( isArpeggioBaseNote() && m_subNotes.size() == 0 )
|
||||
if( m_released && isArpeggioBaseNote() && m_subNotes.size() == 0 )
|
||||
{
|
||||
m_releaseFramesDone = m_releaseFramesToDo;
|
||||
m_frames = 0;
|
||||
}
|
||||
|
||||
// update internal data
|
||||
@@ -339,14 +366,12 @@ void notePlayHandle::noteOff( const f_cnt_t _s )
|
||||
m_releaseFramesToDo = qMax<f_cnt_t>( 0, // 10,
|
||||
m_instrumentTrack->m_soundShaping.releaseFrames() );
|
||||
|
||||
if( !isTopNote() || !instrumentTrack()->isArpeggiatorEnabled() )
|
||||
if( !isTopNote() || !instrumentTrack()->isArpeggioEnabled() )
|
||||
{
|
||||
// send MIDI-note-off-event
|
||||
m_instrumentTrack->processOutEvent( midiEvent( MidiNoteOff,
|
||||
m_instrumentTrack->midiPort()->realOutputChannel(),
|
||||
midiKey(), 0 ),
|
||||
midiTime::fromFrames( m_framesBeforeRelease,
|
||||
engine::framesPerTick() ) );
|
||||
// send MidiNoteOff event
|
||||
m_instrumentTrack->processOutEvent(
|
||||
MidiEvent( MidiNoteOff, midiChannel(), midiKey(), 0 ),
|
||||
MidiTime::fromFrames( m_framesBeforeRelease, engine::framesPerTick() ) );
|
||||
}
|
||||
|
||||
m_released = true;
|
||||
@@ -387,8 +412,7 @@ float notePlayHandle::volumeLevel( const f_cnt_t _frame )
|
||||
|
||||
bool notePlayHandle::isArpeggioBaseNote() const
|
||||
{
|
||||
return isTopNote() && ( m_partOfArpeggio ||
|
||||
m_instrumentTrack->isArpeggiatorEnabled() );
|
||||
return isTopNote() && ( m_partOfArpeggio || m_instrumentTrack->isArpeggioEnabled() );
|
||||
}
|
||||
|
||||
|
||||
@@ -502,7 +526,7 @@ void notePlayHandle::updateFrequency()
|
||||
|
||||
|
||||
|
||||
void notePlayHandle::processMidiTime( const midiTime& time )
|
||||
void notePlayHandle::processMidiTime( const MidiTime& time )
|
||||
{
|
||||
if( detuning() && time >= songGlobalParentOffset()+pos() )
|
||||
{
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QMessageBox>
|
||||
|
||||
#include <math.h>
|
||||
@@ -47,6 +46,7 @@
|
||||
#include "ImportFilter.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "MainWindow.h"
|
||||
#include "FileDialog.h"
|
||||
#include "MidiClient.h"
|
||||
#include "mmp.h"
|
||||
#include "note_play_handle.h"
|
||||
@@ -76,7 +76,7 @@
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
|
||||
tick_t midiTime::s_ticksPerTact = DefaultTicksPerTact;
|
||||
tick_t MidiTime::s_ticksPerTact = DefaultTicksPerTact;
|
||||
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ song::~song()
|
||||
}
|
||||
if( m_SncVSTplug != NULL )
|
||||
{
|
||||
delete m_SncVSTplug;
|
||||
free( m_SncVSTplug );
|
||||
m_SncVSTplug = NULL;
|
||||
}
|
||||
}
|
||||
@@ -256,7 +256,7 @@ void song::setTempo()
|
||||
|
||||
void song::setTimeSignature()
|
||||
{
|
||||
midiTime::setTicksPerTact( ticksPerTact() );
|
||||
MidiTime::setTicksPerTact( ticksPerTact() );
|
||||
emit timeSignatureChanged( m_oldTicksPerTact, ticksPerTact() );
|
||||
emit dataChanged();
|
||||
m_oldTicksPerTact = ticksPerTact();
|
||||
@@ -494,7 +494,7 @@ void song::processNextBuffer()
|
||||
#endif
|
||||
|
||||
// did we play a whole tact?
|
||||
if( ticks >= midiTime::ticksPerTact() )
|
||||
if( ticks >= MidiTime::ticksPerTact() )
|
||||
{
|
||||
// per default we just continue playing even if
|
||||
// there's no more stuff to play
|
||||
@@ -525,7 +525,7 @@ void song::processNextBuffer()
|
||||
// then start from beginning and keep
|
||||
// offset
|
||||
ticks = ticks % ( max_tact *
|
||||
midiTime::ticksPerTact() );
|
||||
MidiTime::ticksPerTact() );
|
||||
#ifdef VST_SNC_LATENCY
|
||||
m_SncVSTplug->ppqPos = ( ( ticks + 0 )
|
||||
/ (float)48 )
|
||||
@@ -1310,7 +1310,7 @@ bool song::guiSaveProjectAs( const QString & _file_name )
|
||||
|
||||
void song::importProject()
|
||||
{
|
||||
QFileDialog ofd( NULL, tr( "Import file" ),
|
||||
FileDialog ofd( NULL, tr( "Import file" ),
|
||||
configManager::inst()->userProjectsDir(),
|
||||
tr("MIDI sequences") +
|
||||
" (*.mid *.midi *.rmi);;" +
|
||||
@@ -1320,11 +1320,8 @@ void song::importProject()
|
||||
" (*.h2song);;" +
|
||||
tr("All file types") +
|
||||
" (*.*)");
|
||||
#if QT_VERSION >= 0x040806
|
||||
ofd.setOption( QFileDialog::DontUseCustomDirectoryIcons );
|
||||
#endif
|
||||
|
||||
ofd.setFileMode( QFileDialog::ExistingFiles );
|
||||
ofd.setFileMode( FileDialog::ExistingFiles );
|
||||
if( ofd.exec () == QDialog::Accepted && !ofd.selectedFiles().isEmpty() )
|
||||
{
|
||||
ImportFilter::import( ofd.selectedFiles()[0], this );
|
||||
@@ -1377,13 +1374,10 @@ void song::exportProject(bool multiExport)
|
||||
return;
|
||||
}
|
||||
|
||||
QFileDialog efd( engine::mainWindow() );
|
||||
#if QT_VERSION >= 0x040806
|
||||
efd.setOption( QFileDialog::DontUseCustomDirectoryIcons );
|
||||
#endif
|
||||
FileDialog efd( engine::mainWindow() );
|
||||
if (multiExport)
|
||||
{
|
||||
efd.setFileMode( QFileDialog::Directory);
|
||||
efd.setFileMode( FileDialog::Directory);
|
||||
efd.setWindowTitle( tr( "Select directory for writing exported tracks..." ) );
|
||||
if( !m_fileName.isEmpty() )
|
||||
{
|
||||
@@ -1392,7 +1386,7 @@ void song::exportProject(bool multiExport)
|
||||
}
|
||||
else
|
||||
{
|
||||
efd.setFileMode( QFileDialog::AnyFile );
|
||||
efd.setFileMode( FileDialog::AnyFile );
|
||||
int idx = 0;
|
||||
QStringList types;
|
||||
while( __fileEncodeDevices[idx].m_fileFormat !=
|
||||
@@ -1417,7 +1411,7 @@ void song::exportProject(bool multiExport)
|
||||
efd.setWindowTitle( tr( "Select file for project-export..." ) );
|
||||
}
|
||||
|
||||
efd.setAcceptMode( QFileDialog::AcceptSave );
|
||||
efd.setAcceptMode( FileDialog::AcceptSave );
|
||||
|
||||
|
||||
if( efd.exec() == QDialog::Accepted &&
|
||||
|
||||
@@ -47,7 +47,7 @@ QPixmap * timeLine::s_loopPointPixmap = NULL;
|
||||
|
||||
|
||||
timeLine::timeLine( const int _xoff, const int _yoff, const float _ppt,
|
||||
song::playPos & _pos, const midiTime & _begin,
|
||||
song::playPos & _pos, const MidiTime & _begin,
|
||||
QWidget * _parent ) :
|
||||
QWidget( _parent ),
|
||||
m_autoScroll( AutoScrollEnabled ),
|
||||
@@ -175,7 +175,7 @@ void timeLine::loadSettings( const QDomElement & _this )
|
||||
|
||||
|
||||
|
||||
void timeLine::updatePosition( const midiTime & )
|
||||
void timeLine::updatePosition( const MidiTime & )
|
||||
{
|
||||
const int new_x = markerX( m_pos );
|
||||
|
||||
@@ -238,7 +238,7 @@ void timeLine::paintEvent( QPaintEvent * )
|
||||
|
||||
tact_t tact_num = m_begin.getTact();
|
||||
int x = m_xOffset + s_posMarkerPixmap->width() / 2 -
|
||||
( ( static_cast<int>( m_begin * m_ppt ) / midiTime::ticksPerTact() ) % static_cast<int>( m_ppt ) );
|
||||
( ( static_cast<int>( m_begin * m_ppt ) / MidiTime::ticksPerTact() ) % static_cast<int>( m_ppt ) );
|
||||
|
||||
p.setPen( QColor( 192, 192, 192 ) );
|
||||
for( int i = 0; x + i * m_ppt < width(); ++i )
|
||||
@@ -248,7 +248,7 @@ void timeLine::paintEvent( QPaintEvent * )
|
||||
++tact_num;
|
||||
if( ( tact_num - 1 ) %
|
||||
qMax( 1, qRound( 1.0f / 3.0f *
|
||||
midiTime::ticksPerTact() / m_ppt ) ) == 0 )
|
||||
MidiTime::ticksPerTact() / m_ppt ) ) == 0 )
|
||||
{
|
||||
const QString s = QString::number( tact_num );
|
||||
p.drawText( cx + qRound( ( m_ppt - p.fontMetrics().
|
||||
@@ -285,7 +285,7 @@ void timeLine::mousePressEvent( QMouseEvent* event )
|
||||
}
|
||||
else if( event->button() == Qt::RightButton )
|
||||
{
|
||||
const midiTime t = m_begin + static_cast<int>( event->x() * midiTime::ticksPerTact() / m_ppt );
|
||||
const MidiTime t = m_begin + static_cast<int>( event->x() * MidiTime::ticksPerTact() / m_ppt );
|
||||
if( m_loopPos[0] > m_loopPos[1] )
|
||||
{
|
||||
qSwap( m_loopPos[0], m_loopPos[1] );
|
||||
@@ -301,13 +301,20 @@ void timeLine::mousePressEvent( QMouseEvent* event )
|
||||
m_loopPos[( m_action == MoveLoopBegin ) ? 0 : 1] = t;
|
||||
}
|
||||
|
||||
if( m_action == MoveLoopBegin || m_action == MoveLoopEnd )
|
||||
if( m_action == MoveLoopBegin )
|
||||
{
|
||||
delete m_hint;
|
||||
m_hint = textFloat::displayMessage( tr( "Hint" ),
|
||||
tr( "Press <Ctrl> to disable magnetic loop points." ),
|
||||
embed::getIconPixmap( "hint" ), 0 );
|
||||
}
|
||||
else if( m_action == MoveLoopEnd )
|
||||
{
|
||||
delete m_hint;
|
||||
m_hint = textFloat::displayMessage( tr( "Hint" ),
|
||||
tr( "Hold <Shift> to move the begin loop point; Press <Ctrl> to disable magnetic loop points." ),
|
||||
embed::getIconPixmap( "hint" ), 0 );
|
||||
}
|
||||
|
||||
mouseMoveEvent( event );
|
||||
}
|
||||
@@ -317,7 +324,7 @@ void timeLine::mousePressEvent( QMouseEvent* event )
|
||||
|
||||
void timeLine::mouseMoveEvent( QMouseEvent* event )
|
||||
{
|
||||
const midiTime t = m_begin + static_cast<int>( qMax( event->x() - m_xOffset - m_moveXOff, 0 ) * midiTime::ticksPerTact() / m_ppt );
|
||||
const MidiTime t = m_begin + static_cast<int>( qMax( event->x() - m_xOffset - m_moveXOff, 0 ) * MidiTime::ticksPerTact() / m_ppt );
|
||||
|
||||
switch( m_action )
|
||||
{
|
||||
@@ -349,9 +356,9 @@ void timeLine::mouseMoveEvent( QMouseEvent* event )
|
||||
// Note, swap 1 and 0 below and the behavior "skips" the other
|
||||
// marking instead of pushing it.
|
||||
if( m_action == MoveLoopBegin )
|
||||
m_loopPos[0] -= midiTime::ticksPerTact();
|
||||
m_loopPos[0] -= MidiTime::ticksPerTact();
|
||||
else
|
||||
m_loopPos[1] += midiTime::ticksPerTact();
|
||||
m_loopPos[1] += MidiTime::ticksPerTact();
|
||||
}
|
||||
update();
|
||||
break;
|
||||
|
||||
@@ -145,7 +145,7 @@ trackContentObject::~trackContentObject()
|
||||
*
|
||||
* \param _pos The new position of the track content object.
|
||||
*/
|
||||
void trackContentObject::movePosition( const midiTime & _pos )
|
||||
void trackContentObject::movePosition( const MidiTime & _pos )
|
||||
{
|
||||
if( m_startPosition != _pos )
|
||||
{
|
||||
@@ -166,7 +166,7 @@ void trackContentObject::movePosition( const midiTime & _pos )
|
||||
*
|
||||
* \param _length The new length of the track content object.
|
||||
*/
|
||||
void trackContentObject::changeLength( const midiTime & _length )
|
||||
void trackContentObject::changeLength( const MidiTime & _length )
|
||||
{
|
||||
if( m_length != _length )
|
||||
{
|
||||
@@ -243,7 +243,7 @@ void trackContentObject::paste()
|
||||
{
|
||||
if( Clipboard::getContent( nodeName() ) != NULL )
|
||||
{
|
||||
const midiTime pos = startPosition();
|
||||
const MidiTime pos = startPosition();
|
||||
restoreState( *( Clipboard::getContent( nodeName() ) ) );
|
||||
movePosition( pos );
|
||||
}
|
||||
@@ -422,7 +422,7 @@ void trackContentObjectView::updateLength()
|
||||
{
|
||||
setFixedWidth(
|
||||
static_cast<int>( m_tco->length() * pixelsPerTact() /
|
||||
midiTime::ticksPerTact() ) +
|
||||
MidiTime::ticksPerTact() ) +
|
||||
TCO_BORDER_WIDTH * 2-1 );
|
||||
}
|
||||
m_trackView->trackContainerView()->update();
|
||||
@@ -485,7 +485,7 @@ void trackContentObjectView::dropEvent( QDropEvent * _de )
|
||||
multimediaProject mmp( value.toUtf8() );
|
||||
// at least save position before getting to moved to somewhere
|
||||
// the user doesn't expect...
|
||||
midiTime pos = m_tco->startPosition();
|
||||
MidiTime pos = m_tco->startPosition();
|
||||
m_tco->restoreState( mmp.content().firstChild().toElement() );
|
||||
m_tco->movePosition( pos );
|
||||
AutomationPattern::resolveAllIDs();
|
||||
@@ -654,9 +654,9 @@ void trackContentObjectView::mouseMoveEvent( QMouseEvent * _me )
|
||||
if( m_action == Move )
|
||||
{
|
||||
const int x = mapToParent( _me->pos() ).x() - m_initialMouseX;
|
||||
midiTime t = qMax( 0, (int)
|
||||
MidiTime t = qMax( 0, (int)
|
||||
m_trackView->trackContainerView()->currentPosition()+
|
||||
static_cast<int>( x * midiTime::ticksPerTact() /
|
||||
static_cast<int>( x * MidiTime::ticksPerTact() /
|
||||
ppt ) );
|
||||
if( ! ( _me->modifiers() & Qt::ControlModifier )
|
||||
&& _me->button() == Qt::NoButton )
|
||||
@@ -668,7 +668,7 @@ void trackContentObjectView::mouseMoveEvent( QMouseEvent * _me )
|
||||
s_textFloat->setText( QString( "%1:%2" ).
|
||||
arg( m_tco->startPosition().getTact() + 1 ).
|
||||
arg( m_tco->startPosition().getTicks() %
|
||||
midiTime::ticksPerTact() ) );
|
||||
MidiTime::ticksPerTact() ) );
|
||||
s_textFloat->moveGlobal( this, QPoint( width() + 2,
|
||||
height() + 2 ) );
|
||||
}
|
||||
@@ -678,7 +678,7 @@ void trackContentObjectView::mouseMoveEvent( QMouseEvent * _me )
|
||||
QVector<selectableObject *> so =
|
||||
m_trackView->trackContainerView()->selectedObjects();
|
||||
QVector<trackContentObject *> tcos;
|
||||
midiTime smallest_pos, t;
|
||||
MidiTime smallest_pos, t;
|
||||
// find out smallest position of all selected objects for not
|
||||
// moving an object before zero
|
||||
for( QVector<selectableObject *>::iterator it = so.begin();
|
||||
@@ -695,13 +695,13 @@ void trackContentObjectView::mouseMoveEvent( QMouseEvent * _me )
|
||||
smallest_pos = qMin<int>( smallest_pos,
|
||||
(int)tco->startPosition() +
|
||||
static_cast<int>( dx *
|
||||
midiTime::ticksPerTact() / ppt ) );
|
||||
MidiTime::ticksPerTact() / ppt ) );
|
||||
}
|
||||
for( QVector<trackContentObject *>::iterator it = tcos.begin();
|
||||
it != tcos.end(); ++it )
|
||||
{
|
||||
t = ( *it )->startPosition() +
|
||||
static_cast<int>( dx *midiTime::ticksPerTact() /
|
||||
static_cast<int>( dx *MidiTime::ticksPerTact() /
|
||||
ppt )-smallest_pos;
|
||||
if( ! ( _me->modifiers() & Qt::AltModifier )
|
||||
&& _me->button() == Qt::NoButton )
|
||||
@@ -713,22 +713,22 @@ void trackContentObjectView::mouseMoveEvent( QMouseEvent * _me )
|
||||
}
|
||||
else if( m_action == Resize )
|
||||
{
|
||||
midiTime t = qMax( midiTime::ticksPerTact() / 16, static_cast<int>( _me->x() * midiTime::ticksPerTact() / ppt ) );
|
||||
MidiTime t = qMax( MidiTime::ticksPerTact() / 16, static_cast<int>( _me->x() * MidiTime::ticksPerTact() / ppt ) );
|
||||
if( ! ( _me->modifiers() & Qt::ControlModifier ) && _me->button() == Qt::NoButton )
|
||||
{
|
||||
t = qMax<int>( midiTime::ticksPerTact(), t.toNearestTact() );
|
||||
t = qMax<int>( MidiTime::ticksPerTact(), t.toNearestTact() );
|
||||
}
|
||||
m_tco->changeLength( t );
|
||||
s_textFloat->setText( tr( "%1:%2 (%3:%4 to %5:%6)" ).
|
||||
arg( m_tco->length().getTact() ).
|
||||
arg( m_tco->length().getTicks() %
|
||||
midiTime::ticksPerTact() ).
|
||||
MidiTime::ticksPerTact() ).
|
||||
arg( m_tco->startPosition().getTact() + 1 ).
|
||||
arg( m_tco->startPosition().getTicks() %
|
||||
midiTime::ticksPerTact() ).
|
||||
MidiTime::ticksPerTact() ).
|
||||
arg( m_tco->endPosition().getTact() + 1 ).
|
||||
arg( m_tco->endPosition().getTicks() %
|
||||
midiTime::ticksPerTact() ) );
|
||||
MidiTime::ticksPerTact() ) );
|
||||
s_textFloat->moveGlobal( this, QPoint( width() + 2,
|
||||
height() + 2) );
|
||||
}
|
||||
@@ -864,8 +864,8 @@ trackContentWidget::trackContentWidget( trackView * _parent ) :
|
||||
setAcceptDrops( true );
|
||||
|
||||
connect( _parent->trackContainerView(),
|
||||
SIGNAL( positionChanged( const midiTime & ) ),
|
||||
this, SLOT( changePosition( const midiTime & ) ) );
|
||||
SIGNAL( positionChanged( const MidiTime & ) ),
|
||||
this, SLOT( changePosition( const MidiTime & ) ) );
|
||||
|
||||
updateBackground();
|
||||
}
|
||||
@@ -1014,7 +1014,7 @@ void trackContentWidget::update()
|
||||
*
|
||||
* \param _new_pos The MIDI time to move to.
|
||||
*/
|
||||
void trackContentWidget::changePosition( const midiTime & _new_pos )
|
||||
void trackContentWidget::changePosition( const MidiTime & _new_pos )
|
||||
{
|
||||
if( m_trackView->trackContainerView() == engine::getBBEditor() )
|
||||
{
|
||||
@@ -1051,7 +1051,7 @@ void trackContentWidget::changePosition( const midiTime & _new_pos )
|
||||
return;
|
||||
}
|
||||
|
||||
midiTime pos = _new_pos;
|
||||
MidiTime pos = _new_pos;
|
||||
if( pos < 0 )
|
||||
{
|
||||
pos = m_trackView->trackContainerView()->currentPosition();
|
||||
@@ -1077,7 +1077,7 @@ void trackContentWidget::changePosition( const midiTime & _new_pos )
|
||||
( ts <= begin && te >= end ) )
|
||||
{
|
||||
tcov->move( static_cast<int>( ( ts - begin ) * ppt /
|
||||
midiTime::ticksPerTact() ),
|
||||
MidiTime::ticksPerTact() ),
|
||||
tcov->y() );
|
||||
if( !tcov->isVisible() )
|
||||
{
|
||||
@@ -1122,7 +1122,7 @@ void trackContentWidget::dropEvent( QDropEvent * _de )
|
||||
if( type == ( "tco_" + QString::number( getTrack()->type() ) ) &&
|
||||
m_trackView->trackContainerView()->fixedTCOs() == false )
|
||||
{
|
||||
const midiTime pos = getPosition( _de->pos().x()
|
||||
const MidiTime pos = getPosition( _de->pos().x()
|
||||
).toNearestTact();
|
||||
trackContentObject * tco = getTrack()->createTCO( pos );
|
||||
|
||||
@@ -1162,8 +1162,8 @@ void trackContentWidget::mousePressEvent( QMouseEvent * _me )
|
||||
else if( _me->button() == Qt::LeftButton &&
|
||||
!m_trackView->trackContainerView()->fixedTCOs() )
|
||||
{
|
||||
const midiTime pos = getPosition( _me->x() ).getTact() *
|
||||
midiTime::ticksPerTact();
|
||||
const MidiTime pos = getPosition( _me->x() ).getTact() *
|
||||
MidiTime::ticksPerTact();
|
||||
trackContentObject * tco = getTrack()->createTCO( pos );
|
||||
|
||||
tco->saveJournallingState( false );
|
||||
@@ -1237,7 +1237,7 @@ void trackContentWidget::undoStep( JournalEntry & _je )
|
||||
|
||||
case RemoveTrackContentObject:
|
||||
{
|
||||
trackContentObject * tco = getTrack()->createTCO( midiTime( 0 ) );
|
||||
trackContentObject * tco = getTrack()->createTCO( MidiTime( 0 ) );
|
||||
multimediaProject mmp(
|
||||
_je.data().toMap()["state"].
|
||||
toString().toUtf8() );
|
||||
@@ -1292,11 +1292,11 @@ track * trackContentWidget::getTrack()
|
||||
*
|
||||
* \param _mouse_x the mouse's current X position in pixels.
|
||||
*/
|
||||
midiTime trackContentWidget::getPosition( int _mouse_x )
|
||||
MidiTime trackContentWidget::getPosition( int _mouse_x )
|
||||
{
|
||||
return midiTime( m_trackView->trackContainerView()->
|
||||
return MidiTime( m_trackView->trackContainerView()->
|
||||
currentPosition() + _mouse_x *
|
||||
midiTime::ticksPerTact() /
|
||||
MidiTime::ticksPerTact() /
|
||||
static_cast<int>( m_trackView->
|
||||
trackContainerView()->pixelsPerTact() ) );
|
||||
}
|
||||
@@ -1307,11 +1307,11 @@ midiTime trackContentWidget::getPosition( int _mouse_x )
|
||||
*
|
||||
* \param _pos_start the starting position of the Widget (from getPosition())
|
||||
*/
|
||||
midiTime trackContentWidget::endPosition( const midiTime & _pos_start )
|
||||
MidiTime trackContentWidget::endPosition( const MidiTime & _pos_start )
|
||||
{
|
||||
const float ppt = m_trackView->trackContainerView()->pixelsPerTact();
|
||||
const int w = width();
|
||||
return _pos_start + static_cast<int>( w * midiTime::ticksPerTact() / ppt );
|
||||
return _pos_start + static_cast<int>( w * MidiTime::ticksPerTact() / ppt );
|
||||
}
|
||||
|
||||
|
||||
@@ -1762,7 +1762,7 @@ void track::loadSettings( const QDomElement & _this )
|
||||
!node.toElement().attribute( "metadata" ).toInt() )
|
||||
{
|
||||
trackContentObject * tco = createTCO(
|
||||
midiTime( 0 ) );
|
||||
MidiTime( 0 ) );
|
||||
tco->restoreState( node.toElement() );
|
||||
saveJournallingState( false );
|
||||
restoreJournallingState();
|
||||
@@ -1852,7 +1852,7 @@ trackContentObject * track::getTCO( int _tco_num )
|
||||
}
|
||||
printf( "called track::getTCO( %d ), "
|
||||
"but TCO %d doesn't exist\n", _tco_num, _tco_num );
|
||||
return createTCO( _tco_num * midiTime::ticksPerTact() );
|
||||
return createTCO( _tco_num * MidiTime::ticksPerTact() );
|
||||
|
||||
}
|
||||
|
||||
@@ -1898,8 +1898,8 @@ int track::getTCONum( trackContentObject * _tco )
|
||||
* \param _start The MIDI start time of the range.
|
||||
* \param _end The MIDI endi time of the range.
|
||||
*/
|
||||
void track::getTCOsInRange( tcoVector & _tco_v, const midiTime & _start,
|
||||
const midiTime & _end )
|
||||
void track::getTCOsInRange( tcoVector & _tco_v, const MidiTime & _start,
|
||||
const MidiTime & _end )
|
||||
{
|
||||
for( tcoVector::iterator it_o = m_trackContentObjects.begin();
|
||||
it_o != m_trackContentObjects.end(); ++it_o )
|
||||
@@ -1948,7 +1948,7 @@ void track::swapPositionOfTCOs( int _tco_num1, int _tco_num2 )
|
||||
qSwap( m_trackContentObjects[_tco_num1],
|
||||
m_trackContentObjects[_tco_num2] );
|
||||
|
||||
const midiTime pos = m_trackContentObjects[_tco_num1]->startPosition();
|
||||
const MidiTime pos = m_trackContentObjects[_tco_num1]->startPosition();
|
||||
|
||||
m_trackContentObjects[_tco_num1]->movePosition(
|
||||
m_trackContentObjects[_tco_num2]->startPosition() );
|
||||
@@ -1965,7 +1965,7 @@ void track::swapPositionOfTCOs( int _tco_num1, int _tco_num2 )
|
||||
* in ascending order by TCO time, once we hit a TCO that was earlier
|
||||
* than the insert time, we could fall out of the loop early.
|
||||
*/
|
||||
void track::insertTact( const midiTime & _pos )
|
||||
void track::insertTact( const MidiTime & _pos )
|
||||
{
|
||||
// we'll increase the position of every TCO, positioned behind _pos, by
|
||||
// one tact
|
||||
@@ -1975,7 +1975,7 @@ void track::insertTact( const midiTime & _pos )
|
||||
if( ( *it )->startPosition() >= _pos )
|
||||
{
|
||||
( *it )->movePosition( (*it)->startPosition() +
|
||||
midiTime::ticksPerTact() );
|
||||
MidiTime::ticksPerTact() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1987,7 +1987,7 @@ void track::insertTact( const midiTime & _pos )
|
||||
*
|
||||
* \param _pos The time at which we want to remove the bar.
|
||||
*/
|
||||
void track::removeTact( const midiTime & _pos )
|
||||
void track::removeTact( const MidiTime & _pos )
|
||||
{
|
||||
// we'll decrease the position of every TCO, positioned behind _pos, by
|
||||
// one tact
|
||||
@@ -1997,7 +1997,7 @@ void track::removeTact( const midiTime & _pos )
|
||||
if( ( *it )->startPosition() >= _pos )
|
||||
{
|
||||
( *it )->movePosition( qMax( ( *it )->startPosition() -
|
||||
midiTime::ticksPerTact(), 0 ) );
|
||||
MidiTime::ticksPerTact(), 0 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2025,7 +2025,7 @@ tact_t track::length() const
|
||||
}
|
||||
}
|
||||
|
||||
return last / midiTime::ticksPerTact();
|
||||
return last / MidiTime::ticksPerTact();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2008-2013 Paul Giblock <pgib/at/users.sourceforge.net>
|
||||
* Copyright (c) 2006-2008 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
|
||||
*
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -57,7 +57,6 @@
|
||||
#include "gui_templates.h"
|
||||
#include "timeline.h"
|
||||
#include "tooltip.h"
|
||||
#include "midi.h"
|
||||
#include "tool_button.h"
|
||||
#include "text_float.h"
|
||||
#include "combobox.h"
|
||||
@@ -131,10 +130,10 @@ AutomationEditor::AutomationEditor() :
|
||||
engine::getSong()->getPlayPos(
|
||||
song::Mode_PlayAutomationPattern ),
|
||||
m_currentPosition, this );
|
||||
connect( this, SIGNAL( positionChanged( const midiTime & ) ),
|
||||
m_timeLine, SLOT( updatePosition( const midiTime & ) ) );
|
||||
connect( m_timeLine, SIGNAL( positionChanged( const midiTime & ) ),
|
||||
this, SLOT( updatePosition( const midiTime & ) ) );
|
||||
connect( this, SIGNAL( positionChanged( const MidiTime & ) ),
|
||||
m_timeLine, SLOT( updatePosition( const MidiTime & ) ) );
|
||||
connect( m_timeLine, SIGNAL( positionChanged( const MidiTime & ) ),
|
||||
this, SLOT( updatePosition( const MidiTime & ) ) );
|
||||
|
||||
|
||||
m_toolBar = new QWidget( this );
|
||||
@@ -157,10 +156,14 @@ AutomationEditor::AutomationEditor() :
|
||||
tr( "Play/pause current pattern (Space)" ),
|
||||
this, SLOT( play() ), m_toolBar );
|
||||
|
||||
|
||||
m_stopButton = new toolButton( embed::getIconPixmap( "stop" ),
|
||||
tr( "Stop playing of current pattern (Space)" ),
|
||||
this, SLOT( stop() ), m_toolBar );
|
||||
|
||||
m_playButton->setObjectName( "playButton" );
|
||||
m_stopButton->setObjectName( "stopButton" );
|
||||
|
||||
m_playButton->setWhatsThis(
|
||||
tr( "Click here if you want to play the current pattern. "
|
||||
"This is useful while editing it. The pattern is "
|
||||
@@ -278,7 +281,7 @@ AutomationEditor::AutomationEditor() :
|
||||
|
||||
connect( &m_tensionModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( tensionChanged() ) );
|
||||
|
||||
|
||||
tool_button_group = new QButtonGroup( this );
|
||||
tool_button_group->addButton( m_discreteButton );
|
||||
tool_button_group->addButton( m_linearButton );
|
||||
@@ -525,7 +528,7 @@ void AutomationEditor::updateAfterPatternChange()
|
||||
}
|
||||
|
||||
if( m_pattern->progressionType() ==
|
||||
AutomationPattern::DiscreteProgression &&
|
||||
AutomationPattern::DiscreteProgression &&
|
||||
!m_discreteButton->isChecked() )
|
||||
{
|
||||
m_discreteButton->setChecked( true );
|
||||
@@ -764,20 +767,20 @@ void AutomationEditor::drawLine( int _x0, float _y0, int _x1, float _y1 )
|
||||
|
||||
float yscale = deltay / ( deltax );
|
||||
|
||||
if( _x0 < _x1)
|
||||
if( _x0 < _x1)
|
||||
{
|
||||
xstep = quantization();
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
xstep = -( quantization() );
|
||||
}
|
||||
|
||||
if( _y0 < _y1 )
|
||||
{
|
||||
ystep = 1;
|
||||
ystep = 1;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
ystep = -1;
|
||||
}
|
||||
@@ -789,8 +792,8 @@ void AutomationEditor::drawLine( int _x0, float _y0, int _x1, float _y1 )
|
||||
|
||||
x += xstep;
|
||||
i += 1;
|
||||
m_pattern->removeValue( midiTime( x ) );
|
||||
m_pattern->putValue( midiTime( x ), y );
|
||||
m_pattern->removeValue( MidiTime( x ) );
|
||||
m_pattern->putValue( MidiTime( x ), y );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -843,7 +846,7 @@ void AutomationEditor::mousePressEvent( QMouseEvent * _me )
|
||||
// loop through whole time-map...
|
||||
while( it != time_map.end() )
|
||||
{
|
||||
midiTime len = 4;
|
||||
MidiTime len = 4;
|
||||
|
||||
// and check whether the user clicked on an
|
||||
// existing value
|
||||
@@ -878,9 +881,9 @@ void AutomationEditor::mousePressEvent( QMouseEvent * _me )
|
||||
if( it == time_map.end() )
|
||||
{
|
||||
// then set new value
|
||||
midiTime value_pos( pos_ticks );
|
||||
|
||||
midiTime new_time =
|
||||
MidiTime value_pos( pos_ticks );
|
||||
|
||||
MidiTime new_time =
|
||||
m_pattern->putValue( value_pos,
|
||||
level );
|
||||
|
||||
@@ -1020,8 +1023,8 @@ void AutomationEditor::mouseMoveEvent( QMouseEvent * _me )
|
||||
// moved properly according to new starting-
|
||||
// time in the time map of pattern
|
||||
m_pattern->removeValue(
|
||||
midiTime( pos_ticks ) );
|
||||
m_pattern->putValue( midiTime( pos_ticks ),
|
||||
MidiTime( pos_ticks ) );
|
||||
m_pattern->putValue( MidiTime( pos_ticks ),
|
||||
level );
|
||||
}
|
||||
|
||||
@@ -1033,7 +1036,7 @@ void AutomationEditor::mouseMoveEvent( QMouseEvent * _me )
|
||||
( _me->buttons() & Qt::LeftButton &&
|
||||
m_editMode == ERASE ) )
|
||||
{
|
||||
m_pattern->removeValue( midiTime( pos_ticks ) );
|
||||
m_pattern->removeValue( MidiTime( pos_ticks ) );
|
||||
}
|
||||
else if( _me->buttons() & Qt::NoButton && m_editMode == DRAW )
|
||||
{
|
||||
@@ -1216,7 +1219,7 @@ void AutomationEditor::mouseMoveEvent( QMouseEvent * _me )
|
||||
for( timeMap::iterator it = m_selValuesForMove.begin();
|
||||
it != m_selValuesForMove.end(); ++it )
|
||||
{
|
||||
midiTime new_value_pos;
|
||||
MidiTime new_value_pos;
|
||||
if( it.key() )
|
||||
{
|
||||
int value_tact =
|
||||
@@ -1236,7 +1239,7 @@ void AutomationEditor::mouseMoveEvent( QMouseEvent * _me )
|
||||
DefaultTicksPerTact;
|
||||
}
|
||||
m_pattern->removeValue( it.key() );
|
||||
new_value_pos = midiTime( value_tact,
|
||||
new_value_pos = MidiTime( value_tact,
|
||||
value_ticks );
|
||||
}
|
||||
new_selValuesForMove[
|
||||
@@ -1578,7 +1581,7 @@ void AutomationEditor::paintEvent( QPaintEvent * _pe )
|
||||
is_selected );
|
||||
}
|
||||
delete [] values;
|
||||
|
||||
|
||||
// Draw cross
|
||||
int y = yCoordOfLevel( it.value() );
|
||||
p.drawLine( x - 1, y, x + 1, y );
|
||||
@@ -1804,7 +1807,7 @@ void AutomationEditor::wheelEvent( QWheelEvent * _we )
|
||||
m_timeLine->setPixelsPerTact( m_ppt );
|
||||
update();
|
||||
}
|
||||
else if( _we->modifiers() & Qt::ShiftModifier
|
||||
else if( _we->modifiers() & Qt::ShiftModifier
|
||||
|| _we->orientation() == Qt::Horizontal )
|
||||
{
|
||||
m_leftRightScroll->setValue( m_leftRightScroll->value() -
|
||||
@@ -2070,7 +2073,7 @@ void AutomationEditor::selectAll()
|
||||
const float level = it.value();
|
||||
if( level < m_selectStartLevel )
|
||||
{
|
||||
// if we move start-level down, we have to add
|
||||
// if we move start-level down, we have to add
|
||||
// the difference between old and new start-level
|
||||
// to m_selectedLevels, otherwise the selection
|
||||
// is just moved down...
|
||||
@@ -2242,7 +2245,7 @@ void AutomationEditor::deleteSelectedValues()
|
||||
|
||||
|
||||
|
||||
void AutomationEditor::updatePosition( const midiTime & _t )
|
||||
void AutomationEditor::updatePosition( const MidiTime & _t )
|
||||
{
|
||||
if( ( engine::getSong()->isPlaying() &&
|
||||
engine::getSong()->playMode() ==
|
||||
@@ -2257,7 +2260,7 @@ void AutomationEditor::updatePosition( const midiTime & _t )
|
||||
}
|
||||
else if( _t < m_currentPosition )
|
||||
{
|
||||
midiTime t = qMax( _t - w * DefaultTicksPerTact *
|
||||
MidiTime t = qMax( _t - w * DefaultTicksPerTact *
|
||||
DefaultTicksPerTact / m_ppt, 0 );
|
||||
m_leftRightScroll->setValue( t.getTact() *
|
||||
DefaultTicksPerTact );
|
||||
|
||||
@@ -250,7 +250,7 @@ void AutomationPatternView::paintEvent( QPaintEvent * )
|
||||
if( it+1 == m_pat->getTimeMap().end() )
|
||||
{
|
||||
const float x1 = x_base + it.key() * ppt /
|
||||
midiTime::ticksPerTact();
|
||||
MidiTime::ticksPerTact();
|
||||
const float x2 = (float)( width() - TCO_BORDER_WIDTH );
|
||||
p.fillRect( QRectF( x1, 0.0f, x2-x1, it.value() ),
|
||||
lin2grad );
|
||||
@@ -262,9 +262,9 @@ void AutomationPatternView::paintEvent( QPaintEvent * )
|
||||
{
|
||||
float value = values[i - it.key()];
|
||||
const float x1 = x_base + i * ppt /
|
||||
midiTime::ticksPerTact();
|
||||
MidiTime::ticksPerTact();
|
||||
const float x2 = x_base + (i+1) * ppt /
|
||||
midiTime::ticksPerTact();
|
||||
MidiTime::ticksPerTact();
|
||||
|
||||
p.fillRect( QRectF( x1, 0.0f, x2-x1, value ),
|
||||
lin2grad );
|
||||
|
||||
@@ -63,13 +63,13 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void processInEvent( const midiEvent& event, const midiTime& time )
|
||||
virtual void processInEvent( const MidiEvent& event, const MidiTime& time )
|
||||
{
|
||||
if( event.m_type == MidiControlChange &&
|
||||
( m_midiPort.inputChannel() == event.m_channel + 1 || m_midiPort.inputChannel() == 0 ) )
|
||||
if( event.type() == MidiControlChange &&
|
||||
( m_midiPort.inputChannel() == 0 || m_midiPort.inputChannel() == event.channel() + 1 ) )
|
||||
{
|
||||
m_detectedMidiChannel = event.m_channel + 1;
|
||||
m_detectedMidiController = ( event.m_data.m_bytes[0] & 0x7F ) + 1;
|
||||
m_detectedMidiChannel = event.channel() + 1;
|
||||
m_detectedMidiController = event.controllerNumber() + 1;
|
||||
m_detectedMidiPort = engine::mixer()->midiClient()->sourcePortName( event );
|
||||
|
||||
emit valueChanged();
|
||||
|
||||
@@ -209,6 +209,8 @@ FxMixerView::FxMixerView() :
|
||||
|
||||
cv->m_rackView = new EffectRackView(
|
||||
&m->m_fxChannels[i]->m_fxChain, this );
|
||||
cv->m_rackView->setMinimumWidth( 244 );
|
||||
|
||||
m_fxRacksLayout->addWidget( cv->m_rackView );
|
||||
if( i == 0 )
|
||||
{
|
||||
|
||||
@@ -178,15 +178,17 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
|
||||
toolTip::add( white_noise_btn,
|
||||
tr( "Click here for white-noise." ) );
|
||||
|
||||
pixmapButton * uwb = new pixmapButton( this, NULL );
|
||||
uwb->move( CD_LFO_SHAPES_X + 45, CD_LFO_SHAPES_Y + 15 );
|
||||
uwb->setActiveGraphic( embed::getIconPixmap(
|
||||
m_userWaveBtn = new pixmapButton( this, NULL );
|
||||
m_userWaveBtn->move( CD_LFO_SHAPES_X + 45, CD_LFO_SHAPES_Y + 15 );
|
||||
m_userWaveBtn->setActiveGraphic( embed::getIconPixmap(
|
||||
"usr_wave_active" ) );
|
||||
uwb->setInactiveGraphic( embed::getIconPixmap(
|
||||
m_userWaveBtn->setInactiveGraphic( embed::getIconPixmap(
|
||||
"usr_wave_inactive" ) );
|
||||
uwb->setEnabled( false );
|
||||
toolTip::add( uwb, tr( "Click here for a user-defined "
|
||||
"shape." ) );
|
||||
connect( m_userWaveBtn,
|
||||
SIGNAL( doubleClicked() ),
|
||||
this, SLOT( askUserDefWave() ) );
|
||||
toolTip::add( m_userWaveBtn,
|
||||
tr( "Click here for a user-defined shape.\nDouble click to pick a file." ) );
|
||||
|
||||
m_waveBtnGrp = new automatableButtonGroup( this );
|
||||
m_waveBtnGrp->addButton( sin_wave_btn );
|
||||
@@ -196,7 +198,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
|
||||
m_waveBtnGrp->addButton( moog_saw_wave_btn );
|
||||
m_waveBtnGrp->addButton( exp_wave_btn );
|
||||
m_waveBtnGrp->addButton( white_noise_btn );
|
||||
m_waveBtnGrp->addButton( uwb );
|
||||
m_waveBtnGrp->addButton( m_userWaveBtn );
|
||||
|
||||
|
||||
pixmapButton * x1 = new pixmapButton( this, NULL );
|
||||
@@ -240,11 +242,26 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
|
||||
|
||||
LfoControllerDialog::~LfoControllerDialog()
|
||||
{
|
||||
m_userWaveBtn->disconnect( this );
|
||||
//delete m_subWindow;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void LfoControllerDialog::askUserDefWave()
|
||||
{
|
||||
SampleBuffer * sampleBuffer = dynamic_cast<LfoController*>(this->model())->
|
||||
m_userDefSampleBuffer;
|
||||
QString fileName = sampleBuffer->openAndSetAudioFile();
|
||||
if( fileName.isEmpty() == false )
|
||||
{
|
||||
// TODO:
|
||||
toolTip::add( m_userWaveBtn, sampleBuffer->audioFile() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void LfoControllerDialog::contextMenuEvent( QContextMenuEvent * )
|
||||
{
|
||||
/*
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QCloseEvent>
|
||||
#include <QtGui/QDesktopServices>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QMdiArea>
|
||||
#include <QtGui/QMdiSubWindow>
|
||||
#include <QtGui/QMenuBar>
|
||||
@@ -62,6 +61,8 @@
|
||||
#include "ProjectJournal.h"
|
||||
#include "AutomationEditor.h"
|
||||
#include "templates.h"
|
||||
#include "FileDialog.h"
|
||||
#include "VersionedSaveDialog.h"
|
||||
|
||||
|
||||
|
||||
@@ -242,6 +243,10 @@ void MainWindow::finalize( void )
|
||||
this, SLOT( saveProject() ),
|
||||
Qt::CTRL + Qt::Key_S );
|
||||
|
||||
project_menu->addAction( embed::getIconPixmap( "project_save" ),
|
||||
tr( "Save as new &version" ),
|
||||
this, SLOT( saveProjectAsNewVersion() ),
|
||||
Qt::CTRL + Qt::ALT + Qt::Key_S );
|
||||
project_menu->addAction( embed::getIconPixmap( "project_saveas" ),
|
||||
tr( "Save &As..." ),
|
||||
this, SLOT( saveProjectAs() ),
|
||||
@@ -270,7 +275,7 @@ void MainWindow::finalize( void )
|
||||
|
||||
QMenu * edit_menu = new QMenu( this );
|
||||
menuBar()->addMenu( edit_menu )->setText( tr( "&Edit" ) );
|
||||
edit_menu->addAction( embed::getIconPixmap( "edit_undo" ),
|
||||
/* edit_menu->addAction( embed::getIconPixmap( "edit_undo" ),
|
||||
tr( "Undo" ),
|
||||
this, SLOT( undo() ),
|
||||
Qt::CTRL + Qt::Key_Z );
|
||||
@@ -278,7 +283,7 @@ void MainWindow::finalize( void )
|
||||
tr( "Redo" ),
|
||||
this, SLOT( redo() ),
|
||||
Qt::CTRL + Qt::Key_R );
|
||||
edit_menu->addSeparator();
|
||||
edit_menu->addSeparator();*/
|
||||
edit_menu->addAction( embed::getIconPixmap( "setup_general" ),
|
||||
tr( "Settings" ),
|
||||
this, SLOT( showSettingsDialog() ) );
|
||||
@@ -407,7 +412,7 @@ void MainWindow::finalize( void )
|
||||
|
||||
|
||||
toolButton * bb_editor_window = new toolButton(
|
||||
embed::getIconPixmap( "bb_track" ),
|
||||
embed::getIconPixmap( "bb_track_btn" ),
|
||||
tr( "Show/hide Beat+Bassline Editor" ) +
|
||||
" (F6)",
|
||||
this, SLOT( toggleBBEditorWin() ),
|
||||
@@ -681,18 +686,15 @@ void MainWindow::createNewProjectFromTemplate( QAction * _idx )
|
||||
|
||||
|
||||
|
||||
|
||||
void MainWindow::openProject( void )
|
||||
{
|
||||
if( mayChangeProject() )
|
||||
{
|
||||
QFileDialog ofd( this, tr( "Open project" ), "",
|
||||
FileDialog ofd( this, tr( "Open project" ), "",
|
||||
tr( "MultiMedia Project (*.mmp *.mmpz *.xml)" ) );
|
||||
#if QT_VERSION >= 0x040806
|
||||
ofd.setOption( QFileDialog::DontUseCustomDirectoryIcons );
|
||||
#endif
|
||||
|
||||
ofd.setDirectory( configManager::inst()->userProjectsDir() );
|
||||
ofd.setFileMode( QFileDialog::ExistingFiles );
|
||||
ofd.setFileMode( FileDialog::ExistingFiles );
|
||||
if( ofd.exec () == QDialog::Accepted &&
|
||||
!ofd.selectedFiles().isEmpty() )
|
||||
{
|
||||
@@ -751,14 +753,9 @@ bool MainWindow::saveProject( void )
|
||||
|
||||
bool MainWindow::saveProjectAs( void )
|
||||
{
|
||||
QFileDialog sfd( this, tr( "Save project" ), "",
|
||||
VersionedSaveDialog sfd( this, tr( "Save project" ), "",
|
||||
tr( "MultiMedia Project (*.mmp *.mmpz);;"
|
||||
"MultiMedia Project Template (*.mpt)" ) );
|
||||
#if QT_VERSION >= 0x040806
|
||||
sfd.setOption( QFileDialog::DontUseCustomDirectoryIcons );
|
||||
#endif
|
||||
sfd.setAcceptMode( QFileDialog::AcceptSave );
|
||||
sfd.setFileMode( QFileDialog::AnyFile );
|
||||
QString f = engine::getSong()->projectFileName();
|
||||
if( f != "" )
|
||||
{
|
||||
@@ -770,7 +767,7 @@ bool MainWindow::saveProjectAs( void )
|
||||
sfd.setDirectory( configManager::inst()->userProjectsDir() );
|
||||
}
|
||||
|
||||
if( sfd.exec () == QFileDialog::Accepted &&
|
||||
if( sfd.exec () == FileDialog::Accepted &&
|
||||
!sfd.selectedFiles().isEmpty() && sfd.selectedFiles()[0] != "" )
|
||||
{
|
||||
engine::getSong()->guiSaveProjectAs(
|
||||
@@ -783,6 +780,24 @@ bool MainWindow::saveProjectAs( void )
|
||||
|
||||
|
||||
|
||||
bool MainWindow::saveProjectAsNewVersion( void )
|
||||
{
|
||||
QString fileName = engine::getSong()->projectFileName();
|
||||
if( fileName == "" )
|
||||
{
|
||||
return saveProjectAs();
|
||||
}
|
||||
else
|
||||
{
|
||||
VersionedSaveDialog::changeFileNameVersion( fileName, true );
|
||||
engine::getSong()->guiSaveProjectAs( fileName );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MainWindow::showSettingsDialog( void )
|
||||
{
|
||||
setupDialog sd;
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
#include "knob.h"
|
||||
#include "string_pair_drag.h"
|
||||
#include "MainWindow.h"
|
||||
#include "midi.h"
|
||||
#include "MidiEvent.h"
|
||||
#include "templates.h"
|
||||
#include "update_event.h"
|
||||
|
||||
@@ -465,7 +465,7 @@ void PianoView::mousePressEvent( QMouseEvent * _me )
|
||||
velocity = MidiMaxVelocity;
|
||||
}
|
||||
// set note on
|
||||
m_piano->midiEventProcessor()->processInEvent( midiEvent( MidiNoteOn, 0, key_num, velocity ), midiTime() );
|
||||
m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOn, 0, key_num, velocity ) );
|
||||
m_piano->setKeyState( key_num, true );
|
||||
m_lastKey = key_num;
|
||||
|
||||
@@ -510,7 +510,7 @@ void PianoView::mouseReleaseEvent( QMouseEvent * )
|
||||
{
|
||||
if( m_piano != NULL )
|
||||
{
|
||||
m_piano->midiEventProcessor()->processInEvent( midiEvent( MidiNoteOff, 0, m_lastKey, 0 ), midiTime() );
|
||||
m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOff, 0, m_lastKey, 0 ) );
|
||||
m_piano->setKeyState( m_lastKey, false );
|
||||
}
|
||||
|
||||
@@ -571,7 +571,7 @@ void PianoView::mouseMoveEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( m_lastKey != -1 )
|
||||
{
|
||||
m_piano->midiEventProcessor()->processInEvent( midiEvent( MidiNoteOff, 0, m_lastKey, 0 ), midiTime() );
|
||||
m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOff, 0, m_lastKey, 0 ) );
|
||||
m_piano->setKeyState( m_lastKey, false );
|
||||
m_lastKey = -1;
|
||||
}
|
||||
@@ -579,7 +579,7 @@ void PianoView::mouseMoveEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( _me->pos().y() > PIANO_BASE )
|
||||
{
|
||||
m_piano->midiEventProcessor()->processInEvent( midiEvent( MidiNoteOn, 0, key_num, velocity ), midiTime() );
|
||||
m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOn, 0, key_num, velocity ) );
|
||||
m_piano->setKeyState( key_num, true );
|
||||
m_lastKey = key_num;
|
||||
}
|
||||
@@ -593,7 +593,7 @@ void PianoView::mouseMoveEvent( QMouseEvent * _me )
|
||||
}
|
||||
else if( m_piano->isKeyPressed( key_num ) )
|
||||
{
|
||||
m_piano->midiEventProcessor()->processInEvent( midiEvent( MidiKeyPressure, 0, key_num, velocity ), midiTime() );
|
||||
m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiKeyPressure, 0, key_num, velocity ) );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -690,7 +690,7 @@ void PianoView::focusOutEvent( QFocusEvent * )
|
||||
// hang otherwise
|
||||
for( int i = 0; i < NumKeys; ++i )
|
||||
{
|
||||
m_piano->midiEventProcessor()->processInEvent( midiEvent( MidiNoteOff, 0, i, 0 ), midiTime() );
|
||||
m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOff, 0, i, 0 ) );
|
||||
m_piano->setKeyState( i, false );
|
||||
}
|
||||
update();
|
||||
|
||||
@@ -127,9 +127,9 @@ trackView * TrackContainerView::addTrackView( trackView * _tv )
|
||||
|
||||
m_trackViews.push_back( _tv );
|
||||
m_scrollLayout->addWidget( _tv );
|
||||
connect( this, SIGNAL( positionChanged( const midiTime & ) ),
|
||||
connect( this, SIGNAL( positionChanged( const MidiTime & ) ),
|
||||
_tv->getTrackContentWidget(),
|
||||
SLOT( changePosition( const midiTime & ) ) );
|
||||
SLOT( changePosition( const MidiTime & ) ) );
|
||||
realignTracks();
|
||||
return( _tv );
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ aboutDialog::aboutDialog() :
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
iconLabel->setPixmap( embed::getIconPixmap( "icon" ) );
|
||||
iconLabel->setPixmap( embed::getIconPixmap( "icon", 64, 64 ) );
|
||||
|
||||
versionLabel->setText( versionLabel->text().
|
||||
arg( LMMS_VERSION ).
|
||||
@@ -79,7 +79,19 @@ aboutDialog::aboutDialog() :
|
||||
authorLabel->setPlainText( embed::getText( "AUTHORS" ) );
|
||||
|
||||
licenseLabel->setPlainText( embed::getText( "COPYING" ) );
|
||||
|
||||
QString contText = embed::getText( "CONTRIBUTORS" );
|
||||
if ( contText.length() >= 2 )
|
||||
{
|
||||
QWidget *widget = new QWidget();
|
||||
QVBoxLayout *layout = new QVBoxLayout();
|
||||
QTextEdit *contWidget = new QTextEdit();
|
||||
contWidget->setReadOnly(true);
|
||||
contWidget->setText( contText );
|
||||
|
||||
layout->addWidget( new QLabel( tr("Contributors ordered by number of commits:"), this ) );
|
||||
layout->addWidget( contWidget );
|
||||
widget->setLayout( layout );
|
||||
tabWidget->insertTab( 2, widget, tr("Involved") );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* bb_editor.cpp - basic main-window for editing of beats and basslines
|
||||
*
|
||||
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -85,6 +85,9 @@ bbEditor::bbEditor( bbTrackContainer* tc ) :
|
||||
tr( "Stop playback of current beat/bassline (Space)" ),
|
||||
this, SLOT( stop() ), m_toolBar );
|
||||
|
||||
m_playButton->setObjectName( "playButton" );
|
||||
m_stopButton->setObjectName( "stopButton" );
|
||||
|
||||
toolButton * add_bb_track = new toolButton(
|
||||
embed::getIconPixmap( "add_bb_track" ),
|
||||
tr( "Add beat/bassline" ),
|
||||
|
||||
68
src/gui/dialogs/FileDialog.cpp
Normal file
68
src/gui/dialogs/FileDialog.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* FileDialog.cpp - implementation of class FileDialog
|
||||
*
|
||||
* Copyright (c) 2014 Lukas W <lukaswhl/at/gmail.com>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QUrl>
|
||||
#include <QtGui/QDesktopServices>
|
||||
#include <QtGui/QListView>
|
||||
|
||||
#include "config_mgr.h"
|
||||
#include "FileDialog.h"
|
||||
|
||||
|
||||
FileDialog::FileDialog( QWidget *parent, const QString &caption,
|
||||
const QString &directory, const QString &filter ) :
|
||||
QFileDialog( parent, caption, directory, filter )
|
||||
{
|
||||
#if QT_VERSION >= 0x040806
|
||||
setOption( QFileDialog::DontUseCustomDirectoryIcons );
|
||||
#endif
|
||||
|
||||
// Add additional locations to the sidebar
|
||||
QList<QUrl> urls = sidebarUrls();
|
||||
urls << QUrl::fromLocalFile( QDesktopServices::storageLocation( QDesktopServices::DesktopLocation ) );
|
||||
// Find downloads directory
|
||||
QDir downloadDir( QDir::homePath() + "/Downloads" );
|
||||
if ( ! downloadDir.exists() )
|
||||
downloadDir = QDesktopServices::storageLocation( QDesktopServices::DocumentsLocation ) + "/Downloads";
|
||||
if ( downloadDir.exists() )
|
||||
urls << QUrl::fromLocalFile( downloadDir.absolutePath() );
|
||||
|
||||
urls << QUrl::fromLocalFile( QDesktopServices::storageLocation( QDesktopServices::MusicLocation ) );
|
||||
urls << QUrl::fromLocalFile( configManager::inst()->workingDir() );
|
||||
|
||||
setSidebarUrls(urls);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FileDialog::clearSelection()
|
||||
{
|
||||
QListView *view = findChild<QListView*>();
|
||||
Q_ASSERT( view );
|
||||
view->clearSelection();
|
||||
}
|
||||
|
||||
|
||||
#include "moc_FileDialog.cxx"
|
||||
139
src/gui/dialogs/VersionedSaveDialog.cpp
Normal file
139
src/gui/dialogs/VersionedSaveDialog.cpp
Normal file
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* VersionedSaveDialog.cpp - implementation of class VersionedSaveDialog
|
||||
*
|
||||
* Copyright (c) 2014 Lukas W <lukaswhl/at/gmail.com>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <QtGui/QLayout>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QFontMetrics>
|
||||
#include <QtGui/QLineEdit>
|
||||
|
||||
#include "VersionedSaveDialog.h"
|
||||
|
||||
|
||||
|
||||
|
||||
VersionedSaveDialog::VersionedSaveDialog( QWidget *parent,
|
||||
const QString &caption,
|
||||
const QString &directory,
|
||||
const QString &filter ) :
|
||||
FileDialog(parent, caption, directory, filter)
|
||||
{
|
||||
setAcceptMode( QFileDialog::AcceptSave );
|
||||
setFileMode( QFileDialog::AnyFile );
|
||||
|
||||
// Create + and - buttons
|
||||
QPushButton *plusButton( new QPushButton( "+", this) );
|
||||
plusButton->setToolTip( tr( "Increment version number" ) );
|
||||
QPushButton *minusButton( new QPushButton( "-", this ) );
|
||||
minusButton->setToolTip( tr( "Decrement version number" ) );
|
||||
plusButton->setFixedWidth( plusButton->fontMetrics().width( "+" ) + 30 );
|
||||
minusButton->setFixedWidth( minusButton->fontMetrics().width( "+" ) + 30 );
|
||||
|
||||
// Add buttons to grid layout. For doing this, remove the lineEdit and
|
||||
// replace it with a HBox containing lineEdit and the buttons.
|
||||
QGridLayout *layout = dynamic_cast<QGridLayout*>( this->layout() );
|
||||
QWidget *lineEdit = findChild<QLineEdit*>();
|
||||
layout->removeWidget( lineEdit );
|
||||
|
||||
QHBoxLayout* hLayout( new QHBoxLayout() );
|
||||
hLayout->addWidget( lineEdit );
|
||||
hLayout->addWidget( plusButton );
|
||||
hLayout->addWidget( minusButton );
|
||||
layout->addLayout( hLayout, 2, 1 );
|
||||
|
||||
// Connect + and - buttons
|
||||
connect( plusButton, SIGNAL( clicked() ), this, SLOT( incrementVersion() ));
|
||||
connect( minusButton, SIGNAL( clicked() ), this, SLOT( decrementVersion() ));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool VersionedSaveDialog::changeFileNameVersion(QString &fileName, bool increment )
|
||||
{
|
||||
static QRegExp regexp( "-\\d+(\\.\\w+)?$" );
|
||||
|
||||
int idx = regexp.indexIn( fileName );
|
||||
// For file names without extension (no ".mmpz")
|
||||
int insertIndex = fileName.lastIndexOf( '.' );
|
||||
if ( insertIndex < idx+1 )
|
||||
insertIndex = fileName.size();
|
||||
|
||||
if ( idx == -1 )
|
||||
{
|
||||
// Can't decrement if there is no version number
|
||||
if ( increment == false )
|
||||
return false;
|
||||
else
|
||||
fileName.insert( insertIndex, "-01" );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find current version number
|
||||
QString number = fileName.mid( idx+1, insertIndex - idx - 1 );
|
||||
bool ok;
|
||||
ushort version = number.toUShort( &ok );
|
||||
Q_ASSERT( ok );
|
||||
|
||||
// Can't decrement 0
|
||||
if ( !increment and version == 0 )
|
||||
return false;
|
||||
// Replace version number
|
||||
version = increment ? version + 1 : version - 1;
|
||||
QString newnumber = QString( "%1" ).arg( version, 2, 10, QChar( '0' ) );
|
||||
|
||||
fileName.replace( idx+1, number.length(), newnumber );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void VersionedSaveDialog::incrementVersion()
|
||||
{
|
||||
const QStringList& selected = selectedFiles();
|
||||
if ( selected.size() != 1 )
|
||||
return;
|
||||
QString file = selected[0];
|
||||
changeFileNameVersion( file, true );
|
||||
clearSelection();
|
||||
selectFile( file );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void VersionedSaveDialog::decrementVersion()
|
||||
{
|
||||
const QStringList& selected = selectedFiles();
|
||||
if ( selected.size() != 1 )
|
||||
return;
|
||||
QString file = selected[0];
|
||||
changeFileNameVersion( file, false );
|
||||
clearSelection();
|
||||
selectFile( file );
|
||||
}
|
||||
|
||||
#include "moc_VersionedSaveDialog.cxx"
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0" >
|
||||
<class>AboutDialog</class>
|
||||
<widget class="QDialog" name="AboutDialog" >
|
||||
@@ -125,7 +126,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string>Copyright (c) 2004-2013, LMMS developers</string>
|
||||
<string>Copyright (c) 2004-2014, LMMS developers</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
@@ -151,7 +152,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="text" >
|
||||
<string>http://lmms.sourceforge.net</string>
|
||||
<string><html><head/><body><p><a href="http://lmms.sourceforge.net"><span style=" text-decoration: underline; color:#0000ff;">http://lmms.sourceforge.net</span></a></p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
#include "gui_templates.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "MainWindow.h"
|
||||
#include "midi.h"
|
||||
#include "MidiEvent.h"
|
||||
#include "mmp.h"
|
||||
#include "pattern.h"
|
||||
#include "Piano.h"
|
||||
@@ -162,7 +162,7 @@ pianoRoll::pianoRoll() :
|
||||
m_oldNotesEditHeight( 100 ),
|
||||
m_notesEditHeight( 100 ),
|
||||
m_ppt( DEFAULT_PR_PPT ),
|
||||
m_lenOfNewNotes( midiTime( 0, DefaultTicksPerTact/4 ) ),
|
||||
m_lenOfNewNotes( MidiTime( 0, DefaultTicksPerTact/4 ) ),
|
||||
m_lastNoteVolume( DefaultVolume ),
|
||||
m_lastNotePanning( DefaultPanning ),
|
||||
m_startKey( INITIAL_START_KEY ),
|
||||
@@ -283,21 +283,21 @@ pianoRoll::pianoRoll() :
|
||||
engine::getSong()->getPlayPos(
|
||||
song::Mode_PlayPattern ),
|
||||
m_currentPosition, this );
|
||||
connect( this, SIGNAL( positionChanged( const midiTime & ) ),
|
||||
m_timeLine, SLOT( updatePosition( const midiTime & ) ) );
|
||||
connect( m_timeLine, SIGNAL( positionChanged( const midiTime & ) ),
|
||||
this, SLOT( updatePosition( const midiTime & ) ) );
|
||||
connect( this, SIGNAL( positionChanged( const MidiTime & ) ),
|
||||
m_timeLine, SLOT( updatePosition( const MidiTime & ) ) );
|
||||
connect( m_timeLine, SIGNAL( positionChanged( const MidiTime & ) ),
|
||||
this, SLOT( updatePosition( const MidiTime & ) ) );
|
||||
|
||||
// update timeline when in record-accompany mode
|
||||
connect( engine::getSong()->getPlayPos( song::Mode_PlaySong ).m_timeLine,
|
||||
SIGNAL( positionChanged( const midiTime & ) ),
|
||||
SIGNAL( positionChanged( const MidiTime & ) ),
|
||||
this,
|
||||
SLOT( updatePositionAccompany( const midiTime & ) ) );
|
||||
SLOT( updatePositionAccompany( const MidiTime & ) ) );
|
||||
// TODO
|
||||
/* connect( engine::getSong()->getPlayPos( song::Mode_PlayBB ).m_timeLine,
|
||||
SIGNAL( positionChanged( const midiTime & ) ),
|
||||
SIGNAL( positionChanged( const MidiTime & ) ),
|
||||
this,
|
||||
SLOT( updatePositionAccompany( const midiTime & ) ) );*/
|
||||
SLOT( updatePositionAccompany( const MidiTime & ) ) );*/
|
||||
|
||||
|
||||
m_toolBar = new QWidget( this );
|
||||
@@ -331,6 +331,11 @@ pianoRoll::pianoRoll() :
|
||||
m_stopButton = new toolButton( embed::getIconPixmap( "stop" ),
|
||||
tr( "Stop playing of current pattern (Space)" ),
|
||||
this, SLOT( stop() ), m_toolBar );
|
||||
|
||||
m_playButton->setObjectName( "playButton" );
|
||||
m_stopButton->setObjectName( "stopButton" );
|
||||
m_recordButton->setObjectName( "recordButton" );
|
||||
m_recordAccompanyButton->setObjectName( "recordAccompanyButton" );
|
||||
|
||||
m_playButton->setWhatsThis(
|
||||
tr( "Click here to play the current pattern. "
|
||||
@@ -520,7 +525,7 @@ pianoRoll::pianoRoll() :
|
||||
this, SLOT( quantizeChanged() ) );
|
||||
|
||||
|
||||
const ChordCreator::ChordTable & chord_table = ChordCreator::ChordTable::getInstance();
|
||||
const InstrumentFunctionNoteStacking::ChordTable & chord_table = InstrumentFunctionNoteStacking::ChordTable::getInstance();
|
||||
|
||||
// setup scale-stuff
|
||||
QLabel * scale_lbl = new QLabel( m_toolBar );
|
||||
@@ -644,7 +649,7 @@ void pianoRoll::changeNoteEditMode( int i )
|
||||
void pianoRoll::markSemiTone( int i )
|
||||
{
|
||||
const int key = getKey( mapFromGlobal( m_semiToneMarkerMenu->pos() ).y() );
|
||||
const ChordCreator::Chord * chord = 0;
|
||||
const InstrumentFunctionNoteStacking::Chord * chord = 0;
|
||||
|
||||
switch( static_cast<semiToneMarkerAction>( i ) )
|
||||
{
|
||||
@@ -665,13 +670,13 @@ void pianoRoll::markSemiTone( int i )
|
||||
break;
|
||||
}
|
||||
case stmaMarkCurrentScale:
|
||||
chord = & ChordCreator::ChordTable::getInstance()
|
||||
chord = & InstrumentFunctionNoteStacking::ChordTable::getInstance()
|
||||
.getScaleByName( m_scaleModel.currentText() );
|
||||
case stmaMarkCurrentChord:
|
||||
{
|
||||
if( ! chord )
|
||||
{
|
||||
chord = & ChordCreator::ChordTable::getInstance()
|
||||
chord = & InstrumentFunctionNoteStacking::ChordTable::getInstance()
|
||||
.getChordByName( m_chordModel.currentText() );
|
||||
}
|
||||
|
||||
@@ -765,15 +770,9 @@ void pianoRoll::setCurrentPattern( pattern * _new_pattern )
|
||||
// of start-notes and so on...)
|
||||
resizeEvent( NULL );
|
||||
|
||||
connect( m_pattern->instrumentTrack(),
|
||||
SIGNAL( noteOn( const note & ) ),
|
||||
this, SLOT( startRecordNote( const note & ) ) );
|
||||
connect( m_pattern->instrumentTrack(),
|
||||
SIGNAL( noteOff( const note & ) ),
|
||||
this, SLOT( finishRecordNote( const note & ) ) );
|
||||
connect( m_pattern->instrumentTrack()->pianoModel(),
|
||||
SIGNAL( dataChanged() ),
|
||||
this, SLOT( update() ) );
|
||||
connect( m_pattern->instrumentTrack(), SIGNAL( midiNoteOn( const note& ) ), this, SLOT( startRecordNote( const note& ) ) );
|
||||
connect( m_pattern->instrumentTrack(), SIGNAL( midiNoteOff( const note& ) ), this, SLOT( finishRecordNote( const note& ) ) );
|
||||
connect( m_pattern->instrumentTrack()->pianoModel(), SIGNAL( dataChanged() ), this, SLOT( update() ) );
|
||||
|
||||
setWindowTitle( tr( "Piano-Roll - %1" ).arg( m_pattern->name() ) );
|
||||
|
||||
@@ -927,7 +926,7 @@ inline void pianoRoll::drawDetuningInfo( QPainter & _p, note * _n, int _x,
|
||||
{
|
||||
break;
|
||||
}
|
||||
int pos_x = _x + pos_ticks * m_ppt / midiTime::ticksPerTact();
|
||||
int pos_x = _x + pos_ticks * m_ppt / MidiTime::ticksPerTact();
|
||||
|
||||
const float level = it.value();
|
||||
|
||||
@@ -1522,7 +1521,7 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me )
|
||||
x -= WHITE_KEY_WIDTH;
|
||||
|
||||
// get tick in which the user clicked
|
||||
int pos_ticks = x * midiTime::ticksPerTact() / m_ppt +
|
||||
int pos_ticks = x * MidiTime::ticksPerTact() / m_ppt +
|
||||
m_currentPosition;
|
||||
|
||||
|
||||
@@ -1535,7 +1534,7 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me )
|
||||
// loop through whole note-vector...
|
||||
for( int i = 0; i < notes.size(); ++i )
|
||||
{
|
||||
midiTime len = ( *it )->length();
|
||||
MidiTime len = ( *it )->length();
|
||||
if( len < 0 )
|
||||
{
|
||||
len = 4;
|
||||
@@ -1552,7 +1551,7 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me )
|
||||
( edit_note == true &&
|
||||
pos_ticks <= ( *it )->pos() +
|
||||
NE_LINE_WIDTH *
|
||||
midiTime::ticksPerTact() /
|
||||
MidiTime::ticksPerTact() /
|
||||
m_ppt )
|
||||
)
|
||||
)
|
||||
@@ -1593,8 +1592,8 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me )
|
||||
// +32 to quanitize the note correctly when placing notes with
|
||||
// the mouse. We do this here instead of in note.quantized
|
||||
// because live notes should still be quantized at the half.
|
||||
midiTime note_pos( pos_ticks - ( quantization() / 2 ) );
|
||||
midiTime note_len( newNoteLen() );
|
||||
MidiTime note_pos( pos_ticks - ( quantization() / 2 ) );
|
||||
MidiTime note_len( newNoteLen() );
|
||||
|
||||
note new_note( note_len, note_pos, key_num );
|
||||
new_note.setSelected( true );
|
||||
@@ -1602,7 +1601,7 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me )
|
||||
new_note.setVolume( m_lastNoteVolume );
|
||||
created_new_note = m_pattern->addNote( new_note );
|
||||
|
||||
const ChordCreator::Chord & chord = ChordCreator::ChordTable::getInstance()
|
||||
const InstrumentFunctionNoteStacking::Chord & chord = InstrumentFunctionNoteStacking::ChordTable::getInstance()
|
||||
.getChordByName( m_chordModel.currentText() );
|
||||
|
||||
if( ! chord.isEmpty() )
|
||||
@@ -1701,8 +1700,8 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me )
|
||||
|
||||
|
||||
// clicked at the "tail" of the note?
|
||||
if( pos_ticks*m_ppt/midiTime::ticksPerTact() >
|
||||
( m_currentNote->pos() + m_currentNote->length() )*m_ppt/ midiTime::ticksPerTact() - RESIZE_AREA_WIDTH &&
|
||||
if( pos_ticks*m_ppt/MidiTime::ticksPerTact() >
|
||||
( m_currentNote->pos() + m_currentNote->length() )*m_ppt/ MidiTime::ticksPerTact() - RESIZE_AREA_WIDTH &&
|
||||
m_currentNote->length() > 0 )
|
||||
{
|
||||
// then resize the note
|
||||
@@ -1865,16 +1864,16 @@ void pianoRoll::testPlayNote( note * n )
|
||||
{
|
||||
m_lastKey = n->key();
|
||||
|
||||
if( ! n->isPlaying() && ! m_recording &&
|
||||
! engine::getSong()->isPlaying() )
|
||||
if( ! n->isPlaying() && ! m_recording && ! engine::getSong()->isPlaying() )
|
||||
{
|
||||
n->setIsPlaying( true );
|
||||
m_pattern->instrumentTrack()->pianoModel()->handleKeyPress( n->key(), volumeToMidi( n->getVolume() ) );
|
||||
|
||||
midiEvent evt( MidiMetaEvent, 0, n->key(), panningToMidi( n->getPanning() ) );
|
||||
|
||||
evt.m_metaEvent = MidiNotePanning;
|
||||
m_pattern->instrumentTrack()->processInEvent( evt, midiTime() );
|
||||
MidiEvent event( MidiMetaEvent, 0, n->key(), panningToMidi( n->getPanning() ) );
|
||||
|
||||
event.setMetaEvent( MidiNotePanning );
|
||||
|
||||
m_pattern->instrumentTrack()->processInEvent( event, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1919,10 +1918,6 @@ void pianoRoll::testPlayKey( int key, int velocity, int pan )
|
||||
|
||||
// play new key
|
||||
m_pattern->instrumentTrack()->pianoModel()->handleKeyPress( key, velocity );
|
||||
|
||||
// set panning of newly played key
|
||||
midiEvent evt( MidiMetaEvent, 0, key, pan );
|
||||
evt.m_metaEvent = MidiNotePanning;
|
||||
}
|
||||
|
||||
|
||||
@@ -2183,9 +2178,9 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
// convert to ticks so that we can check which notes
|
||||
// are in the range
|
||||
int ticks_start = (x-pixel_range/2) *
|
||||
midiTime::ticksPerTact() / m_ppt + m_currentPosition;
|
||||
MidiTime::ticksPerTact() / m_ppt + m_currentPosition;
|
||||
int ticks_end = (x+pixel_range/2) *
|
||||
midiTime::ticksPerTact() / m_ppt + m_currentPosition;
|
||||
MidiTime::ticksPerTact() / m_ppt + m_currentPosition;
|
||||
|
||||
// get note-vector of current pattern
|
||||
const NoteVector & notes = m_pattern->notes();
|
||||
@@ -2233,15 +2228,14 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
if( m_noteEditMode == NoteEditVolume )
|
||||
{
|
||||
n->setVolume( vol );
|
||||
m_pattern->instrumentTrack()->processInEvent(
|
||||
midiEvent( MidiKeyPressure, 0, n->key(), volumeToMidi( vol ) ), midiTime() );
|
||||
m_pattern->instrumentTrack()->processInEvent( MidiEvent( MidiKeyPressure, 0, n->key(), volumeToMidi( vol ) ) );
|
||||
}
|
||||
else if( m_noteEditMode == NoteEditPanning )
|
||||
{
|
||||
n->setPanning( pan );
|
||||
midiEvent evt( MidiMetaEvent, 0, n->key(), panningToMidi( pan ) );
|
||||
evt.m_metaEvent = MidiNotePanning;
|
||||
m_pattern->instrumentTrack()->processInEvent( evt, midiTime() );
|
||||
MidiEvent evt( MidiMetaEvent, 0, n->key(), panningToMidi( pan ) );
|
||||
evt.setMetaEvent( MidiNotePanning );
|
||||
m_pattern->instrumentTrack()->processInEvent( evt );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2264,7 +2258,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
// set move- or resize-cursor
|
||||
|
||||
// get tick in which the cursor is posated
|
||||
int pos_ticks = ( x * midiTime::ticksPerTact() ) /
|
||||
int pos_ticks = ( x * MidiTime::ticksPerTact() ) /
|
||||
m_ppt + m_currentPosition;
|
||||
|
||||
// get note-vector of current pattern
|
||||
@@ -2296,10 +2290,10 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
// cursor at the "tail" of the note?
|
||||
if( ( *it )->length() > 0 &&
|
||||
pos_ticks*m_ppt /
|
||||
midiTime::ticksPerTact() >
|
||||
MidiTime::ticksPerTact() >
|
||||
( ( *it )->pos() +
|
||||
( *it )->length() )*m_ppt/
|
||||
midiTime::ticksPerTact()-
|
||||
MidiTime::ticksPerTact()-
|
||||
RESIZE_AREA_WIDTH )
|
||||
{
|
||||
if( QApplication::overrideCursor() )
|
||||
@@ -2363,7 +2357,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
// change size of selection
|
||||
|
||||
// get tick in which the cursor is posated
|
||||
int pos_ticks = x * midiTime::ticksPerTact() / m_ppt +
|
||||
int pos_ticks = x * MidiTime::ticksPerTact() / m_ppt +
|
||||
m_currentPosition;
|
||||
|
||||
m_selectedTick = pos_ticks - m_selectStartTick;
|
||||
@@ -2383,7 +2377,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
// holding down right-click to delete notes
|
||||
|
||||
// get tick in which the user clicked
|
||||
int pos_ticks = x * midiTime::ticksPerTact() / m_ppt +
|
||||
int pos_ticks = x * MidiTime::ticksPerTact() / m_ppt +
|
||||
m_currentPosition;
|
||||
|
||||
|
||||
@@ -2396,7 +2390,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
// loop through whole note-vector...
|
||||
while( it != notes.end() )
|
||||
{
|
||||
midiTime len = ( *it )->length();
|
||||
MidiTime len = ( *it )->length();
|
||||
if( len < 0 )
|
||||
{
|
||||
len = 4;
|
||||
@@ -2413,7 +2407,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
( edit_note == true &&
|
||||
pos_ticks <= ( *it )->pos() +
|
||||
NE_LINE_WIDTH *
|
||||
midiTime::ticksPerTact() /
|
||||
MidiTime::ticksPerTact() /
|
||||
m_ppt )
|
||||
)
|
||||
)
|
||||
@@ -2474,7 +2468,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
}
|
||||
|
||||
// get tick in which the cursor is posated
|
||||
int pos_ticks = x * midiTime::ticksPerTact()/ m_ppt +
|
||||
int pos_ticks = x * MidiTime::ticksPerTact()/ m_ppt +
|
||||
m_currentPosition;
|
||||
|
||||
m_selectedTick = pos_ticks -
|
||||
@@ -2535,7 +2529,7 @@ void pianoRoll::dragNotes( int x, int y, bool alt, bool shift )
|
||||
|
||||
// convert pixels to ticks and keys
|
||||
int off_x = x - m_moveStartX;
|
||||
int off_ticks = off_x * midiTime::ticksPerTact() / m_ppt;
|
||||
int off_ticks = off_x * MidiTime::ticksPerTact() / m_ppt;
|
||||
int off_key = getKey( y ) - getKey( m_moveStartY );
|
||||
|
||||
// handle scroll changes while dragging
|
||||
@@ -2587,7 +2581,7 @@ void pianoRoll::dragNotes( int x, int y, bool alt, bool shift )
|
||||
{
|
||||
shifted_pos -= off_ticks;
|
||||
}
|
||||
( *it )->setPos( midiTime( shifted_pos ) );
|
||||
( *it )->setPos( MidiTime( shifted_pos ) );
|
||||
}
|
||||
|
||||
if( ( *it )->selected() )
|
||||
@@ -2614,7 +2608,7 @@ void pianoRoll::dragNotes( int x, int y, bool alt, bool shift )
|
||||
key_num = NumKeys;
|
||||
}
|
||||
|
||||
( *it )->setPos( midiTime( pos_ticks ) );
|
||||
( *it )->setPos( MidiTime( pos_ticks ) );
|
||||
( *it )->setKey( key_num );
|
||||
}
|
||||
else if( m_action == ActionResizeNote )
|
||||
@@ -2636,7 +2630,7 @@ void pianoRoll::dragNotes( int x, int y, bool alt, bool shift )
|
||||
shift_ref_pos = pos;
|
||||
}
|
||||
}
|
||||
( *it )->setLength( midiTime( ticks_new ) );
|
||||
( *it )->setLength( MidiTime( ticks_new ) );
|
||||
|
||||
m_lenOfNewNotes = ( *it )->length();
|
||||
}
|
||||
@@ -2941,7 +2935,7 @@ void pianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
// triplet mode occurs if the note duration isn't a multiple of 3
|
||||
bool triplets = ( quantization() % 3 != 0 );
|
||||
|
||||
int spt = midiTime::stepsPerTact();
|
||||
int spt = MidiTime::stepsPerTact();
|
||||
float pp16th = (float)m_ppt / spt;
|
||||
int bpt = DefaultBeatsPerTact;
|
||||
if ( triplets ) {
|
||||
@@ -2953,7 +2947,7 @@ void pianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
int tact_16th = m_currentPosition / bpt;
|
||||
|
||||
const int offset = ( m_currentPosition % bpt ) *
|
||||
m_ppt / midiTime::ticksPerTact();
|
||||
m_ppt / MidiTime::ticksPerTact();
|
||||
|
||||
bool show32nds = ( m_zoomingModel.value() > 3 );
|
||||
|
||||
@@ -3047,9 +3041,9 @@ void pianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
int pos_ticks = ( *it )->pos();
|
||||
|
||||
int note_width = len_ticks * m_ppt /
|
||||
midiTime::ticksPerTact();
|
||||
MidiTime::ticksPerTact();
|
||||
const int x = ( pos_ticks - m_currentPosition ) *
|
||||
m_ppt / midiTime::ticksPerTact();
|
||||
m_ppt / MidiTime::ticksPerTact();
|
||||
// skip this note if not in visible area at all
|
||||
if( !( x + note_width >= 0 &&
|
||||
x <= width() - WHITE_KEY_WIDTH ) )
|
||||
@@ -3141,9 +3135,9 @@ void pianoRoll::paintEvent( QPaintEvent * _pe )
|
||||
|
||||
// now draw selection-frame
|
||||
int x = ( ( sel_pos_start - m_currentPosition ) * m_ppt ) /
|
||||
midiTime::ticksPerTact();
|
||||
MidiTime::ticksPerTact();
|
||||
int w = ( ( ( sel_pos_end - m_currentPosition ) * m_ppt ) /
|
||||
midiTime::ticksPerTact() ) - x;
|
||||
MidiTime::ticksPerTact() ) - x;
|
||||
int y = (int) y_base - sel_key_start * KEY_LINE_HEIGHT;
|
||||
int h = (int) y_base - sel_key_end * KEY_LINE_HEIGHT - y;
|
||||
p.setPen( QColor( 0, 64, 192 ) );
|
||||
@@ -3407,7 +3401,7 @@ void pianoRoll::startRecordNote( const note & _n )
|
||||
engine::getSong()->playMode() ==
|
||||
song::Mode_PlayPattern ) )
|
||||
{
|
||||
midiTime sub;
|
||||
MidiTime sub;
|
||||
if( engine::getSong()->playMode() == song::Mode_PlaySong )
|
||||
{
|
||||
sub = m_pattern->startPosition();
|
||||
@@ -3596,7 +3590,7 @@ void pianoRoll::copy_to_clipboard( const NoteVector & _notes ) const
|
||||
QDomElement note_list = mmp.createElement( "note-list" );
|
||||
mmp.content().appendChild( note_list );
|
||||
|
||||
midiTime start_pos( _notes.front()->pos().getTact(), 0 );
|
||||
MidiTime start_pos( _notes.front()->pos().getTact(), 0 );
|
||||
for( NoteVector::ConstIterator it = _notes.begin(); it != _notes.end();
|
||||
++it )
|
||||
{
|
||||
@@ -3752,20 +3746,20 @@ void pianoRoll::deleteSelectedNotes()
|
||||
|
||||
|
||||
|
||||
void pianoRoll::autoScroll( const midiTime & _t )
|
||||
void pianoRoll::autoScroll( const MidiTime & _t )
|
||||
{
|
||||
const int w = width() - WHITE_KEY_WIDTH;
|
||||
if( _t > m_currentPosition + w * midiTime::ticksPerTact() / m_ppt )
|
||||
if( _t > m_currentPosition + w * MidiTime::ticksPerTact() / m_ppt )
|
||||
{
|
||||
m_leftRightScroll->setValue( _t.getTact() *
|
||||
midiTime::ticksPerTact() );
|
||||
MidiTime::ticksPerTact() );
|
||||
}
|
||||
else if( _t < m_currentPosition )
|
||||
{
|
||||
midiTime t = qMax( _t - w * midiTime::ticksPerTact() *
|
||||
midiTime::ticksPerTact() / m_ppt, 0 );
|
||||
MidiTime t = qMax( _t - w * MidiTime::ticksPerTact() *
|
||||
MidiTime::ticksPerTact() / m_ppt, 0 );
|
||||
m_leftRightScroll->setValue( t.getTact() *
|
||||
midiTime::ticksPerTact() );
|
||||
MidiTime::ticksPerTact() );
|
||||
}
|
||||
m_scrollBack = false;
|
||||
}
|
||||
@@ -3773,7 +3767,7 @@ void pianoRoll::autoScroll( const midiTime & _t )
|
||||
|
||||
|
||||
|
||||
void pianoRoll::updatePosition( const midiTime & _t )
|
||||
void pianoRoll::updatePosition( const MidiTime & _t )
|
||||
{
|
||||
if( ( engine::getSong()->isPlaying() &&
|
||||
engine::getSong()->playMode() ==
|
||||
@@ -3788,14 +3782,14 @@ void pianoRoll::updatePosition( const midiTime & _t )
|
||||
|
||||
|
||||
|
||||
void pianoRoll::updatePositionAccompany( const midiTime & _t )
|
||||
void pianoRoll::updatePositionAccompany( const MidiTime & _t )
|
||||
{
|
||||
song * s = engine::getSong();
|
||||
|
||||
if( m_recording && validPattern() &&
|
||||
s->playMode() != song::Mode_PlayPattern )
|
||||
{
|
||||
midiTime pos = _t;
|
||||
MidiTime pos = _t;
|
||||
if( s->playMode() != song::Mode_PlayBB )
|
||||
{
|
||||
pos -= m_pattern->startPosition();
|
||||
@@ -3855,10 +3849,10 @@ int pianoRoll::quantization() const
|
||||
|
||||
void pianoRoll::updateSemiToneMarkerMenu()
|
||||
{
|
||||
const ChordCreator::Chord & scale = ChordCreator::ChordTable::getInstance()
|
||||
const InstrumentFunctionNoteStacking::Chord & scale = InstrumentFunctionNoteStacking::ChordTable::getInstance()
|
||||
.getScaleByName( m_scaleModel.currentText() );
|
||||
|
||||
const ChordCreator::Chord & chord = ChordCreator::ChordTable::getInstance()
|
||||
const InstrumentFunctionNoteStacking::Chord & chord = InstrumentFunctionNoteStacking::ChordTable::getInstance()
|
||||
.getChordByName( m_chordModel.currentText() );
|
||||
|
||||
emit semiToneMarkerMenuScaleSetEnabled( ! scale.isEmpty() );
|
||||
@@ -3868,7 +3862,7 @@ void pianoRoll::updateSemiToneMarkerMenu()
|
||||
|
||||
|
||||
|
||||
midiTime pianoRoll::newNoteLen() const
|
||||
MidiTime pianoRoll::newNoteLen() const
|
||||
{
|
||||
if( m_noteLenModel.value() == 0 )
|
||||
{
|
||||
@@ -3906,7 +3900,7 @@ note * pianoRoll::noteUnderMouse()
|
||||
|
||||
int key_num = getKey( pos.y() );
|
||||
int pos_ticks = ( pos.x() - WHITE_KEY_WIDTH ) *
|
||||
midiTime::ticksPerTact() / m_ppt + m_currentPosition;
|
||||
MidiTime::ticksPerTact() / m_ppt + m_currentPosition;
|
||||
|
||||
// will be our iterator in the following loop
|
||||
NoteVector::ConstIterator it = notes.begin()+notes.size()-1;
|
||||
|
||||
@@ -35,6 +35,13 @@
|
||||
#include "string_pair_drag.h"
|
||||
|
||||
|
||||
bool pluginBefore( const Plugin::Descriptor& d1, const Plugin::Descriptor& d2 )
|
||||
{
|
||||
return qstricmp( d1.displayName, d2.displayName ) < 0 ? true : false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
pluginBrowser::pluginBrowser( QWidget * _parent ) :
|
||||
SideBarWidget( tr( "Instrument plugins" ),
|
||||
@@ -61,6 +68,7 @@ pluginBrowser::pluginBrowser( QWidget * _parent ) :
|
||||
view_layout->addWidget( hint );
|
||||
|
||||
Plugin::getDescriptorsOfAvailPlugins( m_pluginDescriptors );
|
||||
qSort( m_pluginDescriptors.begin(), m_pluginDescriptors.end(), pluginBefore );
|
||||
|
||||
for( Plugin::DescriptorList::ConstIterator it = m_pluginDescriptors.begin();
|
||||
it != m_pluginDescriptors.end(); ++it )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* setup_dialog.cpp - dialog for setting up LMMS
|
||||
*
|
||||
* Copyright (c) 2005-2013 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QImageReader>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QLayout>
|
||||
@@ -46,6 +45,7 @@
|
||||
#include "tooltip.h"
|
||||
#include "led_checkbox.h"
|
||||
#include "lcd_spinbox.h"
|
||||
#include "FileDialog.h"
|
||||
|
||||
|
||||
// platform-specific audio-interface-classes
|
||||
@@ -108,10 +108,6 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) :
|
||||
m_stkDir( configManager::inst()->stkDir() ),
|
||||
#endif
|
||||
m_backgroundArtwork( configManager::inst()->backgroundArtwork() ),
|
||||
m_disableChActInd( configManager::inst()->value( "ui",
|
||||
"disablechannelactivityindicators" ).toInt() ),
|
||||
m_manualChPiano( configManager::inst()->value( "ui",
|
||||
"manualchannelpiano" ).toInt() ),
|
||||
m_smoothScroll( configManager::inst()->value( "ui", "smoothscroll" ).toInt() ),
|
||||
m_enableAutoSave( configManager::inst()->value( "ui", "enableautosave" ).toInt() ),
|
||||
m_oneInstrumentTrackWindow( configManager::inst()->value( "ui",
|
||||
@@ -513,28 +509,11 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) :
|
||||
tabWidget * ui_fx_tw = new tabWidget( tr( "UI effects vs. "
|
||||
"performance" ).toUpper(),
|
||||
performance );
|
||||
ui_fx_tw->setFixedHeight( 120 );
|
||||
|
||||
ledCheckBox * disable_ch_act_ind = new ledCheckBox(
|
||||
tr( "Disable channel activity indicators" ),
|
||||
ui_fx_tw );
|
||||
disable_ch_act_ind->move( 10, 20 );
|
||||
disable_ch_act_ind->setChecked( m_disableChActInd );
|
||||
connect( disable_ch_act_ind, SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( toggleDisableChActInd( bool ) ) );
|
||||
|
||||
|
||||
ledCheckBox * manual_ch_piano = new ledCheckBox(
|
||||
tr( "Only press keys on channel-piano manually" ),
|
||||
ui_fx_tw );
|
||||
manual_ch_piano->move( 10, 40 );
|
||||
manual_ch_piano->setChecked( m_manualChPiano );
|
||||
connect( manual_ch_piano, SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( toggleManualChPiano( bool ) ) );
|
||||
ui_fx_tw->setFixedHeight( 80 );
|
||||
|
||||
ledCheckBox * smoothScroll = new ledCheckBox(
|
||||
tr( "Smooth scroll in Song Editor" ), ui_fx_tw );
|
||||
smoothScroll->move( 10, 60 );
|
||||
smoothScroll->move( 10, 20 );
|
||||
smoothScroll->setChecked( m_smoothScroll );
|
||||
connect( smoothScroll, SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( toggleSmoothScroll( bool ) ) );
|
||||
@@ -542,7 +521,7 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) :
|
||||
|
||||
ledCheckBox * autoSave = new ledCheckBox(
|
||||
tr( "Enable auto save feature" ), ui_fx_tw );
|
||||
autoSave->move( 10, 80 );
|
||||
autoSave->move( 10, 40 );
|
||||
autoSave->setChecked( m_enableAutoSave );
|
||||
connect( autoSave, SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( toggleAutoSave( bool ) ) );
|
||||
@@ -551,7 +530,7 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) :
|
||||
ledCheckBox * animAFP = new ledCheckBox(
|
||||
tr( "Show playback cursor in AudioFileProcessor" ),
|
||||
ui_fx_tw );
|
||||
animAFP->move( 10, 100 );
|
||||
animAFP->move( 10, 60 );
|
||||
animAFP->setChecked( m_animateAFP );
|
||||
connect( animAFP, SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( toggleAnimateAFP( bool ) ) );
|
||||
@@ -818,11 +797,6 @@ void setupDialog::accept()
|
||||
QString::number( !m_MMPZ ) );
|
||||
configManager::inst()->setValue( "mixer", "hqaudio",
|
||||
QString::number( m_hqAudioDev ) );
|
||||
configManager::inst()->setValue( "ui",
|
||||
"disablechannelactivityindicators",
|
||||
QString::number( m_disableChActInd ) );
|
||||
configManager::inst()->setValue( "ui", "manualchannelpiano",
|
||||
QString::number( m_manualChPiano ) );
|
||||
configManager::inst()->setValue( "ui", "smoothscroll",
|
||||
QString::number( m_smoothScroll ) );
|
||||
configManager::inst()->setValue( "ui", "enableautosave",
|
||||
@@ -979,23 +953,6 @@ void setupDialog::toggleHQAudioDev( bool _enabled )
|
||||
|
||||
|
||||
|
||||
void setupDialog::toggleDisableChActInd( bool _disabled )
|
||||
{
|
||||
m_disableChActInd = _disabled;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void setupDialog::toggleManualChPiano( bool _enabled )
|
||||
{
|
||||
m_manualChPiano = _enabled;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void setupDialog::toggleSmoothScroll( bool _enabled )
|
||||
{
|
||||
m_smoothScroll = _enabled;
|
||||
@@ -1056,13 +1013,8 @@ void setupDialog::toggleOneInstrumentTrackWindow( bool _enabled )
|
||||
|
||||
void setupDialog::openWorkingDir()
|
||||
{
|
||||
QString new_dir = QFileDialog::getExistingDirectory( this,
|
||||
tr( "Choose LMMS working directory" ),
|
||||
m_workingDir
|
||||
#if QT_VERSION >= 0x040806
|
||||
, QFileDialog::DontUseCustomDirectoryIcons
|
||||
#endif
|
||||
);
|
||||
QString new_dir = FileDialog::getExistingDirectory( this,
|
||||
tr( "Choose LMMS working directory" ), m_workingDir );
|
||||
if( new_dir != QString::null )
|
||||
{
|
||||
m_wdLineEdit->setText( new_dir );
|
||||
@@ -1082,7 +1034,7 @@ void setupDialog::setWorkingDir( const QString & _wd )
|
||||
|
||||
void setupDialog::openVSTDir()
|
||||
{
|
||||
QString new_dir = QFileDialog::getExistingDirectory( this,
|
||||
QString new_dir = FileDialog::getExistingDirectory( this,
|
||||
tr( "Choose your VST-plugin directory" ),
|
||||
m_vstDir );
|
||||
if( new_dir != QString::null )
|
||||
@@ -1104,7 +1056,7 @@ void setupDialog::setVSTDir( const QString & _vd )
|
||||
|
||||
void setupDialog::openArtworkDir()
|
||||
{
|
||||
QString new_dir = QFileDialog::getExistingDirectory( this,
|
||||
QString new_dir = FileDialog::getExistingDirectory( this,
|
||||
tr( "Choose artwork-theme directory" ),
|
||||
m_artworkDir );
|
||||
if( new_dir != QString::null )
|
||||
@@ -1126,7 +1078,7 @@ void setupDialog::setArtworkDir( const QString & _ad )
|
||||
|
||||
void setupDialog::openFLDir()
|
||||
{
|
||||
QString new_dir = QFileDialog::getExistingDirectory( this,
|
||||
QString new_dir = FileDialog::getExistingDirectory( this,
|
||||
tr( "Choose FL Studio installation directory" ),
|
||||
m_flDir );
|
||||
if( new_dir != QString::null )
|
||||
@@ -1140,7 +1092,7 @@ void setupDialog::openFLDir()
|
||||
|
||||
void setupDialog::openLADSPADir()
|
||||
{
|
||||
QString new_dir = QFileDialog::getExistingDirectory( this,
|
||||
QString new_dir = FileDialog::getExistingDirectory( this,
|
||||
tr( "Choose LADSPA plugin directory" ),
|
||||
m_ladDir );
|
||||
if( new_dir != QString::null )
|
||||
@@ -1163,7 +1115,7 @@ void setupDialog::openLADSPADir()
|
||||
void setupDialog::openSTKDir()
|
||||
{
|
||||
#ifdef LMMS_HAVE_STK
|
||||
QString new_dir = QFileDialog::getExistingDirectory( this,
|
||||
QString new_dir = FileDialog::getExistingDirectory( this,
|
||||
tr( "Choose STK rawwave directory" ),
|
||||
m_stkDir );
|
||||
if( new_dir != QString::null )
|
||||
@@ -1179,7 +1131,7 @@ void setupDialog::openSTKDir()
|
||||
void setupDialog::openDefaultSoundfont()
|
||||
{
|
||||
#ifdef LMMS_HAVE_FLUIDSYNTH
|
||||
QString new_file = QFileDialog::getOpenFileName( this,
|
||||
QString new_file = FileDialog::getOpenFileName( this,
|
||||
tr( "Choose default SoundFont" ), m_defaultSoundfont,
|
||||
"SoundFont2 Files (*.sf2)" );
|
||||
|
||||
@@ -1212,7 +1164,7 @@ void setupDialog::openBackgroundArtwork()
|
||||
QString dir = ( m_backgroundArtwork.isEmpty() ) ?
|
||||
m_artworkDir :
|
||||
m_backgroundArtwork;
|
||||
QString new_file = QFileDialog::getOpenFileName( this,
|
||||
QString new_file = FileDialog::getOpenFileName( this,
|
||||
tr( "Choose background artwork" ), dir,
|
||||
"Image Files (" + fileTypes + ")" );
|
||||
|
||||
|
||||
@@ -99,11 +99,11 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) :
|
||||
pixelsPerTact(),
|
||||
m_s->m_playPos[song::Mode_PlaySong],
|
||||
m_currentPosition, this );
|
||||
connect( this, SIGNAL( positionChanged( const midiTime & ) ),
|
||||
connect( this, SIGNAL( positionChanged( const MidiTime & ) ),
|
||||
m_s->m_playPos[song::Mode_PlaySong].m_timeLine,
|
||||
SLOT( updatePosition( const midiTime & ) ) );
|
||||
connect( m_timeLine, SIGNAL( positionChanged( const midiTime & ) ),
|
||||
this, SLOT( updatePosition( const midiTime & ) ) );
|
||||
SLOT( updatePosition( const MidiTime & ) ) );
|
||||
connect( m_timeLine, SIGNAL( positionChanged( const MidiTime & ) ),
|
||||
this, SLOT( updatePosition( const MidiTime & ) ) );
|
||||
|
||||
m_positionLine = new positionLine( this );
|
||||
|
||||
@@ -113,7 +113,7 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) :
|
||||
this, SLOT( adjustUiAfterProjectLoad() ) );
|
||||
|
||||
|
||||
// add some essential widgets to global tool-bar
|
||||
// add some essential widgets to global tool-bar
|
||||
QWidget * tb = engine::mainWindow()->toolBar();
|
||||
|
||||
engine::mainWindow()->addSpacingToToolBar( 10 );
|
||||
@@ -153,7 +153,7 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) :
|
||||
engine::mainWindow()->addWidgetToToolBar( m_timeSigDisplay );
|
||||
|
||||
engine::mainWindow()->addSpacingToToolBar( 10 );
|
||||
|
||||
|
||||
|
||||
QLabel * master_vol_lbl = new QLabel( tb );
|
||||
master_vol_lbl->setPixmap( embed::getIconPixmap( "master_volume" ) );
|
||||
@@ -239,7 +239,7 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) :
|
||||
m_toolBar->setFixedHeight( 32 );
|
||||
m_toolBar->setAutoFillBackground( true );
|
||||
QPalette pal;
|
||||
pal.setBrush( m_toolBar->backgroundRole(),
|
||||
pal.setBrush( m_toolBar->backgroundRole(),
|
||||
embed::getIconPixmap( "toolbar_bg" ) );
|
||||
m_toolBar->setPalette( pal );
|
||||
|
||||
@@ -255,19 +255,23 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) :
|
||||
m_playButton = new toolButton( embed::getIconPixmap( "play" ),
|
||||
tr( "Play song (Space)" ),
|
||||
this, SLOT( play() ), m_toolBar );
|
||||
m_playButton->setObjectName( "playButton" );
|
||||
|
||||
m_recordButton = new toolButton( embed::getIconPixmap( "record" ),
|
||||
tr( "Record samples from Audio-device" ),
|
||||
this, SLOT( record() ), m_toolBar );
|
||||
m_recordAccompanyButton = new toolButton(
|
||||
m_recordButton->setObjectName( "recordButton" );
|
||||
|
||||
m_recordAccompanyButton = new toolButton(
|
||||
embed::getIconPixmap( "record_accompany" ),
|
||||
tr( "Record samples from Audio-device while playing "
|
||||
"song or BB track" ),
|
||||
this, SLOT( recordAccompany() ), m_toolBar );
|
||||
m_recordAccompanyButton->setObjectName( "recordAccompanyButton" );
|
||||
|
||||
// FIXME: disable record button while it is not implemented
|
||||
m_recordButton->setDisabled( true );
|
||||
|
||||
|
||||
// disable record buttons if capturing is not supported
|
||||
if( !engine::mixer()->audioDev()->supportsCapture() )
|
||||
{
|
||||
@@ -278,6 +282,7 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) :
|
||||
m_stopButton = new toolButton( embed::getIconPixmap( "stop" ),
|
||||
tr( "Stop song (Space)" ),
|
||||
this, SLOT( stop() ), m_toolBar );
|
||||
m_stopButton->setObjectName( "stopButton" );
|
||||
|
||||
m_addBBTrackButton = new toolButton( embed::getIconPixmap(
|
||||
"add_bb_track" ),
|
||||
@@ -419,7 +424,7 @@ void songEditor::setHighQuality( bool _hq )
|
||||
void songEditor::scrolled( int _new_pos )
|
||||
{
|
||||
update();
|
||||
emit positionChanged( m_currentPosition = midiTime( _new_pos, 0 ) );
|
||||
emit positionChanged( m_currentPosition = MidiTime( _new_pos, 0 ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -503,7 +508,7 @@ void songEditor::keyPressEvent( QKeyEvent * _ke )
|
||||
}
|
||||
else if( _ke->key() == Qt::Key_Left )
|
||||
{
|
||||
tick_t t = m_s->currentTick() - midiTime::ticksPerTact();
|
||||
tick_t t = m_s->currentTick() - MidiTime::ticksPerTact();
|
||||
if( t >= 0 )
|
||||
{
|
||||
m_s->setPlayPos( t, song::Mode_PlaySong );
|
||||
@@ -511,7 +516,7 @@ void songEditor::keyPressEvent( QKeyEvent * _ke )
|
||||
}
|
||||
else if( _ke->key() == Qt::Key_Right )
|
||||
{
|
||||
tick_t t = m_s->currentTick() + midiTime::ticksPerTact();
|
||||
tick_t t = m_s->currentTick() + MidiTime::ticksPerTact();
|
||||
if( t < MaxSongLength )
|
||||
{
|
||||
m_s->setPlayPos( t, song::Mode_PlaySong );
|
||||
@@ -566,7 +571,7 @@ void songEditor::wheelEvent( QWheelEvent * _we )
|
||||
setPixelsPerTact( pixelsPerTact() );
|
||||
// and make sure, all TCO's are resized and relocated
|
||||
realignTracks();
|
||||
}
|
||||
}
|
||||
else if( engine::mainWindow()->isShiftPressed() == TRUE )
|
||||
{
|
||||
m_leftRightScroll->setValue( m_leftRightScroll->value() -
|
||||
@@ -706,7 +711,7 @@ static inline void animateScroll( QScrollBar *scrollBar, int newVal, bool smooth
|
||||
}
|
||||
|
||||
|
||||
void songEditor::updatePosition( const midiTime & _t )
|
||||
void songEditor::updatePosition( const MidiTime & _t )
|
||||
{
|
||||
int widgetWidth, trackOpWidth;
|
||||
if( configManager::inst()->value( "ui", "compacttrackbuttons" ).toInt() )
|
||||
@@ -720,22 +725,22 @@ void songEditor::updatePosition( const midiTime & _t )
|
||||
trackOpWidth = TRACK_OP_WIDTH;
|
||||
}
|
||||
|
||||
if( ( m_s->isPlaying() && m_s->m_playMode == song::Mode_PlaySong
|
||||
if( ( m_s->isPlaying() && m_s->m_playMode == song::Mode_PlaySong
|
||||
&& m_timeLine->autoScroll() == timeLine::AutoScrollEnabled) ||
|
||||
m_scrollBack == true )
|
||||
{
|
||||
const int w = width() - widgetWidth
|
||||
- trackOpWidth
|
||||
- 32; // rough estimation for width of right scrollbar
|
||||
if( _t > m_currentPosition + w * midiTime::ticksPerTact() /
|
||||
if( _t > m_currentPosition + w * MidiTime::ticksPerTact() /
|
||||
pixelsPerTact() )
|
||||
{
|
||||
animateScroll( m_leftRightScroll, _t.getTact(), m_smoothScroll );
|
||||
}
|
||||
else if( _t < m_currentPosition )
|
||||
{
|
||||
midiTime t = qMax(
|
||||
(int)( _t - w * midiTime::ticksPerTact() /
|
||||
MidiTime t = qMax(
|
||||
(int)( _t - w * MidiTime::ticksPerTact() /
|
||||
pixelsPerTact() ),
|
||||
0 );
|
||||
animateScroll( m_leftRightScroll, t.getTact(), m_smoothScroll );
|
||||
|
||||
@@ -158,8 +158,11 @@ EffectView::~EffectView()
|
||||
|
||||
delete m_subWindow;
|
||||
#else
|
||||
// otherwise on win32 build VST GUI can get lost
|
||||
m_subWindow->hide();
|
||||
if( m_subWindow )
|
||||
{
|
||||
// otherwise on win32 build VST GUI can get lost
|
||||
m_subWindow->hide();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QLayout>
|
||||
|
||||
#include "InstrumentFunctions.h"
|
||||
#include "InstrumentFunctionViews.h"
|
||||
@@ -37,50 +38,43 @@
|
||||
#include "tooltip.h"
|
||||
|
||||
|
||||
|
||||
const int CHORDS_GROUPBOX_X = 4;
|
||||
const int CHORDS_GROUPBOX_Y = 5;
|
||||
const int CHORDS_GROUPBOX_WIDTH = 242;
|
||||
const int CHORDS_GROUPBOX_HEIGHT = 65;
|
||||
const int ARP_GROUPBOX_X = CHORDS_GROUPBOX_X;
|
||||
const int ARP_GROUPBOX_Y = 10 + CHORDS_GROUPBOX_Y + CHORDS_GROUPBOX_HEIGHT;
|
||||
const int ARP_GROUPBOX_WIDTH = CHORDS_GROUPBOX_WIDTH;
|
||||
const int ARP_GROUPBOX_HEIGHT = 240 - ARP_GROUPBOX_Y;
|
||||
|
||||
|
||||
|
||||
ChordCreatorView::ChordCreatorView( ChordCreator * _cc, QWidget * _parent ) :
|
||||
QWidget( _parent ),
|
||||
InstrumentFunctionNoteStackingView::InstrumentFunctionNoteStackingView( InstrumentFunctionNoteStacking* cc, QWidget* parent ) :
|
||||
QWidget( parent ),
|
||||
ModelView( NULL, this ),
|
||||
m_cc( _cc ),
|
||||
m_chordsGroupBox( new groupBox( tr( "CHORDS" ), this ) ),
|
||||
m_chordsComboBox( new comboBox( m_chordsGroupBox ) ),
|
||||
m_chordRangeKnob( new knob( knobBright_26, m_chordsGroupBox ) )
|
||||
m_cc( cc ),
|
||||
m_chordsGroupBox( new groupBox( tr( "STACKING" ) ) ),
|
||||
m_chordsComboBox( new comboBox() ),
|
||||
m_chordRangeKnob( new knob( knobBright_26 ) )
|
||||
{
|
||||
move( CHORDS_GROUPBOX_X, CHORDS_GROUPBOX_Y );
|
||||
setFixedSize( 250, CHORDS_GROUPBOX_HEIGHT );
|
||||
m_chordsGroupBox->setGeometry( 0, 0, CHORDS_GROUPBOX_WIDTH,
|
||||
CHORDS_GROUPBOX_HEIGHT );
|
||||
QHBoxLayout* topLayout = new QHBoxLayout( this );
|
||||
topLayout->setMargin( 0 );
|
||||
topLayout->addWidget( m_chordsGroupBox );
|
||||
|
||||
QGridLayout* mainLayout = new QGridLayout( m_chordsGroupBox );
|
||||
mainLayout->setContentsMargins( 8, 18, 8, 8 );
|
||||
mainLayout->setColumnStretch( 0, 1 );
|
||||
mainLayout->setHorizontalSpacing( 20 );
|
||||
mainLayout->setVerticalSpacing( 1 );
|
||||
|
||||
m_chordsComboBox->setGeometry( 10, 25, 140, 22 );
|
||||
|
||||
QLabel* chordLabel = new QLabel( tr( "Chord:" ) );
|
||||
chordLabel->setFont( pointSize<8>( chordLabel->font() ) );
|
||||
|
||||
m_chordRangeKnob->setLabel( tr( "RANGE" ) );
|
||||
m_chordRangeKnob->move( 164, 24 );
|
||||
m_chordRangeKnob->setHintText( tr( "Chord range:" ) + " ", " " +
|
||||
tr( "octave(s)" ) );
|
||||
m_chordRangeKnob->setHintText( tr( "Chord range:" ) + " ", " " + tr( "octave(s)" ) );
|
||||
m_chordRangeKnob->setWhatsThis(
|
||||
tr( "Use this knob for setting the chord range in octaves. "
|
||||
"The selected chord will be played within specified "
|
||||
"number of octaves." ) );
|
||||
|
||||
mainLayout->addWidget( chordLabel, 0, 0 );
|
||||
mainLayout->addWidget( m_chordsComboBox, 1, 0 );
|
||||
mainLayout->addWidget( m_chordRangeKnob, 0, 1, 2, 1, Qt::AlignHCenter );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ChordCreatorView::~ChordCreatorView()
|
||||
InstrumentFunctionNoteStackingView::~InstrumentFunctionNoteStackingView()
|
||||
{
|
||||
delete m_chordsGroupBox;
|
||||
}
|
||||
@@ -88,9 +82,9 @@ ChordCreatorView::~ChordCreatorView()
|
||||
|
||||
|
||||
|
||||
void ChordCreatorView::modelChanged()
|
||||
void InstrumentFunctionNoteStackingView::modelChanged()
|
||||
{
|
||||
m_cc = castModel<ChordCreator>();
|
||||
m_cc = castModel<InstrumentFunctionNoteStacking>();
|
||||
m_chordsGroupBox->setModel( &m_cc->m_chordsEnabledModel );
|
||||
m_chordsComboBox->setModel( &m_cc->m_chordsModel );
|
||||
m_chordRangeKnob->setModel( &m_cc->m_chordRangeModel );
|
||||
@@ -102,22 +96,27 @@ void ChordCreatorView::modelChanged()
|
||||
|
||||
|
||||
|
||||
ArpeggiatorView::ArpeggiatorView( Arpeggiator * _arp, QWidget * _parent ) :
|
||||
QWidget( _parent ),
|
||||
InstrumentFunctionArpeggioView::InstrumentFunctionArpeggioView( InstrumentFunctionArpeggio* arp, QWidget* parent ) :
|
||||
QWidget( parent ),
|
||||
ModelView( NULL, this ),
|
||||
m_a( _arp ),
|
||||
m_arpGroupBox( new groupBox( tr( "ARPEGGIO" ), this ) ),
|
||||
m_arpComboBox( new comboBox( m_arpGroupBox) ),
|
||||
m_arpRangeKnob( new knob( knobBright_26, m_arpGroupBox ) ),
|
||||
m_arpTimeKnob( new TempoSyncKnob( knobBright_26, m_arpGroupBox ) ),
|
||||
m_arpGateKnob( new knob( knobBright_26, m_arpGroupBox ) ),
|
||||
m_arpDirectionComboBox( new comboBox( m_arpGroupBox ) ),
|
||||
m_arpModeComboBox( new comboBox( m_arpGroupBox ) )
|
||||
m_a( arp ),
|
||||
m_arpGroupBox( new groupBox( tr( "ARPEGGIO" ) ) ),
|
||||
m_arpComboBox( new comboBox() ),
|
||||
m_arpRangeKnob( new knob( knobBright_26 ) ),
|
||||
m_arpTimeKnob( new TempoSyncKnob( knobBright_26 ) ),
|
||||
m_arpGateKnob( new knob( knobBright_26 ) ),
|
||||
m_arpDirectionComboBox( new comboBox() ),
|
||||
m_arpModeComboBox( new comboBox() )
|
||||
{
|
||||
move( ARP_GROUPBOX_X, ARP_GROUPBOX_Y );
|
||||
setFixedSize( 250, ARP_GROUPBOX_HEIGHT );
|
||||
m_arpGroupBox->setGeometry( 0, 0, ARP_GROUPBOX_WIDTH,
|
||||
ARP_GROUPBOX_HEIGHT );
|
||||
QHBoxLayout* topLayout = new QHBoxLayout( this );
|
||||
topLayout->setMargin( 0 );
|
||||
topLayout->addWidget( m_arpGroupBox );
|
||||
|
||||
QGridLayout* mainLayout = new QGridLayout( m_arpGroupBox );
|
||||
mainLayout->setContentsMargins( 8, 18, 8, 8 );
|
||||
mainLayout->setColumnStretch( 0, 1 );
|
||||
mainLayout->setHorizontalSpacing( 20 );
|
||||
mainLayout->setVerticalSpacing( 1 );
|
||||
|
||||
m_arpGroupBox->setWhatsThis(
|
||||
tr( "An arpeggio is a method playing (especially plucked) "
|
||||
@@ -130,13 +129,8 @@ ArpeggiatorView::ArpeggiatorView( Arpeggiator * _arp, QWidget * _parent ) :
|
||||
"possible chords, you can select." ) );
|
||||
|
||||
|
||||
m_arpComboBox->setGeometry( 10, 25, 140, 22 );
|
||||
|
||||
|
||||
m_arpRangeKnob->setLabel( tr( "RANGE" ) );
|
||||
m_arpRangeKnob->move( 164, 24 );
|
||||
m_arpRangeKnob->setHintText( tr( "Arpeggio range:" ) + " ", " " +
|
||||
tr( "octave(s)" ) );
|
||||
m_arpRangeKnob->setHintText( tr( "Arpeggio range:" ) + " ", " " + tr( "octave(s)" ) );
|
||||
m_arpRangeKnob->setWhatsThis(
|
||||
tr( "Use this knob for setting the arpeggio range in octaves. "
|
||||
"The selected arpeggio will be played within specified "
|
||||
@@ -144,9 +138,7 @@ ArpeggiatorView::ArpeggiatorView( Arpeggiator * _arp, QWidget * _parent ) :
|
||||
|
||||
|
||||
m_arpTimeKnob->setLabel( tr( "TIME" ) );
|
||||
m_arpTimeKnob->move( 164, 70 );
|
||||
m_arpTimeKnob->setHintText( tr( "Arpeggio time:" ) + " ", " " +
|
||||
tr( "ms" ) );
|
||||
m_arpTimeKnob->setHintText( tr( "Arpeggio time:" ) + " ", " " + tr( "ms" ) );
|
||||
m_arpTimeKnob->setWhatsThis(
|
||||
tr( "Use this knob for setting the arpeggio time in "
|
||||
"milliseconds. The arpeggio time specifies how long "
|
||||
@@ -154,7 +146,6 @@ ArpeggiatorView::ArpeggiatorView( Arpeggiator * _arp, QWidget * _parent ) :
|
||||
|
||||
|
||||
m_arpGateKnob->setLabel( tr( "GATE" ) );
|
||||
m_arpGateKnob->move( 204, 70 );
|
||||
m_arpGateKnob->setHintText( tr( "Arpeggio gate:" ) + " ", tr( "%" ) );
|
||||
m_arpGateKnob->setWhatsThis(
|
||||
tr( "Use this knob for setting the arpeggio gate. The "
|
||||
@@ -162,24 +153,34 @@ ArpeggiatorView::ArpeggiatorView( Arpeggiator * _arp, QWidget * _parent ) :
|
||||
"arpeggio-tone that should be played. With this you "
|
||||
"can make cool staccato arpeggios." ) );
|
||||
|
||||
m_arpDirectionLbl = new QLabel( tr( "Direction:" ), m_arpGroupBox );
|
||||
m_arpDirectionLbl->setGeometry( 10, 60, 64, 10 );
|
||||
m_arpDirectionLbl->setFont( pointSize<8>( m_arpDirectionLbl->font() ) );
|
||||
QLabel* arpChordLabel = new QLabel( tr( "Chord:" ) );
|
||||
arpChordLabel->setFont( pointSize<8>( arpChordLabel->font() ) );
|
||||
|
||||
m_arpDirectionComboBox->setGeometry( 10, 74, 140, 22 );
|
||||
QLabel* arpDirectionLabel = new QLabel( tr( "Direction:" ) );
|
||||
arpDirectionLabel->setFont( pointSize<8>( arpDirectionLabel->font() ) );
|
||||
|
||||
QLabel* arpModeLabel = new QLabel( tr( "Mode:" ) );
|
||||
arpModeLabel->setFont( pointSize<8>( arpModeLabel->font() ) );
|
||||
|
||||
QLabel * mode_lbl = new QLabel( tr( "Mode:" ), m_arpGroupBox );
|
||||
mode_lbl->setGeometry( 10, 110, 64, 10 );
|
||||
mode_lbl->setFont( pointSize<8>( mode_lbl->font() ) );
|
||||
mainLayout->addWidget( arpChordLabel, 0, 0 );
|
||||
mainLayout->addWidget( m_arpComboBox, 1, 0 );
|
||||
mainLayout->addWidget( arpDirectionLabel, 3, 0 );
|
||||
mainLayout->addWidget( m_arpDirectionComboBox, 4, 0 );
|
||||
mainLayout->addWidget( arpModeLabel, 6, 0 );
|
||||
mainLayout->addWidget( m_arpModeComboBox, 7, 0 );
|
||||
|
||||
m_arpModeComboBox->setGeometry( 10, 124, 128, 22 );
|
||||
mainLayout->addWidget( m_arpRangeKnob, 0, 1, 2, 1, Qt::AlignHCenter );
|
||||
mainLayout->addWidget( m_arpTimeKnob, 3, 1, 2, 1, Qt::AlignHCenter );
|
||||
mainLayout->addWidget( m_arpGateKnob, 6, 1, 2, 1, Qt::AlignHCenter );
|
||||
|
||||
mainLayout->setRowMinimumHeight( 2, 10 );
|
||||
mainLayout->setRowMinimumHeight( 5, 10 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ArpeggiatorView::~ArpeggiatorView()
|
||||
InstrumentFunctionArpeggioView::~InstrumentFunctionArpeggioView()
|
||||
{
|
||||
delete m_arpGroupBox;
|
||||
}
|
||||
@@ -187,9 +188,9 @@ ArpeggiatorView::~ArpeggiatorView()
|
||||
|
||||
|
||||
|
||||
void ArpeggiatorView::modelChanged()
|
||||
void InstrumentFunctionArpeggioView::modelChanged()
|
||||
{
|
||||
m_a = castModel<Arpeggiator>();
|
||||
m_a = castModel<InstrumentFunctionArpeggio>();
|
||||
m_arpGroupBox->setModel( &m_a->m_arpEnabledModel );
|
||||
m_arpComboBox->setModel( &m_a->m_arpModel );
|
||||
m_arpRangeKnob->setModel( &m_a->m_arpRangeModel );
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* combobox.cpp - implementation of LMMS-combobox
|
||||
* combobox.cpp - implementation of LMMS combobox
|
||||
*
|
||||
* Copyright (c) 2006-2011 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2008-2009 Paul Giblock <pgib/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
@@ -88,6 +88,22 @@ comboBox::~comboBox()
|
||||
|
||||
|
||||
|
||||
QSize comboBox::sizeHint() const
|
||||
{
|
||||
int maxTextWidth = 0;
|
||||
for( int i = 0; i < model()->size(); ++i )
|
||||
{
|
||||
int w = fontMetrics().width( model()->itemText( i ) );
|
||||
if( w > maxTextWidth )
|
||||
{
|
||||
maxTextWidth = w;
|
||||
}
|
||||
}
|
||||
|
||||
return QSize( 32 + maxTextWidth, 22 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void comboBox::contextMenuEvent( QContextMenuEvent * _me )
|
||||
{
|
||||
|
||||
@@ -45,6 +45,7 @@ cpuloadWidget::cpuloadWidget( QWidget * _parent ) :
|
||||
setFixedSize( m_background.width(), m_background.height() );
|
||||
|
||||
m_temp = QPixmap( width(), height() );
|
||||
|
||||
|
||||
connect( &m_updateTimer, SIGNAL( timeout() ),
|
||||
this, SLOT( updateCpuLoad() ) );
|
||||
@@ -66,7 +67,8 @@ void cpuloadWidget::paintEvent( QPaintEvent * )
|
||||
if( m_changed == true )
|
||||
{
|
||||
m_changed = false;
|
||||
|
||||
|
||||
m_temp.fill( QColor(0,0,0,0) );
|
||||
QPainter p( &m_temp );
|
||||
p.drawPixmap( 0, 0, m_background );
|
||||
|
||||
|
||||
@@ -290,7 +290,7 @@ void fader::paintEvent( QPaintEvent * ev)
|
||||
|
||||
if( m_persistentPeak_L > 0.05 )
|
||||
{
|
||||
painter.fillRect( QRect( 2, persistentPeak_L, 4, 1 ), (m_persistentPeak_L < 1.0 )? QColor( 74, 253, 133) : QColor( 255, 100, 100));
|
||||
painter.fillRect( QRect( 2, persistentPeak_L, 7, 1 ), (m_persistentPeak_L < 1.0 )? QColor( 74, 253, 133) : QColor( 255, 100, 100));
|
||||
}
|
||||
|
||||
int peak_R = calculateDisplayPeak( m_fPeakValue_R - m_fMinPeak );
|
||||
@@ -299,7 +299,7 @@ void fader::paintEvent( QPaintEvent * ev)
|
||||
|
||||
if( m_persistentPeak_R > 0.05 )
|
||||
{
|
||||
painter.fillRect( QRect( 16, persistentPeak_R, 4, 1 ), (m_persistentPeak_R < 1.0 )? QColor( 74, 253, 133) : QColor( 255, 100, 100));
|
||||
painter.fillRect( QRect( 14, persistentPeak_R, 7, 1 ), (m_persistentPeak_R < 1.0 )? QColor( 74, 253, 133) : QColor( 255, 100, 100));
|
||||
}
|
||||
|
||||
// knob
|
||||
|
||||
@@ -482,6 +482,25 @@ void graphModel::setWaveToNoise()
|
||||
emit samplesChanged( 0, length() - 1 );
|
||||
};
|
||||
|
||||
QString graphModel::setWaveToUser()
|
||||
{
|
||||
SampleBuffer * sampleBuffer = new SampleBuffer;
|
||||
QString fileName = sampleBuffer->openAndSetAudioFile();
|
||||
if( fileName.isEmpty() == false )
|
||||
{
|
||||
for( int i = 0; i < length(); i++ )
|
||||
{
|
||||
m_samples[i] = sampleBuffer->userWaveSample(
|
||||
i / static_cast<float>( length() ) );
|
||||
}
|
||||
}
|
||||
|
||||
sharedObject::unref( sampleBuffer );
|
||||
|
||||
emit samplesChanged( 0, length() - 1 );
|
||||
return fileName;
|
||||
};
|
||||
|
||||
|
||||
|
||||
void graphModel::smooth()
|
||||
|
||||
@@ -352,6 +352,7 @@ void knob::drawKnob( QPainter * _p )
|
||||
}
|
||||
case knobDark_28:
|
||||
{
|
||||
p.setPen( QPen( QApplication::palette().color( QPalette::Active, QPalette::WindowText ), 2 ) );
|
||||
const float rb = qMax<float>( ( radius - 10 ) / 3.0,
|
||||
0.0 );
|
||||
const float re = qMax<float>( ( radius - 4 ), 0.0 );
|
||||
@@ -379,7 +380,7 @@ void knob::drawKnob( QPainter * _p )
|
||||
float knob::getValue( const QPoint & _p )
|
||||
{
|
||||
const float SMOOTH_FACTOR = 0.125f;
|
||||
int yDist = (_p.y() - m_origMousePos.y()) * SMOOTH_FACTOR;
|
||||
float yDist = (_p.y() - m_origMousePos.y()) * SMOOTH_FACTOR;
|
||||
if( engine::mainWindow()->isShiftPressed() )
|
||||
{
|
||||
return m_origValue - (yDist * model()->step<float>());
|
||||
|
||||
@@ -58,7 +58,7 @@ trackLabelButton::trackLabelButton( trackView * _tv, QWidget * _parent ) :
|
||||
setFixedSize( 160, 29 );
|
||||
}
|
||||
|
||||
setIconSize( QSize( 32, 32 ) );
|
||||
setIconSize( QSize( 24, 24 ) );
|
||||
setText( " " );
|
||||
|
||||
connect( m_trackView->getTrack(), SIGNAL( dataChanged() ),
|
||||
|
||||
@@ -141,7 +141,7 @@ void visualizationWidget::paintEvent( QPaintEvent * )
|
||||
// and set color according to that...
|
||||
if( max_level * master_output < 0.9 )
|
||||
{
|
||||
p.setPen( QColor( 128, 224, 128 ) );
|
||||
p.setPen( QColor( 71, 253, 133 ) );
|
||||
}
|
||||
else if( max_level * master_output < 1.0 )
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ AutomationTrack::~AutomationTrack()
|
||||
|
||||
|
||||
|
||||
bool AutomationTrack::play( const midiTime & _start, const fpp_t _frames,
|
||||
bool AutomationTrack::play( const MidiTime & _start, const fpp_t _frames,
|
||||
const f_cnt_t _frame_base, int _tco_num )
|
||||
{
|
||||
if( isMuted() )
|
||||
@@ -77,7 +77,7 @@ bool AutomationTrack::play( const midiTime & _start, const fpp_t _frames,
|
||||
{
|
||||
continue;
|
||||
}
|
||||
midiTime cur_start = _start;
|
||||
MidiTime cur_start = _start;
|
||||
if( _tco_num < 0 )
|
||||
{
|
||||
cur_start -= p->startPosition();
|
||||
@@ -98,7 +98,7 @@ trackView * AutomationTrack::createView( TrackContainerView* tcv )
|
||||
|
||||
|
||||
|
||||
trackContentObject * AutomationTrack::createTCO( const midiTime & )
|
||||
trackContentObject * AutomationTrack::createTCO( const MidiTime & )
|
||||
{
|
||||
return new AutomationPattern( this );
|
||||
}
|
||||
@@ -168,11 +168,11 @@ void AutomationTrackView::dropEvent( QDropEvent * _de )
|
||||
journallingObject( val.toInt() ) );
|
||||
if( mod != NULL )
|
||||
{
|
||||
midiTime pos = midiTime( trackContainerView()->
|
||||
MidiTime pos = MidiTime( trackContainerView()->
|
||||
currentPosition() +
|
||||
( _de->pos().x() -
|
||||
getTrackContentWidget()->x() ) *
|
||||
midiTime::ticksPerTact() /
|
||||
MidiTime::ticksPerTact() /
|
||||
static_cast<int>( trackContainerView()->pixelsPerTact() ) )
|
||||
.toNearestTact();
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <QtCore/QQueue>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QCloseEvent>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QLayout>
|
||||
#include <QtGui/QLineEdit>
|
||||
@@ -38,6 +37,7 @@
|
||||
#include <QtGui/QMdiSubWindow>
|
||||
#include <QtGui/QPainter>
|
||||
|
||||
#include "FileDialog.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "AudioPort.h"
|
||||
#include "AutomationPattern.h"
|
||||
@@ -103,13 +103,13 @@ InstrumentTrack::InstrumentTrack( TrackContainer* tc ) :
|
||||
tr( "Base note" ) ),
|
||||
m_volumeModel( DefaultVolume, MinVolume, MaxVolume, 0.1f, this, tr( "Volume" ) ),
|
||||
m_panningModel( DefaultPanning, PanningLeft, PanningRight, 0.1f, this, tr( "Panning" ) ),
|
||||
m_pitchModel( 0, -100, 100, 1, this, tr( "Pitch" ) ),
|
||||
m_pitchModel( 0, MinPitchDefault, MaxPitchDefault, 1, this, tr( "Pitch" ) ),
|
||||
m_pitchRangeModel( 1, 1, 24, this, tr( "Pitch range" ) ),
|
||||
m_effectChannelModel( 0, 0, NumFxChannels, this, tr( "FX channel" ) ),
|
||||
m_instrument( NULL ),
|
||||
m_soundShaping( this ),
|
||||
m_arpeggiator( this ),
|
||||
m_chordCreator( this ),
|
||||
m_arpeggio( this ),
|
||||
m_noteStacking( this ),
|
||||
m_piano( this )
|
||||
{
|
||||
m_pitchModel.setCenterValue( 0 );
|
||||
@@ -202,15 +202,15 @@ void InstrumentTrack::processAudioBuffer( sampleFrame * _buf,
|
||||
|
||||
|
||||
|
||||
midiEvent InstrumentTrack::applyMasterKey( const midiEvent & _me )
|
||||
MidiEvent InstrumentTrack::applyMasterKey( const MidiEvent& event )
|
||||
{
|
||||
midiEvent copy( _me );
|
||||
switch( _me.m_type )
|
||||
MidiEvent copy( event );
|
||||
switch( event.type() )
|
||||
{
|
||||
case MidiNoteOn:
|
||||
case MidiNoteOff:
|
||||
case MidiKeyPressure:
|
||||
copy.key() = masterKey( _me.key() );
|
||||
copy.setKey( masterKey( event.key() ) );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -221,109 +221,69 @@ midiEvent InstrumentTrack::applyMasterKey( const midiEvent & _me )
|
||||
|
||||
|
||||
|
||||
void InstrumentTrack::processInEvent( const midiEvent & _me,
|
||||
const midiTime & _time )
|
||||
void InstrumentTrack::processInEvent( const MidiEvent& event, const MidiTime& time )
|
||||
{
|
||||
engine::mixer()->lock();
|
||||
|
||||
// in the special case this event comes from a MIDI port, the instrument
|
||||
// is MIDI based (VST plugin, Sf2Player etc.) and the user did not set
|
||||
// a dedicated MIDI output channel, directly pass the MIDI event to the
|
||||
// instrument plugin
|
||||
if( _me.isFromMidiPort() && m_instrument->isMidiBased()/* &&
|
||||
midiPort()->realOutputChannel() < 0 */ )
|
||||
{
|
||||
m_instrument->handleMidiEvent( _me, _time );
|
||||
engine::mixer()->unlock();
|
||||
return;
|
||||
}
|
||||
bool eventHandled = false;
|
||||
|
||||
switch( _me.m_type )
|
||||
switch( event.type() )
|
||||
{
|
||||
// we don't send MidiNoteOn, MidiNoteOff and MidiKeyPressure
|
||||
// events to instrument as notePlayHandle will send them on its
|
||||
// own
|
||||
case MidiNoteOn:
|
||||
if( _me.velocity() > 0 )
|
||||
case MidiNoteOn:
|
||||
if( event.velocity() > 0 )
|
||||
{
|
||||
if( m_notes[_me.key()] == NULL )
|
||||
if( m_notes[event.key()] == NULL )
|
||||
{
|
||||
if( !configManager::inst()->value( "ui",
|
||||
"manualchannelpiano" ).toInt() )
|
||||
{
|
||||
m_piano.setKeyState(
|
||||
_me.key(), true );
|
||||
}
|
||||
// create temporary note
|
||||
note n;
|
||||
n.setKey( _me.key() );
|
||||
n.setVolume( _me.getVolume() );
|
||||
|
||||
// create (timed) note-play-handle
|
||||
notePlayHandle * nph = new
|
||||
notePlayHandle( this,
|
||||
_time.frames(
|
||||
engine::framesPerTick() ),
|
||||
typeInfo<f_cnt_t>::max() / 2,
|
||||
n );
|
||||
if( engine::mixer()->addPlayHandle(
|
||||
nph ) )
|
||||
notePlayHandle* nph = new notePlayHandle( this, time.frames( engine::framesPerTick() ),
|
||||
typeInfo<f_cnt_t>::max() / 2,
|
||||
note( MidiTime(), MidiTime(), event.key(), event.volume() ),
|
||||
NULL, false, event.channel(),
|
||||
notePlayHandle::OriginMidiInput );
|
||||
if( engine::mixer()->addPlayHandle( nph ) )
|
||||
{
|
||||
m_notes[_me.key()] = nph;
|
||||
m_notes[event.key()] = nph;
|
||||
}
|
||||
|
||||
emit noteOn( n );
|
||||
}
|
||||
|
||||
eventHandled = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case MidiNoteOff:
|
||||
{
|
||||
notePlayHandle * n = m_notes[_me.key()];
|
||||
if( n != NULL )
|
||||
if( m_notes[event.key()] != NULL )
|
||||
{
|
||||
// create dummy-note which has the same length
|
||||
// as the played note for sending it later
|
||||
// to all slots connected to signal noteOff()
|
||||
// this is for example needed by piano-roll for
|
||||
// recording notes into a pattern
|
||||
note done_note(
|
||||
midiTime( static_cast<f_cnt_t>(
|
||||
n->totalFramesPlayed() /
|
||||
engine::framesPerTick() ) ),
|
||||
0,
|
||||
n->key(),
|
||||
n->getVolume(),
|
||||
n->getPanning() );
|
||||
|
||||
n->noteOff();
|
||||
m_notes[_me.key()] = NULL;
|
||||
|
||||
emit noteOff( done_note );
|
||||
// do actual note off and remove internal reference to NotePlayHandle (which itself will
|
||||
// be deleted later automatically)
|
||||
m_notes[event.key()]->noteOff();
|
||||
m_notes[event.key()] = NULL;
|
||||
}
|
||||
eventHandled = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case MidiKeyPressure:
|
||||
if( m_notes[_me.key()] != NULL )
|
||||
if( m_notes[event.key()] != NULL )
|
||||
{
|
||||
m_notes[_me.key()]->setVolume( _me.getVolume() );
|
||||
// setVolume() calls processOutEvent() with MidiKeyPressure so the
|
||||
// attached instrument will receive the event as well
|
||||
m_notes[event.key()]->setVolume( event.volume() );
|
||||
}
|
||||
eventHandled = true;
|
||||
break;
|
||||
|
||||
case MidiPitchBend:
|
||||
// updatePitch() is connected to
|
||||
// m_pitchModel::dataChanged() which will send out
|
||||
// updatePitch() is connected to m_pitchModel::dataChanged() which will send out
|
||||
// MidiPitchBend events
|
||||
m_pitchModel.setValue( m_pitchModel.minValue() +
|
||||
_me.m_data.m_param[0] *
|
||||
m_pitchModel.range() / 16384 );
|
||||
m_pitchModel.setValue( m_pitchModel.minValue() + event.pitchBend() * m_pitchModel.range() / MidiMaxPitchBend );
|
||||
break;
|
||||
|
||||
case MidiControlChange:
|
||||
if( _me.controllerNumber() == MidiControllerSustain )
|
||||
if( event.controllerNumber() == MidiControllerSustain )
|
||||
{
|
||||
if( _me.controllerValue() > MidiMaxControllerValue/2 )
|
||||
if( event.controllerValue() > MidiMaxControllerValue/2 )
|
||||
{
|
||||
m_sustainPedalPressed = true;
|
||||
}
|
||||
@@ -332,120 +292,95 @@ void InstrumentTrack::processInEvent( const midiEvent & _me,
|
||||
m_sustainPedalPressed = false;
|
||||
}
|
||||
}
|
||||
if( _me.controllerNumber() == MidiControllerAllSoundOff ||
|
||||
_me.controllerNumber() == MidiControllerAllNotesOff ||
|
||||
_me.controllerNumber() == MidiControllerOmniOn ||
|
||||
_me.controllerNumber() == MidiControllerOmniOff ||
|
||||
_me.controllerNumber() == MidiControllerMonoOn ||
|
||||
_me.controllerNumber() == MidiControllerPolyOn )
|
||||
if( event.controllerNumber() == MidiControllerAllSoundOff ||
|
||||
event.controllerNumber() == MidiControllerAllNotesOff ||
|
||||
event.controllerNumber() == MidiControllerOmniOn ||
|
||||
event.controllerNumber() == MidiControllerOmniOff ||
|
||||
event.controllerNumber() == MidiControllerMonoOn ||
|
||||
event.controllerNumber() == MidiControllerPolyOn )
|
||||
{
|
||||
silenceAllNotes();
|
||||
}
|
||||
m_instrument->handleMidiEvent( _me, _time );
|
||||
break;
|
||||
|
||||
case MidiProgramChange:
|
||||
m_instrument->handleMidiEvent( _me, _time );
|
||||
break;
|
||||
|
||||
case MidiMetaEvent:
|
||||
// handle special cases such as note panning
|
||||
switch( _me.m_metaEvent )
|
||||
switch( event.metaEvent() )
|
||||
{
|
||||
case MidiNotePanning:
|
||||
if( m_notes[_me.key()] != NULL )
|
||||
if( m_notes[event.key()] != NULL )
|
||||
{
|
||||
m_notes[_me.key()]->setPanning( _me.getPanning() );
|
||||
eventHandled = true;
|
||||
m_notes[event.key()]->setPanning( event.panning() );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf( "instrument-track: unhandled "
|
||||
"MIDI meta event: %i\n",
|
||||
_me.m_metaEvent );
|
||||
qWarning( "InstrumentTrack: unhandled MIDI meta event: %i", event.metaEvent() );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if( !m_instrument->handleMidiEvent( _me, _time ) )
|
||||
{
|
||||
printf( "instrument-track: unhandled "
|
||||
"MIDI event %d\n", _me.m_type );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if( eventHandled == false && instrument()->handleMidiEvent( event, time ) == false )
|
||||
{
|
||||
qWarning( "InstrumentTrack: unhandled MIDI event %d", event.type() );
|
||||
}
|
||||
|
||||
engine::mixer()->unlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void InstrumentTrack::processOutEvent( const midiEvent & _me,
|
||||
const midiTime & _time )
|
||||
void InstrumentTrack::processOutEvent( const MidiEvent& event, const MidiTime& time )
|
||||
{
|
||||
int k;
|
||||
// do nothing if we do not have an instrument instance (e.g. when loading settings)
|
||||
if( m_instrument == NULL )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch( _me.m_type )
|
||||
const MidiEvent transposedEvent = applyMasterKey( event );
|
||||
const int key = transposedEvent.key();
|
||||
|
||||
switch( event.type() )
|
||||
{
|
||||
case MidiNoteOn:
|
||||
if( !configManager::inst()->value( "ui",
|
||||
"manualchannelpiano" ).toInt() )
|
||||
m_piano.setKeyState( event.key(), true ); // event.key() = original key
|
||||
|
||||
if( key >= 0 && key < NumKeys )
|
||||
{
|
||||
m_piano.setKeyState( _me.key(), true );
|
||||
}
|
||||
if( !configManager::inst()->value( "ui",
|
||||
"disablechannelactivityindicators" ).toInt() )
|
||||
{
|
||||
if( m_notes[_me.key()] == NULL )
|
||||
if( m_runningMidiNotes[key] > 0 )
|
||||
{
|
||||
emit newNote();
|
||||
m_instrument->handleMidiEvent( MidiEvent( MidiNoteOff, midiPort()->realOutputChannel(), key, 0 ), time );
|
||||
}
|
||||
}
|
||||
k = masterKey( _me.key() );
|
||||
if( k >= 0 && k < NumKeys )
|
||||
{
|
||||
if( m_runningMidiNotes[k] > 0 )
|
||||
{
|
||||
m_instrument->handleMidiEvent(
|
||||
midiEvent( MidiNoteOff, midiPort()->realOutputChannel(), k, 0 ),
|
||||
_time );
|
||||
}
|
||||
++m_runningMidiNotes[k];
|
||||
m_instrument->handleMidiEvent(
|
||||
midiEvent( MidiNoteOn, midiPort()->realOutputChannel(), k,
|
||||
_me.velocity() ), _time );
|
||||
++m_runningMidiNotes[key];
|
||||
m_instrument->handleMidiEvent( MidiEvent( MidiNoteOn, midiPort()->realOutputChannel(), key, event.velocity() ), time );
|
||||
|
||||
emit newNote();
|
||||
}
|
||||
break;
|
||||
|
||||
case MidiNoteOff:
|
||||
if( !configManager::inst()->value( "ui",
|
||||
"manualchannelpiano" ).toInt() )
|
||||
m_piano.setKeyState( event.key(), false ); // event.key() = original key
|
||||
|
||||
if( key >= 0 && key < NumKeys && --m_runningMidiNotes[key] <= 0 )
|
||||
{
|
||||
m_piano.setKeyState( _me.key(), false );
|
||||
}
|
||||
k = masterKey( _me.key() );
|
||||
if( k >= 0 && k < NumKeys &&
|
||||
--m_runningMidiNotes[k] <= 0 )
|
||||
{
|
||||
m_runningMidiNotes[k] = qMax( 0, m_runningMidiNotes[k] );
|
||||
m_instrument->handleMidiEvent(
|
||||
midiEvent( MidiNoteOff, midiPort()->realOutputChannel(), k, 0 ),
|
||||
_time );
|
||||
m_runningMidiNotes[key] = qMax( 0, m_runningMidiNotes[key] );
|
||||
m_instrument->handleMidiEvent( MidiEvent( MidiNoteOff, midiPort()->realOutputChannel(), key, 0 ), time );
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if( m_instrument != NULL )
|
||||
{
|
||||
m_instrument->handleMidiEvent(
|
||||
applyMasterKey( _me ),
|
||||
_time );
|
||||
}
|
||||
m_instrument->handleMidiEvent( transposedEvent, time );
|
||||
break;
|
||||
}
|
||||
|
||||
// if appropriate, midi-port does futher routing
|
||||
m_midiPort.processOutEvent( _me, _time );
|
||||
m_midiPort.processOutEvent( event, time );
|
||||
}
|
||||
|
||||
|
||||
@@ -490,8 +425,8 @@ void InstrumentTrack::playNote( notePlayHandle * _n,
|
||||
{
|
||||
// arpeggio- and chord-widget has to do its work -> adding sub-notes
|
||||
// for chords/arpeggios
|
||||
m_chordCreator.processNote( _n );
|
||||
m_arpeggiator.processNote( _n );
|
||||
m_noteStacking.processNote( _n );
|
||||
m_arpeggio.processNote( _n );
|
||||
|
||||
if( !_n->isArpeggioBaseNote() && m_instrument != NULL )
|
||||
{
|
||||
@@ -515,24 +450,11 @@ QString InstrumentTrack::instrumentName() const
|
||||
|
||||
|
||||
|
||||
void InstrumentTrack::deleteNotePluginData( notePlayHandle * _n )
|
||||
void InstrumentTrack::deleteNotePluginData( notePlayHandle* n )
|
||||
{
|
||||
if( m_instrument != NULL )
|
||||
{
|
||||
m_instrument->deleteNotePluginData( _n );
|
||||
}
|
||||
|
||||
// Notes deleted when keys still pressed
|
||||
if( m_notes[_n->key()] == _n )
|
||||
{
|
||||
note done_note( midiTime( static_cast<f_cnt_t>(
|
||||
_n->totalFramesPlayed() /
|
||||
engine::framesPerTick() ) ),
|
||||
0, _n->key(),
|
||||
_n->getVolume(), _n->getPanning() );
|
||||
_n->noteOff();
|
||||
m_notes[_n->key()] = NULL;
|
||||
emit noteOff( done_note );
|
||||
m_instrument->deleteNotePluginData( n );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,9 +503,8 @@ void InstrumentTrack::updateBaseNote()
|
||||
void InstrumentTrack::updatePitch()
|
||||
{
|
||||
updateBaseNote();
|
||||
processOutEvent( midiEvent( MidiPitchBend,
|
||||
midiPort()->realOutputChannel(),
|
||||
midiPitch() ), 0 );
|
||||
|
||||
processOutEvent( MidiEvent( MidiPitchBend, midiPort()->realOutputChannel(), midiPitch() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -592,7 +513,13 @@ void InstrumentTrack::updatePitch()
|
||||
void InstrumentTrack::updatePitchRange()
|
||||
{
|
||||
const int r = m_pitchRangeModel.value();
|
||||
m_pitchModel.setRange( -100 * r, 100 * r );
|
||||
m_pitchModel.setRange( MinPitchDefault * r, MaxPitchDefault * r );
|
||||
|
||||
processOutEvent( MidiEvent( MidiControlChange, midiPort()->realOutputChannel(),
|
||||
MidiControllerRegisteredParameterNumberLSB, MidiPitchBendSensitivityRPN & 0x7F ) );
|
||||
processOutEvent( MidiEvent( MidiControlChange, midiPort()->realOutputChannel(),
|
||||
MidiControllerRegisteredParameterNumberMSB, ( MidiPitchBendSensitivityRPN >> 8 ) & 0x7F ) );
|
||||
processOutEvent( MidiEvent( MidiControlChange, midiPort()->realOutputChannel(), MidiControllerDataEntry, midiPitchRange() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -616,7 +543,7 @@ void InstrumentTrack::removeMidiPortNode( multimediaProject & _mmp )
|
||||
|
||||
|
||||
|
||||
bool InstrumentTrack::play( const midiTime & _start, const fpp_t _frames,
|
||||
bool InstrumentTrack::play( const MidiTime & _start, const fpp_t _frames,
|
||||
const f_cnt_t _offset, int _tco_num )
|
||||
{
|
||||
const float frames_per_tick = engine::framesPerTick();
|
||||
@@ -657,7 +584,7 @@ bool InstrumentTrack::play( const midiTime & _start, const fpp_t _frames,
|
||||
{
|
||||
continue;
|
||||
}
|
||||
midiTime cur_start = _start;
|
||||
MidiTime cur_start = _start;
|
||||
if( _tco_num < 0 )
|
||||
{
|
||||
cur_start -= p->startPosition();
|
||||
@@ -747,7 +674,7 @@ bool InstrumentTrack::play( const midiTime & _start, const fpp_t _frames,
|
||||
|
||||
|
||||
|
||||
trackContentObject * InstrumentTrack::createTCO( const midiTime & )
|
||||
trackContentObject * InstrumentTrack::createTCO( const MidiTime & )
|
||||
{
|
||||
return new pattern( this );
|
||||
}
|
||||
@@ -763,77 +690,50 @@ trackView * InstrumentTrack::createView( TrackContainerView* tcv )
|
||||
|
||||
|
||||
|
||||
void InstrumentTrack::saveTrackSpecificSettings( QDomDocument & _doc,
|
||||
QDomElement & _this )
|
||||
void InstrumentTrack::saveTrackSpecificSettings( QDomDocument& doc, QDomElement & thisElement )
|
||||
{
|
||||
m_volumeModel.saveSettings( _doc, _this, "vol" );
|
||||
m_panningModel.saveSettings( _doc, _this, "pan" );
|
||||
m_pitchModel.saveSettings( _doc, _this, "pitch" );
|
||||
m_pitchRangeModel.saveSettings( _doc, _this, "pitchrange" );
|
||||
m_volumeModel.saveSettings( doc, thisElement, "vol" );
|
||||
m_panningModel.saveSettings( doc, thisElement, "pan" );
|
||||
m_pitchModel.saveSettings( doc, thisElement, "pitch" );
|
||||
m_pitchRangeModel.saveSettings( doc, thisElement, "pitchrange" );
|
||||
|
||||
m_effectChannelModel.saveSettings( _doc, _this, "fxch" );
|
||||
m_baseNoteModel.saveSettings( _doc, _this, "basenote" );
|
||||
m_effectChannelModel.saveSettings( doc, thisElement, "fxch" );
|
||||
m_baseNoteModel.saveSettings( doc, thisElement, "basenote" );
|
||||
|
||||
if( m_instrument != NULL )
|
||||
{
|
||||
QDomElement i = _doc.createElement( "instrument" );
|
||||
QDomElement i = doc.createElement( "instrument" );
|
||||
i.setAttribute( "name", m_instrument->descriptor()->name );
|
||||
m_instrument->saveState( _doc, i );
|
||||
_this.appendChild( i );
|
||||
m_instrument->saveState( doc, i );
|
||||
thisElement.appendChild( i );
|
||||
}
|
||||
m_soundShaping.saveState( _doc, _this );
|
||||
m_chordCreator.saveState( _doc, _this );
|
||||
m_arpeggiator.saveState( _doc, _this );
|
||||
m_midiPort.saveState( _doc, _this );
|
||||
m_audioPort.effects()->saveState( _doc, _this );
|
||||
m_soundShaping.saveState( doc, thisElement );
|
||||
m_noteStacking.saveState( doc, thisElement );
|
||||
m_arpeggio.saveState( doc, thisElement );
|
||||
m_midiPort.saveState( doc, thisElement );
|
||||
m_audioPort.effects()->saveState( doc, thisElement );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void InstrumentTrack::loadTrackSpecificSettings( const QDomElement & _this )
|
||||
void InstrumentTrack::loadTrackSpecificSettings( const QDomElement & thisElement )
|
||||
{
|
||||
silenceAllNotes();
|
||||
|
||||
engine::mixer()->lock();
|
||||
|
||||
m_volumeModel.loadSettings( _this, "vol" );
|
||||
|
||||
// compat-hacks - move to mmp::upgrade
|
||||
if( _this.hasAttribute( "surpos" ) || _this.hasAttribute( "surpos-x" )
|
||||
|| !_this.firstChildElement( "automationpattern" ).
|
||||
firstChildElement( "surpos-x" ).isNull() )
|
||||
{
|
||||
surroundAreaModel m( this, this );
|
||||
m.loadSettings( _this, "surpos" );
|
||||
m_panningModel.setValue( m.x() * 100 / SURROUND_AREA_SIZE );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_panningModel.loadSettings( _this, "pan" );
|
||||
}
|
||||
|
||||
m_pitchModel.loadSettings( _this, "pitch" );
|
||||
m_pitchRangeModel.loadSettings( _this, "pitchrange" );
|
||||
m_effectChannelModel.loadSettings( _this, "fxch" );
|
||||
|
||||
if( _this.hasAttribute( "baseoct" ) )
|
||||
{
|
||||
// TODO: move this compat code to mmp.cpp -> upgrade()
|
||||
m_baseNoteModel.setInitValue( _this.
|
||||
attribute( "baseoct" ).toInt()
|
||||
* KeysPerOctave
|
||||
+ _this.attribute( "basetone" ).toInt() );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_baseNoteModel.loadSettings( _this, "basenote" );
|
||||
}
|
||||
m_volumeModel.loadSettings( thisElement, "vol" );
|
||||
m_panningModel.loadSettings( thisElement, "pan" );
|
||||
m_pitchModel.loadSettings( thisElement, "pitch" );
|
||||
m_pitchRangeModel.loadSettings( thisElement, "pitchrange" );
|
||||
m_effectChannelModel.loadSettings( thisElement, "fxch" );
|
||||
m_baseNoteModel.loadSettings( thisElement, "basenote" );
|
||||
|
||||
// clear effect-chain just in case we load an old preset without FX-data
|
||||
m_audioPort.effects()->clear();
|
||||
|
||||
QDomNode node = _this.firstChild();
|
||||
QDomNode node = thisElement.firstChild();
|
||||
while( !node.isNull() )
|
||||
{
|
||||
if( node.isElement() )
|
||||
@@ -842,13 +742,13 @@ void InstrumentTrack::loadTrackSpecificSettings( const QDomElement & _this )
|
||||
{
|
||||
m_soundShaping.restoreState( node.toElement() );
|
||||
}
|
||||
else if( m_chordCreator.nodeName() == node.nodeName() )
|
||||
else if( m_noteStacking.nodeName() == node.nodeName() )
|
||||
{
|
||||
m_chordCreator.restoreState( node.toElement() );
|
||||
m_noteStacking.restoreState( node.toElement() );
|
||||
}
|
||||
else if( m_arpeggiator.nodeName() == node.nodeName() )
|
||||
else if( m_arpeggio.nodeName() == node.nodeName() )
|
||||
{
|
||||
m_arpeggiator.restoreState( node.toElement() );
|
||||
m_arpeggio.restoreState( node.toElement() );
|
||||
}
|
||||
else if( m_midiPort.nodeName() == node.nodeName() )
|
||||
{
|
||||
@@ -862,11 +762,9 @@ void InstrumentTrack::loadTrackSpecificSettings( const QDomElement & _this )
|
||||
{
|
||||
delete m_instrument;
|
||||
m_instrument = NULL;
|
||||
m_instrument = Instrument::instantiate(
|
||||
node.toElement().attribute( "name" ),
|
||||
this );
|
||||
m_instrument->restoreState(
|
||||
node.firstChildElement() );
|
||||
m_instrument = Instrument::instantiate( node.toElement().attribute( "name" ), this );
|
||||
m_instrument->restoreState( node.firstChildElement() );
|
||||
|
||||
emit instrumentChanged();
|
||||
}
|
||||
// compat code - if node-name doesn't match any known
|
||||
@@ -878,19 +776,16 @@ void InstrumentTrack::loadTrackSpecificSettings( const QDomElement & _this )
|
||||
{
|
||||
delete m_instrument;
|
||||
m_instrument = NULL;
|
||||
m_instrument = Instrument::instantiate(
|
||||
node.nodeName(), this );
|
||||
if( m_instrument->nodeName() ==
|
||||
node.nodeName() )
|
||||
m_instrument = Instrument::instantiate( node.nodeName(), this );
|
||||
if( m_instrument->nodeName() == node.nodeName() )
|
||||
{
|
||||
m_instrument->restoreState(
|
||||
node.toElement() );
|
||||
m_instrument->restoreState( node.toElement() );
|
||||
}
|
||||
emit instrumentChanged();
|
||||
}
|
||||
}
|
||||
node = node.nextSibling();
|
||||
}
|
||||
}
|
||||
engine::mixer()->unlock();
|
||||
}
|
||||
|
||||
@@ -1181,9 +1076,7 @@ void InstrumentTrackView::toggleInstrumentWindow( bool _on )
|
||||
|
||||
void InstrumentTrackView::activityIndicatorPressed()
|
||||
{
|
||||
model()->processInEvent(
|
||||
midiEvent( MidiNoteOn, 0, DefaultKey, MidiMaxVelocity ),
|
||||
midiTime() );
|
||||
model()->processInEvent( MidiEvent( MidiNoteOn, 0, DefaultKey, MidiMaxVelocity ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -1191,8 +1084,7 @@ void InstrumentTrackView::activityIndicatorPressed()
|
||||
|
||||
void InstrumentTrackView::activityIndicatorReleased()
|
||||
{
|
||||
model()->processInEvent( midiEvent( MidiNoteOff, 0, DefaultKey, 0 ),
|
||||
midiTime() );
|
||||
model()->processInEvent( MidiEvent( MidiNoteOff, 0, DefaultKey, 0 ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -1203,8 +1095,7 @@ void InstrumentTrackView::midiInSelected()
|
||||
{
|
||||
if( model() )
|
||||
{
|
||||
model()->m_midiPort.setReadable(
|
||||
m_midiInputAction->isChecked() );
|
||||
model()->m_midiPort.setReadable( m_midiInputAction->isChecked() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1215,8 +1106,7 @@ void InstrumentTrackView::midiOutSelected()
|
||||
{
|
||||
if( model() )
|
||||
{
|
||||
model()->m_midiPort.setWritable(
|
||||
m_midiOutputAction->isChecked() );
|
||||
model()->m_midiPort.setWritable( m_midiOutputAction->isChecked() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1351,10 +1241,22 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
|
||||
|
||||
// create tab-widgets
|
||||
m_ssView = new InstrumentSoundShapingView( m_tabWidget );
|
||||
|
||||
// FUNC tab
|
||||
QWidget* instrumentFunctions = new QWidget( m_tabWidget );
|
||||
m_chordView = new ChordCreatorView( &m_track->m_chordCreator, instrumentFunctions );
|
||||
m_arpView= new ArpeggiatorView( &m_track->m_arpeggiator, instrumentFunctions );
|
||||
QVBoxLayout* instrumentFunctionsLayout = new QVBoxLayout( instrumentFunctions );
|
||||
instrumentFunctionsLayout->setMargin( 5 );
|
||||
m_noteStackingView = new InstrumentFunctionNoteStackingView( &m_track->m_noteStacking );
|
||||
m_arpeggioView = new InstrumentFunctionArpeggioView( &m_track->m_arpeggio );
|
||||
|
||||
instrumentFunctionsLayout->addWidget( m_noteStackingView );
|
||||
instrumentFunctionsLayout->addWidget( m_arpeggioView );
|
||||
instrumentFunctionsLayout->addStretch();
|
||||
|
||||
// MIDI tab
|
||||
m_midiView = new InstrumentMidiIOView( m_tabWidget );
|
||||
|
||||
// FX tab
|
||||
m_effectView = new EffectRackView( m_track->m_audioPort.effects(), m_tabWidget );
|
||||
|
||||
m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), 1 );
|
||||
@@ -1407,13 +1309,14 @@ InstrumentTrackWindow::~InstrumentTrackWindow()
|
||||
|
||||
|
||||
|
||||
void InstrumentTrackWindow::setInstrumentTrackView( InstrumentTrackView * _tv )
|
||||
void InstrumentTrackWindow::setInstrumentTrackView( InstrumentTrackView* view )
|
||||
{
|
||||
if( m_itv && _tv )
|
||||
if( m_itv && view )
|
||||
{
|
||||
m_itv->m_tlb->setChecked( false );
|
||||
}
|
||||
m_itv = _tv;
|
||||
|
||||
m_itv = view;
|
||||
}
|
||||
|
||||
|
||||
@@ -1451,8 +1354,8 @@ void InstrumentTrackWindow::modelChanged()
|
||||
}
|
||||
|
||||
m_ssView->setModel( &m_track->m_soundShaping );
|
||||
m_chordView->setModel( &m_track->m_chordCreator );
|
||||
m_arpView->setModel( &m_track->m_arpeggiator );
|
||||
m_noteStackingView->setModel( &m_track->m_noteStacking );
|
||||
m_arpeggioView->setModel( &m_track->m_arpeggio );
|
||||
m_midiView->setModel( &m_track->m_midiPort );
|
||||
m_effectView->setModel( m_track->m_audioPort.effects() );
|
||||
updateName();
|
||||
@@ -1463,28 +1366,27 @@ void InstrumentTrackWindow::modelChanged()
|
||||
|
||||
void InstrumentTrackWindow::saveSettingsBtnClicked()
|
||||
{
|
||||
QFileDialog sfd( this, tr( "Save preset" ), "",
|
||||
tr( "XML preset file (*.xpf)" ) );
|
||||
FileDialog sfd( this, tr( "Save preset" ), "", tr( "XML preset file (*.xpf)" ) );
|
||||
|
||||
QString preset_root = configManager::inst()->userPresetsDir();
|
||||
if( !QDir( preset_root ).exists() )
|
||||
QString presetRoot = configManager::inst()->userPresetsDir();
|
||||
if( !QDir( presetRoot ).exists() )
|
||||
{
|
||||
QDir().mkdir( preset_root );
|
||||
QDir().mkdir( presetRoot );
|
||||
}
|
||||
if( !QDir( preset_root + m_track->instrumentName() ).exists() )
|
||||
if( !QDir( presetRoot + m_track->instrumentName() ).exists() )
|
||||
{
|
||||
QDir( preset_root ).mkdir( m_track->instrumentName() );
|
||||
QDir( presetRoot ).mkdir( m_track->instrumentName() );
|
||||
}
|
||||
|
||||
sfd.setAcceptMode( QFileDialog::AcceptSave );
|
||||
sfd.setDirectory( preset_root + m_track->instrumentName() );
|
||||
sfd.setFileMode( QFileDialog::AnyFile );
|
||||
if( sfd.exec () == QDialog::Accepted &&
|
||||
!sfd.selectedFiles().isEmpty() && sfd.selectedFiles()[0] != ""
|
||||
)
|
||||
sfd.setAcceptMode( FileDialog::AcceptSave );
|
||||
sfd.setDirectory( presetRoot + m_track->instrumentName() );
|
||||
sfd.setFileMode( FileDialog::AnyFile );
|
||||
|
||||
if( sfd.exec() == QDialog::Accepted &&
|
||||
!sfd.selectedFiles().isEmpty() &&
|
||||
!sfd.selectedFiles().first().isEmpty() )
|
||||
{
|
||||
multimediaProject mmp(
|
||||
multimediaProject::InstrumentTrackSettings );
|
||||
multimediaProject mmp( multimediaProject::InstrumentTrackSettings );
|
||||
m_track->setSimpleSerializing();
|
||||
m_track->saveSettings( mmp, mmp.content() );
|
||||
QString f = sfd.selectedFiles()[0];
|
||||
@@ -1515,8 +1417,7 @@ void InstrumentTrackWindow::updateInstrumentView()
|
||||
delete m_instrumentView;
|
||||
if( m_track->m_instrument != NULL )
|
||||
{
|
||||
m_instrumentView = m_track->m_instrument->createView(
|
||||
m_tabWidget );
|
||||
m_instrumentView = m_track->m_instrument->createView( m_tabWidget );
|
||||
m_tabWidget->addTab( m_instrumentView, tr( "PLUGIN" ), 0 );
|
||||
m_tabWidget->setActiveTab( 0 );
|
||||
|
||||
@@ -1528,19 +1429,18 @@ void InstrumentTrackWindow::updateInstrumentView()
|
||||
|
||||
|
||||
|
||||
void InstrumentTrackWindow::textChanged( const QString & _new_name )
|
||||
void InstrumentTrackWindow::textChanged( const QString& newName )
|
||||
{
|
||||
m_track->setName( _new_name );
|
||||
m_track->setName( newName );
|
||||
engine::getSong()->setModified();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void InstrumentTrackWindow::toggleVisibility( bool _on )
|
||||
void InstrumentTrackWindow::toggleVisibility( bool on )
|
||||
{
|
||||
|
||||
if( _on )
|
||||
if( on )
|
||||
{
|
||||
show();
|
||||
parentWidget()->show();
|
||||
@@ -1555,9 +1455,10 @@ void InstrumentTrackWindow::toggleVisibility( bool _on )
|
||||
|
||||
|
||||
|
||||
void InstrumentTrackWindow::closeEvent( QCloseEvent * _ce )
|
||||
void InstrumentTrackWindow::closeEvent( QCloseEvent* event )
|
||||
{
|
||||
_ce->ignore();
|
||||
event->ignore();
|
||||
|
||||
if( engine::mainWindow()->workspace() )
|
||||
{
|
||||
parentWidget()->hide();
|
||||
@@ -1566,6 +1467,7 @@ void InstrumentTrackWindow::closeEvent( QCloseEvent * _ce )
|
||||
{
|
||||
hide();
|
||||
}
|
||||
|
||||
m_itv->m_tlb->setFocus();
|
||||
m_itv->m_tlb->setChecked( false );
|
||||
}
|
||||
@@ -1573,7 +1475,7 @@ void InstrumentTrackWindow::closeEvent( QCloseEvent * _ce )
|
||||
|
||||
|
||||
|
||||
void InstrumentTrackWindow::focusInEvent( QFocusEvent * )
|
||||
void InstrumentTrackWindow::focusInEvent( QFocusEvent* )
|
||||
{
|
||||
m_pianoView->setFocus();
|
||||
}
|
||||
@@ -1581,32 +1483,34 @@ void InstrumentTrackWindow::focusInEvent( QFocusEvent * )
|
||||
|
||||
|
||||
|
||||
void InstrumentTrackWindow::dragEnterEventGeneric( QDragEnterEvent * _dee )
|
||||
void InstrumentTrackWindow::dragEnterEventGeneric( QDragEnterEvent* event )
|
||||
{
|
||||
stringPairDrag::processDragEnterEvent( _dee, "instrument,presetfile,"
|
||||
"pluginpresetfile" );
|
||||
stringPairDrag::processDragEnterEvent( event, "instrument,presetfile,pluginpresetfile" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void InstrumentTrackWindow::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
void InstrumentTrackWindow::dragEnterEvent( QDragEnterEvent* event )
|
||||
{
|
||||
dragEnterEventGeneric( _dee );
|
||||
dragEnterEventGeneric( event );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void InstrumentTrackWindow::dropEvent( QDropEvent * _de )
|
||||
void InstrumentTrackWindow::dropEvent( QDropEvent* event )
|
||||
{
|
||||
QString type = stringPairDrag::decodeKey( _de );
|
||||
QString value = stringPairDrag::decodeValue( _de );
|
||||
QString type = stringPairDrag::decodeKey( event );
|
||||
QString value = stringPairDrag::decodeValue( event );
|
||||
|
||||
if( type == "instrument" )
|
||||
{
|
||||
m_track->loadInstrument( value );
|
||||
|
||||
engine::getSong()->setModified();
|
||||
_de->accept();
|
||||
|
||||
event->accept();
|
||||
}
|
||||
else if( type == "presetfile" )
|
||||
{
|
||||
@@ -1614,40 +1518,43 @@ void InstrumentTrackWindow::dropEvent( QDropEvent * _de )
|
||||
InstrumentTrack::removeMidiPortNode( mmp );
|
||||
m_track->setSimpleSerializing();
|
||||
m_track->loadSettings( mmp.content().toElement() );
|
||||
|
||||
engine::getSong()->setModified();
|
||||
_de->accept();
|
||||
|
||||
event->accept();
|
||||
}
|
||||
else if( type == "pluginpresetfile" )
|
||||
{
|
||||
const QString ext = fileItem::extension( value );
|
||||
Instrument * i = m_track->instrument();
|
||||
|
||||
if( !i->descriptor()->supportsFileType( ext ) )
|
||||
{
|
||||
i = m_track->loadInstrument(
|
||||
engine::pluginFileHandling()[ext] );
|
||||
i = m_track->loadInstrument( engine::pluginFileHandling()[ext] );
|
||||
}
|
||||
|
||||
i->loadFile( value );
|
||||
_de->accept();
|
||||
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void InstrumentTrackWindow::saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _this )
|
||||
void InstrumentTrackWindow::saveSettings( QDomDocument& doc, QDomElement & thisElement )
|
||||
{
|
||||
_this.setAttribute( "tab", m_tabWidget->activeTab() );
|
||||
MainWindow::saveWidgetState( this, _this );
|
||||
thisElement.setAttribute( "tab", m_tabWidget->activeTab() );
|
||||
MainWindow::saveWidgetState( this, thisElement );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void InstrumentTrackWindow::loadSettings( const QDomElement & _this )
|
||||
void InstrumentTrackWindow::loadSettings( const QDomElement& thisElement )
|
||||
{
|
||||
m_tabWidget->setActiveTab( _this.attribute( "tab" ).toInt() );
|
||||
MainWindow::restoreWidgetState( this, _this );
|
||||
m_tabWidget->setActiveTab( thisElement.attribute( "tab" ).toInt() );
|
||||
MainWindow::restoreWidgetState( this, thisElement );
|
||||
if( isVisible() )
|
||||
{
|
||||
m_itv->m_tlb->setChecked( true );
|
||||
|
||||
@@ -74,7 +74,7 @@ SampleTCO::~SampleTCO()
|
||||
|
||||
|
||||
|
||||
void SampleTCO::changeLength( const midiTime & _length )
|
||||
void SampleTCO::changeLength( const MidiTime & _length )
|
||||
{
|
||||
trackContentObject::changeLength( qMax( static_cast<int>( _length ), DefaultTicksPerTact ) );
|
||||
}
|
||||
@@ -128,7 +128,7 @@ void SampleTCO::updateLength( bpm_t )
|
||||
|
||||
|
||||
|
||||
midiTime SampleTCO::sampleLength() const
|
||||
MidiTime SampleTCO::sampleLength() const
|
||||
{
|
||||
return (int)( m_sampleBuffer->frames() / engine::framesPerTick() );
|
||||
}
|
||||
@@ -406,7 +406,7 @@ SampleTrack::~SampleTrack()
|
||||
|
||||
|
||||
|
||||
bool SampleTrack::play( const midiTime & _start, const fpp_t _frames,
|
||||
bool SampleTrack::play( const MidiTime & _start, const fpp_t _frames,
|
||||
const f_cnt_t _offset, int /*_tco_num*/ )
|
||||
{
|
||||
m_audioPort.effects()->startRunning();
|
||||
@@ -461,7 +461,7 @@ trackView * SampleTrack::createView( TrackContainerView* tcv )
|
||||
|
||||
|
||||
|
||||
trackContentObject * SampleTrack::createTCO( const midiTime & )
|
||||
trackContentObject * SampleTrack::createTCO( const MidiTime & )
|
||||
{
|
||||
return new SampleTCO( this );
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ bbTCO::bbTCO( track * _track, unsigned int _color ) :
|
||||
if( t > 0 )
|
||||
{
|
||||
saveJournallingState( false );
|
||||
changeLength( midiTime( t, 0 ) );
|
||||
changeLength( MidiTime( t, 0 ) );
|
||||
restoreJournallingState();
|
||||
}
|
||||
}
|
||||
@@ -192,7 +192,7 @@ void bbTCOView::paintEvent( QPaintEvent * )
|
||||
|
||||
tact_t t = engine::getBBTrackContainer()->lengthOfBB(
|
||||
bbTrack::numOfBBTrack( m_bbTCO->getTrack() ) );
|
||||
if( m_bbTCO->length() > midiTime::ticksPerTact() && t > 0 )
|
||||
if( m_bbTCO->length() > MidiTime::ticksPerTact() && t > 0 )
|
||||
{
|
||||
for( int x = static_cast<int>( t * pixelsPerTact() );
|
||||
x < width()-2;
|
||||
@@ -341,7 +341,7 @@ bbTrack::~bbTrack()
|
||||
|
||||
|
||||
// play _frames frames of given TCO within starting with _start
|
||||
bool bbTrack::play( const midiTime & _start, const fpp_t _frames,
|
||||
bool bbTrack::play( const MidiTime & _start, const fpp_t _frames,
|
||||
const f_cnt_t _offset, int _tco_num )
|
||||
{
|
||||
if( isMuted() )
|
||||
@@ -362,8 +362,8 @@ bool bbTrack::play( const midiTime & _start, const fpp_t _frames,
|
||||
return false;
|
||||
}
|
||||
|
||||
midiTime lastPosition;
|
||||
midiTime lastLen;
|
||||
MidiTime lastPosition;
|
||||
MidiTime lastLen;
|
||||
for( tcoVector::iterator it = tcos.begin(); it != tcos.end(); ++it )
|
||||
{
|
||||
if( !( *it )->isMuted() &&
|
||||
@@ -392,7 +392,7 @@ trackView * bbTrack::createView( TrackContainerView* tcv )
|
||||
|
||||
|
||||
|
||||
trackContentObject * bbTrack::createTCO( const midiTime & _pos )
|
||||
trackContentObject * bbTrack::createTCO( const MidiTime & _pos )
|
||||
{
|
||||
// if we're creating a new bbTCO, we colorize it according to the
|
||||
// previous bbTCO, so we have to get all TCOs from 0 to _pos and
|
||||
|
||||
@@ -63,7 +63,7 @@ pattern::pattern( InstrumentTrack * _instrument_track ) :
|
||||
trackContentObject( _instrument_track ),
|
||||
m_instrumentTrack( _instrument_track ),
|
||||
m_patternType( BeatPattern ),
|
||||
m_steps( midiTime::stepsPerTact() ),
|
||||
m_steps( MidiTime::stepsPerTact() ),
|
||||
m_frozenPattern( NULL ),
|
||||
m_freezing( false ),
|
||||
m_freezeAborted( false )
|
||||
@@ -127,14 +127,14 @@ void pattern::init()
|
||||
|
||||
|
||||
|
||||
midiTime pattern::length() const
|
||||
MidiTime pattern::length() const
|
||||
{
|
||||
if( m_patternType == BeatPattern )
|
||||
{
|
||||
return beatPatternLength();
|
||||
}
|
||||
|
||||
tick_t max_length = midiTime::ticksPerTact();
|
||||
tick_t max_length = MidiTime::ticksPerTact();
|
||||
|
||||
for( NoteVector::ConstIterator it = m_notes.begin();
|
||||
it != m_notes.end(); ++it )
|
||||
@@ -145,16 +145,16 @@ midiTime pattern::length() const
|
||||
( *it )->endPos() );
|
||||
}
|
||||
}
|
||||
return midiTime( max_length ).nextFullTact() *
|
||||
midiTime::ticksPerTact();
|
||||
return MidiTime( max_length ).nextFullTact() *
|
||||
MidiTime::ticksPerTact();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
midiTime pattern::beatPatternLength() const
|
||||
MidiTime pattern::beatPatternLength() const
|
||||
{
|
||||
tick_t max_length = midiTime::ticksPerTact();
|
||||
tick_t max_length = MidiTime::ticksPerTact();
|
||||
|
||||
for( NoteVector::ConstIterator it = m_notes.begin();
|
||||
it != m_notes.end(); ++it )
|
||||
@@ -163,18 +163,18 @@ midiTime pattern::beatPatternLength() const
|
||||
{
|
||||
max_length = qMax<tick_t>( max_length,
|
||||
( *it )->pos() +
|
||||
midiTime::ticksPerTact() /
|
||||
midiTime::stepsPerTact() );
|
||||
MidiTime::ticksPerTact() /
|
||||
MidiTime::stepsPerTact() );
|
||||
}
|
||||
}
|
||||
|
||||
if( m_steps != midiTime::stepsPerTact() )
|
||||
if( m_steps != MidiTime::stepsPerTact() )
|
||||
{
|
||||
max_length = m_steps * midiTime::ticksPerTact() /
|
||||
midiTime::stepsPerTact() ;
|
||||
max_length = m_steps * MidiTime::ticksPerTact() /
|
||||
MidiTime::stepsPerTact() ;
|
||||
}
|
||||
|
||||
return midiTime( max_length ).nextFullTact() * midiTime::ticksPerTact();
|
||||
return MidiTime( max_length ).nextFullTact() * MidiTime::ticksPerTact();
|
||||
}
|
||||
|
||||
|
||||
@@ -385,7 +385,7 @@ void pattern::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
movePosition( _this.attribute( "pos" ).toInt() );
|
||||
}
|
||||
changeLength( midiTime( _this.attribute( "len" ).toInt() ) );
|
||||
changeLength( MidiTime( _this.attribute( "len" ).toInt() ) );
|
||||
if( _this.attribute( "muted" ).toInt() != isMuted() )
|
||||
{
|
||||
toggleMute();
|
||||
@@ -409,7 +409,7 @@ void pattern::loadSettings( const QDomElement & _this )
|
||||
m_steps = _this.attribute( "steps" ).toInt();
|
||||
if( m_steps == 0 )
|
||||
{
|
||||
m_steps = midiTime::stepsPerTact();
|
||||
m_steps = MidiTime::stepsPerTact();
|
||||
}
|
||||
|
||||
ensureBeatNotes();
|
||||
@@ -487,7 +487,7 @@ void pattern::abortFreeze()
|
||||
|
||||
void pattern::addSteps()
|
||||
{
|
||||
m_steps += midiTime::stepsPerTact();
|
||||
m_steps += MidiTime::stepsPerTact();
|
||||
ensureBeatNotes();
|
||||
emit dataChanged();
|
||||
}
|
||||
@@ -497,7 +497,7 @@ void pattern::addSteps()
|
||||
|
||||
void pattern::removeSteps()
|
||||
{
|
||||
int _n = midiTime::stepsPerTact();
|
||||
int _n = MidiTime::stepsPerTact();
|
||||
if( _n < m_steps )
|
||||
{
|
||||
for( int i = m_steps - _n; i < m_steps; ++i )
|
||||
@@ -506,8 +506,8 @@ void pattern::removeSteps()
|
||||
it != m_notes.end(); ++it )
|
||||
{
|
||||
if( ( *it )->pos() ==
|
||||
i * midiTime::ticksPerTact() /
|
||||
midiTime::stepsPerTact() &&
|
||||
i * MidiTime::ticksPerTact() /
|
||||
MidiTime::stepsPerTact() &&
|
||||
( *it )->length() <= 0 )
|
||||
{
|
||||
removeNote( *it );
|
||||
@@ -542,8 +542,8 @@ void pattern::ensureBeatNotes()
|
||||
it != m_notes.end(); ++it )
|
||||
{
|
||||
if( ( *it )->pos() ==
|
||||
i * midiTime::ticksPerTact() /
|
||||
midiTime::stepsPerTact() &&
|
||||
i * MidiTime::ticksPerTact() /
|
||||
MidiTime::stepsPerTact() &&
|
||||
( *it )->length() <= 0 )
|
||||
{
|
||||
found = true;
|
||||
@@ -552,9 +552,9 @@ void pattern::ensureBeatNotes()
|
||||
}
|
||||
if( found == false )
|
||||
{
|
||||
addNote( note( midiTime( 0 ), midiTime( i *
|
||||
midiTime::ticksPerTact() /
|
||||
midiTime::stepsPerTact() ) ), false );
|
||||
addNote( note( MidiTime( 0 ), MidiTime( i *
|
||||
MidiTime::ticksPerTact() /
|
||||
MidiTime::stepsPerTact() ) ), false );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -591,17 +591,17 @@ bool pattern::empty()
|
||||
|
||||
void pattern::changeTimeSignature()
|
||||
{
|
||||
midiTime last_pos = midiTime::ticksPerTact();
|
||||
MidiTime last_pos = MidiTime::ticksPerTact();
|
||||
for( NoteVector::ConstIterator cit = m_notes.begin();
|
||||
cit != m_notes.end(); ++cit )
|
||||
{
|
||||
if( ( *cit )->length() < 0 && ( *cit )->pos() > last_pos )
|
||||
{
|
||||
last_pos = ( *cit )->pos()+midiTime::ticksPerTact() /
|
||||
midiTime::stepsPerTact();
|
||||
last_pos = ( *cit )->pos()+MidiTime::ticksPerTact() /
|
||||
MidiTime::stepsPerTact();
|
||||
}
|
||||
}
|
||||
last_pos = last_pos.nextFullTact() * midiTime::ticksPerTact();
|
||||
last_pos = last_pos.nextFullTact() * MidiTime::ticksPerTact();
|
||||
for( NoteVector::Iterator it = m_notes.begin(); it != m_notes.end(); )
|
||||
{
|
||||
if( ( *it )->length() == 0 && ( *it )->pos() >= last_pos )
|
||||
@@ -616,8 +616,8 @@ void pattern::changeTimeSignature()
|
||||
}
|
||||
}
|
||||
m_steps = qMax<tick_t>(
|
||||
qMax<tick_t>( m_steps, midiTime::stepsPerTact() ),
|
||||
last_pos.getTact() * midiTime::stepsPerTact() );
|
||||
qMax<tick_t>( m_steps, MidiTime::stepsPerTact() ),
|
||||
last_pos.getTact() * MidiTime::stepsPerTact() );
|
||||
ensureBeatNotes();
|
||||
}
|
||||
|
||||
@@ -970,7 +970,7 @@ void patternView::mouseDoubleClickEvent( QMouseEvent * _me )
|
||||
if( m_pat->type() == pattern::MelodyPattern ||
|
||||
!( m_pat->type() == pattern::BeatPattern &&
|
||||
( pixelsPerTact() >= 192 ||
|
||||
m_pat->m_steps != midiTime::stepsPerTact() ) &&
|
||||
m_pat->m_steps != MidiTime::stepsPerTact() ) &&
|
||||
_me->y() > height() - s_stepBtnOff->height() ) )
|
||||
{
|
||||
openInPianoRoll();
|
||||
@@ -985,7 +985,7 @@ void patternView::mousePressEvent( QMouseEvent * _me )
|
||||
if( _me->button() == Qt::LeftButton &&
|
||||
m_pat->m_patternType == pattern::BeatPattern &&
|
||||
( fixedTCOs() || pixelsPerTact() >= 96 ||
|
||||
m_pat->m_steps != midiTime::stepsPerTact() ) &&
|
||||
m_pat->m_steps != MidiTime::stepsPerTact() ) &&
|
||||
_me->y() > height() - s_stepBtnOff->height() )
|
||||
{
|
||||
int step = ( _me->x() - TCO_BORDER_WIDTH ) *
|
||||
@@ -1033,7 +1033,7 @@ void patternView::wheelEvent( QWheelEvent * _we )
|
||||
{
|
||||
if( m_pat->m_patternType == pattern::BeatPattern &&
|
||||
( fixedTCOs() || pixelsPerTact() >= 96 ||
|
||||
m_pat->m_steps != midiTime::stepsPerTact() ) &&
|
||||
m_pat->m_steps != MidiTime::stepsPerTact() ) &&
|
||||
_we->y() > height() - s_stepBtnOff->height() )
|
||||
{
|
||||
int step = ( _we->x() - TCO_BORDER_WIDTH ) *
|
||||
@@ -1192,9 +1192,9 @@ void patternView::paintEvent( QPaintEvent * )
|
||||
{
|
||||
const int x1 = 2 * x_base +
|
||||
static_cast<int>( ( *it )->pos() * ppt /
|
||||
midiTime::ticksPerTact() );
|
||||
MidiTime::ticksPerTact() );
|
||||
const int x2 =
|
||||
static_cast<int>( ( ( *it )->pos() + ( *it )->length() ) * ppt / midiTime::ticksPerTact() );
|
||||
static_cast<int>( ( ( *it )->pos() + ( *it )->length() ) * ppt / MidiTime::ticksPerTact() );
|
||||
p.drawLine( x1, y_base + y_pos,
|
||||
x2, y_base + y_pos );
|
||||
|
||||
@@ -1205,7 +1205,7 @@ void patternView::paintEvent( QPaintEvent * )
|
||||
}
|
||||
else if( m_pat->m_patternType == pattern::BeatPattern &&
|
||||
( fixedTCOs() || ppt >= 96
|
||||
|| m_pat->m_steps != midiTime::stepsPerTact() ) )
|
||||
|| m_pat->m_steps != MidiTime::stepsPerTact() ) )
|
||||
{
|
||||
QPixmap stepon;
|
||||
QPixmap stepoverlay;
|
||||
|
||||
Reference in New Issue
Block a user