completely new MIDI-subsystem and other bugfixes, see ChangeLog for details
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@20 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -64,9 +64,8 @@ class arpAndChordsTabWidget : public QWidget, public settings
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
arpAndChordsTabWidget( channelTrack * _channel_track,
|
||||
QWidget * _parent );
|
||||
~arpAndChordsTabWidget();
|
||||
arpAndChordsTabWidget( channelTrack * _channel_track );
|
||||
virtual ~arpAndChordsTabWidget();
|
||||
|
||||
static struct chord
|
||||
{
|
||||
@@ -114,8 +113,6 @@ private:
|
||||
RANDOM
|
||||
} m_arpDirection;
|
||||
|
||||
channelTrack * m_channelTrack;
|
||||
|
||||
// chord-stuff
|
||||
groupBox * m_chordsGroupBox;
|
||||
QComboBox * m_chordsComboBox;
|
||||
|
||||
@@ -59,8 +59,8 @@ class envelopeTabWidget : public QWidget, public settings
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
envelopeTabWidget( channelTrack * _channel_track, QWidget * parent );
|
||||
~envelopeTabWidget();
|
||||
envelopeTabWidget( channelTrack * _channel_track );
|
||||
virtual ~envelopeTabWidget();
|
||||
|
||||
void FASTCALL processAudioBuffer( sampleFrame * _ab, Uint32 _frames,
|
||||
notePlayHandle * _n );
|
||||
@@ -91,8 +91,6 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
channelTrack * m_channelTrack;
|
||||
|
||||
tabWidget * m_targetsTabWidget;
|
||||
envelopeAndLFOWidget * m_envLFOWidgets[TARGET_COUNT];
|
||||
|
||||
|
||||
205
include/file_browser.h
Normal file
205
include/file_browser.h
Normal file
@@ -0,0 +1,205 @@
|
||||
/*
|
||||
* file_browser.h - include file for fileBrowser
|
||||
*
|
||||
* Linux MultiMedia Studio
|
||||
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _FILE_BROWSER_H
|
||||
#define _FILE_BROWSER_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "qt3support.h"
|
||||
|
||||
#ifdef QT4
|
||||
|
||||
#include <QDir>
|
||||
|
||||
#else
|
||||
|
||||
#include <qlistview.h>
|
||||
#include <qdir.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#include "side_bar_widget.h"
|
||||
|
||||
|
||||
|
||||
class fileItem;
|
||||
class trackContainer;
|
||||
class QPixmap;
|
||||
class playHandle;
|
||||
|
||||
|
||||
class fileBrowser : public sideBarWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
fileBrowser( const QString & _path, const QString & _filter,
|
||||
const QString & _title, const QPixmap & _pm,
|
||||
QWidget * _parent );
|
||||
virtual ~fileBrowser();
|
||||
|
||||
|
||||
public slots:
|
||||
void reloadTree( void );
|
||||
|
||||
|
||||
protected:
|
||||
void keyPressEvent( QKeyEvent * _ke );
|
||||
|
||||
|
||||
protected slots:
|
||||
#ifdef QT4
|
||||
void itemPressed( int btn, Q3ListViewItem * _i, const QPoint & _pos,
|
||||
int _col );
|
||||
void itemReleased( int btn, Q3ListViewItem * _i, const QPoint & _pos,
|
||||
int _col );
|
||||
void itemDoubleClicked( Q3ListViewItem * _i, const QPoint & _pos,
|
||||
int _col );
|
||||
void contextMenuRequest( Q3ListViewItem * _i, const QPoint & _pos,
|
||||
int _col );
|
||||
#else
|
||||
void itemPressed( int btn, QListViewItem * _i, const QPoint & _pos,
|
||||
int _col );
|
||||
void itemReleased( int btn, QListViewItem * _i, const QPoint & _pos,
|
||||
int _col );
|
||||
void itemDoubleClicked( QListViewItem * _i, const QPoint & _pos,
|
||||
int _col );
|
||||
void contextMenuRequest( QListViewItem * _i, const QPoint & _pos,
|
||||
int _col );
|
||||
#endif
|
||||
void selectionChanged( void );
|
||||
void sendToActiveChannel( void );
|
||||
void openInNewChannelSE( void );
|
||||
void openInNewChannelBBE( void );
|
||||
void renameItem( void );
|
||||
|
||||
|
||||
private:
|
||||
void openInNewChannel( trackContainer * _tc );
|
||||
|
||||
Q3ListView * m_l;
|
||||
fileItem * m_contextMenuItem;
|
||||
|
||||
QString m_path;
|
||||
QString m_filter;
|
||||
|
||||
playHandle * m_previewPlayHandle;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
class directory : public Q3ListViewItem
|
||||
{
|
||||
public:
|
||||
directory( Q3ListView * _parent, const QString & _filename,
|
||||
const QString & _path, const QString & _filter );
|
||||
directory( directory * _parent, const QString & _filename,
|
||||
const QString & _path, const QString & _filter );
|
||||
|
||||
void setOpen( bool );
|
||||
void setup( void );
|
||||
|
||||
inline QString fullName( void )
|
||||
{
|
||||
#ifdef QT4
|
||||
return( QDir::cleanPath( m_path + "/" + text( 0 ) + "/" ) );
|
||||
#else
|
||||
return( QDir::cleanDirPath( m_path + "/" + text( 0 ) + "/" ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
inline const QPixmap * pixmap( int ) const
|
||||
{
|
||||
return( m_pix );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
void initPixmapStuff( void );
|
||||
//using Q3ListViewItem::setPixmap;
|
||||
void FASTCALL setPixmap( QPixmap * _px );
|
||||
|
||||
static QPixmap * s_folderPixmap;
|
||||
static QPixmap * s_folderOpenedPixmap;
|
||||
static QPixmap * s_folderLockedPixmap;
|
||||
|
||||
directory * m_p;
|
||||
QPixmap * m_pix;
|
||||
QString m_path;
|
||||
QString m_filter;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
class fileItem : public Q3ListViewItem
|
||||
{
|
||||
public:
|
||||
fileItem( Q3ListView * _parent, const QString & _name,
|
||||
const QString & _path );
|
||||
fileItem( Q3ListViewItem * _parent, const QString & _name,
|
||||
const QString & _path );
|
||||
|
||||
inline QString fullName( void ) const
|
||||
{
|
||||
return( m_path + "/" + text( 0 ) );
|
||||
}
|
||||
inline const QPixmap * pixmap( int ) const
|
||||
{
|
||||
return( m_pix );
|
||||
}
|
||||
|
||||
enum fileTypes
|
||||
{
|
||||
SONG_FILE, PRESET_FILE, SAMPLE_FILE, UNKNOWN
|
||||
} ;
|
||||
|
||||
inline fileTypes type( void )
|
||||
{
|
||||
return( m_type );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
void initPixmapStuff( void );
|
||||
void determineFileType( void );
|
||||
|
||||
static QPixmap * s_songFilePixmap;
|
||||
static QPixmap * s_presetFilePixmap;
|
||||
static QPixmap * s_sampleFilePixmap;
|
||||
static QPixmap * s_unknownFilePixmap;
|
||||
|
||||
QPixmap * m_pix;
|
||||
QString m_path;
|
||||
fileTypes m_type;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
122
include/instrument.h
Normal file
122
include/instrument.h
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* instrument.h - declaration of class instrument, which provides a
|
||||
* standard interface for all instrument plugins
|
||||
*
|
||||
* Linux MultiMedia Studio
|
||||
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _INSTRUMENT_H
|
||||
#define _INSTRUMENT_H
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "qt3support.h"
|
||||
|
||||
#ifdef QT4
|
||||
|
||||
#include <QWidget>
|
||||
#include <QVector>
|
||||
|
||||
#else
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qvaluevector.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#include "plugin.h"
|
||||
#include "mixer.h"
|
||||
|
||||
|
||||
// forward-declarations
|
||||
class channelTrack;
|
||||
class notePlayHandle;
|
||||
|
||||
|
||||
class instrument : public QWidget, public plugin
|
||||
{
|
||||
public:
|
||||
instrument( channelTrack * _channel_track, const QString & _name );
|
||||
virtual ~instrument();
|
||||
|
||||
// if the plugin doesn't play each note, it can create an instrument-
|
||||
// play-handle and re-implement this method, so that it mixes it's
|
||||
// output buffer only once per mixer-period
|
||||
virtual void play( void );
|
||||
|
||||
// must be overloaded by actual plugin
|
||||
virtual void FASTCALL playNote( notePlayHandle * note_to_play );
|
||||
|
||||
// needed for deleting plugin-specific-data of a note - plugin has to
|
||||
// cast void-ptr so that the plugin-data is deleted properly
|
||||
// (call of dtor if it's a class etc.)
|
||||
virtual void FASTCALL deleteNotePluginData( notePlayHandle *
|
||||
_note_to_play );
|
||||
|
||||
// Get number of sample-frames that should be used when playing beat
|
||||
// (note with unspecified length)
|
||||
// Per default this function returns 0. In this case, channel is using
|
||||
// the length of the longest envelope (if one active).
|
||||
virtual Uint32 FASTCALL beatLen( notePlayHandle * _n ) const;
|
||||
|
||||
|
||||
// instrument-play-handles use this for checking whether they can mark
|
||||
// themselves as done, so that mixer trashes them
|
||||
inline virtual bool valid( void ) const
|
||||
{
|
||||
return( m_valid );
|
||||
}
|
||||
|
||||
|
||||
// instantiate instrument-plugin with given name or return NULL
|
||||
// on failure
|
||||
static instrument * FASTCALL instantiate( const QString & _plugin_name,
|
||||
channelTrack * _channel_track );
|
||||
|
||||
protected:
|
||||
inline channelTrack * getChannelTrack( void ) const
|
||||
{
|
||||
return( m_channelTrack );
|
||||
}
|
||||
|
||||
// instruments can use this for invalidating themselves, which is for
|
||||
// example neccessary when being destroyed and having instrument-play-
|
||||
// handles running
|
||||
inline void invalidate( void )
|
||||
{
|
||||
m_valid = FALSE;
|
||||
mixer::inst()->checkValidityOfPlayHandles();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
channelTrack * m_channelTrack;
|
||||
bool m_valid;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
#endif
|
||||
71
include/instrument_play_handle.h
Normal file
71
include/instrument_play_handle.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* instrument_play_handle.h - play-handle for playing an instrument
|
||||
*
|
||||
* Linux MultiMedia Studio
|
||||
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _INSTRUMENT_PLAY_HANDLE_H
|
||||
#define _INSTRUMENT_PLAY_HANDLE_H
|
||||
|
||||
#include "play_handle.h"
|
||||
#include "instrument.h"
|
||||
|
||||
|
||||
class instrumentPlayHandle : public playHandle
|
||||
{
|
||||
public:
|
||||
inline instrumentPlayHandle( instrument * _instrument ) :
|
||||
playHandle(),
|
||||
m_instrument( _instrument )
|
||||
{
|
||||
}
|
||||
|
||||
inline virtual ~instrumentPlayHandle()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
inline virtual void play( void )
|
||||
{
|
||||
m_instrument->play();
|
||||
}
|
||||
|
||||
inline virtual bool done( void ) const
|
||||
{
|
||||
return( m_instrument == NULL );
|
||||
}
|
||||
|
||||
inline virtual void checkValidity( void )
|
||||
{
|
||||
if( !m_instrument->valid() )
|
||||
{
|
||||
m_instrument = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
instrument * m_instrument;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
#endif
|
||||
@@ -61,16 +61,7 @@ public:
|
||||
knob( int _knob_num, QWidget * _parent, const QString & _name );
|
||||
virtual ~knob();
|
||||
|
||||
enum ScrollMode
|
||||
{
|
||||
ScrNone,
|
||||
ScrMouse,
|
||||
ScrTimer,
|
||||
ScrDirect,
|
||||
ScrPage
|
||||
} ;
|
||||
|
||||
void setTracking( bool _enable );
|
||||
void setHintText( const QString & _txt_before,
|
||||
const QString & _txt_after );
|
||||
void setLabel( const QString & _txt );
|
||||
@@ -110,6 +101,7 @@ public slots:
|
||||
void reset( void );
|
||||
void copyValue( void );
|
||||
void pasteValue( void );
|
||||
void enterValue( void );
|
||||
void connectToMidiDevice( void );
|
||||
void displayHelp( void );
|
||||
|
||||
@@ -127,6 +119,7 @@ protected:
|
||||
virtual void mousePressEvent( QMouseEvent * _me );
|
||||
virtual void mouseReleaseEvent( QMouseEvent * _me );
|
||||
virtual void mouseMoveEvent( QMouseEvent * _me );
|
||||
virtual void mouseDoubleClickEvent( QMouseEvent * _me );
|
||||
virtual void wheelEvent( QWheelEvent * _me );
|
||||
virtual void contextMenuEvent( QContextMenuEvent * _me );
|
||||
|
||||
@@ -140,8 +133,6 @@ protected:
|
||||
//private:
|
||||
void layoutKnob( bool _update = TRUE );
|
||||
float getValue( const QPoint & _p );
|
||||
void getScrollMode( const QPoint & _p, int & _scroll_mode,
|
||||
int & _direction );
|
||||
void recalcAngle( void );
|
||||
|
||||
void valueChange( void );
|
||||
@@ -150,25 +141,20 @@ protected:
|
||||
|
||||
void buttonReleased( void );
|
||||
|
||||
void setNewValue( float x, int align = 0 );
|
||||
void setNewValue( float _x, bool _align = FALSE );
|
||||
|
||||
|
||||
static float s_copiedValue;
|
||||
static textFloat * s_textFloat;
|
||||
|
||||
|
||||
int m_knobWidth;
|
||||
int m_scrollMode;
|
||||
float m_mouseOffset;
|
||||
int m_direction;
|
||||
int m_tracking;
|
||||
QPoint m_origMousePos;
|
||||
bool m_buttonPressed;
|
||||
|
||||
|
||||
float m_angle;
|
||||
float m_oldAngle;
|
||||
float m_totalAngle;
|
||||
float m_nTurns;
|
||||
|
||||
QPixmap * m_knobPixmap;
|
||||
int m_knobNum;
|
||||
|
||||
@@ -30,14 +30,18 @@
|
||||
#ifdef QT4
|
||||
|
||||
#include <QLCDNumber>
|
||||
#include <QMap>
|
||||
|
||||
#else
|
||||
|
||||
#include <qlcdnumber.h>
|
||||
#include <qmap.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
class QLabel;
|
||||
|
||||
|
||||
class lcdSpinBox : public QWidget
|
||||
{
|
||||
@@ -56,6 +60,15 @@ public:
|
||||
void setValue( int _value );
|
||||
void setLabel( const QString & _txt );
|
||||
|
||||
inline void addTextForValue( int _val, const QString & _text )
|
||||
{
|
||||
m_textForValue[_val] = _text;
|
||||
}
|
||||
|
||||
|
||||
public slots:
|
||||
virtual void setEnabled( bool _on );
|
||||
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent( QMouseEvent * _me );
|
||||
@@ -65,6 +78,8 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
QMap<int, QString> m_textForValue;
|
||||
|
||||
int m_value;
|
||||
int m_minValue;
|
||||
int m_maxValue;
|
||||
|
||||
@@ -70,6 +70,7 @@ public slots:
|
||||
void toggle( void );
|
||||
void setChecked( bool _on );
|
||||
|
||||
|
||||
protected:
|
||||
virtual void paintEvent( QPaintEvent * _pe );
|
||||
virtual void mousePressEvent( QMouseEvent * _me );
|
||||
|
||||
@@ -61,11 +61,13 @@ enum midiEventTypes
|
||||
} ;
|
||||
|
||||
|
||||
const Sint8 MIDI_CHANNEL_COUNT = 16;
|
||||
|
||||
|
||||
struct midiEvent
|
||||
{
|
||||
midiEvent( midiEventTypes _type = MIDI_ACTIVE_SENSING,
|
||||
Uint8 _channel = 0,
|
||||
Sint8 _channel = 0,
|
||||
Uint16 _param1 = 0,
|
||||
Uint16 _param2 = 0 ) :
|
||||
m_type( _type ),
|
||||
@@ -75,7 +77,8 @@ struct midiEvent
|
||||
m_data.m_param[0] = _param1;
|
||||
m_data.m_param[1] = _param2;
|
||||
}
|
||||
midiEvent( midiEventTypes _type, char * _sysex_data, int _data_len ) :
|
||||
midiEvent( midiEventTypes _type, const char * _sysex_data,
|
||||
int _data_len ) :
|
||||
m_type( _type ),
|
||||
m_channel( 0 ),
|
||||
m_sysExData( _sysex_data )
|
||||
@@ -92,14 +95,14 @@ struct midiEvent
|
||||
}
|
||||
|
||||
midiEventTypes m_type; // MIDI event type
|
||||
Uint8 m_channel; // MIDI channel
|
||||
Sint8 m_channel; // MIDI channel
|
||||
union
|
||||
{
|
||||
Uint16 m_param[2]; // first/second parameter (key/velocity)
|
||||
int m_sysExDataLen; // len of m_sysExData
|
||||
} m_data;
|
||||
|
||||
char * m_sysExData;
|
||||
const char * m_sysExData;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* midi_alsa_raw.h - midi-device-driver for RawMIDI via ALSA
|
||||
* midi_alsa_raw.h - midi-client for RawMIDI via ALSA
|
||||
*
|
||||
* Linux MultiMedia Studio
|
||||
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.sourceforge.net>
|
||||
@@ -50,17 +50,17 @@
|
||||
#endif
|
||||
|
||||
|
||||
#include "midi_device.h"
|
||||
#include "midi_client.h"
|
||||
|
||||
|
||||
struct pollfd;
|
||||
class QLineEdit;
|
||||
|
||||
|
||||
class midiALSARaw : public midiDevice, public QThread
|
||||
class midiALSARaw : public midiRawClient, public QThread
|
||||
{
|
||||
public:
|
||||
midiALSARaw( channelTrack * _ct = NULL );
|
||||
midiALSARaw( void );
|
||||
~midiALSARaw();
|
||||
|
||||
static QString probeDevice( void );
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
class setupWidget : public midiDevice::setupWidget
|
||||
class setupWidget : public midiRawClient::setupWidget
|
||||
{
|
||||
public:
|
||||
setupWidget( QWidget * _parent );
|
||||
@@ -88,8 +88,8 @@ public:
|
||||
|
||||
|
||||
protected:
|
||||
virtual void FASTCALL sendByte( Uint8 _c );
|
||||
virtual void FASTCALL run( void );
|
||||
virtual void FASTCALL sendByte( const Uint8 _c );
|
||||
virtual void run( void );
|
||||
|
||||
|
||||
private:
|
||||
|
||||
153
include/midi_client.h
Normal file
153
include/midi_client.h
Normal file
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* midi_client.h - base-class for MIDI-clients like ALSA-sequencer-client
|
||||
*
|
||||
* Linux MultiMedia Studio
|
||||
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _MIDI_CLIENT_H
|
||||
#define _MIDI_CLIENT_H
|
||||
|
||||
#include "qt3support.h"
|
||||
|
||||
#ifdef QT4
|
||||
|
||||
#include <QVector>
|
||||
|
||||
#else
|
||||
|
||||
#include <qvaluevector.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#include "midi.h"
|
||||
#include "midi_event_processor.h"
|
||||
#include "tab_widget.h"
|
||||
|
||||
|
||||
class midiPort;
|
||||
|
||||
|
||||
// base-class for all MIDI-clients
|
||||
class midiClient
|
||||
{
|
||||
public:
|
||||
midiClient( void );
|
||||
virtual ~midiClient();
|
||||
|
||||
virtual midiPort * FASTCALL createPort( midiEventProcessor * _mep,
|
||||
const QString & _desired_name ) = 0;
|
||||
|
||||
virtual void FASTCALL processOutEvent( const midiEvent & _me,
|
||||
const midiTime & _time,
|
||||
const midiPort * _port ) = 0;
|
||||
|
||||
// validate port-name by trying to change port name in underlying MIDI-
|
||||
// subsystem
|
||||
virtual void FASTCALL validatePortName( midiPort * _port ) = 0;
|
||||
|
||||
void FASTCALL removePort( midiPort * _port );
|
||||
|
||||
static midiClient * openMidiClient( void );
|
||||
|
||||
|
||||
class setupWidget : public tabWidget
|
||||
{
|
||||
public:
|
||||
setupWidget( const QString & _caption, QWidget * _parent ) :
|
||||
tabWidget( tabWidget::tr( "Settings for %1" ).arg(
|
||||
_caption ), _parent )
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~setupWidget()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void saveSettings( void ) = 0;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
protected:
|
||||
inline void addPort( midiPort * _port )
|
||||
{
|
||||
m_midiPorts.push_back( _port );
|
||||
}
|
||||
|
||||
|
||||
vvector<midiPort *> m_midiPorts;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
const Uint8 RAW_MIDI_PARSE_BUF_SIZE = 16;
|
||||
|
||||
|
||||
class midiRawClient : public midiClient
|
||||
{
|
||||
public:
|
||||
midiRawClient( void );
|
||||
~midiRawClient();
|
||||
|
||||
|
||||
protected:
|
||||
virtual midiPort * FASTCALL createPort( midiEventProcessor * _mep,
|
||||
const QString & _desired_name );
|
||||
|
||||
virtual void FASTCALL validatePortName( midiPort * _port );
|
||||
|
||||
void FASTCALL parseData( const Uint8 _c );
|
||||
|
||||
virtual void FASTCALL sendByte( const Uint8 _c ) = 0;
|
||||
|
||||
|
||||
private:
|
||||
void processParsedEvent();
|
||||
void FASTCALL processOutEvent( const midiEvent & _me,
|
||||
const midiTime & _time,
|
||||
const midiPort * _port );
|
||||
|
||||
static Uint8 FASTCALL eventLength( const Uint8 _event );
|
||||
|
||||
|
||||
struct midiParserData
|
||||
{
|
||||
Uint8 m_status; // identifies the type of event, that
|
||||
// is currently received ('Noteon',
|
||||
// 'Pitch Bend' etc).
|
||||
Uint8 m_channel; // The channel of the event that is
|
||||
// received (in case of a channel event)
|
||||
Uint32 m_bytes; // How many bytes have been read for
|
||||
// the current event?
|
||||
Uint32 m_bytesTotal; // How many bytes does the current
|
||||
// event type include?
|
||||
Uint32 m_buffer[RAW_MIDI_PARSE_BUF_SIZE];
|
||||
// buffer for incoming data
|
||||
midiEvent m_midiEvent; // midi-event
|
||||
} m_midiParseData;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -26,15 +26,16 @@
|
||||
#define _MIDI_DUMMY_H
|
||||
|
||||
|
||||
#include "midi_device.h"
|
||||
#include "midi_client.h"
|
||||
#include "midi_port.h"
|
||||
#include "tab_widget.h"
|
||||
|
||||
|
||||
class midiDummy : public midiDevice
|
||||
class midiDummy : public midiRawClient
|
||||
{
|
||||
public:
|
||||
midiDummy() :
|
||||
midiDevice()
|
||||
midiRawClient()
|
||||
{
|
||||
}
|
||||
~midiDummy()
|
||||
@@ -47,11 +48,11 @@ public:
|
||||
}
|
||||
|
||||
|
||||
class setupWidget : public midiDevice::setupWidget
|
||||
class setupWidget : public midiClient::setupWidget
|
||||
{
|
||||
public:
|
||||
setupWidget( QWidget * _parent ) :
|
||||
midiDevice::setupWidget( midiDummy::name(), _parent )
|
||||
midiRawClient::setupWidget( midiDummy::name(), _parent )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -67,7 +68,7 @@ public:
|
||||
|
||||
|
||||
protected:
|
||||
virtual void FASTCALL sendByte( Uint8 )
|
||||
virtual void FASTCALL sendByte( const Uint8 )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
59
include/midi_event_processor.h
Normal file
59
include/midi_event_processor.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* midi_event_processor.h - base-class for midi-processing classes
|
||||
*
|
||||
* Linux MultiMedia Studio
|
||||
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _MIDI_EVENT_PROCESSOR_H
|
||||
#define _MIDI_EVENT_PROCESSOR_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "midi_time.h"
|
||||
|
||||
|
||||
class midiEvent;
|
||||
|
||||
|
||||
// all classes being able to process MIDI-events should inherit from this
|
||||
class midiEventProcessor
|
||||
{
|
||||
public:
|
||||
inline midiEventProcessor( void )
|
||||
{
|
||||
}
|
||||
|
||||
virtual inline ~midiEventProcessor()
|
||||
{
|
||||
}
|
||||
|
||||
// to be implemented by inheriting classes
|
||||
virtual void FASTCALL processInEvent( const midiEvent & _me,
|
||||
const midiTime & _time ) = 0;
|
||||
virtual void FASTCALL processOutEvent( const midiEvent & _me,
|
||||
const midiTime & _time ) = 0;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* midi_oss.h - OSS-driver for MIDI-port
|
||||
* midi_oss.h - OSS-raw-midi-client
|
||||
*
|
||||
* Linux MultiMedia Studio
|
||||
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.sourceforge.net>
|
||||
@@ -33,16 +33,16 @@
|
||||
#include <qthread.h>
|
||||
#include <qfile.h>
|
||||
|
||||
#include "midi_device.h"
|
||||
#include "midi_client.h"
|
||||
|
||||
|
||||
class QLineEdit;
|
||||
|
||||
|
||||
class midiOSS : public midiDevice, public QThread
|
||||
class midiOSS : public midiRawClient, public QThread
|
||||
{
|
||||
public:
|
||||
midiOSS( channelTrack * _ct = NULL );
|
||||
midiOSS( void );
|
||||
~midiOSS();
|
||||
|
||||
static QString probeDevice( void );
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
class setupWidget : public midiDevice::setupWidget
|
||||
class setupWidget : public midiRawClient::setupWidget
|
||||
{
|
||||
public:
|
||||
setupWidget( QWidget * _parent );
|
||||
@@ -69,8 +69,8 @@ public:
|
||||
|
||||
|
||||
protected:
|
||||
virtual void FASTCALL sendByte( Uint8 _c );
|
||||
virtual void FASTCALL run( void );
|
||||
virtual void FASTCALL sendByte( const Uint8 _c );
|
||||
virtual void run( void );
|
||||
|
||||
|
||||
private:
|
||||
|
||||
132
include/midi_port.h
Normal file
132
include/midi_port.h
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* midi_port.h - abstraction of MIDI-ports which are part of LMMS's MIDI-
|
||||
* sequencing system
|
||||
*
|
||||
* Linux MultiMedia Studio
|
||||
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _MIDI_PORT_H
|
||||
#define _MIDI_PORT_H
|
||||
|
||||
#include "qt3support.h"
|
||||
|
||||
#ifdef QT4
|
||||
|
||||
#include <QString>
|
||||
|
||||
#else
|
||||
|
||||
#include <qstring.h>
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "types.h"
|
||||
#include "midi.h"
|
||||
#include "midi_time.h"
|
||||
|
||||
|
||||
class midiClient;
|
||||
class midiEventProcessor;
|
||||
|
||||
|
||||
// class for abstraction of MIDI-port
|
||||
class midiPort
|
||||
{
|
||||
public:
|
||||
enum modes
|
||||
{
|
||||
DUMMY, // don't route any MIDI-events (default)
|
||||
INPUT, // from MIDI-client to MIDI-event-processor
|
||||
OUTPUT, // from MIDI-event-processor to MIDI-client
|
||||
DUPLEX // both directions
|
||||
} ;
|
||||
|
||||
midiPort( midiClient * _mc, midiEventProcessor * _mep,
|
||||
const QString & _name, modes _mode = DUMMY );
|
||||
~midiPort();
|
||||
|
||||
inline const QString & name( void ) const
|
||||
{
|
||||
return( m_name );
|
||||
}
|
||||
|
||||
inline void setName( const QString & _name )
|
||||
{
|
||||
m_name = _name;
|
||||
}
|
||||
|
||||
void FASTCALL trySetName( const QString & _name );
|
||||
|
||||
inline modes mode( void ) const
|
||||
{
|
||||
return( m_mode );
|
||||
}
|
||||
|
||||
inline void setMode( modes _mode )
|
||||
{
|
||||
m_mode = _mode;
|
||||
}
|
||||
|
||||
inline Sint8 inputChannel( void ) const
|
||||
{
|
||||
return( m_inputChannel );
|
||||
}
|
||||
|
||||
inline void setInputChannel( Sint8 _chnl )
|
||||
{
|
||||
m_inputChannel = _chnl;
|
||||
}
|
||||
|
||||
inline Sint8 outputChannel( void ) const
|
||||
{
|
||||
return( m_outputChannel );
|
||||
}
|
||||
|
||||
inline void setOutputChannel( Sint8 _chnl )
|
||||
{
|
||||
m_outputChannel = _chnl;
|
||||
}
|
||||
|
||||
|
||||
void FASTCALL processInEvent( const midiEvent & _me,
|
||||
const midiTime & _time );
|
||||
void FASTCALL processOutEvent( const midiEvent & _me,
|
||||
const midiTime & _time );
|
||||
|
||||
|
||||
private:
|
||||
midiClient * m_midiClient;
|
||||
midiEventProcessor * m_midiEventProcessor;
|
||||
QString m_name;
|
||||
modes m_mode;
|
||||
Sint8 m_inputChannel;
|
||||
Sint8 m_outputChannel;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
96
include/midi_tab_widget.h
Normal file
96
include/midi_tab_widget.h
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* midi_tab_widget.h - tab-widget in channel-track-window for setting up
|
||||
* MIDI-related stuff
|
||||
*
|
||||
* Linux MultiMedia Studio
|
||||
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox@users.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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _MIDI_TAB_WIDGET_H
|
||||
#define _MIDI_TAB_WIDGET_H
|
||||
|
||||
#include "qt3support.h"
|
||||
|
||||
#ifdef QT4
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#else
|
||||
|
||||
#include <qwidget.h>
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
|
||||
class QComboBox;
|
||||
class QPixmap;
|
||||
|
||||
class channelTrack;
|
||||
class tabWidget;
|
||||
class ledCheckBox;
|
||||
class lcdSpinBox;
|
||||
class midiPort;
|
||||
|
||||
|
||||
class midiTabWidget : public QWidget, public settings
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
midiTabWidget( channelTrack * _channel_track, midiPort * _port );
|
||||
~midiTabWidget();
|
||||
|
||||
|
||||
virtual void FASTCALL saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent );
|
||||
virtual void FASTCALL loadSettings( const QDomElement & _this );
|
||||
inline virtual QString nodeName( void ) const
|
||||
{
|
||||
return( "midi" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected slots:
|
||||
void inputChannelChanged( int );
|
||||
void outputChannelChanged( int );
|
||||
void midiPortModeToggled( bool );
|
||||
|
||||
|
||||
private:
|
||||
channelTrack * m_channelTrack;
|
||||
midiPort * m_midiPort;
|
||||
|
||||
tabWidget * m_setupTabWidget;
|
||||
lcdSpinBox * m_inputChannelSpinBox;
|
||||
lcdSpinBox * m_outputChannelSpinBox;
|
||||
ledCheckBox * m_receiveCheckBox;
|
||||
ledCheckBox * m_sendCheckBox;
|
||||
ledCheckBox * m_routeCheckBox;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
#endif
|
||||
@@ -32,13 +32,13 @@
|
||||
class midiTime
|
||||
{
|
||||
public:
|
||||
inline midiTime( tact _tact, tact64th _tact_64th ) :
|
||||
inline midiTime( const tact _tact, const tact64th _tact_64th ) :
|
||||
m_tact( _tact ),
|
||||
m_tact64th( _tact_64th )
|
||||
{
|
||||
}
|
||||
|
||||
inline midiTime( Sint32 _abs = 0 ) :
|
||||
inline midiTime( const Sint32 _abs = 0 ) :
|
||||
m_tact( _abs / 64 ),
|
||||
m_tact64th( _abs % 64 )
|
||||
{
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
}
|
||||
|
||||
// calculate number of frame that are needed this time
|
||||
inline Uint32 frames( float _frames_per_tact ) const
|
||||
inline Uint32 frames( const float _frames_per_tact ) const
|
||||
{
|
||||
if( m_tact >= 0 )
|
||||
{
|
||||
@@ -110,6 +110,13 @@ public:
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
static inline midiTime fromFrames( Uint32 _frames,
|
||||
const float _frames_per_tact )
|
||||
{
|
||||
return( midiTime( static_cast<Sint32>( _frames * 64.0f /
|
||||
_frames_per_tact ) ) );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
tact m_tact;
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
|
||||
class audioDevice;
|
||||
class midiDevice;
|
||||
class midiClient;
|
||||
class lmmsMainWin;
|
||||
class plugin;
|
||||
|
||||
@@ -153,15 +153,15 @@ public:
|
||||
void restoreAudioDevice( void );
|
||||
|
||||
|
||||
// MIDI-device-stuff
|
||||
inline const QString & midiDevName( void ) const
|
||||
// MIDI-client-stuff
|
||||
inline const QString & midiClientName( void ) const
|
||||
{
|
||||
return( m_midiDevName );
|
||||
return( m_midiClientName );
|
||||
}
|
||||
|
||||
inline midiDevice * getMIDIDevice( void )
|
||||
inline midiClient * getMIDIClient( void )
|
||||
{
|
||||
return( m_midiDev );
|
||||
return( m_midiClient );
|
||||
}
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ private:
|
||||
|
||||
|
||||
audioDevice * tryAudioDevices( void );
|
||||
midiDevice * tryMIDIDevices( void );
|
||||
midiClient * tryMIDIClients( void );
|
||||
|
||||
|
||||
|
||||
@@ -326,8 +326,8 @@ private:
|
||||
QString m_audioDevName;
|
||||
|
||||
|
||||
midiDevice * m_midiDev;
|
||||
QString m_midiDevName;
|
||||
midiClient * m_midiClient;
|
||||
QString m_midiClientName;
|
||||
|
||||
|
||||
QMutex m_safetySyncMutex;
|
||||
|
||||
@@ -62,18 +62,17 @@ class pianoWidget : public QWidget
|
||||
Q_OBJECT
|
||||
public:
|
||||
pianoWidget( channelTrack * _channel_track );
|
||||
~pianoWidget();
|
||||
virtual ~pianoWidget();
|
||||
|
||||
|
||||
protected:
|
||||
void paintEvent( QPaintEvent * );
|
||||
void mousePressEvent( QMouseEvent * me );
|
||||
void mouseReleaseEvent( QMouseEvent * me );
|
||||
void mouseMoveEvent( QMouseEvent * me );
|
||||
void keyPressEvent( QKeyEvent * ke );
|
||||
void keyReleaseEvent( QKeyEvent * ke );
|
||||
void focusInEvent( QFocusEvent * _fe );
|
||||
void focusOutEvent( QFocusEvent * _fe );
|
||||
virtual void paintEvent( QPaintEvent * );
|
||||
virtual void mousePressEvent( QMouseEvent * me );
|
||||
virtual void mouseReleaseEvent( QMouseEvent * me );
|
||||
virtual void mouseMoveEvent( QMouseEvent * me );
|
||||
virtual void keyPressEvent( QKeyEvent * ke );
|
||||
virtual void keyReleaseEvent( QKeyEvent * ke );
|
||||
virtual void focusOutEvent( QFocusEvent * _fe );
|
||||
|
||||
|
||||
private:
|
||||
@@ -86,6 +85,8 @@ private:
|
||||
static QPixmap * s_whiteKeyPressedPm;
|
||||
static QPixmap * s_blackKeyPressedPm;
|
||||
|
||||
bool m_pressedKeys[NOTES_PER_OCTAVE * OCTAVES];
|
||||
|
||||
QScrollBar * m_pianoScroll;
|
||||
channelTrack * m_channelTrack;
|
||||
tones m_startTone; // first key when drawing
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#endif
|
||||
|
||||
#include "audio_device.h"
|
||||
#include "midi_device.h"
|
||||
#include "midi_client.h"
|
||||
|
||||
|
||||
class QComboBox;
|
||||
@@ -98,7 +98,7 @@ private:
|
||||
|
||||
|
||||
typedef QMap<QString, audioDevice::setupWidget *> aswMap;
|
||||
typedef QMap<QString, midiDevice::setupWidget *> mswMap;
|
||||
typedef QMap<QString, midiClient::setupWidget *> mswMap;
|
||||
|
||||
QComboBox * m_audioInterfaces;
|
||||
aswMap m_audioIfaceSetupWidgets;
|
||||
|
||||
@@ -63,7 +63,7 @@ class visualizationWidget;
|
||||
|
||||
const int MIN_BPM = 10;
|
||||
const int DEFAULT_BPM = 140;
|
||||
const int MAX_BPM = 1000;
|
||||
const int MAX_BPM = 999;
|
||||
const Uint16 MAX_SONG_LENGTH = 9999;
|
||||
|
||||
|
||||
|
||||
@@ -119,6 +119,9 @@ private:
|
||||
protected:
|
||||
virtual void wheelEvent( QWheelEvent * _we );
|
||||
|
||||
private:
|
||||
trackContainer * m_trackContainer;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user