dynamic tempo, online help, filter directories

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@469 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Javier Serrano Polo
2007-03-28 02:54:25 +00:00
parent 799d87c530
commit 52d9ca470b
15 changed files with 217 additions and 49 deletions

View File

@@ -1,3 +1,32 @@
2007-03-28 Javier Serrano Polo <jasp00/at/terra/dot/es>
* include/mixer.h:
* include/note_play_handle.h:
* src/core/note_play_handle.cpp:
* src/core/song_editor.cpp:
fixed notes with dynamic tempo
* include/main_window.h:
* src/core/main_window.cpp:
added online help
* include/file_browser.h:
* src/core/file_browser.cpp:
- filter directories without relevant content
- simplified entry retrieval
* include/basic_filters.h:
limit Moog instability
* src/core/main.cpp:
updated year
* src/widgets/knob.cpp:
initialize members according to last arrangement
* data/locale/ca.ts:
updated translation
2007-03-26 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* configure.in:

View File

@@ -2,8 +2,8 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT(lmms, 0.2.1-svn20070325, lmms-devel/at/lists/dot/sf/dot/net)
AM_INIT_AUTOMAKE(lmms, 0.2.1-svn20070325)
AC_INIT(lmms, 0.2.1-svn20070328, lmms-devel/at/lists/dot/sf/dot/net)
AM_INIT_AUTOMAKE(lmms, 0.2.1-svn20070328)
AM_CONFIG_HEADER(config.h)

Binary file not shown.

View File

@@ -2338,6 +2338,15 @@ Per favor, visita http://wiki.mindrules.net per a documentació sobre LMMS.</tra
<source>MultiMedia Project (*.mmp *.mmpz);;MultiMedia Project Template (*.mpt)</source>
<translation>Projecte MultiMèdia (*.mmp *.mmpz);;Plantilla de Projecte MultiMèdia (*.mpt)</translation>
</message>
<message>
<source>Online help</source>
<translation>Ajuda en línia</translation>
</message>
<message>
<source>start</source>
<comment>doku.php id</comment>
<translation>start</translation>
</message>
</context>
<context>
<name>mallets</name>

View File

@@ -4,7 +4,7 @@
* original file by ???
* modified and enhanced by Tobias Doerffel
*
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -115,14 +115,22 @@ public:
// four cascaded onepole filters
// (bilinear transform)
m_y1[_chnl] = x*m_p + m_oldx[_chnl]*m_p -
m_k*m_y1[_chnl];
m_y2[_chnl] = m_y1[_chnl]*m_p+m_oldy1[_chnl]*
m_p - m_k*m_y2[_chnl];
m_y3[_chnl] = m_y2[_chnl]*m_p+m_oldy2[_chnl]*
m_p - m_k*m_y3[_chnl];
m_y4[_chnl] = m_y3[_chnl]*m_p+m_oldy3[_chnl]*
m_p - m_k*m_y4[_chnl];
m_y1[_chnl] = tLimit(
x*m_p + m_oldx[_chnl]*m_p -
m_k*m_y1[_chnl],
-10.0f, 10.0f );
m_y2[_chnl] = tLimit(
m_y1[_chnl]*m_p+m_oldy1[_chnl]*
m_p - m_k*m_y2[_chnl],
-10.0f, 10.0f );
m_y3[_chnl] = tLimit(
m_y2[_chnl]*m_p+m_oldy2[_chnl]*
m_p - m_k*m_y3[_chnl],
-10.0f, 10.0f );
m_y4[_chnl] = tLimit(
m_y3[_chnl]*m_p+m_oldy3[_chnl]*
m_p - m_k*m_y4[_chnl],
-10.0f, 10.0f );
m_oldx[_chnl] = x;
m_oldy1[_chnl] = m_y1[_chnl];

View File

@@ -1,7 +1,7 @@
/*
* file_browser.h - include file for fileBrowser
*
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -68,6 +68,9 @@ public:
QWidget * _parent, engine * _engine );
virtual ~fileBrowser();
static bool isDirWithContent( const QString & _path,
const QString & _filter );
public slots:
void reloadTree( void );

View File

@@ -1,7 +1,7 @@
/*
* main_window.h - declaration of class mainWindow, the main window of LMMS
*
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -169,11 +169,14 @@ private:
QMenu * m_tools_menu;
vlist<tool *> m_tools;
bool have_www_browser( void );
friend class engine;
private slots:
void browseHelp( void );
void fillTemplatesMenu( void );
void showTool( int _idx );

View File

@@ -1,7 +1,7 @@
/*
* mixer.h - audio-device-independent mixer for LMMS
*
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -182,6 +182,11 @@ public:
return( m_playHandles );
}
inline playHandleVector & playHandles( void )
{
return( m_playHandles );
}
void checkValidityOfPlayHandles( void );
inline bool haveNoRunningNotes( void ) const

View File

@@ -208,6 +208,7 @@ public:
}
void processMidiTime( const midiTime & _time );
void resize( const bpm_t _new_bpm );
#if SINGERBOT_SUPPORT
int patternIndex( void )
@@ -250,6 +251,10 @@ private:
int m_patternIndex; // position among relevant notes
#endif
// tempo reaction
bpm_t m_orig_bpm; // original bpm
f_cnt_t m_orig_frames; // original m_frames
private slots:
void updateFrequency( void );

View File

@@ -4,7 +4,7 @@
* file_browser.cpp - implementation of the project-, preset- and
* sample-file-browser
*
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -160,7 +160,7 @@ void fileBrowser::reloadTree( void )
void fileBrowser::addItems( const QString & _path )
{
QDir cdir( _path );
QStringList files = cdir.entryList( QDir::NoFilter, QDir::Name );
QStringList files = cdir.entryList( QDir::Files, QDir::Name );
// TODO: after dropping qt3-support we can use QStringList's iterator
// which makes it possible to travel through the list in reverse
@@ -169,9 +169,7 @@ void fileBrowser::addItems( const QString & _path )
for( csize i = 0; i < files.size(); ++i )
{
QString cur_file = files[files.size() - i - 1];
if( cur_file[0] != '.' &&
QFileInfo( _path + QDir::separator() +
cur_file ).isDir() == FALSE
if( cur_file[0] != '.'
#ifdef QT4
// TBD
#else
@@ -185,12 +183,13 @@ void fileBrowser::addItems( const QString & _path )
}
}
files = cdir.entryList( QDir::Dirs, QDir::Name );
for( csize i = 0; i < files.size(); ++i )
{
QString cur_file = files[files.size() - i - 1];
if( cur_file[0] != '.' &&
QFileInfo( _path + QDir::separator() +
cur_file ).isDir() )
isDirWithContent( _path + QDir::separator() + cur_file,
m_filter ) )
{
QListViewItem * item = m_l->findItem( cur_file, 0 );
if( item == NULL )
@@ -210,6 +209,44 @@ void fileBrowser::addItems( const QString & _path )
bool fileBrowser::isDirWithContent( const QString & _path,
const QString & _filter )
{
QDir cdir( _path );
QStringList files = cdir.entryList( QDir::Files, QDir::Unsorted );
for( QStringList::iterator it = files.begin(); it != files.end(); ++it )
{
QString cur_file = *it;
if( cur_file[0] != '.'
#ifdef QT4
// TBD
#else
&& QDir::match( _filter, cur_file.lower() )
#endif
)
{
return( TRUE );
}
}
files = cdir.entryList( QDir::Dirs, QDir::Unsorted );
for( QStringList::iterator it = files.begin(); it != files.end(); ++it )
{
QString cur_file = *it;
if( cur_file[0] != '.' &&
isDirWithContent( _path + QDir::separator() + cur_file,
_filter ) )
{
return( TRUE );
}
}
return( FALSE );
}
void fileBrowser::keyPressEvent( QKeyEvent * _ke )
{
if( _ke->key() == Qt::Key_F5 )
@@ -740,41 +777,34 @@ bool directory::addItems( const QString & _path )
bool added_something = FALSE;
QStringList files = thisDir.entryList( QDir::NoFilter, QDir::Name );
QStringList files = thisDir.entryList( QDir::Files, QDir::Name );
for( csize i = 0; i < files.size(); ++i )
{
QString cur_file = files[files.size() - i - 1];
if( cur_file[0] != '.'
#ifdef QT4
if( cur_file[0] != '.' && !QFileInfo(
thisDir.absolutePath() + QDir::separator() +
cur_file ).isDir() &&
thisDir.match( m_filter, cur_file.toLower() )
/*QDir::match( FILE_FILTER, cur_file )*/ )
&& thisDir.match( m_filter, cur_file.toLower() )
#else
if( cur_file[0] != '.' && !QFileInfo(
thisDir.absPath() + QDir::separator() +
cur_file ).isDir() &&
thisDir.match( m_filter, cur_file.lower() )
/*QDir::match( FILE_FILTER, cur_file )*/ )
&& thisDir.match( m_filter, cur_file.lower() )
#endif
/*QDir::match( FILE_FILTER, cur_file )*/ )
{
(void) new fileItem( this, cur_file, _path );
added_something = TRUE;
}
}
files = thisDir.entryList( QDir::Dirs, QDir::Name );
for( csize i = 0; i < files.size(); ++i )
{
QString cur_file = files[files.size() - i - 1];
if( cur_file[0] != '.' && fileBrowser::isDirWithContent(
#ifdef QT4
if( cur_file[0] != '.' && QFileInfo(
thisDir.absolutePath() + QDir::separator() +
cur_file ).isDir() )
#else
if( cur_file[0] != '.' && QFileInfo(
thisDir.absPath() + QDir::separator() +
cur_file ).isDir() )
#endif
cur_file, m_filter ) )
{
new directory( this, cur_file, _path, m_filter );
added_something = TRUE;

View File

@@ -3,7 +3,7 @@
/*
* main.cpp - just main.cpp which is starting up app...
*
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -101,7 +101,7 @@ int main( int argc, char * * argv )
QString( app.argv()[i] ) == "-v" )
{
printf( "\nLinux MultiMedia Studio %s\n\n"
"Copyright (c) 2004-2006 Tobias Doerffel and others.\n\n"
"Copyright (c) 2004-2007 Tobias Doerffel and others.\n\n"
"This program is free software; you can redistribute it and/or\n"
"modify it under the terms of the GNU General Public\n"
"License as published by the Free Software Foundation; either\n"
@@ -115,7 +115,7 @@ int main( int argc, char * * argv )
QString( app.argv()[i] ) == "-h" ) )
{
printf( "\nLinux MultiMedia Studio %s\n"
"Copyright (c) 2004-2006 Tobias Doerffel and others.\n\n"
"Copyright (c) 2004-2007 Tobias Doerffel and others.\n\n"
"usage: lmms [ -r <file_to_render> [ -o <format> ] [ -h ] "
"[ <file_to_load> ]\n"
"-r, --render render given file.\n"

View File

@@ -3,7 +3,7 @@
/*
* main_window.cpp - implementation of LMMS-main-window
*
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -550,8 +550,18 @@ void mainWindow::finalize( void )
#else
menuBar()->insertItem( tr( "&Help" ), help_menu );
#endif
help_menu->addAction( embed::getIconPixmap( "help" ), tr( "Help" ),
if( have_www_browser() )
{
help_menu->addAction( embed::getIconPixmap( "help" ),
tr( "Online help" ),
this, SLOT( browseHelp() ) );
}
else
{
help_menu->addAction( embed::getIconPixmap( "help" ),
tr( "Help" ),
this, SLOT( help() ) );
}
help_menu->addAction( embed::getIconPixmap( "whatsthis" ),
tr( "What's this?" ),
this, SLOT( enterWhatsThisMode() ) );
@@ -1089,6 +1099,41 @@ void mainWindow::showTool( int _idx )
bool mainWindow::have_www_browser( void )
{
int ret = system( "which x-www-browser > /dev/null" );
return( WIFEXITED( ret ) && WEXITSTATUS( ret ) == EXIT_SUCCESS );
}
void mainWindow::browseHelp( void )
{
pid_t pid = fork();
if( pid == -1 )
{
perror( "fork" );
}
else if( pid == 0 )
{
QString url = "http://wiki.mindrules.net/doku.php?id="
+ tr( "start", "doku.php id" );
execlp( "x-www-browser", "x-www-browser", url.
#ifdef QT4
toAscii().constData(),
#else
ascii(),
#endif
NULL );
perror( "execlp" );
exit( EXIT_FAILURE );
}
}
#ifndef QT4
#undef addSeparator
#endif

View File

@@ -58,10 +58,11 @@ notePlayHandle::notePlayHandle( instrumentTrack * _it,
m_baseNote( TRUE ),
m_arpNote( _arp_note ),
m_muted( FALSE ),
m_bbTrack( NULL )
m_bbTrack( NULL ),
#if SINGERBOT_SUPPORT
, m_patternIndex( 0 )
m_patternIndex( 0 ),
#endif
m_orig_bpm( _it->eng()->getSongEditor()->getTempo() )
{
setDetuning( _n.detuning() );
if( detuning() )
@@ -320,6 +321,7 @@ void notePlayHandle::setFrames( const f_cnt_t _frames )
{
m_frames = m_instrumentTrack->beatLen( this );
}
m_orig_frames = m_frames;
}
@@ -437,6 +439,23 @@ void notePlayHandle::processMidiTime( const midiTime & _time )
void notePlayHandle::resize( const bpm_t _new_bpm )
{
double completed = m_totalFramesPlayed / (double)m_frames;
double new_frames = m_orig_frames * m_orig_bpm / (double)_new_bpm;
m_frames = (f_cnt_t)new_frames;
m_totalFramesPlayed = (f_cnt_t)( completed * new_frames );
for( notePlayHandleVector::iterator it = m_subNotes.begin();
it != m_subNotes.end(); ++it )
{
( *it )->resize( _new_bpm );
}
}
#include "note_play_handle.moc"

View File

@@ -3,7 +3,7 @@
/*
* song_editor.cpp - basic window for editing song
*
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -79,6 +79,7 @@
#include "instrument_track.h"
#include "mmp.h"
#include "midi_client.h"
#include "note_play_handle.h"
#include "timeline.h"
#include "pattern.h"
#include "piano_roll.h"
@@ -755,6 +756,17 @@ void songEditor::zoomingChanged( const QString & _zfac )
void songEditor::setTempo( int _new_bpm )
{
playHandleVector & phv = eng()->getMixer()->playHandles();
for( playHandleVector::iterator it = phv.begin(); it != phv.end();
++it )
{
notePlayHandle * nph = dynamic_cast<notePlayHandle *>( *it );
if( nph && !nph->released() )
{
nph->resize( _new_bpm );
}
}
m_bpmSpinBox->setInitValue( _new_bpm );
eng()->updateFramesPerTact64th();
emit tempoChanged( _new_bpm );

View File

@@ -6,7 +6,7 @@
* This file is partly based on the knob-widget of the Qwt Widget Library by
* Josef Wilgen.
*
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -95,12 +95,12 @@ knob::knob( int _knob_num, QWidget * _parent, const QString & _name,
autoObj( _engine, _track ),
m_mouseOffset( 0.0f ),
m_buttonPressed( FALSE ),
m_angle( 0.0f ),
m_knobNum( _knob_num ),
m_hintTextBeforeValue( "" ),
m_hintTextAfterValue( "" ),
m_label( "" ),
m_initValue( 0.0f )
m_initValue( 0.0f ),
m_angle( 0.0f ),
m_knobNum( _knob_num ),
m_label( "" )
{
if( s_textFloat == NULL )
{