Skip to content

Commit

Permalink
Relabel
Browse files Browse the repository at this point in the history
Allow sample track patterns to be less than one bar long

Reset size when reloading same file

Use existing sampleLength() method

Fix cloning issue

Style and comparison improvements

Don't include QDebug

Unrelated cosmetic fix
  • Loading branch information
Spekular committed Apr 14, 2019
1 parent 97d5529 commit a091d50
Show file tree
Hide file tree
Showing 19 changed files with 182 additions and 61 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ matrix:
git:
depth: false
- env: TARGET_OS=debian-sid TARGET_ARCH=i386
git:
depth: false
- compiler: clang
env: TARGET_OS=debian-sid
git:
depth: false
before_install:
- . ${TRAVIS_BUILD_DIR}/.travis/${TRAVIS_OS_NAME}.${TARGET_OS}.before_install.sh
install:
Expand Down
2 changes: 1 addition & 1 deletion .travis/linux..install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ sudo apt-get install -y $PACKAGES
sudo add-apt-repository -y ppa:kxstudio-debian/libs
sudo add-apt-repository -y ppa:kxstudio-debian/apps
sudo apt-get update
sudo apt-get install -y carla-git
sudo apt-get install -y carla
1 change: 1 addition & 0 deletions include/Editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class Editor : public QMainWindow
DropToolBar * addDropToolBar(Qt::ToolBarArea whereToAdd, QString const & windowTitle);
DropToolBar * addDropToolBar(QWidget * parent, Qt::ToolBarArea whereToAdd, QString const & windowTitle);

virtual void closeEvent( QCloseEvent * _ce );
protected slots:
virtual void play() {}
virtual void record() {}
Expand Down
5 changes: 5 additions & 0 deletions include/SetupDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ private slots:
void toggleDisplayWaveform( bool en );
void toggleDisableAutoquit( bool en );

void vstEmbedMethodChanged();
void toggleVSTAlwaysOnTop( bool en );

void setLanguage( int lang );


Expand Down Expand Up @@ -207,6 +210,8 @@ private slots:

QComboBox* m_vstEmbedComboBox;
QString m_vstEmbedMethod;
LedCheckBox * m_vstAlwaysOnTopCheckBox;
bool m_vstAlwaysOnTop;
} ;


Expand Down
2 changes: 1 addition & 1 deletion include/Track.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ class TrackContentWidget : public QWidget, public JournallingObject
}
}

bool canPasteSelection( MidiTime tcoPos, const QMimeData * mimeData );
bool canPasteSelection( MidiTime tcoPos, const QDropEvent *de );
bool pasteSelection( MidiTime tcoPos, QDropEvent * de );

MidiTime endPosition( const MidiTime & posStart );
Expand Down
2 changes: 1 addition & 1 deletion include/VstSyncController.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ private slots:
private:
struct VstSyncData
{
bool isPlaying;
double ppqPos;
int timeSigNumer;
int timeSigDenom;
bool isPlaying;
bool isCycle;
bool hasSHM;
float cycleStart;
Expand Down
2 changes: 1 addition & 1 deletion include/VstSyncData.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@

struct VstSyncData
{
bool isPlaying;
double ppqPos;
int timeSigNumer;
int timeSigDenom;
bool isPlaying;
bool isCycle;
bool hasSHM;
float cycleStart;
Expand Down
4 changes: 2 additions & 2 deletions plugins/Eq/EqControlsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ EqControlsDialog::EqControlsDialog( EqControls *controls ) :

EqSpectrumView * inSpec = new EqSpectrumView( &controls->m_inFftBands, this );
inSpec->move( 26, 17 );
inSpec->setColor( QColor( 54, 45, 142, 150 ) );
inSpec->setColor( QColor( 77, 101, 242, 150 ) );

EqSpectrumView * outSpec = new EqSpectrumView( &controls->m_outFftBands, this );
outSpec->setColor( QColor( 9, 166, 156, 150 ) );
outSpec->setColor( QColor( 0, 255, 239, 150 ) );
outSpec->move( 26, 17 );

m_parameterWidget = new EqParameterWidget( this , controls );
Expand Down
8 changes: 4 additions & 4 deletions plugins/Eq/EqSpectrumView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ EqAnalyser::EqAnalyser() :
const float a2 = 0.14128;
const float a3 = 0.01168;

for(int i = 0; i < FFT_BUFFER_SIZE; i++)
for (int i = 0; i < FFT_BUFFER_SIZE; i++)
{
m_fftWindow[i] = ( a0 - a1 * cosf( 2 * F_PI * i / (float)FFT_BUFFER_SIZE - 1 )
+ a2 * cosf( 4 * F_PI * i / (float)FFT_BUFFER_SIZE-1)
- a3 * cos( 6 * F_PI * i / (float)FFT_BUFFER_SIZE - 1.0 ));
m_fftWindow[i] = (a0 - a1 * cos(2 * F_PI * i / ((float)FFT_BUFFER_SIZE - 1.0))
+ a2 * cos(4 * F_PI * i / ((float)FFT_BUFFER_SIZE - 1.0))
- a3 * cos(6 * F_PI * i / ((float)FFT_BUFFER_SIZE - 1.0)));
}
clear();
}
Expand Down
8 changes: 7 additions & 1 deletion plugins/vestige/vestige.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,13 @@ vestigeInstrument::~vestigeInstrument()

void vestigeInstrument::loadSettings( const QDomElement & _this )
{
loadFile( _this.attribute( "plugin" ) );
QString plugin = _this.attribute( "plugin" );
if( plugin.isEmpty() )
{
return;
}

loadFile( plugin );
m_pluginMutex.lock();
if( m_plugin != NULL )
{
Expand Down
4 changes: 0 additions & 4 deletions plugins/vst_base/RemoteVstPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,10 +775,6 @@ void RemoteVstPlugin::initEditor()
SWP_NOMOVE | SWP_NOZORDER );
pluginDispatch( effEditTop );

if (! EMBED) {
showEditor();
}

#ifdef LMMS_BUILD_LINUX
m_windowID = (intptr_t) GetProp( m_window, "__wine_x11_whole_window" );
#else
Expand Down
4 changes: 3 additions & 1 deletion plugins/vst_base/VstPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,9 @@ bool VstPlugin::processMessage( const message & _m )

case IdVstPluginWindowID:
m_pluginWindowID = _m.getInt();
if( m_embedMethod == "none" )
if( m_embedMethod == "none"
&& ConfigManager::inst()->value(
"ui", "vstalwaysontop" ).toInt() )
{
#ifdef LMMS_BUILD_WIN32
// We're changing the owner, not the parent,
Expand Down
35 changes: 32 additions & 3 deletions plugins/zynaddsubfx/zynaddsubfx/src/Misc/Bank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ void Bank::loadfromslot(unsigned int ninstrument, Part *part)
*/
int Bank::loadbank(string bankdirname)
{
normalizedirsuffix(bankdirname);
DIR *dir = opendir(bankdirname.c_str());
clearbank();

Expand Down Expand Up @@ -255,9 +256,15 @@ int Bank::newbank(string newbankdirname)
string bankdir;
bankdir = config.cfg.bankRootDirList[0];

if(((bankdir[bankdir.size() - 1]) != '/')
&& ((bankdir[bankdir.size() - 1]) != '\\'))
bankdir += "/";
expanddirname(bankdir);
normalizedirsuffix(bankdir);

// FIXME: Zyn should automatically handle creation of parent directory
#ifdef WIN32
if(mkdir(bankdir.c_str()) < 0) return -1;
#else
if(mkdir(bankdir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)) return -1;
#endif

bankdir += newbankdirname;
#ifdef WIN32
Expand Down Expand Up @@ -355,6 +362,8 @@ void Bank::rescanforbanks()

void Bank::scanrootdir(string rootdir)
{
expanddirname(rootdir);

DIR *dir = opendir(rootdir.c_str());
if(dir == NULL)
return;
Expand Down Expand Up @@ -472,3 +481,23 @@ Bank::ins_t::ins_t()
{
info.PADsynth_used = false;
}

void Bank::expanddirname(std::string &dirname) {
if (dirname.empty())
return;

// if the directory name starts with a ~ and the $HOME variable is
// defined in the environment, replace ~ by the content of $HOME
if (dirname.at(0) == '~') {
char *home_dirname = getenv("HOME");
if (home_dirname != NULL) {
dirname = std::string(home_dirname) + dirname.substr(1);
}
}
}

void Bank::normalizedirsuffix(string &dirname) const {
if(((dirname[dirname.size() - 1]) != '/')
&& ((dirname[dirname.size() - 1]) != '\\'))
dirname += "/";
}
7 changes: 7 additions & 0 deletions plugins/zynaddsubfx/zynaddsubfx/src/Misc/Bank.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ class Bank
std::string dirname;

void scanrootdir(std::string rootdir); //scans a root dir for banks

/** Expends ~ prefix in dirname, if any */
void expanddirname(std::string &dirname);

/** Ensure that the directory name is suffixed by a
* directory separator */
void normalizedirsuffix(std::string &dirname) const;
};

#endif
49 changes: 29 additions & 20 deletions src/core/Track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ TrackContentObjectView::~TrackContentObjectView()

/*! \brief Update a TrackContentObjectView
*
* TCO's get drawn only when needed,
* and when a TCO is updated,
* TCO's get drawn only when needed,
* and when a TCO is updated,
* it needs to be redrawn.
*
*/
Expand Down Expand Up @@ -497,7 +497,7 @@ void TrackContentObjectView::dragEnterEvent( QDragEnterEvent * dee )
{
TrackContentWidget * tcw = getTrackView()->getTrackContentWidget();
MidiTime tcoPos = MidiTime( m_tco->startPosition().getTact(), 0 );
if( tcw->canPasteSelection( tcoPos, dee->mimeData() ) == false )
if( tcw->canPasteSelection( tcoPos, dee ) == false )
{
dee->ignore();
}
Expand Down Expand Up @@ -602,9 +602,12 @@ DataFile TrackContentObjectView::createTCODataFiles(
it != tcoViews.end(); ++it )
{
// Insert into the dom under the "tcos" element
int trackIndex = tc->tracks().indexOf( ( *it )->m_trackView->getTrack() );
Track* tcoTrack = ( *it )->m_trackView->getTrack();
int trackIndex = tc->tracks().indexOf( tcoTrack );
QDomElement tcoElement = dataFile.createElement( "tco" );
tcoElement.setAttribute( "trackIndex", trackIndex );
tcoElement.setAttribute( "trackType", tcoTrack->type() );
tcoElement.setAttribute( "trackName", tcoTrack->name() );
( *it )->m_tco->saveState( dataFile, tcoElement );
tcoParent.appendChild( tcoElement );
}
Expand All @@ -621,6 +624,7 @@ DataFile TrackContentObjectView::createTCODataFiles(
QDomElement metadata = dataFile.createElement( "copyMetadata" );
// initialTrackIndex is the index of the track that was touched
metadata.setAttribute( "initialTrackIndex", initialTrackIndex );
metadata.setAttribute( "trackContainerId", tc->id() );
// grabbedTCOPos is the pos of the tact containing the TCO we grabbed
metadata.setAttribute( "grabbedTCOPos", m_tco->startPosition() );

Expand Down Expand Up @@ -674,7 +678,7 @@ void TrackContentObjectView::mousePressEvent( QMouseEvent * me )
}
}
}
else if( me->button() == Qt::LeftButton &&
else if( me->button() == Qt::LeftButton &&
me->modifiers() & Qt::ControlModifier )
{
// start drag-action
Expand Down Expand Up @@ -1119,7 +1123,7 @@ void TrackContentWidget::updateBackground()

// draw lines
// vertical lines
pmp.setPen( QPen( gridColor(), 1 ) );
pmp.setPen( QPen( gridColor(), 1 ) );
for( float x = 0; x < w * 2; x += ppt )
{
pmp.drawLine( QLineF( x, 0.0, x, h ) );
Expand All @@ -1130,9 +1134,9 @@ void TrackContentWidget::updateBackground()
{
pmp.drawLine( QLineF( x, 0.0, x, h ) );
}

// horizontal line
pmp.setPen( QPen( gridColor(), 1 ) );
pmp.setPen( QPen( gridColor(), 1 ) );
pmp.drawLine( 0, h-1, w*2, h-1 );

pmp.end();
Expand Down Expand Up @@ -1315,8 +1319,8 @@ MidiTime TrackContentWidget::getPosition( int mouseX )
*/
void TrackContentWidget::dragEnterEvent( QDragEnterEvent * dee )
{
MidiTime tcoPos = MidiTime( getPosition( dee->pos().x() ).getTact(), 0 );
if( canPasteSelection( tcoPos, dee->mimeData() ) == false )
MidiTime tcoPos = getPosition( dee->pos().x() );
if( canPasteSelection( tcoPos, dee ) == false )
{
dee->ignore();
}
Expand All @@ -1335,8 +1339,10 @@ void TrackContentWidget::dragEnterEvent( QDragEnterEvent * dee )
* \param tcoPos the position of the TCO slot being pasted on
* \param de the DropEvent generated
*/
bool TrackContentWidget::canPasteSelection( MidiTime tcoPos, const QMimeData * mimeData )
bool TrackContentWidget::canPasteSelection( MidiTime tcoPos, const QDropEvent* de )
{
const QMimeData * mimeData = de->mimeData();

Track * t = getTrack();
QString type = StringPairDrag::decodeMimeKey( mimeData );
QString value = StringPairDrag::decodeMimeValue( mimeData );
Expand Down Expand Up @@ -1366,7 +1372,9 @@ bool TrackContentWidget::canPasteSelection( MidiTime tcoPos, const QMimeData * m
const int currentTrackIndex = tracks.indexOf( t );

// Don't paste if we're on the same tact
if( tcoPos == grabbedTCOTact && currentTrackIndex == initialTrackIndex )
auto sourceTrackContainerId = metadata.attributeNode( "trackContainerId" ).value().toUInt();
if( de->source() && sourceTrackContainerId == t->trackContainer()->id() &&
tcoPos == grabbedTCOTact && currentTrackIndex == initialTrackIndex )
{
return false;
}
Expand All @@ -1389,9 +1397,9 @@ bool TrackContentWidget::canPasteSelection( MidiTime tcoPos, const QMimeData * m
}

// Track must be of the same type
Track * startTrack = tracks.at( trackIndex );
auto startTrackType = tcoElement.attributeNode("trackType").value().toInt();
Track * endTrack = tracks.at( finalTrackIndex );
if( startTrack->type() != endTrack->type() )
if( startTrackType != endTrack->type() )
{
return false;
}
Expand All @@ -1407,7 +1415,7 @@ bool TrackContentWidget::canPasteSelection( MidiTime tcoPos, const QMimeData * m
*/
bool TrackContentWidget::pasteSelection( MidiTime tcoPos, QDropEvent * de )
{
if( canPasteSelection( tcoPos, de->mimeData() ) == false )
if( canPasteSelection( tcoPos, de ) == false )
{
return false;
}
Expand Down Expand Up @@ -1478,7 +1486,8 @@ bool TrackContentWidget::pasteSelection( MidiTime tcoPos, QDropEvent * de )
tco->selectViewOnCreate( true );
}
//check tco name, if the same as source track name dont copy
if( tco->name() == tracks[trackIndex]->name() )
QString sourceTrackName = outerTCOElement.attributeNode( "trackName" ).value();
if( tco->name() == sourceTrackName )
{
tco->setName( "" );
}
Expand Down Expand Up @@ -1853,7 +1862,7 @@ void TrackOperationsWidget::updateMenu()
toMenu->addAction( embed::getIconPixmap( "cancel", 16, 16 ),
tr( "Remove this track" ),
this, SLOT( removeTrack() ) );

if( ! m_trackView->trackContainerView()->fixedTCOs() )
{
toMenu->addAction( tr( "Clear this track" ), this, SLOT( clearTrack() ) );
Expand Down Expand Up @@ -2778,12 +2787,12 @@ void TrackView::mouseMoveEvent( QMouseEvent * me )
else if( m_action == MoveTrack )
{
// look which track-widget the mouse-cursor is over
const int yPos =
const int yPos =
m_trackContainerView->contentWidget()->mapFromGlobal( me->globalPos() ).y();
const TrackView * trackAtY = m_trackContainerView->trackViewAt( yPos );

// debug code
// qDebug( "y position %d", yPos );
// debug code
// qDebug( "y position %d", yPos );

// a track-widget not equal to ourself?
if( trackAtY != NULL && trackAtY != this )
Expand Down
Loading

0 comments on commit a091d50

Please sign in to comment.