small bug-fixes

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@42 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2005-12-22 12:57:51 +00:00
parent f543cd8f4e
commit 181f9b56f6
11 changed files with 95 additions and 46 deletions

View File

@@ -1,9 +1,29 @@
2005-12-21 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* src/lib/sample_buffer.cpp:
- first try to use libsndfile instead of SDL_sound for decoding sample
as SDL_sound sometimes doesn't handle samples (raw- and FLAC-files)
the correct way and returns unusable data while libsndfile seems to
work quite fine with these samples
- when using libsamplerate, use linear-interpolation per default
instead of zero-order-hold-resampling which results in MUCH higher
quality when resampling as it produces much less artifacts
* src/core/file_browser.cpp:
classify files with extension "flac" as samples
* src/widgets/tab_widget.cpp:
hide all other tabs when changing active tab - neccessary for working
with Qt 4.1
2005-12-20 Danny McRae <khjklujn/at/yahoo.com>
* resources/step_btn_on_100.png:
* resources/step_btn_yellow.png:
* include/pattern.h:
* src/tracks/pattern.cpp:
be able to change volume of step in bb-editor via mouse wheel and
change color of step-button accordingly
make it possible to change volume of steps in bb-editor using mouse
wheel and which changes color of step-button accordingly
2005-12-20 Tobias Doerffel <tobydox/at/users.sourceforge.net>

3
TODO
View File

@@ -1,10 +1,9 @@
to be done as soon as possible:
- do not skip samples because of rounding when resampling in src/lib/sample_buffer.cpp
- MIDI-program/MIDI-mapping/process program-/channel-change-events from MIDI-files
- do not allow to connect output-port of channel to own input-port!
- add note-len- and note-alignment-selectbox to piano-roll
- fix audio/midi-settings stuff/translation
- tooltips for controls in MIDI-tab
- DSSI-support
- save/load parameters of VST-plugin
- somehow avoid hidden plugin-descriptor-widgets plugin-browser if height of window is too small -> add scrollbar

View File

@@ -2,8 +2,8 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT(lmms, 0.1.1-cvs20051219, tobydox/at/users.sourceforge.net)
AM_INIT_AUTOMAKE(lmms, 0.1.1-cvs20051219)
AC_INIT(lmms, 0.1.1-cvs20051221, tobydox/at/users.sourceforge.net)
AM_INIT_AUTOMAKE(lmms, 0.1.1-cvs20051221)
AM_CONFIG_HEADER(config.h)

View File

@@ -26,6 +26,11 @@
#ifndef _TAB_WIDGET_H
#define _TAB_WIDGET_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "qt3support.h"
#ifdef QT4
@@ -51,17 +56,10 @@ public:
tabWidget( const QString & _caption, QWidget * _parent );
~tabWidget();
void addTab( QWidget * _w, const QString & _name, int _idx = -1 );
void FASTCALL addTab( QWidget * _w, const QString & _name,
int _idx = -1 );
inline void setActiveTab( int _idx )
{
if( m_widgets.contains( _idx ) )
{
m_activeTab = _idx;
m_widgets[m_activeTab].w->raise();
update();
}
}
void FASTCALL setActiveTab( int _idx );
inline int activeTab( void ) const
{

View File

@@ -803,7 +803,7 @@ void fileItem::determineFileType( void )
}
else if( ext == "wav" || ext == "ogg" || ext == "mp3" ||
ext == "aiff" || ext == "aif" || ext == "voc" ||
ext == "au" || ext == "raw" )
ext == "au" || ext == "raw" || ext == "flac" )
{
m_type = SAMPLE_FILE;
}

View File

@@ -1540,7 +1540,7 @@ bool songEditor::saveProject( void )
else
{
textFloat::displayMessage( tr( "Project NOT saved." ),
tr( "The project %1 could not be saved!" ).arg(
tr( "The project %1 was not saved!" ).arg(
m_fileName ),
embed::getIconPixmap( "error" ), 4000 );
return( FALSE );

View File

@@ -144,7 +144,7 @@ sampleBuffer::sampleBuffer( const sampleFrame * _data, Uint32 _frames ) :
m_dataMutex()
{
m_origData = new sampleFrame[_frames];
memcpy( m_origData, _data, _frames*BYTES_PER_FRAME );
memcpy( m_origData, _data, _frames * BYTES_PER_FRAME );
m_origFrames = _frames;
#ifdef SDL_SDL_SOUND_H
// init sound-file-system of SDL
@@ -225,18 +225,18 @@ void sampleBuffer::update( bool _keep_settings )
Sint16 * buf = NULL;
Uint8 channels;
#ifdef SDL_SDL_SOUND_H
if( m_frames == 0 )
{
m_frames = decodeSampleSDL( f, buf, channels );
}
#endif
#ifdef HAVE_SNDFILE_H
if( m_frames == 0 )
{
m_frames = decodeSampleSF( f, buf, channels );
}
#endif
#ifdef SDL_SDL_SOUND_H
if( m_frames == 0 )
{
m_frames = decodeSampleSDL( f, buf, channels );
}
#endif
#ifdef HAVE_VORBIS_VORBISFILE_H
if( m_frames == 0 )
{
@@ -338,7 +338,7 @@ Uint32 sampleBuffer::decodeSampleSDL( const char * _f, Sint16 * & _buf,
Sound_Sample * snd_sample = Sound_NewSampleFromFile( _f,
&STD_AUDIO_INFO, 16384 );
// file not found?
// file found?
if( snd_sample != NULL )
{
// let SDL_sound decode our file to requested format
@@ -561,12 +561,10 @@ SRC_STATE * sampleBuffer::createResamplingContext( void )
{
int error;
SRC_STATE * state;
if( ( state = src_new(
#ifdef HQ_SINC
SRC_SINC_MEDIUM_QUALITY,
#else
SRC_ZERO_ORDER_HOLD,
#endif
if( ( state = src_new(/*
( mixer::inst()->highQuality() == TRUE ) ?
SRC_SINC_FASTEST :*/
SRC_LINEAR,
DEFAULT_CHANNELS, &error ) ) == NULL )
{
printf( "Error: src_new() failed in sample_buffer.cpp!\n" );
@@ -598,7 +596,7 @@ bool FASTCALL sampleBuffer::play( sampleFrame * _ab, Uint32 _start_frame,
return( FALSE );
}
const float freq_factor = 1.0f / (BASE_FREQ / _freq);
const double freq_factor = (double) _freq / (double) BASE_FREQ;
const Sint16 freq_diff = static_cast<Sint16>( BASE_FREQ - _freq );
Uint32 frames_to_process = _frames;
@@ -635,11 +633,21 @@ bool FASTCALL sampleBuffer::play( sampleFrame * _ab, Uint32 _start_frame,
{
frames_to_process = frames_for_loop;
}
const Uint32 f1 = static_cast<Uint32>( play_frame * freq_factor );
/* Uint32 f2 = 0;
while( f2 < f1 )
{
f2 += frames_to_process * freq_factor;
}
if( f2 > f1 && f2 >= frames_to_process )
{
f2 -= frames_to_process * freq_factor;
}*/
// static int foo = 0;
// calc pointer of first frame
sampleFrame * start_frame = (sampleFrame *) m_data +
static_cast<Uint32>( play_frame *
freq_factor );
sampleFrame * start_frame = (sampleFrame *) m_data + f1;
//printf("diff:%d %f %d f2: %d input: %d\n", f2 -foo, play_frame * freq_factor, static_cast<Uint32>( play_frame * freq_factor ), f2, (Uint32)( frames_for_loop * freq_factor ) );
// foo = f2;
sampleFrame * loop_start = start_frame;
// check whether we have to change pitch...
@@ -670,7 +678,7 @@ bool FASTCALL sampleBuffer::play( sampleFrame * _ab, Uint32 _start_frame,
#else
Uint32 src_frame_base = 0;
// check whether we're in high-quality-mode
if( mixer::inst()->highQuality() )
if( mixer::inst()->highQuality() == TRUE )
{
// we are, so let's use cubic interpolation...
for( Uint32 frame = 0; frame < frames_to_process;

View File

@@ -185,7 +185,7 @@ void pattern::init( void )
toolTip::add( this,
tr( "double-click to open this pattern in piano-roll\n"
"use mouse wheel to set volume" ) );
"use mouse wheel to set volume of a step" ) );
}
@@ -810,11 +810,6 @@ void pattern::mousePressEvent( QMouseEvent * _me )
void pattern::wheelEvent( QWheelEvent * _we )
{
/* if( _me->button() != Qt::LeftButton )
{
return;
}*/
if( m_patternType == pattern::BEAT_PATTERN &&
( pixelsPerTact() >= 192 ||
m_steps != DEFAULT_STEPS_PER_TACT ) &&
@@ -1015,6 +1010,7 @@ void pattern::paintEvent( QPaintEvent * )
if( ( *it )->length() < 0 )
{
p.drawPixmap( x, y, stepoff );
for( int i = 0; i < vol / 5 + 1; ++i )
{
p.drawPixmap( x, y, stepon );

View File

@@ -160,7 +160,11 @@ void lcdSpinBox::mousePressEvent( QMouseEvent * _me )
void lcdSpinBox::mouseMoveEvent( QMouseEvent * _me )
{
#ifdef QT4
if( _me->buttons() & Qt::LeftButton )
#else
if( _me->modifiers() == Qt::LeftButton )
#endif
{
int dy = _me->globalY() - m_origMousePos.y();
if( dy > 1 || dy < -1 )

View File

@@ -89,6 +89,7 @@ void tabWidget::addTab( QWidget * _w, const QString & _name, int _idx )
if( m_widgets.contains( m_activeTab ) )
{
// make sure new tab doesn't overlap current widget
m_widgets[m_activeTab].w->show();
m_widgets[m_activeTab].w->raise();
}
}
@@ -96,6 +97,25 @@ void tabWidget::addTab( QWidget * _w, const QString & _name, int _idx )
void tabWidget::setActiveTab( int _idx )
{
if( m_widgets.contains( _idx ) )
{
int old_active = m_activeTab;
m_activeTab = _idx;
m_widgets[m_activeTab].w->raise();
m_widgets[m_activeTab].w->show();
if( old_active != _idx && m_widgets.contains( old_active ) )
{
m_widgets[old_active].w->hide();
}
update();
}
}
void tabWidget::mousePressEvent( QMouseEvent * _me )
{
if( _me->y() > 1 && _me->y() < 13 )
@@ -108,8 +128,7 @@ void tabWidget::mousePressEvent( QMouseEvent * _me )
if( _me->x() >= cx &&
_me->x() <= cx + ( *it ).nwidth )
{
( *it ).w->raise();
m_activeTab = it.key();
setActiveTab( it.key() );
update();
return;
}

View File

@@ -43,6 +43,7 @@
#include "text_float.h"
#include "gui_templates.h"
#include "lmms_main_win.h"
@@ -151,6 +152,10 @@ textFloat * textFloat::displayMessage( const QString & _msg, int _timeout,
{
#ifdef QT4
QWidget * mw = QApplication::activeWindow();
if( mw == NULL )
{
mw = lmmsMainWin::inst();
}
#else
QWidget * mw = qApp->mainWidget();
#endif