lot of fixes

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@124 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2006-04-10 08:22:55 +00:00
parent 1d6e678914
commit b1887d62b8
118 changed files with 377 additions and 324 deletions

View File

@@ -382,7 +382,8 @@ int audioJACK::processCallback( jack_nframes_t _nframes, void * _udata )
{
for( Uint8 chnl = 0; chnl < _this->channels(); ++chnl )
{
for( Uint32 frame = 0; frame < todo; ++frame )
for( jack_nframes_t frame = 0; frame < todo;
++frame )
{
outbufs[chnl][done+frame] =
_this->m_outBuf[_this->m_framesDoneInCurBuf+frame][chnl] *

View File

@@ -328,7 +328,7 @@ void audioOSS::run( void )
while( m_quit == FALSE )
{
const Uint32 frames = getNextBuffer( temp );
const fpab_t frames = getNextBuffer( temp );
int bytes = convertToS16( temp, frames,
getMixer()->masterGain(), outbuf,

View File

@@ -539,7 +539,7 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
// now?
if( m_arpModeComboBox->value() == SORT &&
( ( cur_frame / arp_frames ) % total_range ) /
range != (Uint32) _n->index() )
range != (f_cnt_t) _n->index() )
{
// update counters
frames_processed += arp_frames;

View File

@@ -214,8 +214,8 @@ tact bbEditor::lengthOfBB( csize _bb )
bool FASTCALL bbEditor::play( midiTime _start, Uint32 _start_frame,
Uint32 _frames, Uint32 _frame_base,
bool FASTCALL bbEditor::play( midiTime _start, f_cnt_t _start_frame,
f_cnt_t _frames, f_cnt_t _frame_base,
Sint16 _tco_num )
{
bool played_a_note = FALSE;

View File

@@ -432,6 +432,8 @@ envelopeAndLFOWidget::envelopeAndLFOWidget( float _value_for_zero_amount,
m_lfoWaveBtnGrp->addButton( m_userLfoBtn );
m_lfoWaveBtnGrp->setInitValue( SIN );
connect( m_lfoWaveBtnGrp, SIGNAL( valueChanged( int ) ),
SLOT( lfoWaveCh( int ) ) );
m_x100Cb = new ledCheckBox( tr( "FREQ x 100" ), this, eng() );
m_x100Cb->setFont( pointSize<6>( m_x100Cb->font() ) );
@@ -554,46 +556,33 @@ float FASTCALL envelopeAndLFOWidget::level( f_cnt_t _frame,
{
return( 0.0f );
}
if( _frame < m_pahdFrames )
const float lfo_level = lfoLevel( _frame, _frame_offset );
float env_level;
if( _frame < _release_begin && _frame < m_pahdFrames )
{
if( m_controlEnvAmountCb->isChecked() )
env_level = m_pahdEnv[_frame];
}
else if( _frame >= _release_begin )
{
if( ( _frame -= _release_begin ) < m_rFrames )
{
return( m_pahdEnv[_frame] * ( 0.5f +
lfoLevel( _frame, _frame_offset ) ) );
env_level = m_rEnv[_frame] *
( ( _release_begin < m_pahdFrames ) ?
m_pahdEnv[_release_begin] : m_sustainLevel );
}
else
{
return( m_pahdEnv[_frame] +
lfoLevel( _frame, _frame_offset ) );
env_level = 0.0f;
}
}
else if( _frame > _release_begin )
else
{
_frame -= _release_begin;
if( _frame < m_rFrames )
{
if( m_controlEnvAmountCb->isChecked() )
{
return( m_rEnv[_frame] * ( 0.5f +
lfoLevel( _frame, _frame_offset ) ) );
}
else
{
return( m_rEnv[_frame] +
lfoLevel( _frame, _frame_offset ) );
}
}
else
{
return( 0.0f );
}
env_level = m_sustainLevel;
}
if( m_controlEnvAmountCb->isChecked() )
{
return( m_sustainLevel * ( 0.5f +
lfoLevel( _frame, _frame_offset ) ) );
}
return( m_sustainLevel + lfoLevel( _frame, _frame_offset ) );
return( m_controlEnvAmountCb->isChecked() ?
env_level * ( 0.5f + lfo_level )
:
env_level + lfo_level );
}
@@ -998,8 +987,9 @@ void envelopeAndLFOWidget::updateSampleVars( void )
for( f_cnt_t i = 0; i < m_rFrames; ++i )
{
new_r_env[i] = ( (float)( m_rFrames - i ) / m_rFrames *
m_sustainLevel ) * m_amount;
new_r_env[i] = ( (float)( m_rFrames - i ) / m_rFrames
// * m_sustainLevel
) * m_amount;
}
// save this calculation in real-time-part
@@ -1117,7 +1107,7 @@ void envelopeAndLFOWidget::lfoWaveCh( int _val )
void envelopeAndLFOWidget::lfoUserWaveCh( bool _on )
{
if( _on )
if( _on && m_lfoShape != USER )
{
if( m_userWave.frames() <= 1 )
{

View File

@@ -581,7 +581,7 @@ void listView::contentsMouseReleaseEvent( QMouseEvent * _me )
if( s != NULL )
{
if( s->totalFrames() - s->framesDone() <=
static_cast<Uint32>(
static_cast<f_cnt_t>(
eng()->getMixer()->sampleRate() * 3 ) )
{
s->setDoneMayReturnTrue( TRUE );

View File

@@ -140,7 +140,7 @@ void mixer::stopProcessing( void )
bool mixer::criticalXRuns( void ) const
{
return( ( m_cpuLoad >= 99 &&
eng()->getSongEditor()->realTimeTask() == TRUE ) );
eng()->getSongEditor()->realTimeTask() == TRUE ) );
}

View File

@@ -332,7 +332,8 @@ int notePlayHandle::index( void ) const
{
const notePlayHandle * nph =
dynamic_cast<const notePlayHandle *>( *it );
if( nph == NULL || nph->m_instrumentTrack != m_instrumentTrack ||
if( nph == NULL ||
nph->m_instrumentTrack != m_instrumentTrack ||
nph->released() == TRUE )
{
continue;

View File

@@ -47,6 +47,7 @@
#include "mmp.h"
#include "debug.h"
#include "midi_port.h"
#include "project_journal.h"
@@ -143,11 +144,15 @@ presetPreviewPlayHandle::presetPreviewPlayHandle(
}
const bool j = eng()->getProjectJournal()->isJournalling();
eng()->getProjectJournal()->setJournalling( FALSE );
multimediaProject mmp( _preset_file );
printf("load track sp\n");
previewTC()->previewInstrumentTrack()->loadTrackSpecificSettings(
mmp.content().firstChild().toElement() );
printf("here\n");
// preset also contains information about window-states etc. that's why
// here we have to make sure that the instrument-track-window is hidden
previewTC()->previewInstrumentTrack()->hide();
// make sure, our preset-preview-track does not appear in any MIDI-
// devices list, so just disable receiving/sending MIDI-events at all
@@ -156,7 +161,8 @@ presetPreviewPlayHandle::presetPreviewPlayHandle(
// create note-play-handle for it
m_previewNote = new notePlayHandle(
previewTC()->previewInstrumentTrack(), 0, ~0,
previewTC()->previewInstrumentTrack(), 0,
valueRanges<f_cnt_t>::max,
note( NULL, 0, 0, static_cast<tones>( A ),
static_cast<octaves>( DEFAULT_OCTAVE - 1 ), 100 ) );
@@ -164,6 +170,7 @@ presetPreviewPlayHandle::presetPreviewPlayHandle(
previewTC()->setPreviewNote( m_previewNote );
previewTC()->unlockData();
eng()->getProjectJournal()->setJournalling( j );
}

View File

@@ -953,8 +953,8 @@ void songEditor::processNextBuffer( void )
}
}
Uint32 total_frames_played = 0;
Uint32 frames_per_tact = static_cast<Uint32>( framesPerTact() );
f_cnt_t total_frames_played = 0;
f_cnt_t frames_per_tact = static_cast<f_cnt_t>( framesPerTact() );
if( m_playPos[m_playMode].currentFrame() == 0 &&
m_playPos[m_playMode].getTact64th() > 0 )
{
@@ -965,7 +965,7 @@ void songEditor::processNextBuffer( void )
while( total_frames_played < eng()->getMixer()->framesPerAudioBuffer() )
{
Uint32 played_frames = eng()->getMixer()->framesPerAudioBuffer() -
f_cnt_t played_frames = eng()->getMixer()->framesPerAudioBuffer() -
total_frames_played;
// did we play a whole tact?
@@ -1144,7 +1144,7 @@ void songEditor::setPlayPos( tact _tact_num, tact64th _t_64th, playModes
{
m_playPos[_play_mode].setTact( _tact_num );
m_playPos[_play_mode].setTact64th( _t_64th );
m_playPos[_play_mode].setCurrentFrame( static_cast<Uint32>(
m_playPos[_play_mode].setCurrentFrame( static_cast<f_cnt_t>(
_t_64th * framesPerTact() / 64.0f ) );
if( _play_mode == m_playMode )
{

View File

@@ -367,9 +367,9 @@ bool trackContainer::allowRubberband( void ) const
unsigned int trackContainer::countTracks( track::trackTypes _tt ) const
Uint16 trackContainer::countTracks( track::trackTypes _tt ) const
{
unsigned int cnt = 0;
Uint16 cnt = 0;
for( trackWidgetVector::const_iterator it = m_trackWidgets.begin();
it != m_trackWidgets.end(); ++it )
{

View File

@@ -29,7 +29,7 @@
#ifdef QT4
#include <QImage>
#include <QtGui/QImage>
#else

View File

@@ -621,7 +621,7 @@ void instrumentTrack::processInEvent( const midiEvent & _me,
notePlayHandle * nph = new
notePlayHandle( this,
_time.frames( eng()->getSongEditor()->framesPerTact() ),
~0, n );
valueRanges<f_cnt_t>::max, n );
if( eng()->getMixer()->addPlayHandle(
nph ) )
{