Note panning editing support in the piano roll

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1918 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Andrew Kelley
2008-12-14 02:39:12 +00:00
parent c23dcee37f
commit e0e7cb9af8
8 changed files with 210 additions and 92 deletions

View File

@@ -26,8 +26,8 @@
#ifndef _MIDI_H
#define _MIDI_H
#include "lmms_basics.h"
#include "panning_constants.h"
#include <cstdlib>
@@ -87,6 +87,9 @@ const int MidiControllerCount = 128;
const int MidiProgramCount = 128;
const int MidiMaxVelocity = 127;
const int MidiMaxPanning = 127;
const int MidiMinPanning = -128;
struct midiEvent
{
@@ -145,11 +148,24 @@ struct midiEvent
{
return m_data.m_param[1];
}
inline Sint16 midiPanning( void ) const
{
return m_data.m_param[1];
}
inline volume getVolume( void ) const
{
return (volume)( velocity() * 100 / MidiMaxVelocity );
}
inline panning getPanning( void ) const
{
return (panning) ( PanningLeft +
( (float)( midiPanning() - MidiMinPanning ) ) /
( (float)( MidiMaxPanning - MidiMinPanning ) ) *
( (float)( PanningRight - PanningLeft ) ) );
}
MidiEventTypes m_type; // MIDI event type

View File

@@ -1,5 +1,5 @@
/*
* panning.h - declaration of some constants and types, concerning the
* panning.h - declaration of some types, concerning the
* panning of a note
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
@@ -29,11 +29,7 @@
#include "lmms_basics.h"
#include "volume.h"
#include "templates.h"
const panning PanningRight = ( 0 + 100 );
const panning PanningLeft = - PanningRight;
const panning PanningCenter = 0;
const panning DefaultPanning = PanningCenter;
#include "panning_constants.h"
inline stereoVolumeVector panningToVolumeVector( panning _p,
float _scale = 1.0f )

View File

@@ -0,0 +1,34 @@
/*
* panning_constants.h - declaration of some constants, concerning the
* panning of a note
*
* Copyright (c) 2004-2008 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., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _PANNING_CONSTANTS_H
#define _PANNING_CONSTANTS_H
const panning PanningRight = ( 0 + 100 );
const panning PanningLeft = - PanningRight;
const panning PanningCenter = 0;
const panning DefaultPanning = PanningCenter;
#endif

View File

@@ -139,7 +139,7 @@ private:
ModeSelect,
ModeMove,
ModeOpen
} ;
};
enum actions
{
@@ -147,18 +147,23 @@ private:
ActionMoveNote,
ActionResizeNote,
ActionSelectNotes,
ActionMoveSelection,
ActionChangeNoteVolume,
ActionChangeNotePanning,
ActionResizeNoteEditArea,
} ;
ActionChangeNoteProperty,
ActionResizeNoteEditArea
};
enum noteEditMode
{
NoteEditVolume,
NoteEditPanning,
NoteEditCount
};
enum pianoRollKeyTypes
{
PR_WHITE_KEY_SMALL,
PR_WHITE_KEY_BIG,
PR_BLACK_KEY
} ;
};
pianoRoll( void );
@@ -230,6 +235,7 @@ private:
note * m_currentNote;
actions m_action;
noteEditMode m_noteEditMode;
Uint32 m_selectStartTick;
int m_selectedTick;