Conflicts:
	plugins/opl2/opl2instrument.cpp
This commit is contained in:
Raine M. Ekman
2014-01-24 17:48:26 +02:00
115 changed files with 363 additions and 276 deletions

View File

@@ -244,21 +244,19 @@ bool opl2instrument::handleMidiEvent( const midiEvent & _me,
static int lastvoice=0;
switch(_me.m_type) {
case MidiNoteOn:
if( !isMuted() ) {
// to get us in line with MIDI(?)
key = _me.key() +12;
vel = _me.velocity();
for(int i=lastvoice+1; i!=lastvoice; ++i,i%=9) {
if( voiceNote[i] == OPL2_VOICE_FREE ) {
theEmulator->write(0xA0+i, fnums[key] & 0xff);
theEmulator->write(0xB0+i, 32 + ((fnums[key] & 0x1f00) >> 8) );
voiceNote[i] = key;
velocities[key] = vel;
lastvoice=i;
break;
}
}
}
// to get us in line with MIDI(?)
key = _me.key() +12;
vel = _me.velocity();
for(int i=lastvoice+1; i!=lastvoice; ++i,i%=9) {
if( voiceNote[i] == OPL2_VOICE_FREE ) {
theEmulator->write(0xA0+i, fnums[key] & 0xff);
theEmulator->write(0xB0+i, 32 + ((fnums[key] & 0x1f00) >> 8) );
voiceNote[i] = key;
velocities[key] = vel;
lastvoice=i;
break;
}
}
break;
case MidiNoteOff:
key = _me.key() +12;

View File

@@ -389,7 +389,7 @@ organicInstrumentView::organicInstrumentView( Instrument * _instrument,
m_fx1Knob = new organicKnob( this );
m_fx1Knob->move( 15, 201 );
m_fx1Knob->setFixedSize( 37, 47 );
m_fx1Knob->setHintText( tr( "Distortion:" ) + " ", "%" );
m_fx1Knob->setHintText( tr( "Distortion:" ) + " ", QString() );
m_fx1Knob->setObjectName( "fx1Knob" );
// setup volume-knob
@@ -450,8 +450,7 @@ void organicInstrumentView::modelChanged()
// setup waveform-knob
knob * oscKnob = new organicKnob( this );
oscKnob->move( x + i * colWidth, y );
oscKnob->setHintText( tr( "Osc %1 waveform:" ).arg(
i + 1 ) + " ", "%" );
oscKnob->setHintText( tr( "Osc %1 waveform:" ).arg( i + 1 ) + " ", QString() );
// setup volume-knob
knob * volKnob = new knob( knobStyled, this );

View File

@@ -84,12 +84,17 @@ PeakControllerEffect::~PeakControllerEffect()
}
}
//! returns 1.0f if val > 0.0f, -1.0 else
inline float my_sign(float val) { return -1.0f + 2.0f * (val > 0.0f); }
namespace helpers
{
//! returns 1.0f if val > 0.0f, -1.0 else
inline float sign(float val) { return -1.0f + 2.0f * (val > 0.0f); }
//! if val >= 0.0f, returns sqrtf(val), else: -sqrtf(-val)
inline float sqrt_neg(float val) {
return sqrtf(fabs(val)) * helpers::sign(val);
}
//! if val >= 0.0f, returns sqrtf(val), else: -sqrtf(-val)
inline float sqrt_neg(float val) {
return sqrtf(fabs(val)) * my_sign(val);
}
bool PeakControllerEffect::processAudioBuffer( sampleFrame * _buf,
@@ -106,16 +111,28 @@ bool PeakControllerEffect::processAudioBuffer( sampleFrame * _buf,
// RMS:
double sum = 0;
for( int i = 0; i < _frames; ++i )
if(c.m_absModel.value())
{
float sign_0 = (c.m_absModel.value())
? 1.0f : my_sign(_buf[i][0]);
float sign_1 = (c.m_absModel.value())
? 1.0f : my_sign(_buf[i][1]);
sum += _buf[i][0]*_buf[i][0]*sign_0
+ _buf[i][1]*_buf[i][1]*sign_1;
for( int i = 0; i < _frames; ++i )
{
// absolute value is achieved because the squares are > 0
sum += _buf[i][0]*_buf[i][0] + _buf[i][1]*_buf[i][1];
}
}
else
{
for( int i = 0; i < _frames; ++i )
{
// the value is absolute because of squaring,
// so we need to correct it
sum += _buf[i][0]*_buf[i][0]*helpers::sign(_buf[i][0])
+ _buf[i][1]*_buf[i][1]*helpers::sign(_buf[i][1]);
}
}
// TODO: flipping this might cause clipping
// this will mute the output after the values were measured
if( c.m_muteModel.value() )
{
for( int i = 0; i < _frames; ++i )
@@ -124,7 +141,7 @@ bool PeakControllerEffect::processAudioBuffer( sampleFrame * _buf,
}
}
float curRMS = sqrt_neg( sum / _frames );
float curRMS = helpers::sqrt_neg( sum / _frames );
const float origRMS = curRMS;
if( !m_lastRMSavail )
@@ -135,7 +152,7 @@ bool PeakControllerEffect::processAudioBuffer( sampleFrame * _buf,
const float v = ( curRMS >= m_lastRMS ) ?
c.m_attackModel.value() :
c.m_decayModel.value();
const float a = sqrt_neg( sqrt_neg( v ) );
const float a = helpers::sqrt_neg( helpers::sqrt_neg( v ) );
curRMS = (1-a)*curRMS + a*m_lastRMS;
const float amount = c.m_amountModel.value() * c.m_amountMultModel.value();
@@ -153,16 +170,6 @@ bool PeakControllerEffect::processAudioBuffer( sampleFrame * _buf,
//checkGate( out_sum / _frames );
// finally, mute the output if wanted
// TODO: avoid clips?
if( c.m_muteOutputModel.value() )
{
for( int i = 0; i < _frames; ++i )
{
_buf[i][0] = _buf[i][1] = 0.0f;
}
}
return isRunning();
}

View File

@@ -56,7 +56,7 @@ PeakControllerEffectControlDialog::PeakControllerEffectControlDialog(
m_baseKnob->setHintText( tr( "Base amount:" ) + " ", "" );
m_amountKnob = new knob( knobBright_26, this );
m_amountKnob->setLabel( tr( "AMT" ) );
m_amountKnob->setLabel( tr( "AMNT" ) );
m_amountKnob->setModel( &_controls->m_amountModel );
m_amountKnob->setHintText( tr( "Modulation amount:" ) + " ", "" );
@@ -66,12 +66,12 @@ PeakControllerEffectControlDialog::PeakControllerEffectControlDialog(
m_amountMultKnob->setHintText( tr( "Amount Multiplicator:" ) + " ", "" );
m_attackKnob = new knob( knobBright_26, this );
m_attackKnob->setLabel( tr( "ATTCK" ) );
m_attackKnob->setLabel( tr( "ATCK" ) );
m_attackKnob->setModel( &_controls->m_attackModel );
m_attackKnob->setHintText( tr( "Attack:" ) + " ", "" );
m_decayKnob = new knob( knobBright_26, this );
m_decayKnob->setLabel( tr( "DECAY" ) );
m_decayKnob->setLabel( tr( "DCAY" ) );
m_decayKnob->setModel( &_controls->m_decayModel );
m_decayKnob->setHintText( tr( "Release:" ) + " ", "" );
@@ -88,15 +88,11 @@ PeakControllerEffectControlDialog::PeakControllerEffectControlDialog(
m_muteLed = new ledCheckBox( "Mute Effect", this );
m_muteLed->setModel( &_controls->m_muteModel );
m_absLed = new ledCheckBox( "Abs Value", this );
m_absLed = new ledCheckBox( "Absolute Value", this );
m_absLed->setModel( &_controls->m_absModel );
m_muteOutputLed = new ledCheckBox( "Mute Output", this );
m_muteOutputLed->setModel( &_controls->m_muteOutputModel );
l2->addWidget( m_muteLed );
l2->addWidget( m_absLed );
l2->addWidget( m_muteOutputLed );
l2->addStretch(); // expand, so other widgets have minimum height
tl->addLayout( l2 );

View File

@@ -52,7 +52,6 @@ protected:
ledCheckBox * m_absLed;
knob * m_amountMultKnob;
ledCheckBox * m_muteOutputLed;
} ;

View File

@@ -41,8 +41,7 @@ PeakControllerEffectControls( PeakControllerEffect * _eff ) :
m_decayModel( 0, 0, 0.999, 0.001, this, tr( "Release" ) ),
m_muteModel( false, this, tr( "Mute output" ) ),
m_absModel( true, this, tr("Abs Value") ),
m_amountMultModel( 1.0, 0, 32, 0.2, this, tr("Amount Multiplicator") ),
m_muteOutputModel( false, this, tr("Mute Output") )
m_amountMultModel( 1.0, 0, 32, 0.2, this, tr("Amount Multiplicator") )
{
}
@@ -59,7 +58,6 @@ void PeakControllerEffectControls::loadSettings( const QDomElement & _this )
m_absModel.loadSettings( _this, "abs" );
m_amountMultModel.loadSettings( _this, "amountmult" );
m_muteOutputModel.loadSettings( _this, "muteout" );
int effectId = _this.attribute( "effectId" ).toInt();
if( effectId > PeakController::s_lastEffectId )
@@ -92,7 +90,6 @@ void PeakControllerEffectControls::saveSettings( QDomDocument & _doc,
m_absModel.saveSettings( _doc, _this, "abs" );
m_amountMultModel.saveSettings( _doc, _this, "amountmult" );
m_muteOutputModel.saveSettings( _doc, _this, "muteout" );
}

View File

@@ -68,7 +68,6 @@ private:
BoolModel m_muteModel;
BoolModel m_absModel;
FloatModel m_amountMultModel;
BoolModel m_muteOutputModel;
friend class PeakControllerEffectControlDialog;
friend class PeakControllerEffect;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 880 B

After

Width:  |  Height:  |  Size: 608 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 916 B

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 604 B

After

Width:  |  Height:  |  Size: 435 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 B

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 849 B

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 839 B

After

Width:  |  Height:  |  Size: 446 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 928 B

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 908 B

After

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 594 B

After

Width:  |  Height:  |  Size: 350 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 881 B

After

Width:  |  Height:  |  Size: 579 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 870 B

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 595 B

After

Width:  |  Height:  |  Size: 437 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 576 B

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 627 B

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 592 B

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 547 B

After

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 531 B

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 787 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 972 B

After

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 614 B

After

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 591 B

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 587 B

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 562 B

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 606 B

After

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 578 B

After

Width:  |  Height:  |  Size: 312 B

View File

@@ -313,15 +313,13 @@ void vestigeInstrument::play( sampleFrame * _buf )
bool vestigeInstrument::handleMidiEvent( const midiEvent & _me,
const midiTime & _time )
{
if( !isMuted() )
m_pluginMutex.lock();
if( m_plugin != NULL )
{
m_pluginMutex.lock();
if( m_plugin != NULL )
{
m_plugin->processMidiEvent( _me, _time );
}
m_pluginMutex.unlock();
m_plugin->processMidiEvent( _me, _time );
}
m_pluginMutex.unlock();
return true;
}

View File

@@ -1,7 +1,7 @@
/*
* ZynAddSubFx.cpp - ZynAddSubxFX-embedding plugin
*
* Copyright (c) 2008-2013 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
*
@@ -343,14 +343,9 @@ void ZynAddSubFxInstrument::play( sampleFrame * _buf )
bool ZynAddSubFxInstrument::handleMidiEvent( const midiEvent & _me,
const midiTime & _time )
{
// do not send NoteOn events if muted
if( _me.type() == MidiNoteOn && isMuted() )
{
return true;
}
// do not forward external MIDI Control Change events if the according
// LED is not checked
else if( _me.type() == MidiControlChange &&
if( _me.type() == MidiControlChange &&
_me.sourcePort() != this &&
m_forwardMidiCcModel.value() == false )
{

View File

@@ -1076,7 +1076,7 @@ void Part::setPpanning(char Ppanning_)
*/
void Part::setkititemstatus(int kititem, int Penabled_)
{
if((kititem == 0) && (kititem >= NUM_KIT_ITEMS))
if((kititem == 0) || (kititem >= NUM_KIT_ITEMS))
return; //nonexistent kit item and the first kit item is always enabled
kit[kititem].Penabled = Penabled_;