lot of bugfixes, especially in VST-support-layer and some nice new features
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@44 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -181,7 +181,11 @@ void audioALSA::startProcessing( void )
|
||||
{
|
||||
if( !isRunning() )
|
||||
{
|
||||
start();
|
||||
start(
|
||||
#if QT_VERSION >= 0x030200
|
||||
QThread::HighestPriority
|
||||
#endif
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,9 @@
|
||||
#endif
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
#include "debug.h"
|
||||
#include "templates.h"
|
||||
#include "gui_templates.h"
|
||||
|
||||
@@ -284,7 +284,11 @@ void audioOSS::startProcessing( void )
|
||||
{
|
||||
if( !isRunning() )
|
||||
{
|
||||
start();
|
||||
start(
|
||||
#if QT_VERSION >= 0x030200
|
||||
QThread::HighestPriority
|
||||
#endif
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* about_dialog.cpp - implementation of about-dialog
|
||||
*
|
||||
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -65,13 +65,13 @@ aboutDialog::aboutDialog() :
|
||||
|
||||
m_appNameLbl = new QLabel( tr( "Linux MultiMedia Studio %1"
|
||||
).arg( VERSION ), this );
|
||||
m_appNameLbl->setGeometry( 80, 30, 240, 20 );
|
||||
m_appNameLbl->setGeometry( 80, 30, 280, 20 );
|
||||
|
||||
m_aboutTabs = new QTabWidget( this );
|
||||
|
||||
QLabel * about_lbl = new QLabel( tr( "LMMS - A powerful "
|
||||
"synthesizer-studio\n\n"
|
||||
"Copyright (c) 2004-2005 "
|
||||
"Copyright (c) 2004-2006 "
|
||||
"LMMS-Developers\n\n"
|
||||
"http://lmms.sourceforge.net" )
|
||||
#ifndef QT4
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
/*#ifdef HAVE_STDLIB_H*/
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
/*#endif*/
|
||||
|
||||
|
||||
#include "arp_and_chords_tab_widget.h"
|
||||
@@ -607,37 +607,26 @@ void arpAndChordsTabWidget::saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent )
|
||||
{
|
||||
QDomElement act_de = _doc.createElement( nodeName() );
|
||||
act_de.setAttribute( "chorddisabled", QString::number(
|
||||
!m_chordsGroupBox->isActive() ) );
|
||||
act_de.setAttribute( "chorddisabled", !m_chordsGroupBox->isActive() );
|
||||
#ifdef QT4
|
||||
act_de.setAttribute( "chord", QString::number(
|
||||
m_chordsComboBox->currentIndex() ) );
|
||||
act_de.setAttribute( "chord", m_chordsComboBox->currentIndex() );
|
||||
#else
|
||||
act_de.setAttribute( "chord", QString::number(
|
||||
m_chordsComboBox->currentItem() ) );
|
||||
act_de.setAttribute( "chord", m_chordsComboBox->currentItem() );
|
||||
#endif
|
||||
act_de.setAttribute( "chordrange", QString::number(
|
||||
m_chordRangeKnob->value() ) );
|
||||
act_de.setAttribute( "chordrange", m_chordRangeKnob->value() );
|
||||
|
||||
act_de.setAttribute( "arpdisabled", QString::number(
|
||||
!m_arpGroupBox->isActive() ) );
|
||||
act_de.setAttribute( "arpdisabled", !m_arpGroupBox->isActive() );
|
||||
#ifdef QT4
|
||||
act_de.setAttribute( "arp", QString::number(
|
||||
m_arpComboBox->currentIndex() ) );
|
||||
act_de.setAttribute( "arp", m_arpComboBox->currentIndex() );
|
||||
#else
|
||||
act_de.setAttribute( "arp", QString::number(
|
||||
m_arpComboBox->currentItem() ) );
|
||||
act_de.setAttribute( "arp", m_arpComboBox->currentItem() );
|
||||
#endif
|
||||
act_de.setAttribute( "arprange", QString::number(
|
||||
m_arpRangeKnob->value() ) );
|
||||
act_de.setAttribute( "arptime", QString::number(
|
||||
m_arpTimeKnob->value() ) );
|
||||
act_de.setAttribute( "arpgate", QString::number(
|
||||
m_arpGateKnob->value() ) );
|
||||
act_de.setAttribute( "arpdir", QString::number(
|
||||
m_arpDirection ) );
|
||||
act_de.setAttribute( "arpsyncmode", QString::number(
|
||||
( int ) m_arpTimeKnob->getSyncMode() ) );
|
||||
act_de.setAttribute( "arprange", m_arpRangeKnob->value() );
|
||||
act_de.setAttribute( "arptime", m_arpTimeKnob->value() );
|
||||
act_de.setAttribute( "arpgate", m_arpGateKnob->value() );
|
||||
act_de.setAttribute( "arpdir", m_arpDirection );
|
||||
act_de.setAttribute( "arpsyncmode",
|
||||
( int ) m_arpTimeKnob->getSyncMode() );
|
||||
|
||||
|
||||
_parent.appendChild( act_de );
|
||||
|
||||
@@ -767,7 +767,7 @@ bool configManager::loadConfigFile( void )
|
||||
|
||||
// get the head information from the DOM
|
||||
QDomElement root = dom_tree.documentElement();
|
||||
/* if( root.isElement() )
|
||||
if( root.isElement() )
|
||||
{
|
||||
QString cfg_file_ver = root.toElement().attribute( "version" );
|
||||
if( ( cfg_file_ver.length() == 0 || cfg_file_ver != VERSION ) &&
|
||||
@@ -798,7 +798,7 @@ bool configManager::loadConfigFile( void )
|
||||
return( loadConfigFile() );
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
QDomNode node = root.firstChild();
|
||||
|
||||
|
||||
@@ -583,31 +583,22 @@ float FASTCALL envelopeAndLFOWidget::level( Uint32 _frame,
|
||||
void envelopeAndLFOWidget::saveSettings( QDomDocument & ,
|
||||
QDomElement & _parent )
|
||||
{
|
||||
_parent.setAttribute( "pdel", QString::number(
|
||||
m_predelayKnob->value() ) );
|
||||
_parent.setAttribute( "att", QString::number( m_attackKnob->value() ) );
|
||||
_parent.setAttribute( "hold", QString::number( m_holdKnob->value() ) );
|
||||
_parent.setAttribute( "dec", QString::number( m_decayKnob->value() ) );
|
||||
_parent.setAttribute( "sus", QString::number(
|
||||
m_sustainKnob->value() ) );
|
||||
_parent.setAttribute( "rel", QString::number(
|
||||
m_releaseKnob->value() ) );
|
||||
_parent.setAttribute( "amt", QString::number( m_amountKnob->value() ) );
|
||||
_parent.setAttribute( "lshp", QString::number( m_lfoShape ) );
|
||||
_parent.setAttribute( "lpdel", QString::number(
|
||||
m_lfoPredelayKnob->value() ) );
|
||||
_parent.setAttribute( "latt", QString::number(
|
||||
m_lfoAttackKnob->value() ) );
|
||||
_parent.setAttribute( "lspd", QString::number(
|
||||
m_lfoSpeedKnob->value() ) );
|
||||
_parent.setAttribute( "lamt", QString::number(
|
||||
m_lfoAmountKnob->value() ) );
|
||||
_parent.setAttribute( "x100", QString::number(
|
||||
m_x100Cb->isChecked() ) );
|
||||
_parent.setAttribute( "ctlenvamt", QString::number(
|
||||
m_controlEnvAmountCb->isChecked() ) );
|
||||
_parent.setAttribute( "lfosyncmode", QString::number(
|
||||
( int ) m_lfoSpeedKnob->getSyncMode() ) );
|
||||
_parent.setAttribute( "pdel", m_predelayKnob->value() );
|
||||
_parent.setAttribute( "att", m_attackKnob->value() );
|
||||
_parent.setAttribute( "hold", m_holdKnob->value() );
|
||||
_parent.setAttribute( "dec", m_decayKnob->value() );
|
||||
_parent.setAttribute( "sus", m_sustainKnob->value() );
|
||||
_parent.setAttribute( "rel", m_releaseKnob->value() );
|
||||
_parent.setAttribute( "amt", m_amountKnob->value() );
|
||||
_parent.setAttribute( "lshp", m_lfoShape );
|
||||
_parent.setAttribute( "lpdel", m_lfoPredelayKnob->value() );
|
||||
_parent.setAttribute( "latt", m_lfoAttackKnob->value() );
|
||||
_parent.setAttribute( "lspd", m_lfoSpeedKnob->value() );
|
||||
_parent.setAttribute( "lamt", m_lfoAmountKnob->value() );
|
||||
_parent.setAttribute( "x100", m_x100Cb->isChecked() );
|
||||
_parent.setAttribute( "ctlenvamt", m_controlEnvAmountCb->isChecked() );
|
||||
_parent.setAttribute( "lfosyncmode",
|
||||
( int ) m_lfoSpeedKnob->getSyncMode() );
|
||||
_parent.setAttribute( "userwavefile", m_userWave.audioFile() );
|
||||
}
|
||||
|
||||
|
||||
@@ -493,19 +493,13 @@ void envelopeTabWidget::saveSettings( QDomDocument & _doc,
|
||||
{
|
||||
QDomElement etw_de = _doc.createElement( nodeName() );
|
||||
#ifdef QT4
|
||||
etw_de.setAttribute( "ftype", QString::number(
|
||||
m_filterComboBox->currentIndex() ) );
|
||||
etw_de.setAttribute( "ftype", m_filterComboBox->currentIndex() );
|
||||
#else
|
||||
etw_de.setAttribute( "ftype", QString::number(
|
||||
m_filterComboBox->currentItem() ) );
|
||||
etw_de.setAttribute( "ftype", m_filterComboBox->currentItem() );
|
||||
#endif
|
||||
etw_de.setAttribute( "fcut", QString::number(
|
||||
m_filterCutKnob->value() ) );
|
||||
etw_de.setAttribute( "fres", QString::number(
|
||||
m_filterResKnob->value() ) );
|
||||
etw_de.setAttribute( "fwet", QString::number(
|
||||
/*m_filterState->isChecked()*/
|
||||
m_filterGroupBox->isActive() ) );
|
||||
etw_de.setAttribute( "fcut", m_filterCutKnob->value() );
|
||||
etw_de.setAttribute( "fres", m_filterResKnob->value() );
|
||||
etw_de.setAttribute( "fwet", m_filterGroupBox->isActive() );
|
||||
_parent.appendChild( etw_de );
|
||||
|
||||
for( int i = 0; i < TARGET_COUNT; ++i )
|
||||
|
||||
@@ -226,7 +226,7 @@ void fileBrowser::sendToActiveChannel( void )
|
||||
"audiofileprocessor" );
|
||||
if( afp != NULL )
|
||||
{
|
||||
afp->setParameter( "audiofile",
|
||||
afp->setParameter( "samplefile",
|
||||
m_contextMenuItem->fullName() );
|
||||
}
|
||||
}
|
||||
@@ -265,7 +265,7 @@ void fileBrowser::openInNewChannel( trackContainer * _tc )
|
||||
instrument * afp = ct->loadInstrument( "audiofileprocessor" );
|
||||
if( afp != NULL )
|
||||
{
|
||||
afp->setParameter( "audiofile",
|
||||
afp->setParameter( "samplefile",
|
||||
m_contextMenuItem->fullName() );
|
||||
}
|
||||
ct->toggledChannelButton( TRUE );
|
||||
@@ -354,7 +354,8 @@ void listView::contentsMouseDoubleClickEvent( QMouseEvent * _me )
|
||||
"audiofileprocessor" );
|
||||
if( afp != NULL )
|
||||
{
|
||||
afp->setParameter( "audiofile", f->fullName() );
|
||||
afp->setParameter( "samplefile",
|
||||
f->fullName() );
|
||||
}
|
||||
ct->toggledChannelButton( TRUE );
|
||||
}
|
||||
|
||||
@@ -28,13 +28,18 @@
|
||||
#include "dummy_instrument.h"
|
||||
|
||||
|
||||
instrument::instrument( channelTrack * _channel_track, const QString & _name ) :
|
||||
instrument::instrument( channelTrack * _channel_track,
|
||||
const descriptor * _descriptor ) :
|
||||
QWidget( _channel_track->tabWidgetParent() ),
|
||||
plugin( _name, INSTRUMENT ),
|
||||
plugin( _descriptor ),
|
||||
m_channelTrack( _channel_track ),
|
||||
m_valid( TRUE )
|
||||
{
|
||||
setFixedSize( 250, 250 );
|
||||
QPixmap logo;
|
||||
logo.loadFromData( getDescriptor()->logo.data,
|
||||
getDescriptor()->logo.size );
|
||||
m_channelTrack->setWindowIcon( logo );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* midi_tab_widget.cpp - tab-widget in channel-track-window for setting up
|
||||
* MIDI-related stuff
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@@ -80,15 +80,17 @@ midiTabWidget::midiTabWidget( channelTrack * _channel_track,
|
||||
m_inputChannelSpinBox->move( 28, 52 );
|
||||
connect( m_inputChannelSpinBox, SIGNAL( valueChanged( int ) ),
|
||||
this, SLOT( inputChannelChanged( int ) ) );
|
||||
inputChannelChanged( m_inputChannelSpinBox->value() );
|
||||
|
||||
m_outputChannelSpinBox = new lcdSpinBox( 0, MIDI_CHANNEL_COUNT, 3,
|
||||
m_outputChannelSpinBox = new lcdSpinBox( 1, MIDI_CHANNEL_COUNT, 3,
|
||||
m_setupTabWidget );
|
||||
m_outputChannelSpinBox->addTextForValue( 0, "---" );
|
||||
m_outputChannelSpinBox->setValue( m_midiPort->outputChannel() + 1 );
|
||||
//m_outputChannelSpinBox->addTextForValue( 0, "---" );
|
||||
m_outputChannelSpinBox->setLabel( tr( "CHANNEL" ) );
|
||||
m_outputChannelSpinBox->move( 28, 112 );
|
||||
connect( m_outputChannelSpinBox, SIGNAL( valueChanged( int ) ),
|
||||
this, SLOT( outputChannelChanged( int ) ) );
|
||||
outputChannelChanged( m_outputChannelSpinBox->value() );
|
||||
|
||||
|
||||
m_receiveCheckBox = new ledCheckBox( tr( "RECEIVE MIDI-EVENTS" ),
|
||||
@@ -109,17 +111,20 @@ midiTabWidget::midiTabWidget( channelTrack * _channel_track,
|
||||
m_outputChannelSpinBox, SLOT( setEnabled( bool ) ) );
|
||||
|
||||
|
||||
midiPort::modes m = m_midiPort->mode();
|
||||
const midiPort::modes m = m_midiPort->mode();
|
||||
m_receiveCheckBox->setChecked( m == midiPort::INPUT ||
|
||||
m == midiPort::DUPLEX );
|
||||
m_sendCheckBox->setChecked( m == midiPort::OUTPUT ||
|
||||
m == midiPort::DUPLEX );
|
||||
|
||||
// when using with non-raw-clients we can provide buttons showing
|
||||
// our port-menus when being clicked
|
||||
midiClient * mc = mixer::inst()->getMIDIClient();
|
||||
// non-raw-clients have ports we can subscribe to!
|
||||
if( mc->isRaw() == FALSE )
|
||||
{
|
||||
m_readablePorts = new QMenu( m_setupTabWidget );
|
||||
m_readablePorts->setFont( pointSize<9>(
|
||||
m_readablePorts->font() ) );
|
||||
#ifdef QT4
|
||||
connect( m_readablePorts, SIGNAL( triggered( QAction * ) ),
|
||||
this, SLOT( activatedReadablePort( QAction * ) ) );
|
||||
@@ -130,6 +135,8 @@ midiTabWidget::midiTabWidget( channelTrack * _channel_track,
|
||||
#endif
|
||||
|
||||
m_writeablePorts = new QMenu( m_setupTabWidget );
|
||||
m_writeablePorts->setFont( pointSize<9>(
|
||||
m_writeablePorts->font() ) );
|
||||
#ifdef QT4
|
||||
connect( m_writeablePorts, SIGNAL( triggered( QAction * ) ),
|
||||
this, SLOT( activatedWriteablePort( QAction * ) ) );
|
||||
@@ -187,14 +194,10 @@ midiTabWidget::~midiTabWidget()
|
||||
void midiTabWidget::saveSettings( QDomDocument & _doc, QDomElement & _parent )
|
||||
{
|
||||
QDomElement mw_de = _doc.createElement( nodeName() );
|
||||
mw_de.setAttribute( "inputchannel", QString::number(
|
||||
m_inputChannelSpinBox->value() ) );
|
||||
mw_de.setAttribute( "outputchannel", QString::number(
|
||||
m_outputChannelSpinBox->value() ) );
|
||||
mw_de.setAttribute( "receive", QString::number(
|
||||
m_receiveCheckBox->isChecked() ) );
|
||||
mw_de.setAttribute( "send", QString::number(
|
||||
m_sendCheckBox->isChecked() ) );
|
||||
mw_de.setAttribute( "inputchannel", m_inputChannelSpinBox->value() );
|
||||
mw_de.setAttribute( "outputchannel", m_outputChannelSpinBox->value() );
|
||||
mw_de.setAttribute( "receive", m_receiveCheckBox->isChecked() );
|
||||
mw_de.setAttribute( "send", m_sendCheckBox->isChecked() );
|
||||
|
||||
if( m_readablePorts != NULL && m_receiveCheckBox->isChecked() == TRUE )
|
||||
{
|
||||
@@ -600,6 +603,10 @@ void midiTabWidget::activatedWriteablePort( int _id )
|
||||
void midiTabWidget::activatedReadablePort( QAction * ) { }
|
||||
void midiTabWidget::activatedWriteablePort( QAction * ) { }
|
||||
|
||||
|
||||
#undef setIcon
|
||||
#undef setText
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -23,12 +23,6 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include "mixer.h"
|
||||
#include "play_handle.h"
|
||||
#include "song_editor.h"
|
||||
@@ -38,6 +32,9 @@
|
||||
#include "debug.h"
|
||||
#include "config_mgr.h"
|
||||
#include "audio_port.h"
|
||||
#include "sample_play_handle.h"
|
||||
#include "piano_roll.h"
|
||||
#include "micro_timer.h"
|
||||
|
||||
#include "audio_device.h"
|
||||
#include "midi_client.h"
|
||||
@@ -60,38 +57,6 @@
|
||||
Uint32 SAMPLE_RATES[QUALITY_LEVELS] = { 44100, 88200 } ;
|
||||
|
||||
|
||||
class microTimer
|
||||
{
|
||||
public:
|
||||
microTimer( void )
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
~microTimer()
|
||||
{
|
||||
}
|
||||
|
||||
void reset( void )
|
||||
{
|
||||
gettimeofday( &begin, NULL );
|
||||
}
|
||||
|
||||
Uint32 elapsed( void ) const
|
||||
{
|
||||
struct timeval now;
|
||||
gettimeofday( &now, NULL );
|
||||
return( ( now.tv_sec - begin.tv_sec ) * 1000 * 1000 +
|
||||
( now.tv_usec - begin.tv_usec ) );
|
||||
}
|
||||
|
||||
private:
|
||||
struct timeval begin;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
mixer * mixer::s_instanceOfMe = NULL;
|
||||
|
||||
|
||||
@@ -167,6 +132,18 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
|
||||
{
|
||||
microTimer timer;
|
||||
|
||||
static songEditor::playPos last_metro_pos = -1;
|
||||
|
||||
songEditor::playPos p = songEditor::inst()->getPlayPos(
|
||||
songEditor::PLAY_PATTERN );
|
||||
if( songEditor::inst()->playMode() == songEditor::PLAY_PATTERN &&
|
||||
pianoRoll::inst()->isRecording() == TRUE &&
|
||||
p != last_metro_pos && p.getTact64th() % 16 == 0 )
|
||||
{
|
||||
addPlayHandle( new samplePlayHandle( "misc/metronome01.ogg" ) );
|
||||
last_metro_pos = p;
|
||||
}
|
||||
|
||||
// now we have to make sure no other thread does anything bad
|
||||
// while we're acting...
|
||||
m_mixMutex.lock();
|
||||
@@ -205,10 +182,9 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
|
||||
while( idx < m_playHandles.size() )
|
||||
{
|
||||
register playHandle * n = m_playHandles[idx];
|
||||
// delete play-handle if it played completely
|
||||
if( n->done() )
|
||||
{
|
||||
// delete all play-handles which have
|
||||
// played completely now
|
||||
delete n;
|
||||
m_playHandles.erase( m_playHandles.begin() +
|
||||
idx );
|
||||
@@ -255,13 +231,21 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
|
||||
|
||||
// removes all play-handles. this is neccessary, when the song is stopped ->
|
||||
// all remaining notes etc. would be played until their end
|
||||
void mixer::clear( void )
|
||||
void mixer::clear( bool _everything )
|
||||
{
|
||||
// TODO: m_midiClient->noteOffAll();
|
||||
for( playHandleVector::iterator it = m_playHandles.begin();
|
||||
it != m_playHandles.end(); ++it )
|
||||
{
|
||||
m_playHandlesToRemove.push_back( *it );
|
||||
// we must not delete instrument-play-handles as they exist
|
||||
// during the whole lifetime of an instrument - exception if
|
||||
// parameter _everything is true (which is the case when
|
||||
// clearing song for example)
|
||||
if( _everything == TRUE ||
|
||||
( *it )->type() != playHandle::INSTRUMENT_PLAY_HANDLE )
|
||||
{
|
||||
m_playHandlesToRemove.push_back( *it );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,9 +274,10 @@ void FASTCALL mixer::bufferToPort( sampleFrame * _buf, Uint32 _frames,
|
||||
volumeVector & _volume_vector,
|
||||
audioPort * _port )
|
||||
{
|
||||
Uint32 start_frame = _frames_ahead % m_framesPerAudioBuffer;
|
||||
const Uint32 start_frame = _frames_ahead % m_framesPerAudioBuffer;
|
||||
Uint32 end_frame = start_frame + _frames;
|
||||
Uint32 loop1_frame = tMin( end_frame, m_framesPerAudioBuffer );
|
||||
const Uint32 loop1_frame = tMin( end_frame, m_framesPerAudioBuffer );
|
||||
|
||||
for( Uint32 frame = start_frame; frame < loop1_frame; ++frame )
|
||||
{
|
||||
for( Uint8 chnl = 0; chnl < SURROUND_CHANNELS; ++chnl )
|
||||
@@ -303,6 +288,7 @@ void FASTCALL mixer::bufferToPort( sampleFrame * _buf, Uint32 _frames,
|
||||
_volume_vector.vol[chnl];
|
||||
}
|
||||
}
|
||||
|
||||
if( end_frame > m_framesPerAudioBuffer )
|
||||
{
|
||||
Uint32 frames_done = m_framesPerAudioBuffer - start_frame;
|
||||
@@ -318,10 +304,12 @@ void FASTCALL mixer::bufferToPort( sampleFrame * _buf, Uint32 _frames,
|
||||
_volume_vector.vol[chnl];
|
||||
}
|
||||
}
|
||||
// we used both buffers so set flags
|
||||
_port->m_bufferUsage = audioPort::BOTH;
|
||||
}
|
||||
else if( _port->m_bufferUsage == audioPort::NONE )
|
||||
{
|
||||
// only first buffer touched
|
||||
_port->m_bufferUsage = audioPort::FIRST;
|
||||
}
|
||||
|
||||
@@ -344,6 +332,7 @@ void mixer::setHighQuality( bool _hq_on )
|
||||
{
|
||||
m_qualityLevel = DEFAULT_QUALITY_LEVEL;
|
||||
}
|
||||
|
||||
// and re-open device
|
||||
m_audioDev = tryAudioDevices();
|
||||
m_audioDev->startProcessing();
|
||||
@@ -423,20 +412,6 @@ audioDevice * mixer::tryAudioDevices( void )
|
||||
audioDevice * dev = NULL;
|
||||
QString dev_name = configManager::inst()->value( "mixer", "audiodev" );
|
||||
|
||||
#ifdef OSS_SUPPORT
|
||||
if( dev_name == audioOSS::name() || dev_name == "" )
|
||||
{
|
||||
dev = new audioOSS( SAMPLE_RATES[DEFAULT_QUALITY_LEVEL],
|
||||
success_ful );
|
||||
if( success_ful )
|
||||
{
|
||||
m_audioDevName = audioOSS::name();
|
||||
return( dev );
|
||||
}
|
||||
delete dev;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ALSA_SUPPORT
|
||||
if( dev_name == audioALSA::name() || dev_name == "" )
|
||||
{
|
||||
@@ -452,6 +427,21 @@ audioDevice * mixer::tryAudioDevices( void )
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef OSS_SUPPORT
|
||||
if( dev_name == audioOSS::name() || dev_name == "" )
|
||||
{
|
||||
dev = new audioOSS( SAMPLE_RATES[DEFAULT_QUALITY_LEVEL],
|
||||
success_ful );
|
||||
if( success_ful )
|
||||
{
|
||||
m_audioDevName = audioOSS::name();
|
||||
return( dev );
|
||||
}
|
||||
delete dev;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef JACK_SUPPORT
|
||||
if( dev_name == audioJACK::name() || dev_name == "" )
|
||||
{
|
||||
|
||||
@@ -166,12 +166,12 @@ void note::setPanning( panning _panning )
|
||||
void note::saveSettings( QDomDocument & _doc, QDomElement & _parent )
|
||||
{
|
||||
QDomElement note_de = _doc.createElement( "note" );
|
||||
note_de.setAttribute( "tone", QString::number( m_tone ) );
|
||||
note_de.setAttribute( "oct", QString::number( m_octave ) );
|
||||
note_de.setAttribute( "vol", QString::number( m_volume ) );
|
||||
note_de.setAttribute( "pan", QString::number( m_panning ) );
|
||||
note_de.setAttribute( "len", QString::number( m_length ) );
|
||||
note_de.setAttribute( "pos", QString::number( m_pos ) );
|
||||
note_de.setAttribute( "tone", m_tone );
|
||||
note_de.setAttribute( "oct", m_octave );
|
||||
note_de.setAttribute( "vol", m_volume );
|
||||
note_de.setAttribute( "pan", m_panning );
|
||||
note_de.setAttribute( "len", m_length );
|
||||
note_de.setAttribute( "pos", m_pos );
|
||||
_parent.appendChild( note_de );
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* note_play_handle.cpp - implementation of class notePlayHandle, part of
|
||||
* play-engine
|
||||
*
|
||||
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -34,10 +34,14 @@
|
||||
#include "song_editor.h"
|
||||
|
||||
|
||||
notePlayHandle::notePlayHandle( channelTrack * _chnl_trk, Uint32 _frames_ahead,
|
||||
Uint32 _frames, note * n, bool _arp_note ) :
|
||||
playHandle(),
|
||||
note( *n ),
|
||||
|
||||
notePlayHandle::notePlayHandle( channelTrack * _chnl_trk,
|
||||
const Uint32 _frames_ahead,
|
||||
const Uint32 _frames,
|
||||
note * _n,
|
||||
const bool _arp_note ) :
|
||||
playHandle( NOTE_PLAY_HANDLE ),
|
||||
note( *_n ),
|
||||
m_pluginData( NULL ),
|
||||
m_filter( NULL ),
|
||||
m_channelTrack( _chnl_trk ),
|
||||
@@ -201,6 +205,13 @@ void notePlayHandle::checkValidity( void )
|
||||
if( m_channelTrack != NULL &&
|
||||
m_channelTrack->type() == track::NULL_TRACK )
|
||||
{
|
||||
// track-type being track::NULL_TRACK indicates a track whose
|
||||
// removal is in progress, so we have to invalidate ourself
|
||||
if( m_released == FALSE )
|
||||
{
|
||||
noteOff( 0 );
|
||||
}
|
||||
m_channelTrack->deleteNotePluginData( this );
|
||||
m_channelTrack = NULL;
|
||||
}
|
||||
// sub-notes might not be registered at mixer (for example arpeggio-
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
#include "tooltip.h"
|
||||
#include "midi.h"
|
||||
#include "tool_button.h"
|
||||
|
||||
#include "text_float.h"
|
||||
|
||||
extern tones whiteKeys[]; // defined in piano_widget.cpp
|
||||
|
||||
@@ -130,6 +130,8 @@ const int DEFAULT_PR_PPT = KEY_LINE_HEIGHT * DEFAULT_STEPS_PER_TACT;
|
||||
|
||||
pianoRoll::pianoRoll( void ) :
|
||||
QWidget( lmmsMainWin::inst()->workspace() ),
|
||||
m_paintPixmap(),
|
||||
m_cursorInside( FALSE ),
|
||||
m_pattern( NULL ),
|
||||
m_currentPosition(),
|
||||
m_recording( FALSE ),
|
||||
@@ -522,7 +524,7 @@ void pianoRoll::setCurrentPattern( pattern * _new_pattern )
|
||||
|
||||
|
||||
inline void pianoRoll::drawNoteRect( QPainter & _p, Uint16 _x, Uint16 _y,
|
||||
Sint16 _width, bool _is_selected )
|
||||
Sint16 _width, const bool _is_selected )
|
||||
{
|
||||
++_x;
|
||||
++_y;
|
||||
@@ -564,38 +566,15 @@ inline void pianoRoll::drawNoteRect( QPainter & _p, Uint16 _x, Uint16 _y,
|
||||
|
||||
|
||||
|
||||
void pianoRoll::removeSelection( void )
|
||||
void pianoRoll::update( void )
|
||||
{
|
||||
m_selectStartTact64th = 0;
|
||||
m_selectedTact64th = 0;
|
||||
m_selectStartKey = 0;
|
||||
m_selectedKeys = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void pianoRoll::closeEvent( QCloseEvent * _ce )
|
||||
{
|
||||
QApplication::restoreOverrideCursor();
|
||||
hide();
|
||||
_ce->ignore ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void pianoRoll::paintEvent( QPaintEvent * )
|
||||
{
|
||||
#ifdef QT4
|
||||
QPainter p( this );
|
||||
p.fillRect( rect(), QColor( 0, 0, 0 ) );
|
||||
#else
|
||||
QPixmap draw_pm( rect().size() );
|
||||
draw_pm.fill( QColor( 0, 0, 0 ) );//, rect().topLeft());
|
||||
|
||||
QPainter p( &draw_pm, this );
|
||||
#endif
|
||||
if( m_paintPixmap.isNull() == TRUE ||
|
||||
m_paintPixmap.size() != rect().size() )
|
||||
{
|
||||
m_paintPixmap = QPixmap( rect().size() );
|
||||
}
|
||||
m_paintPixmap.fill( QColor( 0, 0, 0 ) );
|
||||
QPainter p( &m_paintPixmap, this );
|
||||
|
||||
// set font-size to 8
|
||||
p.setFont( pointSize<8>( p.font() ) );
|
||||
@@ -693,14 +672,6 @@ void pianoRoll::paintEvent( QPaintEvent * )
|
||||
}
|
||||
// draw key-line
|
||||
p.drawLine( WHITE_KEY_WIDTH, key_line_y, width(), key_line_y );
|
||||
if( key == m_keyMouseOver )
|
||||
{
|
||||
p.fillRect( WHITE_KEY_WIDTH, key_line_y -
|
||||
KEY_LINE_HEIGHT,
|
||||
width() - WHITE_KEY_WIDTH,
|
||||
KEY_LINE_HEIGHT,
|
||||
QColor( 64, 64, 64 ) );
|
||||
}
|
||||
++key;
|
||||
}
|
||||
|
||||
@@ -771,22 +742,11 @@ void pianoRoll::paintEvent( QPaintEvent * )
|
||||
QColor( 0, 0, 0 ) );
|
||||
|
||||
|
||||
// draw artwork-stuff
|
||||
/* p.drawPixmap( 0, 0, *s_artwork1 );
|
||||
|
||||
int artwork_x = s_artwork1->width();
|
||||
|
||||
while( artwork_x < width() )
|
||||
{
|
||||
p.drawPixmap( artwork_x, 0, *s_artwork2 );
|
||||
artwork_x += s_artwork2->width();
|
||||
}*/
|
||||
|
||||
|
||||
// set clipping area, because we are not allowed to paint over
|
||||
// keyboard...
|
||||
p.setClipRect( WHITE_KEY_WIDTH, PR_TOP_MARGIN, width()-WHITE_KEY_WIDTH,
|
||||
height()-PR_TOP_MARGIN-PR_BOTTOM_MARGIN );
|
||||
p.setClipRect( WHITE_KEY_WIDTH, PR_TOP_MARGIN,
|
||||
width() - WHITE_KEY_WIDTH,
|
||||
height() - PR_TOP_MARGIN - PR_BOTTOM_MARGIN );
|
||||
|
||||
// draw vertical raster
|
||||
int tact_16th = m_currentPosition / 4;
|
||||
@@ -824,7 +784,7 @@ void pianoRoll::paintEvent( QPaintEvent * )
|
||||
|
||||
p.setClipRect( WHITE_KEY_WIDTH, PR_TOP_MARGIN, width() -
|
||||
WHITE_KEY_WIDTH, height() - PR_TOP_MARGIN -
|
||||
PR_BOTTOM_MARGIN );
|
||||
PR_BOTTOM_MARGIN );
|
||||
|
||||
// setup selection-vars
|
||||
int sel_pos_start = m_selectStartTact64th;
|
||||
@@ -950,96 +910,175 @@ void pianoRoll::paintEvent( QPaintEvent * )
|
||||
#else
|
||||
m_leftRightScroll->setSteps( 1, l );
|
||||
#endif
|
||||
/*
|
||||
// draw current edit-mode-icon below the cursor
|
||||
switch( m_editMode )
|
||||
{
|
||||
case DRAW:
|
||||
p.drawPixmap( mapFromGlobal( QCursor::pos() ),
|
||||
*s_toolDraw );
|
||||
break;
|
||||
case ERASE:
|
||||
p.drawPixmap( mapFromGlobal( QCursor::pos() ),
|
||||
*s_toolErase );
|
||||
break;
|
||||
case SELECT:
|
||||
p.drawPixmap( mapFromGlobal( QCursor::pos() ),
|
||||
*s_toolSelect );
|
||||
break;
|
||||
case MOVE:
|
||||
p.drawPixmap( mapFromGlobal( QCursor::pos() ),
|
||||
*s_toolMove );
|
||||
break;
|
||||
}*/
|
||||
|
||||
#ifndef QT4
|
||||
// and blit all the drawn stuff on the screen...
|
||||
bitBlt( this, rect().topLeft(), &draw_pm );
|
||||
#endif
|
||||
QWidget::update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// responsible for moving/resizing scrollbars after window-resizing
|
||||
void pianoRoll::resizeEvent( QResizeEvent * )
|
||||
void pianoRoll::removeSelection( void )
|
||||
{
|
||||
|
||||
m_leftRightScroll->setGeometry( WHITE_KEY_WIDTH, height() -
|
||||
SCROLLBAR_SIZE,
|
||||
width()-WHITE_KEY_WIDTH,
|
||||
SCROLLBAR_SIZE );
|
||||
m_topBottomScroll->setGeometry( width() - SCROLLBAR_SIZE, PR_TOP_MARGIN,
|
||||
SCROLLBAR_SIZE,
|
||||
height() - PR_TOP_MARGIN -
|
||||
SCROLLBAR_SIZE );
|
||||
|
||||
int total_pixels = OCTAVE_HEIGHT * OCTAVES - ( height() -
|
||||
PR_TOP_MARGIN - PR_BOTTOM_MARGIN -
|
||||
m_notesEditHeight );
|
||||
m_totalKeysToScroll = total_pixels * NOTES_PER_OCTAVE / OCTAVE_HEIGHT;
|
||||
|
||||
m_topBottomScroll->setRange( 0, m_totalKeysToScroll );
|
||||
#ifdef QT4
|
||||
m_topBottomScroll->setSingleStep( 1 );
|
||||
m_topBottomScroll->setPageStep( 20 );
|
||||
#else
|
||||
m_topBottomScroll->setSteps( 1, 20 );
|
||||
#endif
|
||||
|
||||
if( m_startKey > m_totalKeysToScroll )
|
||||
{
|
||||
m_startKey = m_totalKeysToScroll;
|
||||
}
|
||||
m_topBottomScroll->setValue( m_totalKeysToScroll - m_startKey );
|
||||
|
||||
songEditor::inst()->getPlayPos( songEditor::PLAY_PATTERN
|
||||
).m_timeLine->setFixedWidth( width() );
|
||||
m_toolBar->setFixedWidth( width() );
|
||||
m_selectStartTact64th = 0;
|
||||
m_selectedTact64th = 0;
|
||||
m_selectStartKey = 0;
|
||||
m_selectedKeys = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int pianoRoll::getKey( int _y )
|
||||
void pianoRoll::closeEvent( QCloseEvent * _ce )
|
||||
{
|
||||
int key_line_y = height() - PR_BOTTOM_MARGIN - m_notesEditHeight - 1;
|
||||
// pressed key on piano
|
||||
int key_num = ( key_line_y - _y ) / KEY_LINE_HEIGHT;
|
||||
key_num += m_startKey;
|
||||
QApplication::restoreOverrideCursor();
|
||||
hide();
|
||||
_ce->ignore ();
|
||||
}
|
||||
|
||||
// some range-checking-stuff
|
||||
if( key_num < 0 )
|
||||
|
||||
|
||||
|
||||
void pianoRoll::enterEvent( QEvent * _e )
|
||||
{
|
||||
m_cursorInside = TRUE;
|
||||
QWidget::enterEvent( _e );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void pianoRoll::keyPressEvent( QKeyEvent * _ke )
|
||||
{
|
||||
switch( _ke->key() )
|
||||
{
|
||||
key_num = 0;
|
||||
}
|
||||
case Qt::Key_Up:
|
||||
m_topBottomScroll->setValue(
|
||||
m_topBottomScroll->value() - 1 );
|
||||
break;
|
||||
|
||||
if( key_num >= NOTES_PER_OCTAVE * OCTAVES )
|
||||
case Qt::Key_Down:
|
||||
m_topBottomScroll->setValue(
|
||||
m_topBottomScroll->value() + 1 );
|
||||
break;
|
||||
|
||||
case Qt::Key_Left:
|
||||
{
|
||||
if( ( m_timeLine->pos() -= 16 ) < 0 )
|
||||
{
|
||||
m_timeLine->pos().setTact( 0 );
|
||||
m_timeLine->pos().setTact64th( 0 );
|
||||
}
|
||||
m_timeLine->updatePosition();
|
||||
break;
|
||||
}
|
||||
case Qt::Key_Right:
|
||||
{
|
||||
m_timeLine->pos() += 16;
|
||||
m_timeLine->updatePosition();
|
||||
break;
|
||||
}
|
||||
|
||||
case Qt::Key_C:
|
||||
if( _ke->modifiers() & Qt::ControlModifier )
|
||||
{
|
||||
copySelectedNotes();
|
||||
}
|
||||
else
|
||||
{
|
||||
_ke->ignore();
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_X:
|
||||
if( _ke->modifiers() & Qt::ControlModifier )
|
||||
{
|
||||
cutSelectedNotes();
|
||||
}
|
||||
else
|
||||
{
|
||||
_ke->ignore();
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_V:
|
||||
if( _ke->modifiers() & Qt::ControlModifier )
|
||||
{
|
||||
pasteNotes();
|
||||
}
|
||||
else
|
||||
{
|
||||
_ke->ignore();
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_A:
|
||||
if( _ke->modifiers() & Qt::ControlModifier )
|
||||
{
|
||||
m_selectButton->setChecked( TRUE );
|
||||
selectAll();
|
||||
update();
|
||||
}
|
||||
else
|
||||
{
|
||||
_ke->ignore();
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_D:
|
||||
m_drawButton->setChecked( TRUE );
|
||||
break;
|
||||
|
||||
case Qt::Key_E:
|
||||
m_eraseButton->setChecked( TRUE );
|
||||
break;
|
||||
|
||||
case Qt::Key_S:
|
||||
m_selectButton->setChecked( TRUE );
|
||||
break;
|
||||
|
||||
case Qt::Key_M:
|
||||
m_moveButton->setChecked( TRUE );
|
||||
break;
|
||||
|
||||
case Qt::Key_Delete:
|
||||
deleteSelectedNotes();
|
||||
break;
|
||||
|
||||
case Qt::Key_Space:
|
||||
if( songEditor::inst()->playing() )
|
||||
{
|
||||
stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
play();
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_Home:
|
||||
m_timeLine->pos().setTact( 0 );
|
||||
m_timeLine->pos().setTact64th( 0 );
|
||||
m_timeLine->updatePosition();
|
||||
break;
|
||||
|
||||
default:
|
||||
_ke->ignore();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void pianoRoll::leaveEvent( QEvent * _e )
|
||||
{
|
||||
while( QApplication::overrideCursor() != NULL )
|
||||
{
|
||||
key_num = NOTES_PER_OCTAVE * OCTAVES - 1;
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
m_cursorInside = FALSE;
|
||||
|
||||
return( m_lastKey = key_num );
|
||||
QWidget::leaveEvent( _e );
|
||||
}
|
||||
|
||||
|
||||
@@ -1324,6 +1363,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
// but is still on the same key)
|
||||
if( key_num != released_key &&
|
||||
m_action != CHANGE_NOTE_VOLUME &&
|
||||
m_action != MOVE_SELECTION &&
|
||||
edit_note == FALSE &&
|
||||
#ifdef QT4
|
||||
_me->buttons() &
|
||||
@@ -1344,6 +1384,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
Qt::LeftButton &&
|
||||
m_action != RESIZE_NOTE &&
|
||||
m_action != SELECT_NOTES &&
|
||||
m_action != MOVE_SELECTION &&
|
||||
m_recording == FALSE &&
|
||||
songEditor::inst()->playing() == FALSE )
|
||||
{
|
||||
@@ -1355,7 +1396,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
}
|
||||
if( _me->x() <= WHITE_KEY_WIDTH )
|
||||
{
|
||||
update();
|
||||
QWidget::update();
|
||||
return;
|
||||
}
|
||||
x -= WHITE_KEY_WIDTH;
|
||||
@@ -1427,7 +1468,13 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
songEditor::inst()->setModified();
|
||||
|
||||
}
|
||||
else if( _me->button() == Qt::NoButton && m_editMode == DRAW )
|
||||
else if(
|
||||
#ifdef QT4
|
||||
_me->buttons() &
|
||||
#else
|
||||
_me->state() ==
|
||||
#endif
|
||||
Qt::NoButton && m_editMode == DRAW )
|
||||
{
|
||||
// set move- or resize-cursor
|
||||
|
||||
@@ -1771,130 +1818,108 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
update();
|
||||
if(
|
||||
#ifdef QT4
|
||||
_me->buttons() &
|
||||
#else
|
||||
_me->state() ==
|
||||
#endif
|
||||
Qt::NoButton )
|
||||
{
|
||||
QWidget::update();
|
||||
}
|
||||
else
|
||||
{
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void pianoRoll::keyPressEvent( QKeyEvent * _ke )
|
||||
void pianoRoll::paintEvent( QPaintEvent * )
|
||||
{
|
||||
switch( _ke->key() )
|
||||
#ifdef QT4
|
||||
QPainter p( this );
|
||||
#else
|
||||
QPixmap draw_pm( size() );
|
||||
draw_pm.fill( QColor( 0, 0, 0 ) );
|
||||
|
||||
QPainter p( &draw_pm, this );
|
||||
#endif
|
||||
p.drawPixmap( 0, 0, m_paintPixmap );
|
||||
|
||||
if( m_cursorInside == TRUE )
|
||||
{
|
||||
case Qt::Key_Up:
|
||||
m_topBottomScroll->setValue(
|
||||
m_topBottomScroll->value() - 1 );
|
||||
break;
|
||||
|
||||
case Qt::Key_Down:
|
||||
m_topBottomScroll->setValue(
|
||||
m_topBottomScroll->value() + 1 );
|
||||
break;
|
||||
|
||||
case Qt::Key_Left:
|
||||
p.setClipRect( WHITE_KEY_WIDTH, PR_TOP_MARGIN, width() -
|
||||
WHITE_KEY_WIDTH, height() - PR_TOP_MARGIN -
|
||||
m_notesEditHeight - PR_BOTTOM_MARGIN );
|
||||
if( validPattern() == TRUE )
|
||||
{
|
||||
if( ( m_timeLine->pos() -= 16 ) < 0 )
|
||||
{
|
||||
m_timeLine->pos().setTact( 0 );
|
||||
m_timeLine->pos().setTact64th( 0 );
|
||||
}
|
||||
m_timeLine->updatePosition();
|
||||
break;
|
||||
}
|
||||
case Qt::Key_Right:
|
||||
{
|
||||
m_timeLine->pos() += 16;
|
||||
m_timeLine->updatePosition();
|
||||
break;
|
||||
p.fillRect( 10, height() + 3 - PR_BOTTOM_MARGIN -
|
||||
m_notesEditHeight - KEY_LINE_HEIGHT *
|
||||
( m_keyMouseOver - m_startKey + 1 ),
|
||||
width() - 10, KEY_LINE_HEIGHT - 7,
|
||||
QColor( 64, 64, 64 ) );
|
||||
}
|
||||
|
||||
case Qt::Key_C:
|
||||
if( _ke->modifiers() & Qt::ControlModifier )
|
||||
{
|
||||
copySelectedNotes();
|
||||
}
|
||||
else
|
||||
{
|
||||
_ke->ignore();
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_X:
|
||||
if( _ke->modifiers() & Qt::ControlModifier )
|
||||
{
|
||||
cutSelectedNotes();
|
||||
}
|
||||
else
|
||||
{
|
||||
_ke->ignore();
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_V:
|
||||
if( _ke->modifiers() & Qt::ControlModifier )
|
||||
{
|
||||
pasteNotes();
|
||||
}
|
||||
else
|
||||
{
|
||||
_ke->ignore();
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_A:
|
||||
if( _ke->modifiers() & Qt::ControlModifier )
|
||||
{
|
||||
m_selectButton->setChecked( TRUE );
|
||||
selectAll();
|
||||
update();
|
||||
}
|
||||
else
|
||||
{
|
||||
_ke->ignore();
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_D:
|
||||
m_drawButton->setChecked( TRUE );
|
||||
break;
|
||||
|
||||
case Qt::Key_E:
|
||||
m_eraseButton->setChecked( TRUE );
|
||||
break;
|
||||
|
||||
case Qt::Key_S:
|
||||
m_selectButton->setChecked( TRUE );
|
||||
break;
|
||||
|
||||
case Qt::Key_M:
|
||||
m_moveButton->setChecked( TRUE );
|
||||
break;
|
||||
|
||||
case Qt::Key_Delete:
|
||||
deleteSelectedNotes();
|
||||
break;
|
||||
|
||||
case Qt::Key_Space:
|
||||
if( songEditor::inst()->playing() )
|
||||
{
|
||||
stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
play();
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_Home:
|
||||
m_timeLine->pos().setTact( 0 );
|
||||
m_timeLine->pos().setTact64th( 0 );
|
||||
m_timeLine->updatePosition();
|
||||
break;
|
||||
|
||||
default:
|
||||
_ke->ignore();
|
||||
break;
|
||||
const QPixmap * cursor = NULL;
|
||||
// draw current edit-mode-icon below the cursor
|
||||
switch( m_editMode )
|
||||
{
|
||||
case DRAW: cursor = s_toolDraw; break;
|
||||
case ERASE: cursor = s_toolErase; break;
|
||||
case SELECT: cursor = s_toolSelect; break;
|
||||
case MOVE: cursor = s_toolMove; break;
|
||||
}
|
||||
p.drawPixmap( mapFromGlobal( QCursor::pos() ) + QPoint( 8, 8 ),
|
||||
*cursor );
|
||||
}
|
||||
|
||||
#ifndef QT4
|
||||
// and blit all the drawn stuff on the screen...
|
||||
bitBlt( this, rect().topLeft(), &draw_pm );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// responsible for moving/resizing scrollbars after window-resizing
|
||||
void pianoRoll::resizeEvent( QResizeEvent * )
|
||||
{
|
||||
|
||||
m_leftRightScroll->setGeometry( WHITE_KEY_WIDTH, height() -
|
||||
SCROLLBAR_SIZE,
|
||||
width()-WHITE_KEY_WIDTH,
|
||||
SCROLLBAR_SIZE );
|
||||
m_topBottomScroll->setGeometry( width() - SCROLLBAR_SIZE, PR_TOP_MARGIN,
|
||||
SCROLLBAR_SIZE,
|
||||
height() - PR_TOP_MARGIN -
|
||||
SCROLLBAR_SIZE );
|
||||
|
||||
int total_pixels = OCTAVE_HEIGHT * OCTAVES - ( height() -
|
||||
PR_TOP_MARGIN - PR_BOTTOM_MARGIN -
|
||||
m_notesEditHeight );
|
||||
m_totalKeysToScroll = total_pixels * NOTES_PER_OCTAVE / OCTAVE_HEIGHT;
|
||||
|
||||
m_topBottomScroll->setRange( 0, m_totalKeysToScroll );
|
||||
#ifdef QT4
|
||||
m_topBottomScroll->setSingleStep( 1 );
|
||||
m_topBottomScroll->setPageStep( 20 );
|
||||
#else
|
||||
m_topBottomScroll->setSteps( 1, 20 );
|
||||
#endif
|
||||
|
||||
if( m_startKey > m_totalKeysToScroll )
|
||||
{
|
||||
m_startKey = m_totalKeysToScroll;
|
||||
}
|
||||
m_topBottomScroll->setValue( m_totalKeysToScroll - m_startKey );
|
||||
|
||||
songEditor::inst()->getPlayPos( songEditor::PLAY_PATTERN
|
||||
).m_timeLine->setFixedWidth( width() );
|
||||
m_toolBar->setFixedWidth( width() );
|
||||
}
|
||||
|
||||
|
||||
@@ -1945,6 +1970,30 @@ void pianoRoll::wheelEvent( QWheelEvent * _we )
|
||||
|
||||
|
||||
|
||||
int pianoRoll::getKey( int _y )
|
||||
{
|
||||
int key_line_y = height() - PR_BOTTOM_MARGIN - m_notesEditHeight - 1;
|
||||
// pressed key on piano
|
||||
int key_num = ( key_line_y - _y ) / KEY_LINE_HEIGHT;
|
||||
key_num += m_startKey;
|
||||
|
||||
// some range-checking-stuff
|
||||
if( key_num < 0 )
|
||||
{
|
||||
key_num = 0;
|
||||
}
|
||||
|
||||
if( key_num >= NOTES_PER_OCTAVE * OCTAVES )
|
||||
{
|
||||
key_num = NOTES_PER_OCTAVE * OCTAVES - 1;
|
||||
}
|
||||
|
||||
return( m_lastKey = key_num );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void pianoRoll::play( void )
|
||||
{
|
||||
if( validPattern() == FALSE )
|
||||
@@ -2218,6 +2267,10 @@ void pianoRoll::copySelectedNotes( void )
|
||||
m_notesToCopy.back()->setPos( m_notesToCopy.back()->pos(
|
||||
start_pos ) );
|
||||
}
|
||||
textFloat::displayMessage( tr( "Notes copied" ),
|
||||
tr( "All selected notes were copied to the "
|
||||
"clipboard." ),
|
||||
embed::getIconPixmap( "edit_copy" ), 2000 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* plugin.cpp - implemenation of plugin-class including plugin-loader
|
||||
* plugin.cpp - implementation of plugin-class including plugin-loader
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@@ -46,12 +46,29 @@
|
||||
#include "dummy_plugin.h"
|
||||
|
||||
|
||||
static embed::descriptor dummy_embed = { 0, NULL, "" } ;
|
||||
|
||||
plugin::plugin( const QString & _public_name, pluginTypes _type ) :
|
||||
settings(),
|
||||
m_publicName( _public_name ),
|
||||
m_type( _type )
|
||||
static plugin::descriptor dummy_plugin_descriptor =
|
||||
{
|
||||
"dummy",
|
||||
"dummy",
|
||||
QT_TRANSLATE_NOOP( "pluginBrowser", "no description" ),
|
||||
"Tobias Doerffel <tobydox/at/users.sf.net>",
|
||||
0x0100,
|
||||
plugin::UNDEFINED,
|
||||
dummy_embed
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
plugin::plugin( const descriptor * _descriptor ) :
|
||||
settings(),
|
||||
m_descriptor( _descriptor )
|
||||
{
|
||||
if( m_descriptor == NULL )
|
||||
{
|
||||
m_descriptor = &dummy_plugin_descriptor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +106,8 @@ plugin * plugin::instantiate( const QString & _plugin_name, void * _data )
|
||||
ascii()
|
||||
#endif
|
||||
, RTLD_NOW );*/
|
||||
QLibrary plugin_lib( _plugin_name );
|
||||
QLibrary plugin_lib( configManager::inst()->pluginDir() +
|
||||
_plugin_name );
|
||||
if( /*handle == NULL*/ plugin_lib.load() == FALSE )
|
||||
{
|
||||
QMessageBox::information( NULL,
|
||||
|
||||
@@ -99,7 +99,7 @@ QMutex * presetPreviewPlayHandle::s_globalDataMutex = NULL;
|
||||
|
||||
presetPreviewPlayHandle::presetPreviewPlayHandle(
|
||||
const QString & _preset_file ) :
|
||||
playHandle(),
|
||||
playHandle( PRESET_PREVIEW_PLAY_HANDLE ),
|
||||
m_previewNote( NULL )
|
||||
{
|
||||
if( s_globalDataMutex == NULL )
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
|
||||
samplePlayHandle::samplePlayHandle( const QString & _sample_file ) :
|
||||
playHandle(),
|
||||
playHandle( SAMPLE_PLAY_HANDLE ),
|
||||
m_sampleBuffer( new sampleBuffer( _sample_file ) ),
|
||||
m_ownSampleBuffer( TRUE ),
|
||||
m_doneMayReturnTrue( TRUE ),
|
||||
@@ -49,7 +49,7 @@ samplePlayHandle::samplePlayHandle( const QString & _sample_file ) :
|
||||
|
||||
|
||||
samplePlayHandle::samplePlayHandle( sampleBuffer * _sample_buffer ) :
|
||||
playHandle(),
|
||||
playHandle( SAMPLE_PLAY_HANDLE ),
|
||||
m_sampleBuffer( _sample_buffer ),
|
||||
m_ownSampleBuffer( FALSE ),
|
||||
m_doneMayReturnTrue( TRUE ),
|
||||
|
||||
@@ -1269,8 +1269,11 @@ void songEditor::addSampleTrack( void )
|
||||
|
||||
float songEditor::framesPerTact( void ) const
|
||||
{
|
||||
// when fooling around with tempo while playing, we sometimes get
|
||||
// 0 here which leads to FP-exception, so handle it separately
|
||||
const int bpm = tMax( 1, m_bpmSpinBox->value() );
|
||||
return( mixer::inst()->sampleRate() * 60.0f * BEATS_PER_TACT /
|
||||
m_bpmSpinBox->value() );
|
||||
bpm );
|
||||
}
|
||||
|
||||
|
||||
@@ -1348,7 +1351,7 @@ void songEditor::clearProject( void )
|
||||
|
||||
// make sure all running notes are cleared, otherwise the whole
|
||||
// thing will end up in a SIGSEGV...
|
||||
//mixer::inst()->clear();
|
||||
mixer::inst()->clear( TRUE );
|
||||
while( mixer::inst()->haveNoRunningNotes() == FALSE )
|
||||
{
|
||||
#ifdef QT4
|
||||
@@ -1508,17 +1511,15 @@ bool songEditor::saveProject( void )
|
||||
multimediaProject mmp( multimediaProject::SONG_PROJECT );
|
||||
|
||||
QDomElement bpm = mmp.createElement( "bpm" );
|
||||
bpm.setAttribute( "value", QString::number( m_bpmSpinBox->value() ) );
|
||||
bpm.setAttribute( "value", m_bpmSpinBox->value() );
|
||||
mmp.head().appendChild( bpm );
|
||||
|
||||
QDomElement mv = mmp.createElement( "mastervol" );
|
||||
mv.setAttribute( "value", QString::number( 200 -
|
||||
m_masterVolumeSlider->value() ) );
|
||||
mv.setAttribute( "value", 200 - m_masterVolumeSlider->value() );
|
||||
mmp.head().appendChild( mv );
|
||||
|
||||
QDomElement mp = mmp.createElement( "masterpitch" );
|
||||
mp.setAttribute( "value", QString::number(
|
||||
m_masterPitchSlider->value() ) );
|
||||
mp.setAttribute( "value", m_masterPitchSlider->value() );
|
||||
mmp.head().appendChild( mp );
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* track.cpp - implementation of classes concerning tracks -> neccessary for
|
||||
* all track-like objects (beat/bassline, sample-track...)
|
||||
*
|
||||
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -43,6 +43,9 @@
|
||||
#include <qcursor.h>
|
||||
#include <qwhatsthis.h>
|
||||
|
||||
#define setChecked setOn
|
||||
#define isChecked isOn
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -140,8 +143,8 @@ void trackContentObject::movePosition( const midiTime & _pos )
|
||||
}
|
||||
m_startPosition = _pos;
|
||||
m_track->getTrackWidget()->changePosition();
|
||||
// moving of TCO can result in change of song-length etc.,
|
||||
// therefore we update the trackcontainer
|
||||
// moving a TCO can result in change of song-length etc.,
|
||||
// therefore we update the track-container
|
||||
m_track->getTrackContainer()->update();
|
||||
}
|
||||
|
||||
@@ -156,7 +159,7 @@ void trackContentObject::changeLength( const midiTime & _length )
|
||||
}
|
||||
m_length = _length;
|
||||
setFixedWidth( static_cast<int>( m_length * pixelsPerTact() / 64 ) +
|
||||
TCO_BORDER_WIDTH*2 );
|
||||
TCO_BORDER_WIDTH * 2 );
|
||||
// changing length of TCO can result in change of song-length etc.,
|
||||
// therefore we update the trackcontainer
|
||||
m_track->getTrackContainer()->update();
|
||||
@@ -286,7 +289,7 @@ void trackContentObject::mousePressEvent( QMouseEvent * _me )
|
||||
void trackContentObject::mouseMoveEvent( QMouseEvent * _me )
|
||||
{
|
||||
const float ppt = m_track->getTrackContainer()->pixelsPerTact();
|
||||
if( m_moving )
|
||||
if( m_moving == TRUE )
|
||||
{
|
||||
int x = mapToParent( _me->pos() ).x() - m_initialMouseX;
|
||||
movePosition( tMax( 0, (Sint32) m_track->getTrackContainer()->
|
||||
@@ -299,13 +302,17 @@ void trackContentObject::mouseMoveEvent( QMouseEvent * _me )
|
||||
s_textFloat->move( mapTo( topLevelWidget(), QPoint( 0, 0 ) ) +
|
||||
QPoint( -2 - s_textFloat->width(), 8 ) );
|
||||
}
|
||||
else if( m_resizing )
|
||||
else if( m_resizing == TRUE )
|
||||
{
|
||||
changeLength( tMax( 64,
|
||||
static_cast<int>( _me->x() * 64 / ppt ) ) );
|
||||
s_textFloat->setText( QString( "%1:%2" ).
|
||||
arg( length().getTact() + 1 ).
|
||||
arg( length().getTact64th() ) );
|
||||
s_textFloat->setText( tr( "%1:%2 (%3:%4 to %5:%6)" ).
|
||||
arg( length().getTact() ).
|
||||
arg( length().getTact64th() ).
|
||||
arg( m_startPosition.getTact() + 1 ).
|
||||
arg( m_startPosition.getTact64th() ).
|
||||
arg( endPosition().getTact() + 1 ).
|
||||
arg( endPosition().getTact64th() ) );
|
||||
s_textFloat->move( mapTo( topLevelWidget(), QPoint( 0, 0 ) ) +
|
||||
QPoint( width() + 2, 8 ) );
|
||||
}
|
||||
@@ -712,113 +719,47 @@ midiTime trackContentWidget::getPosition( int _mouse_x )
|
||||
|
||||
|
||||
// ===========================================================================
|
||||
// trackSettingsWidget
|
||||
// trackOperationsWidget
|
||||
// ===========================================================================
|
||||
|
||||
trackSettingsWidget::trackSettingsWidget( trackWidget * _parent ) :
|
||||
|
||||
QPixmap * trackOperationsWidget::s_grip = NULL;
|
||||
|
||||
|
||||
trackOperationsWidget::trackOperationsWidget( trackWidget * _parent ) :
|
||||
QWidget( _parent ),
|
||||
m_trackWidget( _parent )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
trackSettingsWidget::~trackSettingsWidget()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void trackSettingsWidget::mousePressEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( _me->button() == Qt::LeftButton &&
|
||||
m_trackWidget->getTrack()->type() != track::BB_TRACK )
|
||||
if( s_grip == NULL )
|
||||
{
|
||||
multimediaProject mmp( multimediaProject::DRAG_N_DROP_DATA );
|
||||
m_trackWidget->getTrack()->saveSettings( mmp, mmp.content() );
|
||||
new stringPairDrag( "track_" +
|
||||
QString::number( m_trackWidget->getTrack()->type() ),
|
||||
mmp.toString(), QPixmap::grabWidget( this ), this );
|
||||
s_grip = new QPixmap( embed::getIconPixmap(
|
||||
"track_op_grip" ) );
|
||||
}
|
||||
}
|
||||
|
||||
toolTip::add( this, tr( "Press <Ctrl> while clicking on move-grip "
|
||||
"to begin a new drag'n'drop-action" ) );
|
||||
|
||||
QMenu * to_menu = new QMenu( this );
|
||||
to_menu->setFont( pointSize<9>( to_menu->font() ) );
|
||||
to_menu->addAction( embed::getIconPixmap( "edit_copy", 16, 16 ),
|
||||
tr( "Clone this track" ),
|
||||
this, SLOT( cloneTrack() ) );
|
||||
to_menu->addAction( embed::getIconPixmap( "cancel", 16, 16 ),
|
||||
tr( "Remove this track" ),
|
||||
this, SLOT( removeTrack() ) );
|
||||
|
||||
|
||||
m_trackOps = new QPushButton( embed::getIconPixmap( "track_op_menu" ),
|
||||
"", this );
|
||||
m_trackOps->setGeometry( 12, 1, 28, 28 );
|
||||
m_trackOps->setMenu( to_menu );
|
||||
toolTip::add( m_trackOps, tr( "Operations for this track" ) );
|
||||
|
||||
|
||||
|
||||
|
||||
// ===========================================================================
|
||||
// trackWidget
|
||||
// ===========================================================================
|
||||
|
||||
trackWidget::trackWidget( track * _track, QWidget * _parent ) :
|
||||
QWidget( _parent ),
|
||||
m_track( _track ),
|
||||
m_trackOperationsWidget( this ),
|
||||
m_trackSettingsWidget( this ),
|
||||
m_trackContentWidget( this )
|
||||
{
|
||||
#ifdef QT4
|
||||
{
|
||||
QPalette pal;
|
||||
pal.setColor( m_trackOperationsWidget.backgroundRole(),
|
||||
QColor( 128, 128, 128 ) );
|
||||
m_trackOperationsWidget.setPalette( pal );
|
||||
}
|
||||
#else
|
||||
m_trackOperationsWidget.setPaletteBackgroundColor(
|
||||
QColor( 128, 128, 128 ) );
|
||||
#endif
|
||||
|
||||
|
||||
QPushButton * clntr_btn = new QPushButton( embed::getIconPixmap(
|
||||
"edit_copy", 12, 12 ),
|
||||
"",
|
||||
&m_trackOperationsWidget );
|
||||
clntr_btn->setGeometry( 1, 1, TRACK_OP_BTN_WIDTH, TRACK_OP_BTN_HEIGHT );
|
||||
connect( clntr_btn, SIGNAL( clicked() ), this, SLOT( cloneTrack() ) );
|
||||
connect( clntr_btn, SIGNAL( clicked() ), clntr_btn,
|
||||
SLOT( clearFocus() ) );
|
||||
toolTip::add( clntr_btn, tr( "Clone this track" ) );
|
||||
|
||||
QPushButton * deltr_btn = new QPushButton( embed::getIconPixmap(
|
||||
"cancel", 12, 12 ),
|
||||
"", &m_trackOperationsWidget );
|
||||
deltr_btn->setGeometry( 1, 1+TRACK_OP_BTN_HEIGHT, TRACK_OP_BTN_WIDTH,
|
||||
TRACK_OP_BTN_HEIGHT );
|
||||
connect( deltr_btn, SIGNAL( clicked() ), this, SLOT( removeTrack() ) );
|
||||
connect( deltr_btn, SIGNAL( clicked() ), deltr_btn,
|
||||
SLOT( clearFocus() ) );
|
||||
toolTip::add( deltr_btn, tr( "Remove this track" ) );
|
||||
|
||||
QPushButton * muptr_btn = new QPushButton( embed::getIconPixmap(
|
||||
"arp_up_on", 12, 12 ),
|
||||
"", &m_trackOperationsWidget );
|
||||
muptr_btn->setGeometry( 1+TRACK_OP_BTN_WIDTH, 1, TRACK_OP_BTN_WIDTH,
|
||||
TRACK_OP_BTN_HEIGHT );
|
||||
connect( muptr_btn, SIGNAL( clicked() ), this, SLOT( moveTrackUp() ) );
|
||||
connect( muptr_btn, SIGNAL( clicked() ), muptr_btn,
|
||||
SLOT( clearFocus() ) );
|
||||
toolTip::add( muptr_btn, tr( "Move this track up" ) );
|
||||
|
||||
QPushButton * mdowntr_btn = new QPushButton( embed::getIconPixmap(
|
||||
"arp_down_on", 12, 12 ),
|
||||
"", &m_trackOperationsWidget );
|
||||
mdowntr_btn->setGeometry( 1+TRACK_OP_BTN_WIDTH, 1+TRACK_OP_BTN_HEIGHT,
|
||||
TRACK_OP_BTN_WIDTH,
|
||||
TRACK_OP_BTN_HEIGHT );
|
||||
connect( mdowntr_btn, SIGNAL( clicked() ), this,
|
||||
SLOT( moveTrackDown() ) );
|
||||
connect( mdowntr_btn, SIGNAL( clicked() ), mdowntr_btn,
|
||||
SLOT( clearFocus() ) );
|
||||
toolTip::add( mdowntr_btn, tr( "Move this track down" ) );
|
||||
|
||||
m_muteBtn = new pixmapButton( &m_trackOperationsWidget );
|
||||
m_muteBtn = new pixmapButton( this );
|
||||
m_muteBtn->setActiveGraphic( embed::getIconPixmap( "mute_on" ) );
|
||||
m_muteBtn->setInactiveGraphic( embed::getIconPixmap( "mute_off" ) );
|
||||
m_muteBtn->move( 3+TRACK_OP_BTN_WIDTH*2, 8 );
|
||||
m_muteBtn->move( 44, 8 );
|
||||
m_muteBtn->show();
|
||||
connect( m_muteBtn, SIGNAL( toggled( bool ) ), this,
|
||||
SLOT( setMuted( bool ) ) );
|
||||
@@ -839,20 +780,167 @@ trackWidget::trackWidget( track * _track, QWidget * _parent ) :
|
||||
"this track." ) );
|
||||
toolTip::add( m_muteBtn, tr( "left click = mute this track\n"
|
||||
"right click = mute all other tracks (solo)" ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
trackOperationsWidget::~trackOperationsWidget()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool trackOperationsWidget::muted( void ) const
|
||||
{
|
||||
return( m_muteBtn->isChecked() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void trackOperationsWidget::mousePressEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( _me->button() == Qt::LeftButton &&
|
||||
lmmsMainWin::isCtrlPressed() == TRUE &&
|
||||
m_trackWidget->getTrack()->type() != track::BB_TRACK )
|
||||
{
|
||||
multimediaProject mmp( multimediaProject::DRAG_N_DROP_DATA );
|
||||
m_trackWidget->getTrack()->saveSettings( mmp, mmp.content() );
|
||||
new stringPairDrag( "track_" +
|
||||
QString::number( m_trackWidget->getTrack()->type() ),
|
||||
mmp.toString(), QPixmap::grabWidget(
|
||||
&m_trackWidget->getTrackSettingsWidget() ),
|
||||
this );
|
||||
}
|
||||
else if( _me->button() == Qt::LeftButton && _me->x() < 10 )
|
||||
{
|
||||
// track-widget (parent-widget) initiates track-move
|
||||
_me->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void trackOperationsWidget::paintEvent( QPaintEvent * _pe )
|
||||
{
|
||||
#ifdef QT4
|
||||
QPainter p( this );
|
||||
p.fillRect( rect(), QColor( 128, 128, 128 ) );
|
||||
#else
|
||||
// create pixmap for whole widget
|
||||
QPixmap pm( rect().size() );
|
||||
pm.fill( QColor( 128, 128, 128 ) );
|
||||
|
||||
// and a painter for it
|
||||
QPainter p( &pm );
|
||||
#endif
|
||||
if( m_trackWidget->isMovingTrack() == FALSE )
|
||||
{
|
||||
p.drawPixmap( 2, 2, *s_grip );
|
||||
/* if( m_trackOps->isVisible() == FALSE )
|
||||
{*/
|
||||
m_trackOps->show();
|
||||
/* }
|
||||
if( m_muteBtn->isVisible() == FALSE )
|
||||
{*/
|
||||
m_muteBtn->show();
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
m_trackOps->hide();
|
||||
m_muteBtn->hide();
|
||||
}
|
||||
|
||||
#ifndef QT4
|
||||
// blit drawn pixmap to actual widget
|
||||
bitBlt( this, rect().topLeft(), &pm );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void trackOperationsWidget::cloneTrack( void )
|
||||
{
|
||||
m_trackWidget->getTrack()->getTrackContainer()->cloneTrack(
|
||||
m_trackWidget->getTrack() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void trackOperationsWidget::removeTrack( void )
|
||||
{
|
||||
m_trackWidget->getTrack()->getTrackContainer()->removeTrack(
|
||||
m_trackWidget->getTrack() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void trackOperationsWidget::setMuted( bool _muted )
|
||||
{
|
||||
m_muteBtn->setChecked( _muted );
|
||||
m_trackWidget->getTrackContentWidget().updateTCOs();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void trackOperationsWidget::muteBtnRightClicked( void )
|
||||
{
|
||||
const bool m = muted(); // next function might modify our mute-state,
|
||||
// so save it
|
||||
m_trackWidget->getTrack()->getTrackContainer()->setMutedOfAllTracks(
|
||||
m );
|
||||
setMuted( !m );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ===========================================================================
|
||||
// trackWidget
|
||||
// ===========================================================================
|
||||
|
||||
trackWidget::trackWidget( track * _track, QWidget * _parent ) :
|
||||
QWidget( _parent ),
|
||||
m_track( _track ),
|
||||
m_trackOperationsWidget( this ),
|
||||
m_trackSettingsWidget( this ),
|
||||
m_trackContentWidget( this ),
|
||||
m_movingTrack( FALSE ),
|
||||
m_initialMouseX( -1 )
|
||||
{
|
||||
#ifdef QT4
|
||||
{
|
||||
QPalette pal;
|
||||
pal.setColor( m_trackSettingsWidget.backgroundRole(),
|
||||
QColor( 64, 64, 64 ) );
|
||||
m_trackSettingsWidget.setPalette( pal );
|
||||
pal.setColor( m_trackOperationsWidget.backgroundRole(),
|
||||
QColor( 128, 128, 128 ) );
|
||||
m_trackOperationsWidget.setPalette( pal );
|
||||
}
|
||||
#else
|
||||
m_trackSettingsWidget.setPaletteBackgroundColor( QColor( 64, 64, 64 ) );
|
||||
m_trackOperationsWidget.setPaletteBackgroundColor(
|
||||
QColor( 128, 128, 128 ) );
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef QT4
|
||||
QPalette pal;
|
||||
pal.setColor( m_trackSettingsWidget.backgroundRole(),
|
||||
QColor( 64, 64, 64 ) );
|
||||
m_trackSettingsWidget.setPalette( pal );
|
||||
#else
|
||||
m_trackSettingsWidget.setPaletteBackgroundColor( QColor( 64, 64, 64 ) );
|
||||
// set background-mode for flicker-free redraw
|
||||
#ifndef QT4
|
||||
setBackgroundMode( Qt::NoBackground );
|
||||
#endif
|
||||
setAcceptDrops( TRUE );
|
||||
@@ -869,18 +957,6 @@ trackWidget::~trackWidget()
|
||||
|
||||
|
||||
|
||||
bool trackWidget::muted( void ) const
|
||||
{
|
||||
#ifdef QT4
|
||||
return( m_muteBtn->isChecked() );
|
||||
#else
|
||||
return( m_muteBtn->isOn() );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// resposible for moving track-content-widgets to appropriate position after
|
||||
// change of visible viewport
|
||||
void trackWidget::changePosition( const midiTime & _new_pos )
|
||||
@@ -921,61 +997,6 @@ void trackWidget::changePosition( const midiTime & _new_pos )
|
||||
|
||||
|
||||
|
||||
void trackWidget::cloneTrack( void )
|
||||
{
|
||||
m_track->getTrackContainer()->cloneTrack( m_track );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void trackWidget::removeTrack( void )
|
||||
{
|
||||
m_track->getTrackContainer()->removeTrack( m_track );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void trackWidget::moveTrackUp( void )
|
||||
{
|
||||
m_track->getTrackContainer()->moveTrackUp( m_track );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void trackWidget::moveTrackDown( void )
|
||||
{
|
||||
m_track->getTrackContainer()->moveTrackDown( m_track );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void trackWidget::setMuted( bool _muted )
|
||||
{
|
||||
#ifdef QT4
|
||||
m_muteBtn->setChecked( _muted );
|
||||
#else
|
||||
m_muteBtn->setOn( _muted );
|
||||
#endif
|
||||
m_trackContentWidget.updateTCOs();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void trackWidget::muteBtnRightClicked( void )
|
||||
{
|
||||
bool m = muted();
|
||||
m_track->getTrackContainer()->setMutedOfAllTracks( m );
|
||||
setMuted( !m );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void trackWidget::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
{
|
||||
stringPairDrag::processDragEnterEvent( _dee, "track_" +
|
||||
@@ -1002,6 +1023,69 @@ void trackWidget::dropEvent( QDropEvent * _de )
|
||||
|
||||
|
||||
|
||||
void trackWidget::mousePressEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( _me->button() == Qt::LeftButton )
|
||||
{
|
||||
m_movingTrack = TRUE;
|
||||
m_initialMouseX = _me->x();
|
||||
|
||||
QCursor c( Qt::SizeAllCursor );
|
||||
QApplication::setOverrideCursor( c );
|
||||
|
||||
m_trackOperationsWidget.update();
|
||||
|
||||
_me->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
QWidget::mousePressEvent( _me );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void trackWidget::mouseMoveEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( m_movingTrack == TRUE )
|
||||
{
|
||||
trackContainer * tc = m_track->getTrackContainer();
|
||||
// look which track-widget the mouse-cursor is over
|
||||
const trackWidget * track_at_y = tc->trackWidgetAt(
|
||||
mapTo( tc->containerWidget(), _me->pos() ).y() );
|
||||
// a track-widget not equal to ourself?
|
||||
if( track_at_y != NULL && track_at_y != this )
|
||||
{
|
||||
// then move us up/down there!
|
||||
if( _me->y() < 0 )
|
||||
{
|
||||
tc->moveTrackUp( m_track );
|
||||
}
|
||||
else
|
||||
{
|
||||
tc->moveTrackDown( m_track );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void trackWidget::mouseReleaseEvent( QMouseEvent * _me )
|
||||
{
|
||||
m_movingTrack = FALSE;
|
||||
while( QApplication::overrideCursor() != NULL )
|
||||
{
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
m_trackOperationsWidget.update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void trackWidget::paintEvent( QPaintEvent * _pe )
|
||||
{
|
||||
#ifdef QT4
|
||||
@@ -1009,7 +1093,7 @@ void trackWidget::paintEvent( QPaintEvent * _pe )
|
||||
#else
|
||||
// create pixmap for whole widget
|
||||
QPixmap pm( rect().size() );
|
||||
pm.fill( QColor( 128, 128, 128 ) );
|
||||
pm.fill( QColor( 224, 224, 224 ) );
|
||||
|
||||
// and a painter for it
|
||||
QPainter p( &pm );
|
||||
@@ -1143,7 +1227,7 @@ void FASTCALL track::saveSettings( QDomDocument & _doc, QDomElement & _parent )
|
||||
csize num_of_tcos = getTrackContentWidget()->numOfTCOs();
|
||||
|
||||
QDomElement track_de = _doc.createElement( "track" );
|
||||
track_de.setAttribute( "type", QString::number( type() ) );
|
||||
track_de.setAttribute( "type", type() );
|
||||
track_de.setAttribute( "muted", muted() );
|
||||
_parent.appendChild( track_de );
|
||||
|
||||
@@ -1170,7 +1254,7 @@ void FASTCALL track::loadSettings( const QDomElement & _this )
|
||||
"settings-node!\n" );
|
||||
}
|
||||
|
||||
m_trackWidget->setMuted( _this.attribute( "muted" ).toInt() );
|
||||
setMuted( _this.attribute( "muted" ).toInt() );
|
||||
|
||||
|
||||
getTrackContentWidget()->removeAllTCOs();
|
||||
@@ -1295,5 +1379,13 @@ void FASTCALL track::swapPositionOfTCOs( csize _tco_num1, csize _tco_num2 )
|
||||
|
||||
|
||||
|
||||
#ifndef QT4
|
||||
|
||||
#undef isChecked
|
||||
#undef setChecked
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#include "track.moc"
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
#include "mmp.h"
|
||||
#include "config_mgr.h"
|
||||
#include "midi_file.h"
|
||||
#include "instrument.h"
|
||||
|
||||
|
||||
|
||||
@@ -304,6 +305,25 @@ void trackContainer::realignTracks( bool _complete_update )
|
||||
|
||||
|
||||
|
||||
const trackWidget * trackContainer::trackWidgetAt( const int _y ) const
|
||||
{
|
||||
int y_cnt = 0;
|
||||
for( trackWidgetVector::const_iterator it = m_trackWidgets.begin();
|
||||
it != m_trackWidgets.end(); ++it )
|
||||
{
|
||||
const int y_cnt1 = y_cnt;
|
||||
y_cnt += ( *it )->height();
|
||||
if( _y >= y_cnt1 && _y < y_cnt )
|
||||
{
|
||||
return( *it );
|
||||
}
|
||||
}
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
unsigned int trackContainer::countTracks( track::trackTypes _tt ) const
|
||||
{
|
||||
unsigned int cnt = 0;
|
||||
@@ -327,7 +347,7 @@ void trackContainer::setMutedOfAllTracks( bool _muted )
|
||||
for( trackWidgetVector::iterator it = m_trackWidgets.begin();
|
||||
it != m_trackWidgets.end(); ++it )
|
||||
{
|
||||
( *it )->setMuted( _muted );
|
||||
( *it )->getTrack()->setMuted( _muted );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,7 +401,8 @@ void trackContainer::resizeEvent( QResizeEvent * )
|
||||
void trackContainer::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
{
|
||||
stringPairDrag::processDragEnterEvent( _dee,
|
||||
QString( "presetfile,instrument,midifile,track_%1,track_%2" ).
|
||||
QString( "presetfile,sampledata,samplefile,instrument,midifile,"
|
||||
"track_%1,track_%2" ).
|
||||
arg( track::CHANNEL_TRACK ).
|
||||
arg( track::SAMPLE_TRACK ) );
|
||||
}
|
||||
@@ -402,6 +423,16 @@ void trackContainer::dropEvent( QDropEvent * _de )
|
||||
ct->toggledChannelButton( TRUE );
|
||||
_de->accept();
|
||||
}
|
||||
else if( type == "sampledata" || type == "samplefile" )
|
||||
{
|
||||
channelTrack * ct = dynamic_cast<channelTrack *>(
|
||||
track::create( track::CHANNEL_TRACK,
|
||||
this ) );
|
||||
instrument * i = ct->loadInstrument( "audiofileprocessor" );
|
||||
i->setParameter( type, value );
|
||||
ct->toggledChannelButton( TRUE );
|
||||
_de->accept();
|
||||
}
|
||||
else if( type == "presetfile" )
|
||||
{
|
||||
multimediaProject mmp( value );
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* sample_buffer.cpp - container-class sampleBuffer
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@@ -159,6 +159,35 @@ sampleBuffer::sampleBuffer( const sampleFrame * _data, Uint32 _frames ) :
|
||||
|
||||
|
||||
|
||||
sampleBuffer::sampleBuffer( Uint32 _frames ) :
|
||||
QObject(),
|
||||
m_audioFile( "" ),
|
||||
m_origData( NULL ),
|
||||
m_origFrames( 0 ),
|
||||
m_data( NULL ),
|
||||
m_frames( 0 ),
|
||||
m_startFrame( 0 ),
|
||||
m_endFrame( 0 ),
|
||||
m_amplification( 1.0f ),
|
||||
m_reversed( FALSE ),
|
||||
m_dataMutex()
|
||||
{
|
||||
m_origData = new sampleFrame[_frames];
|
||||
memset( m_origData, 0, _frames * BYTES_PER_FRAME );
|
||||
m_origFrames = _frames;
|
||||
#ifdef SDL_SDL_SOUND_H
|
||||
// init sound-file-system of SDL
|
||||
Sound_Init();
|
||||
#endif
|
||||
#ifdef HAVE_SAMPLERATE_H
|
||||
initResampling();
|
||||
#endif
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
sampleBuffer::~sampleBuffer()
|
||||
{
|
||||
m_dataMutex.lock();
|
||||
@@ -166,11 +195,12 @@ sampleBuffer::~sampleBuffer()
|
||||
m_origData = NULL;
|
||||
delete[] m_data;
|
||||
m_data = NULL;
|
||||
m_dataMutex.unlock();
|
||||
|
||||
#ifdef HAVE_SAMPLERATE_H
|
||||
quitResampling();
|
||||
#endif
|
||||
|
||||
m_dataMutex.unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -223,45 +253,36 @@ void sampleBuffer::update( bool _keep_settings )
|
||||
file.ascii();
|
||||
#endif
|
||||
Sint16 * buf = NULL;
|
||||
Uint8 channels;
|
||||
Uint8 channels = DEFAULT_CHANNELS;
|
||||
Uint32 samplerate = SAMPLE_RATES[DEFAULT_QUALITY_LEVEL];
|
||||
|
||||
#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 );
|
||||
m_frames = decodeSampleSF( f, buf, channels,
|
||||
samplerate );
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_VORBIS_VORBISFILE_H
|
||||
if( m_frames == 0 )
|
||||
{
|
||||
m_frames = decodeSampleOGG( f, buf, channels );
|
||||
m_frames = decodeSampleOGGVorbis( f, buf, channels,
|
||||
samplerate );
|
||||
}
|
||||
#endif
|
||||
#ifdef SDL_SDL_SOUND_H
|
||||
if( m_frames == 0 )
|
||||
{
|
||||
m_frames = decodeSampleSDL( f, buf, channels,
|
||||
samplerate );
|
||||
}
|
||||
#endif
|
||||
if( m_frames > 0 && buf != NULL )
|
||||
{
|
||||
if( _keep_settings == FALSE )
|
||||
{
|
||||
// update frame-variables
|
||||
m_startFrame = 0;
|
||||
if( m_frames > 0 )
|
||||
{
|
||||
m_endFrame = m_frames - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_endFrame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// following code transforms int-samples into
|
||||
// float-samples and does amplifying & reversing
|
||||
float fac = m_amplification / 32767.0f;
|
||||
const float fac = m_amplification /
|
||||
OUTPUT_SAMPLE_MULTIPLIER;
|
||||
m_data = new sampleFrame[m_frames];
|
||||
|
||||
// if reversing is on, we also reverse when
|
||||
@@ -297,9 +318,39 @@ m_data[frame][chnl] = buf[idx] * fac;
|
||||
|
||||
delete[] buf;
|
||||
|
||||
// do samplerate-conversion if sample-decoder didn't
|
||||
// convert sample-rate to our default-samplerate
|
||||
if( samplerate != SAMPLE_RATES[DEFAULT_QUALITY_LEVEL] )
|
||||
{
|
||||
sampleBuffer * resampled = resample( this,
|
||||
samplerate,
|
||||
SAMPLE_RATES[DEFAULT_QUALITY_LEVEL] );
|
||||
delete[] m_data;
|
||||
m_frames = resampled->frames();
|
||||
m_data = new sampleFrame[m_frames];
|
||||
memcpy( m_data, resampled->data(), m_frames *
|
||||
sizeof( sampleFrame ) );
|
||||
delete resampled;
|
||||
}
|
||||
|
||||
if( _keep_settings == FALSE )
|
||||
{
|
||||
// update frame-variables
|
||||
m_startFrame = 0;
|
||||
if( m_frames > 0 )
|
||||
{
|
||||
m_endFrame = m_frames - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_endFrame = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// sample couldn't be decoded, create buffer containing
|
||||
// one sample-frame
|
||||
m_data = new sampleFrame[1];
|
||||
memset( m_data, 0, sizeof( *m_data ) );
|
||||
m_frames = 1;
|
||||
@@ -309,6 +360,8 @@ m_data[frame][chnl] = buf[idx] * fac;
|
||||
}
|
||||
else
|
||||
{
|
||||
// neither an audio-file nor a buffer to copy from, so create
|
||||
// buffer containing one sample-frame
|
||||
m_data = new sampleFrame[1];
|
||||
memset( m_data, 0, sizeof( *m_data ) * 1 );
|
||||
m_frames = 1;
|
||||
@@ -326,13 +379,14 @@ m_data[frame][chnl] = buf[idx] * fac;
|
||||
|
||||
#ifdef SDL_SDL_SOUND_H
|
||||
Uint32 sampleBuffer::decodeSampleSDL( const char * _f, Sint16 * & _buf,
|
||||
Uint8 & _channels )
|
||||
Uint8 & _channels,
|
||||
Uint32 & _samplerate )
|
||||
{
|
||||
Sound_AudioInfo STD_AUDIO_INFO =
|
||||
{
|
||||
AUDIO_S16SYS,
|
||||
DEFAULT_CHANNELS,
|
||||
SAMPLE_RATES[DEFAULT_QUALITY_LEVEL]
|
||||
_channels,
|
||||
_samplerate,
|
||||
} ;
|
||||
Uint32 frames = 0;
|
||||
|
||||
@@ -343,7 +397,8 @@ Uint32 sampleBuffer::decodeSampleSDL( const char * _f, Sint16 * & _buf,
|
||||
{
|
||||
// let SDL_sound decode our file to requested format
|
||||
( void )Sound_DecodeAll( snd_sample );
|
||||
_channels = STD_AUDIO_INFO.channels;
|
||||
_channels = snd_sample->actual.channels;
|
||||
_samplerate = snd_sample->actual.rate;
|
||||
frames = snd_sample->buffer_size / ( BYTES_PER_OUTPUT_SAMPLE *
|
||||
_channels );
|
||||
_buf = new Sint16[frames * _channels];
|
||||
@@ -360,7 +415,8 @@ Uint32 sampleBuffer::decodeSampleSDL( const char * _f, Sint16 * & _buf,
|
||||
|
||||
#ifdef HAVE_SNDFILE_H
|
||||
Uint32 sampleBuffer::decodeSampleSF( const char * _f, Sint16 * & _buf,
|
||||
Uint8 & _channels )
|
||||
Uint8 & _channels,
|
||||
Uint32 & _samplerate )
|
||||
{
|
||||
SNDFILE * snd_file;
|
||||
SF_INFO sf_info;
|
||||
@@ -377,6 +433,7 @@ Uint32 sampleBuffer::decodeSampleSF( const char * _f, Sint16 * & _buf,
|
||||
_buf = new Sint16[sf_info.channels * frames];
|
||||
frames = sf_read_short( snd_file, _buf, frames );
|
||||
_channels = sf_info.channels;
|
||||
_samplerate = sf_info.samplerate;
|
||||
|
||||
sf_close( snd_file );
|
||||
}
|
||||
@@ -384,7 +441,7 @@ Uint32 sampleBuffer::decodeSampleSF( const char * _f, Sint16 * & _buf,
|
||||
{
|
||||
#ifdef DEBUG_LMMS
|
||||
printf( "sampleBuffer::decodeSampleSF(): could not load "
|
||||
"sample %s: %s\n", _f, sf_strerror( NULL ) );
|
||||
"sample %s: %s\n", _f, sf_strerror( NULL ) );
|
||||
#endif
|
||||
}
|
||||
return( frames );
|
||||
@@ -398,9 +455,6 @@ Uint32 sampleBuffer::decodeSampleSF( const char * _f, Sint16 * & _buf,
|
||||
|
||||
// callback-functions for reading ogg-file
|
||||
|
||||
#ifndef QT4
|
||||
#endif
|
||||
|
||||
size_t qfileReadCallback( void * _ptr, size_t _size, size_t _n, void * _udata )
|
||||
{
|
||||
return( static_cast<QFile *>( _udata )->read( (char*)_ptr,
|
||||
@@ -449,8 +503,9 @@ long qfileTellCallback( void * _udata )
|
||||
|
||||
|
||||
|
||||
Uint32 sampleBuffer::decodeSampleOGG( const char * _f, Sint16 * & _buf,
|
||||
Uint8 & _channels )
|
||||
Uint32 sampleBuffer::decodeSampleOGGVorbis( const char * _f, Sint16 * & _buf,
|
||||
Uint8 & _channels,
|
||||
Uint32 & _samplerate )
|
||||
{
|
||||
static ov_callbacks callbacks =
|
||||
{
|
||||
@@ -482,20 +537,20 @@ Uint32 sampleBuffer::decodeSampleOGG( const char * _f, Sint16 * & _buf,
|
||||
switch( err )
|
||||
{
|
||||
case OV_EREAD:
|
||||
printf( "sampleBuffer::decodeSampleOgg(): "
|
||||
"media read error\n" );
|
||||
printf( "sampleBuffer::decodeSampleOGGVorbis():"
|
||||
" media read error\n" );
|
||||
break;
|
||||
case OV_ENOTVORBIS:
|
||||
printf( "sampleBuffer::decodeSampleOgg(): "
|
||||
"not an Ogg Vorbis file\n" );
|
||||
/* printf( "sampleBuffer::decodeSampleOGGVorbis():"
|
||||
" not an Ogg Vorbis file\n" );*/
|
||||
break;
|
||||
case OV_EVERSION:
|
||||
printf( "sampleBuffer::decodeSampleOgg(): "
|
||||
"vorbis version mismatch\n" );
|
||||
printf( "sampleBuffer::decodeSampleOGGVorbis():"
|
||||
" vorbis version mismatch\n" );
|
||||
break;
|
||||
case OV_EBADHEADER:
|
||||
printf( "sampleBuffer::decodeSampleOgg(): "
|
||||
"invalid Vorbis bitstream header\n" );
|
||||
printf( "sampleBuffer::decodeSampleOGGVorbis():"
|
||||
" invalid Vorbis bitstream header\n" );
|
||||
break;
|
||||
case OV_EFAULT:
|
||||
printf( "sampleBuffer::decodeSampleOgg(): "
|
||||
@@ -509,6 +564,8 @@ Uint32 sampleBuffer::decodeSampleOGG( const char * _f, Sint16 * & _buf,
|
||||
ov_pcm_seek( &vf, 0 );
|
||||
|
||||
_channels = ov_info( &vf, -1 )->channels;
|
||||
_samplerate = ov_info( &vf, -1 )->rate;
|
||||
|
||||
ogg_int64_t total = ov_pcm_total( &vf, -1 );
|
||||
|
||||
_buf = new Sint16[total * _channels];
|
||||
@@ -517,7 +574,7 @@ Uint32 sampleBuffer::decodeSampleOGG( const char * _f, Sint16 * & _buf,
|
||||
|
||||
do
|
||||
{
|
||||
bytes_read = ov_read( &vf, (char *)&_buf[frames * _channels],
|
||||
bytes_read = ov_read( &vf, (char *) &_buf[frames * _channels],
|
||||
( total - frames ) * _channels *
|
||||
sizeof( Sint16 ),
|
||||
isLittleEndian()? 0 : 1,
|
||||
@@ -694,7 +751,7 @@ bool FASTCALL sampleBuffer::play( sampleFrame * _ab, Uint32 _start_frame,
|
||||
total_frames_for_current_pitch;
|
||||
}
|
||||
|
||||
const float src_frame_idx = frame*freq_factor;
|
||||
const float src_frame_idx = frame * freq_factor;
|
||||
Uint32 frame_num = static_cast<Uint32>(
|
||||
src_frame_idx) - src_frame_base;
|
||||
const float frac_pos = src_frame_idx -
|
||||
@@ -912,35 +969,35 @@ QString sampleBuffer::openAudioFile( void ) const
|
||||
// set filters
|
||||
#ifdef QT4
|
||||
QStringList types;
|
||||
types << tr( "All Audio-Files (*.wav *.ogg *.voc *.aif *.aiff *.au "
|
||||
"*.raw)" )
|
||||
types << tr( "All Audio-Files (*.wav *.ogg *.flac *.voc *.aif *.aiff "
|
||||
"*.au *.raw)" )
|
||||
<< tr( "Wave-Files (*.wav)" )
|
||||
<< tr( "OGG-Files (*.ogg)" )
|
||||
<< tr( "FLAC-Files (*.flac)" )
|
||||
//<< tr( "MP3-Files (*.mp3)" )
|
||||
//<< tr( "MIDI-Files (*.mid)" )
|
||||
<< tr( "VOC-Files (*.voc)" )
|
||||
<< tr( "AIFF-Files (*.aif *.aiff)" )
|
||||
<< tr( "AU-Files (*.au)" )
|
||||
<< tr( "RAW-Files (*.raw)" )
|
||||
//<< tr( "FLAC-Files (*.flac)" )
|
||||
//<< tr( "MOD-Files (*.mod)" )
|
||||
;
|
||||
ofd.setFilters( types );
|
||||
#else
|
||||
ofd.addFilter( tr( "All Audio-Files (*.wav *.ogg *.voc *.aif *.aiff "
|
||||
"*.au *.raw)" ) );
|
||||
ofd.addFilter( tr( "All Audio-Files (*.wav *.ogg *.flac *.voc *.aif "
|
||||
"*.aiff *.au *.raw)" ) );
|
||||
ofd.addFilter( tr( "Wave-Files (*.wav)" ) );
|
||||
ofd.addFilter( tr( "OGG-Files (*.ogg)" ) );
|
||||
ofd.addFilter( tr( "FLAC-Files (*.flac)" ) );
|
||||
//ofd.addFilter (tr("MP3-Files (*.mp3)"));
|
||||
//ofd.addFilter (tr("MIDI-Files (*.mid)"));
|
||||
//ofd.addFilter (tr("MIDI-Files (*.mid)"));^
|
||||
ofd.addFilter( tr( "VOC-Files (*.voc)" ) );
|
||||
ofd.addFilter( tr( "AIFF-Files (*.aif *.aiff)" ) );
|
||||
ofd.addFilter( tr( "AU-Files (*.au)" ) );
|
||||
ofd.addFilter( tr( "RAW-Files (*.raw)" ) );
|
||||
//ofd.addFilter (tr("FLAC-Files (*.flac)"));
|
||||
//ofd.addFilter (tr("MOD-Files (*.mod)"));
|
||||
ofd.setSelectedFilter( tr( "All Audio-Files (*.wav *.ogg *.voc *.aif "
|
||||
"*.aiff *.au *.raw)" ) );
|
||||
ofd.setSelectedFilter( tr( "All Audio-Files (*.wav *.ogg *.flac *.voc "
|
||||
"*.aif *.aiff *.au *.raw)" ) );
|
||||
#endif
|
||||
if( m_audioFile != "" )
|
||||
{
|
||||
@@ -1016,6 +1073,8 @@ QString sampleBuffer::toBase64( void ) const
|
||||
{
|
||||
return( "" );
|
||||
}
|
||||
// the following code is quite confusing as we have to handle four
|
||||
// different configs (no flac/qt3, no flac/qt4, flac/qt3, flac/qt4)
|
||||
#ifdef HAVE_FLAC_STREAM_ENCODER_H
|
||||
const Uint32 FRAMES_PER_BUF = 1152;
|
||||
|
||||
@@ -1155,6 +1214,69 @@ QString sampleBuffer::toBase64( void ) const
|
||||
|
||||
|
||||
|
||||
sampleBuffer * sampleBuffer::resample( sampleFrame * _data,
|
||||
const Uint32 _frames,
|
||||
const Uint32 _src_sr,
|
||||
const Uint32 _dst_sr )
|
||||
{
|
||||
const Uint32 dst_frames = static_cast<Uint32>( _frames /
|
||||
(float) _src_sr * (float) _dst_sr );
|
||||
sampleBuffer * dst_sb = new sampleBuffer( dst_frames );
|
||||
sampleFrame * dst_buf = dst_sb->m_origData;
|
||||
#ifdef HAVE_SAMPLERATE_H
|
||||
// yeah, libsamplerate, let's rock with sinc-interpolation!
|
||||
int error;
|
||||
SRC_STATE * state;
|
||||
if( ( state = src_new( SRC_SINC_MEDIUM_QUALITY,
|
||||
DEFAULT_CHANNELS, &error ) ) != NULL )
|
||||
{
|
||||
SRC_DATA src_data;
|
||||
src_data.end_of_input = 0;
|
||||
src_data.data_in = _data[0];
|
||||
src_data.data_out = dst_buf[0];
|
||||
src_data.input_frames = _frames;
|
||||
src_data.output_frames = dst_frames;
|
||||
src_data.src_ratio = (float) _dst_sr / _src_sr;
|
||||
int error;
|
||||
if( ( error = src_process( state, &src_data ) ) )
|
||||
{
|
||||
printf( "sampleBuffer: error while resampling: %s\n",
|
||||
src_strerror( error ) );
|
||||
}
|
||||
src_delete( state );
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "Error: src_new() failed in sample_buffer.cpp!\n" );
|
||||
}
|
||||
#else
|
||||
// no libsamplerate, so do simple cubic interpolation
|
||||
for( Uint32 frame = 0; frame < dst_frames; ++frame )
|
||||
{
|
||||
const float src_frame_float = frame * (float) _src_sr / _dst_sr;
|
||||
const float frac_pos = src_frame_float -
|
||||
static_cast<Uint32>( src_frame_float );
|
||||
const Uint32 src_frame = tLimit<Uint32>(
|
||||
static_cast<Uint32>( src_frame_float ),
|
||||
1, _frames - 2 );
|
||||
for( Uint8 ch = 0; ch < DEFAULT_CHANNELS; ++ch )
|
||||
{
|
||||
dst_buf[frame][ch] = cubicInterpolate(
|
||||
_data[src_frame - 1][ch],
|
||||
_data[src_frame + 0][ch],
|
||||
_data[src_frame + 1][ch],
|
||||
_data[src_frame + 2][ch],
|
||||
frac_pos );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
dst_sb->update();
|
||||
return( dst_sb );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void sampleBuffer::setAudioFile( const QString & _audio_file )
|
||||
{
|
||||
m_audioFile = _audio_file;
|
||||
@@ -1375,6 +1497,7 @@ void sampleBuffer::loadFromBase64( const QString & _data )
|
||||
delete[] m_origData;
|
||||
m_origData = new sampleFrame[m_origFrames];
|
||||
memcpy( m_origData, orig_data.data(), orig_data.size() );
|
||||
m_audioFile = "";
|
||||
update();
|
||||
#ifndef QT4
|
||||
// delete[] dst;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/*
|
||||
* string_pair_drag.cpp - class stringPairDrag which provides general support
|
||||
* for drag'n'drop of string-pairs
|
||||
* for drag'n'drop of string-pairs and which is the base
|
||||
* for all drag'n'drop-actions within LMMS
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@@ -25,6 +26,7 @@
|
||||
|
||||
|
||||
#include "string_pair_drag.h"
|
||||
#include "lmms_main_win.h"
|
||||
|
||||
#ifdef QT4
|
||||
|
||||
@@ -61,6 +63,9 @@ stringPairDrag::stringPairDrag( const QString & _key, const QString & _value,
|
||||
|
||||
stringPairDrag::~stringPairDrag()
|
||||
{
|
||||
// during a drag, we might have lost key-press-events, so reset
|
||||
// modifiers of main-win
|
||||
lmmsMainWin::inst()->clearKeyModifiers();
|
||||
// TODO: do we have to delete anything???
|
||||
}
|
||||
|
||||
@@ -81,6 +86,7 @@ bool stringPairDrag::processDragEnterEvent( QDragEnterEvent * _dee,
|
||||
_dee->acceptProposedAction();
|
||||
return( TRUE );
|
||||
}
|
||||
_dee->ignore();
|
||||
return( FALSE );
|
||||
#else
|
||||
QString txt = _dee->encodedData( "lmms/stringpair" );
|
||||
|
||||
@@ -62,7 +62,6 @@ bbTCO::bbTCO( track * _track, const QColor & _c ) :
|
||||
QString( "" ) ),
|
||||
m_color( _c.isValid() ? _c : QColor( 64, 128, 255 ) )
|
||||
{
|
||||
//setPaletteBackgroundColor( QColor( 64, 128, 255 ) );
|
||||
#ifndef QT4
|
||||
setBackgroundMode( Qt::NoBackground );
|
||||
#endif
|
||||
@@ -84,24 +83,6 @@ bbTCO::~bbTCO()
|
||||
|
||||
|
||||
|
||||
void bbTCO::movePosition( const midiTime & _pos )
|
||||
{
|
||||
// bb-playlist-entries are always aligned at tact-boundaries
|
||||
trackContentObject::movePosition( midiTime( _pos.getTact(), 0 ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void bbTCO::changeLength( const midiTime & _length )
|
||||
{
|
||||
// the length of a bb-playlist-entry is always a multiple of one tact
|
||||
trackContentObject::changeLength( midiTime( _length.getTact(), 0 ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void bbTCO::constructContextMenu( QMenu * _cm )
|
||||
{
|
||||
#ifdef QT4
|
||||
@@ -169,7 +150,6 @@ void bbTCO::paintEvent( QPaintEvent * )
|
||||
p.setPen( col.light( 130 - y * 60 / height() ) );
|
||||
p.drawLine( 1, y, width() - 1, y );
|
||||
}
|
||||
//pm.fill( col );
|
||||
#endif
|
||||
|
||||
tact t = bbEditor::inst()->lengthOfBB( bbTrack::numOfBBTrack(
|
||||
@@ -208,15 +188,14 @@ void bbTCO::saveSettings( QDomDocument & _doc, QDomElement & _parent )
|
||||
bbtco_de.setAttribute( "name", m_name );
|
||||
if( _parent.nodeName() == "clipboard" )
|
||||
{
|
||||
bbtco_de.setAttribute( "pos", QString::number( -1 ) );
|
||||
bbtco_de.setAttribute( "pos", -1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
bbtco_de.setAttribute( "pos",
|
||||
QString::number( startPosition() ) );
|
||||
bbtco_de.setAttribute( "pos", startPosition() );
|
||||
}
|
||||
bbtco_de.setAttribute( "len", QString::number( length() ) );
|
||||
bbtco_de.setAttribute( "color", QString::number( m_color.rgb() ) );
|
||||
bbtco_de.setAttribute( "len", length() );
|
||||
bbtco_de.setAttribute( "color", m_color.rgb() );
|
||||
_parent.appendChild( bbtco_de );
|
||||
}
|
||||
|
||||
|
||||
@@ -397,7 +397,7 @@ void pattern::playFrozenData( sampleFrame * _ab, Uint32 _start_frame,
|
||||
void pattern::saveSettings( QDomDocument & _doc, QDomElement & _parent )
|
||||
{
|
||||
QDomElement pattern_de = _doc.createElement( nodeName() );
|
||||
pattern_de.setAttribute( "type", QString::number( m_patternType ) );
|
||||
pattern_de.setAttribute( "type", m_patternType );
|
||||
pattern_de.setAttribute( "name", m_name );
|
||||
// as the target of copied/dragged pattern is always an existing
|
||||
// pattern, we must not store actual position, instead we store -1
|
||||
@@ -405,16 +405,15 @@ void pattern::saveSettings( QDomDocument & _doc, QDomElement & _parent )
|
||||
if( _parent.nodeName() == "clipboard" ||
|
||||
_parent.nodeName() == "dnddata" )
|
||||
{
|
||||
pattern_de.setAttribute( "pos", QString::number( -1 ) );
|
||||
pattern_de.setAttribute( "pos", -1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
pattern_de.setAttribute( "pos", QString::number(
|
||||
startPosition() ) );
|
||||
pattern_de.setAttribute( "pos", startPosition() );
|
||||
}
|
||||
pattern_de.setAttribute( "len", QString::number( length() ) );
|
||||
pattern_de.setAttribute( "frozen", QString::number(
|
||||
m_frozenPattern != NULL ) );
|
||||
pattern_de.setAttribute( "len", length() );
|
||||
pattern_de.setAttribute( "steps", m_steps );
|
||||
pattern_de.setAttribute( "frozen", m_frozenPattern != NULL );
|
||||
_parent.appendChild( pattern_de );
|
||||
|
||||
// now save settings of all notes
|
||||
@@ -850,6 +849,11 @@ void pattern::wheelEvent( QWheelEvent * _we )
|
||||
}
|
||||
songEditor::inst()->setModified();
|
||||
update();
|
||||
_we->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
trackContentObject::wheelEvent( _we );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -241,14 +241,13 @@ void FASTCALL sampleTCO::saveSettings( QDomDocument & _doc,
|
||||
QDomElement sampletco_de = _doc.createElement( nodeName() );
|
||||
if( _parent.nodeName() == "clipboard" )
|
||||
{
|
||||
sampletco_de.setAttribute( "pos", QString::number( -1 ) );
|
||||
sampletco_de.setAttribute( "pos", -1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
sampletco_de.setAttribute( "pos", QString::number(
|
||||
startPosition() ) );
|
||||
sampletco_de.setAttribute( "pos", startPosition() );
|
||||
}
|
||||
sampletco_de.setAttribute( "len", QString::number( length() ) );
|
||||
sampletco_de.setAttribute( "len", length() );
|
||||
sampletco_de.setAttribute( "src", sampleFile() );
|
||||
if( sampleFile() == "" )
|
||||
{
|
||||
|
||||
141
src/widgets/fade_button.cpp
Normal file
141
src/widgets/fade_button.cpp
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* fade_button.cpp - implementation of fade-button
|
||||
*
|
||||
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "fade_button.h"
|
||||
|
||||
#ifdef QT4
|
||||
|
||||
#include <QTimer>
|
||||
#include <QPainter>
|
||||
#include <QPixmap>
|
||||
|
||||
#else
|
||||
|
||||
#include <qtimer.h>
|
||||
#include <qpainter.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
fadeButton::fadeButton( const QColor & _normal_color,
|
||||
const QColor & _activated_color, QWidget * _parent ) :
|
||||
QButton( _parent ),
|
||||
m_state( 0.0f ),
|
||||
m_normalColor( _normal_color ),
|
||||
m_activatedColor( _activated_color )
|
||||
{
|
||||
#ifndef QT4
|
||||
setBackgroundMode( NoBackground );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
fadeButton::~fadeButton()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void fadeButton::activate( void )
|
||||
{
|
||||
if( m_state > 0.0f )
|
||||
{
|
||||
m_state = 1.00f;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_state = 1.1f;
|
||||
nextState();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void fadeButton::reset( void )
|
||||
{
|
||||
m_state = 0.0f;
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void fadeButton::paintEvent( QPaintEvent * _pe )
|
||||
{
|
||||
QColor col = m_normalColor;
|
||||
if( m_state > 0.0f )
|
||||
{
|
||||
const int r = (int)( m_normalColor.red() *
|
||||
( 1.0f - m_state ) +
|
||||
m_activatedColor.red() * m_state );
|
||||
const int g = (int)( m_normalColor.green() *
|
||||
( 1.0f - m_state ) +
|
||||
m_activatedColor.green() * m_state );
|
||||
const int b = (int)( m_normalColor.blue() *
|
||||
( 1.0f - m_state ) +
|
||||
m_activatedColor.blue() * m_state );
|
||||
col.setRgb( r, g, b );
|
||||
}
|
||||
#ifdef QT4
|
||||
QPainter p( this );
|
||||
#else
|
||||
QPixmap draw_pm( rect().size() );
|
||||
draw_pm.fill( col );
|
||||
|
||||
QPainter p( &draw_pm, this );
|
||||
#endif
|
||||
p.setPen( QColor( 0, 0, 0 ) );
|
||||
p.drawRect( 0, 0, width(), height() );
|
||||
#ifndef QT4
|
||||
// and blit all the drawn stuff on the screen...
|
||||
bitBlt( this, rect().topLeft(), &draw_pm );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void fadeButton::nextState( void )
|
||||
{
|
||||
if( m_state > 0.0f )
|
||||
{
|
||||
m_state -= 0.1f;
|
||||
QTimer::singleShot( 20, this, SLOT( nextState( void ) ) );
|
||||
// we might be called out of another thread than the GUI-/
|
||||
// event-loop-thread, so let the timer update ourself
|
||||
QTimer::singleShot( 0, this, SLOT( update( void ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "fade_button.moc"
|
||||
|
||||
@@ -158,6 +158,10 @@ textFloat * textFloat::displayMessage( const QString & _msg, int _timeout,
|
||||
}
|
||||
#else
|
||||
QWidget * mw = qApp->mainWidget();
|
||||
if( mw == NULL )
|
||||
{
|
||||
mw = qApp->desktop();
|
||||
}
|
||||
#endif
|
||||
textFloat * tf = new textFloat( ( _parent == NULL ) ? mw : _parent );
|
||||
if( _parent != NULL )
|
||||
|
||||
@@ -48,6 +48,8 @@ toolButton::toolButton( const QPixmap & _pixmap, const QString & _tooltip,
|
||||
setFixedSize( 30, 30 );
|
||||
setIcon( _pixmap );
|
||||
leaveEvent( NULL );
|
||||
connect( this, SIGNAL( toggled( bool ) ), this,
|
||||
SLOT( toggledBool( bool ) ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -85,3 +87,18 @@ void toolButton::leaveEvent( QEvent * )
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void toolButton::toggledBool( bool _on )
|
||||
{
|
||||
if( _on == TRUE )
|
||||
{
|
||||
emit( clicked() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "tool_button.moc"
|
||||
|
||||
|
||||
@@ -56,30 +56,23 @@ visualizationWidget::visualizationWidget( const QPixmap & _bg, QWidget * _p,
|
||||
visualizationTypes _vtype ) :
|
||||
QWidget( _p ),
|
||||
s_background( _bg ),
|
||||
m_enabled( FALSE )
|
||||
m_enabled( TRUE )
|
||||
{
|
||||
#ifndef QT4
|
||||
setBackgroundMode( Qt::NoBackground );
|
||||
#endif
|
||||
setFixedSize( s_background.width(), s_background.height() );
|
||||
|
||||
|
||||
const Uint32 frames = mixer::inst()->framesPerAudioBuffer();
|
||||
m_buffer = bufferAllocator::alloc<surroundSampleFrame>( frames );
|
||||
|
||||
mixer::inst()->clearAudioBuffer( m_buffer, frames );
|
||||
/* for( Uint32 frame = 0; frame < frames; ++frame )
|
||||
{
|
||||
for( Uint8 chnl = 0; chnl < SURROUND_CHANNELS; ++chnl )
|
||||
{
|
||||
m_buffer[frame][chnl] = 0.0f;
|
||||
}
|
||||
}*/
|
||||
|
||||
setFixedSize( s_background.width(), s_background.height() );
|
||||
|
||||
|
||||
m_updateTimer = new QTimer( this );
|
||||
connect( m_updateTimer, SIGNAL( timeout() ), this, SLOT( update() ) );
|
||||
if( m_enabled )
|
||||
if( m_enabled == TRUE )
|
||||
{
|
||||
m_updateTimer->start( UPDATE_TIME );
|
||||
}
|
||||
@@ -106,7 +99,7 @@ visualizationWidget::~visualizationWidget()
|
||||
void visualizationWidget::setAudioBuffer( const surroundSampleFrame * _ab,
|
||||
Uint32 _frames )
|
||||
{
|
||||
if( m_enabled )
|
||||
if( m_enabled == TRUE )
|
||||
{
|
||||
memcpy( m_buffer, *_ab, _frames * BYTES_PER_SURROUND_FRAME);
|
||||
}
|
||||
@@ -121,13 +114,12 @@ void visualizationWidget::paintEvent( QPaintEvent * )
|
||||
QPainter p( this );
|
||||
#else
|
||||
QPixmap draw_pm( rect().size() );
|
||||
//draw_pm.fill( this, rect().topLeft() );
|
||||
|
||||
QPainter p( &draw_pm, this );
|
||||
#endif
|
||||
p.drawPixmap( 0, 0, s_background );
|
||||
|
||||
if( m_enabled )
|
||||
if( m_enabled == TRUE )
|
||||
{
|
||||
float master_output = mixer::inst()->masterGain();
|
||||
Uint16 w = width()-4;
|
||||
@@ -203,7 +195,7 @@ void visualizationWidget::mousePressEvent( QMouseEvent * _me )
|
||||
if( _me->button() == Qt::LeftButton )
|
||||
{
|
||||
m_enabled = !m_enabled;
|
||||
if( m_enabled )
|
||||
if( m_enabled == TRUE )
|
||||
{
|
||||
m_updateTimer->start( UPDATE_TIME );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user