Skip to content

Commit

Permalink
Merge brnach 'stable-1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
PhysSong committed Nov 24, 2017
2 parents fbbcd2a + ec768b0 commit caecae3
Show file tree
Hide file tree
Showing 20 changed files with 137 additions and 42 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
IF (CMAKE_MAJOR_VERSION GREATER 2)
CMAKE_POLICY(SET CMP0026 NEW)
CMAKE_POLICY(SET CMP0045 NEW)
CMAKE_POLICY(SET CMP0050 OLD)
ENDIF()
ENDIF(COMMAND CMAKE_POLICY)
Expand Down
3 changes: 3 additions & 0 deletions cmake/linux/package_linux.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ function skipped {
echo -e " ${PLAIN}[${YELLOW}skipped${PLAIN}] ${1}"
}

# Blindly assume system arch is appimage arch
ARCH=$(arch)
export ARCH

# Check for problematic install locations
INSTALL=$(echo "@CMAKE_INSTALL_PREFIX@" | sed 's/\/*$//g')
Expand Down
6 changes: 1 addition & 5 deletions data/projects/templates/Empty.mpt
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@
<ControllerRackView visible="1" width="258" height="142" x="836" y="407" maximized="0" minimized="0"/>
<pianoroll visible="0" width="640" height="480" x="1" y="1" maximized="0" minimized="0"/>
<automationeditor visible="0" width="640" height="400" x="56" y="255" maximized="0" minimized="0"/>
<projectnotes visible="0" width="640" height="400" x="1" y="1" maximized="0" minimized="0"><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Verdana'; font-size:11pt; font-weight:600; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Droid Sans'; font-size:10pt; font-weight:400; color:#e0e0e0;">Put down your project notes here.</span></p></body></html>]]></projectnotes>
<projectnotes visible="0" width="640" height="400" x="1" y="1" maximized="0" minimized="0"></projectnotes>
<timeline lp0pos="0" lp1pos="192" lpstate="0"/>
<controllers/>
</song>
Expand Down
6 changes: 1 addition & 5 deletions data/projects/templates/default.mpt
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,7 @@
<ControllerRackView width="350" x="680" y="310" maximized="0" height="200" visible="1" minimized="0"/>
<pianoroll width="640" x="5" y="5" maximized="0" height="480" visible="0" minimized="0"/>
<automationeditor width="640" x="-36" y="0" maximized="0" height="400" visible="0" minimized="0"/>
<projectnotes width="640" x="700" y="10" maximized="0" height="400" visible="0" minimized="0"><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Noto Sans'; font-size:9pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#e0e0e0;">Enter project notes here</span></p></body></html>]]></projectnotes>
<projectnotes width="640" x="700" y="10" maximized="0" height="400" visible="0" minimized="0"></projectnotes>
<timeline lp1pos="192" lp0pos="0" lpstate="0"/>
<controllers/>
</song>
Expand Down
2 changes: 1 addition & 1 deletion include/AutomationPattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class EXPORT AutomationPattern : public TrackContentObject
MidiTime putValue( const MidiTime & time,
const float value,
const bool quantPos = true,
const bool ignoreSurroundingPoints = false );
const bool ignoreSurroundingPoints = true );

void removeValue( const MidiTime & time );

Expand Down
11 changes: 11 additions & 0 deletions include/MainApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,26 @@

#ifdef LMMS_BUILD_WIN32
#include <windows.h>
#if QT_VERSION >= 0x050000
#include <QAbstractNativeEventFilter>
#endif
#endif

#if defined(LMMS_BUILD_WIN32) && QT_VERSION >= 0x050000
class MainApplication : public QApplication, public QAbstractNativeEventFilter
#else
class MainApplication : public QApplication
#endif
{
public:
MainApplication(int& argc, char** argv);
bool event(QEvent* event);
#ifdef LMMS_BUILD_WIN32
bool winEventFilter(MSG* msg, long* result);
#if QT_VERSION >= 0x050000
bool nativeEventFilter(const QByteArray& eventType, void* message,
long* result);
#endif
#endif
inline QString& queuedFile()
{
Expand Down
1 change: 1 addition & 0 deletions include/Mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class EXPORT Mixer : public QObject

void initDevices();
void clear();
void clearNewPlayHandles();


// audio-device-stuff
Expand Down
13 changes: 13 additions & 0 deletions include/Song.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "TrackContainer.h"
#include "Controller.h"
#include "MeterModel.h"
#include "Mixer.h"
#include "VstSyncController.h"


Expand Down Expand Up @@ -256,6 +257,17 @@ class EXPORT Song : public TrackContainer
return m_loadingProject;
}

void loadingCancelled()
{
m_isCancelled = true;
Engine::mixer()->clearNewPlayHandles();
}

bool isCancelled()
{
return m_isCancelled;
}

bool isModified() const
{
return m_modified;
Expand Down Expand Up @@ -385,6 +397,7 @@ private slots:
volatile bool m_paused;

bool m_loadingProject;
bool m_isCancelled;

QStringList m_errors;

Expand Down
5 changes: 3 additions & 2 deletions include/lmms_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,12 @@ static inline float logToLinearScale( float min, float max, float value )
static inline float linearToLogScale( float min, float max, float value )
{
static const float EXP = 1.0f / F_E;
const float val = ( value - min ) / ( max - min );
const float valueLimited = qBound( min, value, max);
const float val = ( valueLimited - min ) / ( max - min );
if( min < 0 )
{
const float mmax = qMax( qAbs( min ), qAbs( max ) );
float result = signedPowf( value / mmax, EXP ) * mmax;
float result = signedPowf( valueLimited / mmax, EXP ) * mmax;
return isnan( result ) ? 0 : result;
}
float result = powf( val, EXP ) * ( max - min ) + min;
Expand Down
4 changes: 2 additions & 2 deletions plugins/LadspaEffect/caps/SweepVF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
02111-1307, USA or point your web browser to http://www.gnu.org.
*/

#include <algorithm>

#include "basics.h"

#include <algorithm>

#include "SweepVF.h"
#include "Descriptor.h"

Expand Down
12 changes: 3 additions & 9 deletions src/core/AutomatableModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ AutomatableModel::AutomatableModel( DataType type,
Model( parent, displayName, defaultConstructed ),
m_dataType( type ),
m_scaleType( Linear ),
m_value( val ),
m_initValue( val ),
m_minValue( min ),
m_maxValue( max ),
m_step( step ),
Expand All @@ -59,6 +57,7 @@ AutomatableModel::AutomatableModel( DataType type,
m_hasSampleExactData( false )

{
m_value = fittedValue( val );
setInitValue( val );
}

Expand Down Expand Up @@ -523,14 +522,8 @@ float AutomatableModel::controllerValue( int frameOffset ) const

ValueBuffer * AutomatableModel::valueBuffer()
{
// if we've already calculated the valuebuffer this period, return the cached buffer
if( m_lastUpdatedPeriod == s_periodCounter )
{
return m_hasSampleExactData
? &m_valueBuffer
: NULL;
}
QMutexLocker m( &m_valueBufferMutex );
// if we've already calculated the valuebuffer this period, return the cached buffer
if( m_lastUpdatedPeriod == s_periodCounter )
{
return m_hasSampleExactData
Expand Down Expand Up @@ -626,6 +619,7 @@ void AutomatableModel::setInitValue( const float value )
m_initValue = fittedValue( value );
bool journalling = testAndSetJournalling( false );
setValue( value );
m_oldValue = m_value;
setJournalling( journalling );
emit initValueChanged( value );
}
Expand Down
14 changes: 14 additions & 0 deletions src/core/Mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,20 @@ void Mixer::clear()



void Mixer::clearNewPlayHandles()
{
requestChangeInModel();
for( LocklessListElement * e = m_newPlayHandles.popList(); e; )
{
LocklessListElement * next = e->next;
m_newPlayHandles.free( e );
e = next;
}
doneChangeInModel();
}



// removes all play-handles. this is necessary, when the song is stopped ->
// all remaining notes etc. would be played until their end
void Mixer::clearInternal()
Expand Down
12 changes: 10 additions & 2 deletions src/core/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Song::Song() :
m_playing( false ),
m_paused( false ),
m_loadingProject( false ),
m_isCancelled( false ),
m_playMode( Mode_None ),
m_length( 0 ),
m_patternToPlay( NULL ),
Expand Down Expand Up @@ -1068,7 +1069,7 @@ void Song::loadProject( const QString & fileName )
}
}

while( !node.isNull() )
while( !node.isNull() && !isCancelled() )
{
if( node.isElement() )
{
Expand Down Expand Up @@ -1127,6 +1128,13 @@ void Song::loadProject( const QString & fileName )

emit projectLoaded();

if( isCancelled() )
{
m_isCancelled = false;
createNewProject();
return;
}

if ( hasErrors())
{
if ( gui )
Expand Down Expand Up @@ -1272,7 +1280,7 @@ void Song::saveControllerStates( QDomDocument & doc, QDomElement & element )
void Song::restoreControllerStates( const QDomElement & element )
{
QDomNode node = element.firstChild();
while( !node.isNull() )
while( !node.isNull() && !isCancelled() )
{
Controller * c = Controller::create( node.toElement(), this );
Q_ASSERT( c != NULL );
Expand Down
10 changes: 10 additions & 0 deletions src/core/TrackContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@
#include "AutomationTrack.h"
#include "BBTrack.h"
#include "BBTrackContainer.h"
#include "embed.h"
#include "TrackContainer.h"
#include "InstrumentTrack.h"
#include "Song.h"

#include "GuiApplication.h"
#include "MainWindow.h"
#include "TextFloat.h"

TrackContainer::TrackContainer() :
Model( NULL ),
Expand Down Expand Up @@ -110,6 +112,14 @@ void TrackContainer::loadSettings( const QDomElement & _this )
QEventLoop::AllEvents, 100 );
if( pd->wasCanceled() )
{
if ( gui )
{
TextFloat::displayMessage( tr( "Loading cancelled" ),
tr( "Project loading was cancelled." ),
embed::getIconPixmap( "project_file", 24, 24 ),
2000 );
}
Engine::getSong()->loadingCancelled();
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/midi/MidiApple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ char * MidiApple::getFullName(MIDIEndpointRef &endpoint_ref)
char * deviceName = getName(device);
char * endPointName = getName(endpoint_ref);
qDebug("device name='%s' endpoint name='%s'",deviceName,endPointName);
char * fullName = (char *)malloc(strlen(deviceName) + strlen(endPointName)+1);
char * fullName = (char *)malloc(strlen(deviceName) + strlen(":") + strlen(endPointName)+1);
sprintf(fullName, "%s:%s", deviceName,endPointName);
return fullName;
}
Expand Down
12 changes: 11 additions & 1 deletion src/gui/AutomationPatternView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,16 @@ void AutomationPatternView::paintEvent( QPaintEvent * )

float *values = m_pat->valuesAfter( it.key() );

float nextValue;
if( m_pat->progressionType() == AutomationPattern::DiscreteProgression )
{
nextValue = it.value();
}
else
{
nextValue = ( it + 1 ).value();
}

QPainterPath path;
QPointF origin = QPointF( x_base + it.key() * ppTick, 0.0f );
path.moveTo( origin );
Expand All @@ -340,7 +350,7 @@ void AutomationPatternView::paintEvent( QPaintEvent * )
path.lineTo( QPointF( x, value ) );

}
path.lineTo( x_base + ( ( it + 1 ).key() ) * ppTick, values[ ( it + 1 ).key() - 1 - it.key() ] );
path.lineTo( x_base + ( ( it + 1 ).key() ) * ppTick, nextValue );
path.lineTo( x_base + ( ( it + 1 ).key() ) * ppTick, 0.0f );
path.lineTo( origin );

Expand Down
4 changes: 4 additions & 0 deletions src/gui/FxMixerView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,10 @@ void FxMixerView::deleteChannel(int index)
// remember selected line
int selLine = m_currentFxLine->channelIndex();

// in case the deleted channel is soloed or the remaining
// channels will be left in a muted state
Engine::fxMixer()->clearChannel(index);

// delete the real channel
Engine::fxMixer()->deleteChannel(index);

Expand Down
20 changes: 19 additions & 1 deletion src/gui/MainApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@

MainApplication::MainApplication(int& argc, char** argv) :
QApplication(argc, argv),
m_queuedFile() {}
m_queuedFile()
{
#if defined(LMMS_BUILD_WIN32) && QT_VERSION >= 0x050000
installNativeEventFilter(this);
#endif
}

bool MainApplication::event(QEvent* event)
{
Expand Down Expand Up @@ -64,6 +69,7 @@ bool MainApplication::event(QEvent* event)
}

#ifdef LMMS_BUILD_WIN32
// This can be moved into nativeEventFilter once Qt4 support has been dropped
bool MainApplication::winEventFilter(MSG* msg, long* result)
{
switch(msg->message)
Expand All @@ -85,4 +91,16 @@ bool MainApplication::winEventFilter(MSG* msg, long* result)
return false;
}
}

#if QT_VERSION >= 0x050000
bool MainApplication::nativeEventFilter(const QByteArray& eventType,
void* message, long* result)
{
if(eventType == "windows_generic_MSG")
{
return winEventFilter(static_cast<MSG *>(message), result);
}
return false;
}
#endif
#endif
Loading

0 comments on commit caecae3

Please sign in to comment.