Canorus  0.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CAKeybdInput Class Reference

Music input per midi non realtime This class adds score input capability through a connected midi keyboard in non realtime. It allows to use simultaniously the computer mouse and the computer keyboard as usual. More...

#include <keybdinput.h>

Public Member Functions

 CAKeybdInput (CAMainWin *m)
 
 ~CAKeybdInput ()
 
void onMidiInEvent (QVector< unsigned char > m)
 

Private Member Functions

void midiInEventToScore (CAScoreView *v, QVector< unsigned char > m)
 
CADiatonicPitch matchPitchToKey (CAVoice *voice, CADiatonicPitch p)
 

Private Attributes

CAMainWin_mw
 
QTimer _midiInChordTimer
 
CASheet_lastMidiInSheet
 
CAStaff_lastMidiInStaff
 
CAVoice_lastMidiInVoice
 
CADiatonicPitch _actualKeySignature
 
signed char _actualKeySignatureAccs [7]
 
int _actualKeyAccidentalsSum
 
CAPlayable_tupPla
 
CATuplet_tup
 
QList< CAMusElement * > _noteLayout
 

Detailed Description

Music input per midi non realtime This class adds score input capability through a connected midi keyboard in non realtime. It allows to use simultaniously the computer mouse and the computer keyboard as usual.

To activate midi keyboard input you have to select in canorus settings, readable devices, the alsa midi port of your midi keyboard. When in input mode, when a voice and a duration is selected, notes can be entered with the midi keyboard too.

Key strockes within 100 ms will be combined into a chord.

Accents are set according the current key pitch. Automatic tracking of the scene is done too.

todo: User selectable (to be implemented) midi pitches can be set to be interpreted as rest input, punctuation and so on. Inserting at the currently selected note.

Constructor & Destructor Documentation

◆ CAKeybdInput()

CAKeybdInput::CAKeybdInput ( CAMainWin m)

◆ ~CAKeybdInput()

CAKeybdInput::~CAKeybdInput ( )

Destructor deletes the created arrays.

Member Function Documentation

◆ matchPitchToKey()

CADiatonicPitch CAKeybdInput::matchPitchToKey ( CAVoice voice,
CADiatonicPitch  p 
)
private

This function looks up the current key signiture. Then it computes the proper accidentials for the note.

This function should be somewhere else, maybe in CADiatonicPitch ?

References _actualKeyAccidentalsSum, _actualKeySignature, _actualKeySignatureAccs, CAKeySignature::accidentals(), CADiatonicPitch::accs(), CADiatonicPitch::C, CAKeySignature::diatonicKey(), CADiatonicKey::diatonicPitch(), CAInterval::Diminished, CAVoice::getPreviousByType(), CAMusElement::KeySignature, CAVoice::lastTimeEnd(), CADiatonicPitch::noteName(), and CAInterval::Second.

Referenced by midiInEventToScore().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ midiInEventToScore()

void CAKeybdInput::midiInEventToScore ( CAScoreView v,
QVector< unsigned char >  m 
)
private

This is the entry point the midi input device. All note on events are passed over here.

References _midiInChordTimer, _mw, _noteLayout, _tup, _tupPla, CAScoreView::addToSelection(), CAVoice::append(), CAMusElement::Barline, CAScoreView::clearSelection(), CAMusElementFactory::configureRest(), CAMusElementFactory::configureSlur(), CADrawableContext::context(), CAUndo::createUndoCommand(), CAScoreView::currentContext(), CAMainWin::currentScoreView(), CAMainWin::currentSheet(), CAMainWin::currentVoice(), CADiatonicPitch::diatonicPitchFromMidiPitch(), CAMainWin::document(), CATuplet::firstNote(), CAVoice::getChord(), CAVoice::insert(), CAVoice::insertInTupletAndVoiceAt(), CAPlayable::isFirstInTuplet(), CAVoice::lastMusElement(), CAVoice::lastPlayableElt(), CAVoice::lastTimeEnd(), CAVoice::lastTimeStart(), matchPitchToKey(), CAPlayableLength::matchToBars(), CAMusElementFactory::musElement(), CAMainWin::musElementFactory(), CAVoice::musElementList(), CATuplet::nextTimed(), CARest::Normal, CAStaff::placeAutoBar(), CAMusElementFactory::playableLength(), CAVoice::previousByType(), CAUndo::pushUndoCommand(), CACanorus::rebuildUI(), CACanorus::settings(), CAScoreView::setWorldCoords(), CAVoice::synchronizeMusElements(), CAMusElement::TimeSignature, CAMusElement::timeStart(), CAScoreView::timeToCoordsSimpleVersion(), CAPlayable::tuplet(), CAMainWin::uiTupletActualNumber, CAMainWin::uiTupletNumber, CAMainWin::uiTupletType, CACanorus::undo(), CAScoreView::updateHelpers(), and CAScoreView::worldCoords().

Referenced by onMidiInEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ onMidiInEvent()

void CAKeybdInput::onMidiInEvent ( QVector< unsigned char >  m)

References _mw, CAMainWin::currentScoreView(), CAMidiDevice::Midi_Note_On, and midiInEventToScore().

Referenced by CAMainWin::onMidiInEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _actualKeyAccidentalsSum

int CAKeybdInput::_actualKeyAccidentalsSum
private

Referenced by matchPitchToKey().

◆ _actualKeySignature

CADiatonicPitch CAKeybdInput::_actualKeySignature
private

Referenced by matchPitchToKey().

◆ _actualKeySignatureAccs

signed char CAKeybdInput::_actualKeySignatureAccs[7]
private

Referenced by matchPitchToKey().

◆ _lastMidiInSheet

CASheet* CAKeybdInput::_lastMidiInSheet
private

◆ _lastMidiInStaff

CAStaff* CAKeybdInput::_lastMidiInStaff
private

◆ _lastMidiInVoice

CAVoice* CAKeybdInput::_lastMidiInVoice
private

Referenced by CAKeybdInput().

◆ _midiInChordTimer

QTimer CAKeybdInput::_midiInChordTimer
private

Referenced by CAKeybdInput(), and midiInEventToScore().

◆ _mw

CAMainWin* CAKeybdInput::_mw
private

◆ _noteLayout

QList<CAMusElement*> CAKeybdInput::_noteLayout
private

Referenced by CAKeybdInput(), and midiInEventToScore().

◆ _tup

CATuplet* CAKeybdInput::_tup
private

Referenced by CAKeybdInput(), and midiInEventToScore().

◆ _tupPla

CAPlayable* CAKeybdInput::_tupPla
private

Referenced by CAKeybdInput(), and midiInEventToScore().


The documentation for this class was generated from the following files: