singerbot, automation editor and other improvements

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@462 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Javier Serrano Polo
2007-02-25 19:12:26 +00:00
parent d5112c748a
commit deeca75b1f
17 changed files with 352 additions and 307 deletions

View File

@@ -1,7 +1,7 @@
/*
* ladspa_control.cpp - widget for controlling a LADSPA port
*
* Copyright (c) 2006 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -130,9 +130,11 @@ ladspaControl::ladspaControl( QWidget * _parent,
connect( m_knob, SIGNAL( valueChanged( float ) ),
this, SLOT( knobChange( float ) ) );
m_knob->setLabel( m_port->name );
m_knob->setRange( m_port->min, m_port->max,
( m_port->max -
m_port->min ) / 400.0f );
m_knob->setRange( m_port->min, m_port->max,
( m_port->max - m_port->min )
/ ( m_port->name.toUpper() == "GAIN"
&& m_port->max == 10.0f ? 4000.0f :
400.0f ) );
m_knob->setInitValue( m_port->def );
m_knob->setHintText( tr( "Value:" ) + " ", "" );
#ifdef QT4

View File

@@ -1,7 +1,7 @@
/*
* ladspa_effect.cpp - class for processing LADSPA effects
*
* Copyright (c) 2006 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -191,7 +191,8 @@ ladspaEffect::ladspaEffect( effect::constructionData * _cdata ) :
p->max = m_ladspa->getUpperBound( m_key, port );
if( p->max == NOHINT )
{
p->max = 1.0f;
p->max = p->name.toUpper() == "GAIN" ? 10.0f :
1.0f;
}
if( m_ladspa->areHintsSampleRateDependent(

View File

@@ -3,8 +3,8 @@
* plugin::descriptor::subPluginFeatures for
* hosting LADSPA-plugins
*
* Copyright (c) 2006 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -31,13 +31,11 @@
#include <QtCore/QString>
#include <QtGui/QLabel>
#include <QtGui/QLayout>
#else
#include <qgroupbox.h>
#include <qhbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qstring.h>
#endif
@@ -49,77 +47,6 @@
#include "audio_device.h"
ladspaSubPluginDescriptionWidget::ladspaSubPluginDescriptionWidget(
QWidget * _parent, engine * _engine,
const ladspa_key_t & _key ) :
QWidget( _parent
#ifdef QT3
, "ladspaSubPluginDescriptionWidget"
#endif
)
{
ladspa2LMMS * lm = _engine->getLADSPAManager();
QVBoxLayout * l = new QVBoxLayout( this );
#ifndef QT3
QGroupBox * groupbox = new QGroupBox( tr( "Description" ), this );
#else
QGroupBox * groupbox = new QGroupBox( 9, Qt::Vertical,
tr( "Description" ), this );
#endif
QLabel * label = new QLabel( groupbox );
label->setText( tr( "Name: " ) + lm->getName( _key ) );
QLabel * maker = new QLabel( groupbox );
maker->setText( tr( "Maker: " ) + lm->getMaker( _key ) );
QLabel * copyright = new QLabel( groupbox );
copyright->setText( tr( "Copyright: " ) + lm->getCopyright( _key ) );
QLabel * requiresRealTime = new QLabel( groupbox );
if( lm->hasRealTimeDependency( _key ) )
{
requiresRealTime->setText( tr( "Requires Real Time: Yes" ) );
}
else
{
requiresRealTime->setText( tr( "Requires Real Time: No" ) );
}
QLabel * realTimeCapable = new QLabel( groupbox );
if( lm->isRealTimeCapable( _key ) )
{
realTimeCapable->setText( tr( "Real Time Capable: Yes" ) );
}
else
{
realTimeCapable->setText( tr( "Real Time Capable: No" ) );
}
QLabel * inplaceBroken = new QLabel( groupbox );
if( lm->isInplaceBroken( _key ) )
{
inplaceBroken->setText( tr( "In Place Broken: Yes" ) );
}
else
{
inplaceBroken->setText( tr( "In Place Broken: No" ) );
}
QLabel * channelsIn = new QLabel( groupbox );
channelsIn->setText( tr( "Channels In: " ) +
QString::number( lm->getDescription( _key )->inputChannels ) );
QLabel * channelsOut = new QLabel( groupbox );
channelsOut->setText( tr( "Channels Out: " ) +
QString::number( lm->getDescription( _key )->outputChannels ) );
l->addWidget( groupbox );
}
ladspaSubPluginFeatures::ladspaSubPluginFeatures( plugin::pluginTypes _type ) :
subPluginFeatures( _type )
{
@@ -128,11 +55,59 @@ ladspaSubPluginFeatures::ladspaSubPluginFeatures( plugin::pluginTypes _type ) :
QWidget * ladspaSubPluginFeatures::createDescriptionWidget(
void ladspaSubPluginFeatures::fillDescriptionWidget(
QWidget * _parent, engine * _eng, const key & _key )
{
return( new ladspaSubPluginDescriptionWidget( _parent, _eng,
subPluginKeyToLadspaKey( _key ) ) );
const ladspa_key_t & lkey = subPluginKeyToLadspaKey( _key );
ladspa2LMMS * lm = _eng->getLADSPAManager();
QLabel * label = new QLabel( _parent );
label->setText( QWidget::tr( "Name: " ) + lm->getName( lkey ) );
QHBox * maker = new QHBox( _parent );
QLabel * maker_label = new QLabel( maker );
maker_label->setText( QWidget::tr( "Maker: " ) );
maker_label->setAlignment( Qt::AlignTop );
QLabel * maker_content = new QLabel( maker );
maker_content->setText( lm->getMaker( lkey ) );
maker_content->setAlignment( Qt::WordBreak );
maker->setStretchFactor( maker_content, 100 );
QHBox * copyright = new QHBox( _parent );
copyright->setMinimumWidth( _parent->minimumWidth() );
QLabel * copyright_label = new QLabel( copyright );
copyright_label->setText( QWidget::tr( "Copyright: " ) );
copyright_label->setAlignment( Qt::AlignTop );
QLabel * copyright_content = new QLabel( copyright );
copyright_content->setText( lm->getCopyright( lkey ) );
copyright_content->setAlignment( Qt::WordBreak );
copyright->setStretchFactor( copyright_content, 100 );
QLabel * requiresRealTime = new QLabel( _parent );
requiresRealTime->setText( QWidget::tr( "Requires Real Time: " ) +
( lm->hasRealTimeDependency( lkey ) ?
QWidget::tr( "Yes" ) :
QWidget::tr( "No" ) ) );
QLabel * realTimeCapable = new QLabel( _parent );
realTimeCapable->setText( QWidget::tr( "Real Time Capable: " ) +
( lm->isRealTimeCapable( lkey ) ?
QWidget::tr( "Yes" ) :
QWidget::tr( "No" ) ) );
QLabel * inplaceBroken = new QLabel( _parent );
inplaceBroken->setText( QWidget::tr( "In Place Broken: " ) +
( lm->isInplaceBroken( lkey ) ?
QWidget::tr( "Yes" ) :
QWidget::tr( "No" ) ) );
QLabel * channelsIn = new QLabel( _parent );
channelsIn->setText( QWidget::tr( "Channels In: " ) +
QString::number( lm->getDescription( lkey )->inputChannels ) );
QLabel * channelsOut = new QLabel( _parent );
channelsOut->setText( QWidget::tr( "Channels Out: " ) +
QString::number( lm->getDescription( lkey )->outputChannels ) );
}

View File

@@ -3,8 +3,8 @@
* plugin::descriptor::subPluginFeatures for
* hosting LADSPA-plugins
*
* Copyright (c) 2006 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2007 Danny McRae <khjklujn/at/users.sourceforge.net>
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -33,23 +33,12 @@
#include "ladspa_base.h"
class ladspaSubPluginDescriptionWidget : public QWidget
{
public:
ladspaSubPluginDescriptionWidget( QWidget * _parent, engine * _engine,
const ladspa_key_t & _key );
} ;
class ladspaSubPluginFeatures : public plugin::descriptor::subPluginFeatures
{
public:
ladspaSubPluginFeatures( plugin::pluginTypes _type );
virtual QWidget * createDescriptionWidget( QWidget * _parent,
virtual void fillDescriptionWidget( QWidget * _parent,
engine * _eng,
const key & _key );

View File

@@ -1,7 +1,7 @@
/*
* live_tool.cpp - tool for live performance
*
* Copyright (c) 2006 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
* Copyright (c) 2006-2007 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -23,6 +23,13 @@
*/
#ifdef QT3
#include <qwhatsthis.h>
#endif
#include "live_tool.h"
#include "bb_editor.h"
#include "song_editor.h"
@@ -47,7 +54,7 @@ plugin::descriptor live_tool_plugin_descriptor =
STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ),
"LiveTool",
QT_TRANSLATE_NOOP( "pluginBrowser",
"tool for live performance" ),
"Tool for live performance" ),
"Javier Serrano Polo <jasp00/at/users.sourceforge.net>",
0x0100,
plugin::Tool,
@@ -67,6 +74,19 @@ liveTool::liveTool( mainWindow * _window ) :
setPaletteBackgroundPixmap( background );
setFixedSize( background.size() );
#ifdef QT4
setWhatsThis(
#else
QWhatsThis::add( this,
#endif
tr(
"This tool is intended to be used in live performances, though "
"you can use it for music production as well.\n"
"The following keys will work only if this window is active.\n"
"The spacebar toggles play and pause in the Song Editor.\n"
"F1-F10 keys mute the first 10 instruments in the "
"Beat+Baseline Editor." ) );
hide();
}

View File

@@ -147,9 +147,7 @@ void singerBot::playNote( notePlayHandle * _n, bool )
sampleBuffer * sample_buffer = hdata->remaining_frames ?
readWave( hdata ) : new sampleBuffer( NULL, 0, eng() );
if( sample_buffer->play( buf, 0, frames, BASE_FREQ,
FALSE, //loop
&hdata->resampling_data ) )
if( sample_buffer->play( buf, 0, frames ) )
{
getInstrumentTrack()->processAudioBuffer( buf, frames, _n );
}
@@ -163,14 +161,14 @@ void singerBot::playNote( notePlayHandle * _n, bool )
void singerBot::deleteNotePluginData( notePlayHandle * _n )
{
handle_data * hdata = (handle_data *)_n->m_pluginData;
if( hdata->resampling_data )
{
sampleBuffer::deleteResamplingData( &hdata->resampling_data );
}
if( hdata->wave )
{
delete hdata->wave;
}
if( hdata->resampling_state )
{
src_delete( hdata->resampling_state );
}
delete hdata;
}
@@ -236,9 +234,9 @@ void singerBot::createWave( notePlayHandle * _n )
{
handle_data * hdata = new handle_data;
_n->m_pluginData = hdata;
hdata->resampling_data = NULL;
hdata->wave = NULL;
hdata->remaining_frames = 0;
hdata->resampling_state = NULL;
if( m_words_dirty )
{
@@ -267,7 +265,18 @@ void singerBot::createWave( notePlayHandle * _n )
{
return;
}
hdata->wave->resample( eng()->getMixer()->sampleRate() );
int error;
hdata->resampling_state = src_new( SRC_LINEAR, 1, &error );
if( !hdata->resampling_state )
{
printf( "%s: src_new() error: %s\n", __FILE__,
src_strerror( error ) );
}
hdata->resampling_data.src_ratio = eng()->getMixer()->sampleRate()
/ (double)hdata->wave->sample_rate();
hdata->resampling_data.end_of_input = 0;
hdata->remaining_frames = hdata->wave->num_samples();
}
@@ -276,24 +285,49 @@ void singerBot::createWave( notePlayHandle * _n )
sampleBuffer * singerBot::readWave( handle_data * _hdata )
{
f_cnt_t buffer_size = eng()->getMixer()->framesPerAudioBuffer();
f_cnt_t frames = tMin( buffer_size, _hdata->remaining_frames );
f_cnt_t frames = eng()->getMixer()->framesPerAudioBuffer();
f_cnt_t offset = _hdata->wave->num_samples() - _hdata->remaining_frames;
const float fac = 1.0f / OUTPUT_SAMPLE_MULTIPLIER;
f_cnt_t fragment_size = tMin( _hdata->remaining_frames,
1 + (f_cnt_t)ceil( frames
/ _hdata->resampling_data.src_ratio ) );
sample_t * wave_samples = new sample_t[fragment_size];
for( f_cnt_t frame = 0; frame < fragment_size; ++frame )
{
wave_samples[frame] = _hdata->wave->a( offset + frame ) * fac;
}
sample_t * mono_data = new sample_t[frames];
memset( mono_data, 0, sizeof( sample_t ) * frames );
_hdata->resampling_data.data_in = wave_samples;
_hdata->resampling_data.data_out = mono_data;
_hdata->resampling_data.input_frames = fragment_size;
_hdata->resampling_data.output_frames = frames;
int error = src_process( _hdata->resampling_state,
&_hdata->resampling_data );
if( error )
{
printf( "%s: src_process() error: %s\n", __FILE__,
src_strerror( error ) );
}
sampleFrame * data = new sampleFrame[frames];
for( f_cnt_t frame = 0; frame < frames; ++frame )
{
sample_t wave_sample = _hdata->wave->a( offset + frame ) * fac;
for( ch_cnt_t chnl = 0; chnl < DEFAULT_CHANNELS; ++chnl )
{
data[frame][chnl] = wave_sample;
data[frame][chnl] = mono_data[frame];
}
}
sampleBuffer * buffer = new sampleBuffer( data, frames, eng() );
_hdata->remaining_frames -= frames;
_hdata->remaining_frames -= _hdata->resampling_data.input_frames_used;
delete[] wave_samples;
delete[] mono_data;
delete[] data;
return( buffer );
}
@@ -376,36 +410,29 @@ void singerBot::synThread::text_to_wave( void )
"(set! word " + quote_string( m_data->text, "\"", "\\", 1 )
+ ")" );
festival_eval_command(
"(set! my_utt (eval (list 'Utterance 'Text word)))" );
festival_eval_command(
" (get_segment my_utt)" );
festival_eval_command(
"(if (equal? (length (utt.relation.leafs my_utt 'Segment)) 1)"
" (begin (set! my_utt (eval "
"(list 'Utterance 'Text (string-append word \" \" word))))"
" (get_segment my_utt)"
"))" );
festival_eval_command(
" (Pauses my_utt)" );
festival_eval_command(
" (item.delete (utt.relation.first my_utt 'Segment))" );
festival_eval_command(
" (item.delete (utt.relation.last my_utt 'Segment))" );
festival_eval_command(
" (Intonation my_utt)" );
festival_eval_command(
" (PostLex my_utt)" );
festival_eval_command(
" (Duration my_utt)" );
festival_eval_command(
"(if (not (equal? total_time 0)) (begin"
"(set! utt_time"
" (item.feat (utt.relation.last my_utt 'Segment) 'end))"
"(Parameter.set 'Duration_Stretch (/ total_time utt_time))"
"(Duration my_utt)"
"))" );
festival_eval_command(
" (Int_Targets my_utt)" );
"(begin"
" (set! my_utt (eval (list 'Utterance 'Text word)))"
" (get_segment my_utt)"
" (if (equal? (length (utt.relation.leafs my_utt 'Segment)) 1)"
" (begin (set! my_utt (eval "
" (list 'Utterance 'Text (string-append word \" \" word))))"
" (get_segment my_utt)"
" ))"
" (Pauses my_utt)"
" (item.delete (utt.relation.first my_utt 'Segment))"
" (item.delete (utt.relation.last my_utt 'Segment))"
" (Intonation my_utt)"
" (PostLex my_utt)"
" (Duration my_utt)"
" (if (not (equal? total_time 0)) (begin"
" (set! utt_time"
" (item.feat (utt.relation.last my_utt 'Segment) 'end))"
" (Parameter.set 'Duration_Stretch (/ total_time utt_time))"
" (Duration my_utt)"
" ))"
" (Int_Targets my_utt)"
")" );
if( festival_eval_command(
" (Wave_Synth my_utt)" ) )
{

View File

@@ -38,6 +38,8 @@
#endif
#include <samplerate.h>
#include "instrument.h"
@@ -73,12 +75,13 @@ public slots:
private:
typedef struct
{
void * resampling_data;
EST_Wave * wave;
int remaining_frames;
float frequency;
float duration;
const char * text;
SRC_STATE * resampling_state;
SRC_DATA resampling_data;
} handle_data;

View File

@@ -3,7 +3,7 @@
* plugin::descriptor::subPluginFeatures for
* hosting VST-plugins
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -28,16 +28,12 @@
#ifdef QT4
#include <QtCore/QDir>
#include <QtGui/QGroupBox>
#include <QtGui/QLabel>
#include <QtGui/QLayout>
#else
#include <qdir.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlayout.h>
#endif
@@ -46,29 +42,6 @@
#include "config_mgr.h"
vstSubPluginDescriptionWidget::vstSubPluginDescriptionWidget(
QWidget * _parent, engine * _engine,
const effectKey & _key ) :
QWidget( _parent )
{
QVBoxLayout * l = new QVBoxLayout( this );
#ifndef QT3
QGroupBox * groupbox = new QGroupBox( tr( "Description" ), this );
#else
QGroupBox * groupbox = new QGroupBox( 9, Qt::Vertical,
tr( "Description" ), this );
#endif
new QLabel( tr( "Name: " ) + _key.name, groupbox );
new QLabel( tr( "File: " ) + _key.user.toString(), groupbox );
l->addWidget( groupbox );
}
vstSubPluginFeatures::vstSubPluginFeatures( plugin::pluginTypes _type ) :
subPluginFeatures( _type )
{
@@ -77,10 +50,11 @@ vstSubPluginFeatures::vstSubPluginFeatures( plugin::pluginTypes _type ) :
QWidget * vstSubPluginFeatures::createDescriptionWidget(
void vstSubPluginFeatures::fillDescriptionWidget(
QWidget * _parent, engine * _eng, const key & _key )
{
return( new vstSubPluginDescriptionWidget( _parent, _eng, _key ) );
new QLabel( QWidget::tr( "Name: " ) + _key.name, _parent );
new QLabel( QWidget::tr( "File: " ) + _key.user.toString(), _parent );
}

View File

@@ -3,7 +3,7 @@
* plugin::descriptor::subPluginFeatures for
* hosting VST-plugins
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -31,23 +31,12 @@
#include "effect.h"
class vstSubPluginDescriptionWidget : public QWidget
{
public:
vstSubPluginDescriptionWidget( QWidget * _parent, engine * _engine,
const effectKey & _key );
} ;
class vstSubPluginFeatures : public plugin::descriptor::subPluginFeatures
{
public:
vstSubPluginFeatures( plugin::pluginTypes _type );
virtual QWidget * createDescriptionWidget( QWidget * _parent,
virtual void fillDescriptionWidget( QWidget * _parent,
engine * _eng,
const key & _key );