flp-import-basics and MIDI-tab-widget-extension

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@113 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2006-03-28 12:02:57 +00:00
parent 387cee03d4
commit 7534b09714
21 changed files with 1433 additions and 58 deletions

View File

@@ -376,13 +376,14 @@ void listView::contentsMouseDoubleClickEvent( QMouseEvent * _me )
multimediaProject mmp( f->fullName() );
track * t = track::create( track::CHANNEL_TRACK,
eng()->getBBEditor() );
instrumentTrack * ct = dynamic_cast<instrumentTrack *>( t );
if( ct != NULL )
instrumentTrack * it = dynamic_cast<instrumentTrack *>(
t );
if( it != NULL )
{
ct->loadTrackSpecificSettings( mmp.content().
it->loadTrackSpecificSettings( mmp.content().
firstChild().
toElement() );
ct->toggledInstrumentTrackButton( TRUE );
it->toggledInstrumentTrackButton( TRUE );
}
}
else if( f->type() == fileItem::PROJECT_FILE )
@@ -425,7 +426,8 @@ void listView::contentsMousePressEvent( QMouseEvent * _me )
{
if( m_previewPlayHandle != NULL )
{
eng()->getMixer()->removePlayHandle( m_previewPlayHandle );
eng()->getMixer()->removePlayHandle(
m_previewPlayHandle );
m_previewPlayHandle = NULL;
}
if( f->type() == fileItem::SAMPLE_FILE )
@@ -704,6 +706,7 @@ QPixmap * fileItem::s_projectFilePixmap = NULL;
QPixmap * fileItem::s_presetFilePixmap = NULL;
QPixmap * fileItem::s_sampleFilePixmap = NULL;
QPixmap * fileItem::s_midiFilePixmap = NULL;
QPixmap * fileItem::s_flpFilePixmap = NULL;
QPixmap * fileItem::s_unknownFilePixmap = NULL;
@@ -759,6 +762,12 @@ void fileItem::initPixmapStuff( void )
"midi_file", 16, 16 ) );
}
if( s_flpFilePixmap == NULL )
{
s_flpFilePixmap = new QPixmap( embed::getIconPixmap(
"midi_file", 16, 16 ) );
}
if( s_unknownFilePixmap == NULL )
{
s_unknownFilePixmap = new QPixmap( embed::getIconPixmap(
@@ -771,6 +780,7 @@ void fileItem::initPixmapStuff( void )
case PRESET_FILE: m_pix = s_presetFilePixmap; break;
case SAMPLE_FILE: m_pix = s_sampleFilePixmap; break;
case MIDI_FILE: m_pix = s_midiFilePixmap; break;
case FLP_FILE: m_pix = s_flpFilePixmap; break;
case UNKNOWN:
default:
m_pix = s_unknownFilePixmap;
@@ -823,6 +833,10 @@ void fileItem::determineFileType( void )
{
m_type = MIDI_FILE;
}
else if( ext == "flp" )
{
m_type = FLP_FILE;
}
else
{
m_type = UNKNOWN;

View File

@@ -110,7 +110,7 @@ void importFilter::import( const QString & _file_to_import,
"importing file %1.\n"
"You should convert this file "
"into a format supported by "
"LMMS using another software. "
"LMMS using another software."
).arg( _file_to_import ),
QMessageBox::Ok,
QMessageBox::NoButton );

View File

@@ -127,7 +127,7 @@ mainWindow::mainWindow( engine * _engine ) :
QString wdir = configManager::inst()->workingDir();
side_bar->appendTab( new pluginBrowser( splitter, eng() ), ++id );
side_bar->appendTab( new fileBrowser( wdir+"projects",
"*.mmp *.xml *.mid",
"*.mmp *.xml *.mid *.flp",
tr( "My projects" ),
embed::getIconPixmap( "project_file" ),
splitter, eng() ),

View File

@@ -71,7 +71,7 @@ midiTabWidget::midiTabWidget( instrumentTrack * _instrument_track,
{
m_setupTabWidget = new tabWidget( tr( "MIDI-SETUP FOR THIS CHANNEL" ),
this );
m_setupTabWidget->setGeometry( 4, 5, 238, 160 );
m_setupTabWidget->setGeometry( 4, 5, 238, 200 );
m_inputChannelSpinBox = new lcdSpinBox( 0, MIDI_CHANNEL_COUNT, 3,
@@ -89,7 +89,7 @@ midiTabWidget::midiTabWidget( instrumentTrack * _instrument_track,
m_outputChannelSpinBox->setValue( m_midiPort->outputChannel() + 1 );
//m_outputChannelSpinBox->addTextForValue( 0, "---" );
m_outputChannelSpinBox->setLabel( tr( "CHANNEL" ) );
m_outputChannelSpinBox->move( 28, 112 );
m_outputChannelSpinBox->move( 28, 132 );
connect( m_outputChannelSpinBox, SIGNAL( valueChanged( int ) ),
this, SLOT( outputChannelChanged( int ) ) );
outputChannelChanged( m_outputChannelSpinBox->value() );
@@ -103,15 +103,29 @@ midiTabWidget::midiTabWidget( instrumentTrack * _instrument_track,
connect( m_receiveCheckBox, SIGNAL( toggled( bool ) ),
m_inputChannelSpinBox, SLOT( setEnabled( bool ) ) );
m_defaultVelocityInCheckBox = new ledCheckBox( tr( "Default velocity "
"for all input-events" ),
m_setupTabWidget, eng() );
m_defaultVelocityInCheckBox->move( 28, 84 );
connect( m_defaultVelocityInCheckBox, SIGNAL( toggled( bool ) ),
this, SLOT( defaultVelInChanged( bool ) ) );
m_sendCheckBox = new ledCheckBox( tr( "Send MIDI-events" ),
m_setupTabWidget, eng() );
m_sendCheckBox->move( 10, 94 );
m_sendCheckBox->move( 10, 114 );
connect( m_sendCheckBox, SIGNAL( toggled( bool ) ),
this, SLOT( midiPortModeToggled( bool ) ) );
connect( m_sendCheckBox, SIGNAL( toggled( bool ) ),
m_outputChannelSpinBox, SLOT( setEnabled( bool ) ) );
m_defaultVelocityOutCheckBox = new ledCheckBox( tr( "Default velocity "
"for all output-events" ),
m_setupTabWidget, eng() );
m_defaultVelocityOutCheckBox->move( 28, 164 );
connect( m_defaultVelocityOutCheckBox, SIGNAL( toggled( bool ) ),
this, SLOT( defaultVelOutChanged( bool ) ) );
const midiPort::modes m = m_midiPort->mode();
m_receiveCheckBox->setChecked( m == midiPort::INPUT ||
@@ -168,7 +182,7 @@ midiTabWidget::midiTabWidget( instrumentTrack * _instrument_track,
wp_btn->setText( tr( "MIDI-devices to send MIDI-events "
"to" ) );
wp_btn->setIcon( embed::getIconPixmap( "midi_out" ) );
wp_btn->setGeometry( 186, 94, 40, 40 );
wp_btn->setGeometry( 186, 114, 40, 40 );
wp_btn->setMenu( m_writeablePorts );
#ifdef QT4
wp_btn->setPopupMode( QToolButton::InstantPopup );
@@ -199,6 +213,10 @@ void midiTabWidget::saveSettings( QDomDocument & _doc, QDomElement & _this )
_this.setAttribute( "outputchannel", m_outputChannelSpinBox->value() );
_this.setAttribute( "receive", m_receiveCheckBox->isChecked() );
_this.setAttribute( "send", m_sendCheckBox->isChecked() );
_this.setAttribute( "defvelin",
m_defaultVelocityInCheckBox->isChecked() );
_this.setAttribute( "defvelout",
m_defaultVelocityOutCheckBox->isChecked() );
if( m_readablePorts != NULL && m_receiveCheckBox->isChecked() == TRUE )
{
@@ -274,6 +292,10 @@ void midiTabWidget::loadSettings( const QDomElement & _this )
).toInt() );
m_receiveCheckBox->setChecked( _this.attribute( "receive" ).toInt() );
m_sendCheckBox->setChecked( _this.attribute( "send" ).toInt() );
m_defaultVelocityInCheckBox->setChecked(
_this.attribute( "defvelin" ).toInt() );
m_defaultVelocityOutCheckBox->setChecked(
_this.attribute( "defvelout" ).toInt() );
// restore connections
@@ -359,6 +381,22 @@ void midiTabWidget::outputChannelChanged( int _new_chnl )
void midiTabWidget::defaultVelInChanged( bool _on )
{
m_midiPort->enableDefaultVelocityForInEvents( _on );
}
void midiTabWidget::defaultVelOutChanged( bool _on )
{
m_midiPort->enableDefaultVelocityForOutEvents( _on );
}
void midiTabWidget::midiPortModeToggled( bool )
{
// this small lookup-table makes everything easier

View File

@@ -1599,10 +1599,10 @@ bool FASTCALL songEditor::saveProjectAs( const QString & _file_name )
void songEditor::importProject( void )
{
#ifdef QT4
QFileDialog ofd( this, tr( "Import file" ), "",
tr( "MIDI-files (*.mid)" ) );
QFileDialog ofd( this, tr( "Import file" ), ""/*,
tr( "MIDI-files (*.mid)" )*/ );
#else
QFileDialog ofd( QString::null, tr( "MIDI-files (*.mid)" ),
QFileDialog ofd( QString::null,/* tr( "MIDI-files (*.mid)" )*/ QString::null,
this, "", TRUE );
ofd.setWindowTitle( tr( "Import file" ) );
#endif

View File

@@ -4,7 +4,7 @@
* midi_port.cpp - abstraction of MIDI-ports which are part of LMMS's MIDI-
* sequencing system
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -28,6 +28,7 @@
#include "midi_port.h"
#include "midi_client.h"
#include "volume.h"
@@ -38,7 +39,9 @@ midiPort::midiPort( midiClient * _mc, midiEventProcessor * _mep,
m_name( _name ),
m_mode( _mode ),
m_inputChannel( -1 ),
m_outputChannel( -1 )
m_outputChannel( -1 ),
m_defaultVelocityForInEventsEnabled( FALSE ),
m_defaultVelocityForOutEventsEnabled( FALSE )
{
}
@@ -76,7 +79,13 @@ void midiPort::processInEvent( const midiEvent & _me, const midiTime & _time )
if( ( mode() == INPUT || mode() == DUPLEX ) &&
( inputChannel() == _me.m_channel || inputChannel() == -1 ) )
{
m_midiEventProcessor->processInEvent( _me, _time );
midiEvent ev = _me;
if( m_defaultVelocityForInEventsEnabled == TRUE &&
_me.velocity() > 0 )
{
ev.velocity() = DEFAULT_VOLUME;
}
m_midiEventProcessor->processInEvent( ev, _time );
}
}
@@ -89,7 +98,13 @@ void midiPort::processOutEvent( const midiEvent & _me, const midiTime & _time )
if( ( mode() == OUTPUT || mode() == DUPLEX ) &&
( outputChannel() == _me.m_channel && outputChannel() != -1 ) )
{
m_midiClient->processOutEvent( _me, _time, this );
midiEvent ev = _me;
if( m_defaultVelocityForOutEventsEnabled == TRUE &&
_me.velocity() > 0 )
{
ev.velocity() = DEFAULT_VOLUME;
}
m_midiClient->processOutEvent( ev, _time, this );
}
}