3770 lines
102 KiB
Plaintext
3770 lines
102 KiB
Plaintext
|
||
/*
|
||
|
||
G Ionian Major G A B C D E F# G
|
||
A Dorian minor A B C D E F# G A
|
||
B Phrygian minor B C D E F# G A B
|
||
C Lydian Major C D E F# G A B C
|
||
D Mixolydian Major D E F# G A B C D
|
||
E Aeolian minor E F# G A B C D E
|
||
F# Locrian diminished F# G A B C D E F#
|
||
|
||
|
||
E(4),F#(4),G(4),A(4),B(4),C(5),D(5),E(5)
|
||
|
||
|
||
|| C | C# | D | D# | E | F | F# | G | G# | A | A# | B
|
||
FHFFHFF
|
||
|
||
|
||
|
||
|
||
|
||
Ionian I - Tonic Major Regular Major
|
||
Dorian ii - Supertonic Minor Blues Minor
|
||
Phrygian iii - Mediant Minor Spanish Minor
|
||
Lydian IV - Subdominant Major Jazz Major
|
||
Mixolydian V - Dominant Major Dominant Major
|
||
Aeolian vi - Submediant Minor Pure Minor
|
||
Locrian vii - Subtonic Diminished Diminished
|
||
*/
|
||
|
||
|
||
|
||
/* || C | C# | D | D# | E | F | F# | G | G# | A | A# | B
|
||
------------------------------------------------------------------------------
|
||
0 || 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11
|
||
1 || 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23
|
||
2 || 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35
|
||
3 || 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47
|
||
4 || 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59
|
||
5 || 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71
|
||
6 || 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83
|
||
7 || 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95
|
||
8 || 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107
|
||
9 || 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119
|
||
10 || 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | */
|
||
|
||
|
||
|
||
|
||
/*
|
||
The I, IV, and V7 patterns
|
||
Make sure all of section one leaks into your brain and stays there permanently, because we’re moving fast here. Okay, before we move on,
|
||
you must know that a chord is two or more notes played at the same time. A triad is three notes played at the same time. Sometimes I will
|
||
call a triad a chord, because a triad is basically a special type of chord. (Just like how a dog is a type of mammal, or how music is a
|
||
form of noise.)
|
||
|
||
Each major key has three primary chords. These are three triads that sound beautiful and are absolutely essential to harmonics. (try not
|
||
to confuse harmonics with harmonica...) The first primary chord is the I chord. This is the first note of the scale, the third note, and
|
||
the fifth note. So the I chord for the C scale is consisted of the notes C, E, and G played at the same time. Go ahead, try it. Play those
|
||
three notes at the same time. Don’t it just sound heavenly?
|
||
|
||
The IV chord consists of the first note, the fourth note, and the sixth note played at the same time. For the C scale, those notes would be
|
||
C, F, and A. Finally, the V7 chord consists of the fourth note, the fifth note, and (pay attention to this one now.) the note one note
|
||
below the first note. So for the C scale, those notes would be B(the one below the first note, not the one before the last note), F, and
|
||
G. Got it? Now you can make up your own happy song with these chords. Go ahead, try it. Try playing the chords in this order:
|
||
|
||
I, IV, V7, I
|
||
|
||
*/
|
||
|
||
|
||
|
||
CallbackData::ReturnType ViewWindow::leftButtonDoubleHandler(CallbackData &someCallbackData)
|
||
{
|
||
/* Point clickPoint(someCallbackData.loWord(),someCallbackData.hiWord());
|
||
CallbackData callbackData;
|
||
String strPathFileName;
|
||
String strItemName;
|
||
|
||
clickPoint.x(clickPoint.x()+mScrollInfo.currScrollx());
|
||
clickPoint.y(clickPoint.y()+mScrollInfo.currScrolly());
|
||
if(!mThumbPage.hitTest(*this,clickPoint,strItemName))return (CallbackData::ReturnType)FALSE;
|
||
strPathFileName=getTitle()+String("\\")+strItemName;
|
||
::OutputDebugString(strPathFileName+String("\n"));
|
||
callbackData.lParam(int((char*)strPathFileName));
|
||
mSelectHandler.callback(callbackData); */
|
||
return (CallbackData::ReturnType)FALSE;
|
||
}
|
||
|
||
|
||
|
||
|
||
#include <midiseq/note.hpp>
|
||
#include <midiseq/pureevnt.hpp>
|
||
#include <guitar/note.hpp>
|
||
#include <guitar/scales.hpp>
|
||
#include <guitar/chord.hpp>
|
||
#include <guitar/fretboard.hpp>
|
||
|
||
|
||
void outDebug(const String &string);
|
||
void scalesAndChords(void);
|
||
void minorsAndHarmonics(void);
|
||
void tuningAndFretboard(void);
|
||
|
||
main()
|
||
{
|
||
}
|
||
|
||
void minorsAndHarmonics()
|
||
{
|
||
MIDIOutputDevice midiDevice;
|
||
if(!midiDevice.openDevice())return;
|
||
Note::NoteType root=Note::A;
|
||
IonianScale ionianScale(root);
|
||
outDebug(ionianScale.toString());
|
||
AeolianScale aeolianScale(Note::A);
|
||
// outDebug(aeolianScale.toString());
|
||
HarmonicMinorScale harmonicMinorScale(Note::A);
|
||
// outDebug(harmonicMinorScale.toString());
|
||
MelodicMinorScale melodicMinorScale(Note::A);
|
||
|
||
Music::Chord chord=aeolianScale.getIChord();
|
||
outDebug(chord.toString());
|
||
chord.play(midiDevice);
|
||
::Sleep(1000);
|
||
|
||
chord=aeolianScale.getIVChord();
|
||
chord.play(midiDevice);
|
||
::Sleep(1000);
|
||
|
||
chord=aeolianScale.getV7Chord();
|
||
chord.play(midiDevice);
|
||
::Sleep(250);
|
||
chord.play(midiDevice);
|
||
::Sleep(250);
|
||
chord.play(midiDevice);
|
||
::Sleep(250);
|
||
chord=aeolianScale.getIChord();
|
||
chord.play(midiDevice);
|
||
::Sleep(750);
|
||
|
||
|
||
outDebug(melodicMinorScale.toString());
|
||
melodicMinorScale.play(midiDevice);
|
||
::Sleep(1000);
|
||
// aeolianScale.play(midiDevice);
|
||
outDebug(harmonicMinorScale.toString());
|
||
|
||
// harmonicMinorScale.playBack(midiDevice);
|
||
midiDevice.closeDevice();
|
||
}
|
||
|
||
|
||
void tuningAndFretboard()
|
||
{
|
||
Fretboard fretboard;
|
||
MIDIOutputDevice midiDevice;
|
||
outDebug(fretboard.toString());
|
||
if(!midiDevice.openDevice())return;
|
||
const Tuning &tuning=fretboard.getTuning();
|
||
// tuning.play(midiDevice);
|
||
fretboard.play(midiDevice);
|
||
midiDevice.closeDevice();
|
||
}
|
||
|
||
void scalesAndChords(void)
|
||
{
|
||
using namespace Music;
|
||
Music::Chord chord;
|
||
|
||
MIDIOutputDevice midiDevice;
|
||
if(!midiDevice.openDevice())return;
|
||
AeolianScale scale;
|
||
outDebug(scale.toString());
|
||
scale.setDelay(150);
|
||
scale.play(midiDevice);
|
||
scale.playBack(midiDevice);
|
||
|
||
chord=scale.getIChord();
|
||
outDebug(chord.toString());
|
||
chord.play(midiDevice);
|
||
chord.pause();
|
||
chord.play(midiDevice);
|
||
chord.pause();
|
||
chord.play(midiDevice);
|
||
chord.pause();
|
||
|
||
chord=scale.getIVChord();
|
||
outDebug(chord.toString());
|
||
chord.play(midiDevice);
|
||
chord.pause();
|
||
chord.play(midiDevice);
|
||
chord.pause();
|
||
chord.play(midiDevice);
|
||
chord.pause();
|
||
|
||
chord=scale.getV7Chord();
|
||
outDebug(chord.toString());
|
||
chord.play(midiDevice);
|
||
chord.pause();
|
||
chord.play(midiDevice);
|
||
chord.pause();
|
||
chord.play(midiDevice);
|
||
chord.pause();
|
||
|
||
chord=scale.getIChord();
|
||
outDebug(chord.toString());
|
||
chord.play(midiDevice);
|
||
chord.pause();
|
||
chord.pause();
|
||
|
||
midiDevice.closeDevice();
|
||
}
|
||
|
||
void outDebug(const String &string)
|
||
{
|
||
String outString(string+String("\n"));
|
||
::printf("%s\n",((String&)string).str());
|
||
::OutputDebugString(outString.str());
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
// mTablature.setDelayAtAndThereafter(0,250);
|
||
/*
|
||
mTablature.setDelayAt(4,1000);
|
||
mTablature.setDelayAt(5,750);
|
||
mTablature.setDelayAt(8,1000);
|
||
mTablature.setDelayAt(9,750);
|
||
mTablature.setDelayAt(10,750);
|
||
mTablature.setDelayAt(11,750);
|
||
mTablature.setDelayAt(12,750);
|
||
mTablature.setDelayAtAndThereafter(13,100);
|
||
// mTablature.setDelayAtAndThereafter(13,250);
|
||
mTablature.setDelayAt(64,1500); */
|
||
|
||
|
||
|
||
/*
|
||
bool TabPage::drawTabPage(PureDevice &pureDevice,GUIWindow &guiWindow)
|
||
{
|
||
Point xyPoint;
|
||
SIZE entryExtents;
|
||
|
||
getEntryExtents(pureDevice,entryExtents);
|
||
if(!pureDevice.isOkay()||!guiWindow.isValid()||!mTabEntries.size())return false;
|
||
for(int index=0;index<mTabEntries.size();index++)
|
||
{
|
||
TabEntry &entry=mTabEntries[index];
|
||
if(xyPoint.x()+entryExtents.cx>=guiWindow.width())
|
||
{
|
||
xyPoint.x(0);
|
||
xyPoint.y(xyPoint.y()+entryExtents.cy+Separator);
|
||
}
|
||
// pureDevice.select(mDIBitmap->getBitmap());
|
||
// pureDevice.setTextColor(RGBColor(0,255,0));
|
||
// pureDevice.drawText(Point(0,0),"Text");
|
||
|
||
// ptrThumbNail->draw(pureDevice,xyPoint);
|
||
xyPoint.x(xyPoint.x()+entryExtents.cx+Separator);
|
||
}
|
||
return true;
|
||
}
|
||
*/
|
||
|
||
|
||
|
||
|
||
/*
|
||
int TabPage::getDimensions(GUIWindow &guiWindow,GDIPoint &gdiPoint)
|
||
{
|
||
Point xyPoint;
|
||
|
||
PureDevice pureDevice(guiWindow);
|
||
setCharWidth(getWidestEntry(pureDevice));
|
||
gdiPoint=GDIPoint();
|
||
setNumTabs(0);
|
||
if(!guiWindow.isValid()||!mTabEntries.size())return getNumTabs();
|
||
xyPoint.x(LeftMargin);
|
||
xyPoint.y(TopMargin);
|
||
for(int index=0;index<mTabEntries.size();index++)
|
||
{
|
||
TabEntry &entry=mTabEntries[index];
|
||
if(xyPoint.x()+getCharWidth()>=guiWindow.width()-RightMargin)
|
||
{
|
||
if(!getNumTabs())
|
||
{
|
||
setItemsPerTab(index+1);
|
||
gdiPoint.x(xyPoint.x());
|
||
}
|
||
xyPoint.x(LeftMargin);
|
||
xyPoint.y(xyPoint.y()+TabHeight+TabSeparator);
|
||
setNumTabs(getNumTabs()+1);
|
||
}
|
||
xyPoint.x(xyPoint.x()+getCharWidth());
|
||
}
|
||
gdiPoint.y(xyPoint.y());
|
||
// gdiPoint.y(xyPoint.y()+TabHeight+TabSeparator);
|
||
gdiPoint.x(guiWindow.width());
|
||
if(!getNumTabs())setNumTabs(mTabEntries.size());
|
||
::OutputDebugString(String(String("TabCount:")+String().fromInt(getNumTabs())+String("\n")).str());
|
||
::OutputDebugString(String(String("ItemsPerTab:")+String().fromInt(getItemsPerTab())+String("\n")).str());
|
||
return getNumTabs();
|
||
}
|
||
*/
|
||
|
||
|
||
|
||
|
||
/*
|
||
int TabPage::getWidestEntry(PureDevice &pureDevice,const TabEntry &entry)const
|
||
{
|
||
String string;
|
||
int widestEntry;
|
||
SIZE sizeStruct;
|
||
|
||
widestEntry=0;
|
||
for(int index=0;index<entry.size();index++)
|
||
{
|
||
const FrettedNote &frettedNote=((TabEntry&)entry)[index];
|
||
string=String().fromInt(frettedNote.getFret());
|
||
getEntryExtents(pureDevice,sizeStruct,string);
|
||
if(sizeStruct.cx>widestEntry)widestEntry=sizeStruct.cx;
|
||
}
|
||
return widestEntry;
|
||
}
|
||
*/
|
||
|
||
|
||
|
||
|
||
/*
|
||
bool TabPage::drawTabPage(GUIWindow &guiWindow)
|
||
{
|
||
Point xyPoint;
|
||
String strString;
|
||
SIZE entryExtents;
|
||
|
||
PureDevice pureDevice(guiWindow);
|
||
getEntryExtents(pureDevice,entryExtents);
|
||
if(!guiWindow.isValid()||!mTabEntries.size())return false;
|
||
for(int index=0;index<mTabEntries.size();index++)
|
||
{
|
||
TabEntry &entry=mTabEntries[index];
|
||
if(xyPoint.x()+entryExtents.cx>=guiWindow.width())
|
||
{
|
||
xyPoint.x(0);
|
||
xyPoint.y(xyPoint.y()+entryExtents.cy+Separator);
|
||
}
|
||
Point p1(xyPoint);
|
||
Point p2(xyPoint.x()+entryExtents.cx,xyPoint.y());
|
||
mDIBitmap->line(p1,p2,1);
|
||
|
||
xyPoint.x(xyPoint.x()+entryExtents.cx+Separator);
|
||
}
|
||
return true;
|
||
}
|
||
*/
|
||
|
||
/*
|
||
|
||
DWORD TabPage::rowItems(GUIWindow &guiWindow)const
|
||
{
|
||
PureDevice pureDevice(guiWindow);
|
||
Point xyPoint;
|
||
DWORD rowItems;
|
||
SIZE entryExtents;
|
||
|
||
rowItems=0;
|
||
getEntryExtents(pureDevice,entryExtents," ");
|
||
if(!guiWindow.isValid()||!mTabEntries.size())return rowItems;
|
||
for(int index=0;index<mTabEntries.size();index++)
|
||
{
|
||
TabEntry &entry=((TabEntries&)mTabEntries)[index];
|
||
if(xyPoint.x()+entryExtents.cx>=guiWindow.width())
|
||
{
|
||
if(!rowItems)rowItems=index+1;
|
||
xyPoint.x(0);
|
||
xyPoint.y(xyPoint.y()+entryExtents.cy+Separator);
|
||
}
|
||
xyPoint.x(xyPoint.x()+entryExtents.cx+Separator);
|
||
}
|
||
if(!rowItems)rowItems=mTabEntries.size();
|
||
return rowItems;
|
||
}
|
||
*/
|
||
|
||
|
||
/*
|
||
int TabPage::getDimensions(GUIWindow &guiWindow,GDIPoint &gdiPoint)
|
||
{
|
||
Point xyPoint;
|
||
SIZE entryExtents;
|
||
|
||
PureDevice pureDevice(guiWindow);
|
||
getEntryExtents(pureDevice,entryExtents);
|
||
gdiPoint=GDIPoint();
|
||
rowItems(0);
|
||
if(!guiWindow.isValid()||!mTabEntries.size())return rowItems();
|
||
for(int index=0;index<mTabEntries.size();index++)
|
||
{
|
||
TabEntry &entry=mTabEntries[index];
|
||
if(xyPoint.x()+entryExtents.cx>=guiWindow.width())
|
||
{
|
||
if(!rowItems())
|
||
{
|
||
rowItems(index+1);
|
||
gdiPoint.x(xyPoint.x());
|
||
}
|
||
xyPoint.x(0);
|
||
xyPoint.y(xyPoint.y()+entryExtents.cy+Separator);
|
||
}
|
||
xyPoint.x(xyPoint.x()+entryExtents.cx+Separator);
|
||
}
|
||
gdiPoint.y(xyPoint.y()+entryExtents.cy+Separator);
|
||
if(!rowItems())rowItems(mTabEntries.size());
|
||
gdiPoint.y(200);
|
||
return rowItems();
|
||
}
|
||
*/
|
||
|
||
|
||
/*
|
||
Point p1=getEntryPoint(entryIndex);
|
||
|
||
p1.y(p1.y()-(font.charHeight()/2));
|
||
|
||
pureDevice.textOut(p1.x(),p1.y(),"2");
|
||
|
||
// Point p1=getEntryPoint(entryIndex);
|
||
// pureDevice.textOut(p1.x(),p1.y()-(font.charHeight()/2),"2");
|
||
// mDIBitmap->square(p1,2,TabLineColor);
|
||
|
||
p1.y(p1.y()+TabSpacing);
|
||
pureDevice.textOut(p1.x(),p1.y(),"2");
|
||
// mDIBitmap->square(p1,2,TabLineColor);
|
||
|
||
p1.y(p1.y()+TabSpacing);
|
||
pureDevice.textOut(p1.x(),p1.y(),"2");
|
||
// mDIBitmap->square(p1,2,TabLineColor);
|
||
|
||
p1.y(p1.y()+TabSpacing);
|
||
pureDevice.textOut(p1.x(),p1.y(),"2");
|
||
// mDIBitmap->square(p1,2,TabLineColor);
|
||
|
||
p1.y(p1.y()+TabSpacing);
|
||
pureDevice.textOut(p1.x(),p1.y(),"2");
|
||
// mDIBitmap->square(p1,2,TabLineColor);
|
||
|
||
p1.y(p1.y()+TabSpacing);
|
||
pureDevice.textOut(p1.x(),p1.y(),"2");
|
||
// mDIBitmap->square(p1,2,TabLineColor);
|
||
|
||
// mParent->invalidate(); */
|
||
|
||
|
||
|
||
|
||
|
||
// void outlineEntry(int entryIndex);
|
||
|
||
|
||
|
||
/*
|
||
void TabPage::outlineEntry(int entryIndex)
|
||
{
|
||
Point xyPoint(LeftMargin,TopMargin);
|
||
Rect outlineRect;
|
||
|
||
if(!isOkay())return;
|
||
PureDevice &pureDevice=mDIBitmap->getDevice();
|
||
for(int index=0;index<mTabEntries.size()&&index!=entryIndex;index++)
|
||
{
|
||
if(xyPoint.x()+getCharWidth()>=getWidth()-(RightMargin+LeftMargin))
|
||
{
|
||
xyPoint.x(LeftMargin);
|
||
xyPoint.y(xyPoint.y()+TabHeight+TabSeparator);
|
||
}
|
||
else xyPoint.x(xyPoint.x()+getCharWidth());
|
||
}
|
||
outlineRect.left(xyPoint.x());
|
||
outlineRect.top(xyPoint.y());
|
||
outlineRect.right(xyPoint.x()+getCharWidth()-1);
|
||
outlineRect.bottom(xyPoint.y()+TabHeight-TabSpacing);
|
||
pureDevice.outlineRect(outlineRect,mOutlinePen);
|
||
}
|
||
*/
|
||
|
||
|
||
|
||
bool TabPage::addTip(const Rect &prevOutlineRect,const Rect &outlineRect,const String &strText)
|
||
{
|
||
if(!mToolTipControl.isOkay())return false;
|
||
|
||
PureToolInfo pureToolInfo;
|
||
PureToolInfo currentTool;
|
||
|
||
|
||
// pureToolInfo.rect(mPrevOutlineRect);
|
||
// mToolTipControl->delTool(pureToolInfo);
|
||
|
||
pureToolInfo.flags((UINT)PureToolInfo::IDIsHwnd|(UINT)PureToolInfo::SubClass);
|
||
pureToolInfo.hwnd(*mParent);
|
||
pureToolInfo.toolID((UINT)(HWND)*mParent);
|
||
pureToolInfo.rect(outlineRect);
|
||
pureToolInfo.resInst(mParent->processInstance());
|
||
pureToolInfo.szText(strText);
|
||
|
||
if(!mToolTipControl->getCurrentTool(currentTool))
|
||
{
|
||
mToolTipControl->addTool(pureToolInfo);
|
||
}
|
||
else
|
||
{
|
||
currentTool.rect(outlineRect);
|
||
currentTool.szText(strText);
|
||
mToolTipControl->setToolInfo(currentTool);
|
||
|
||
// mToolTipControl->setToolInfo(pureToolInfo);
|
||
}
|
||
return true;
|
||
}
|
||
|
||
|
||
bool addTip(const Rect &prevOutlineRect,const Rect &outlineRect,const String &strText);
|
||
|
||
|
||
// addTip(mPrevOutlineRect,outlineRect,entry.toString());
|
||
|
||
|
||
mToolTipControl=::new ToolTip(parent);
|
||
mToolTipControl.disposition(PointerDisposition::Delete);
|
||
mToolTipControl->setDelayTime(ToolTip::Initial,25);
|
||
mToolTipControl->setDelayTime(ToolTip::Reshow,25);
|
||
|
||
|
||
#ifndef _TOOLTIP_TOOLTIP_HPP_
|
||
#include <tooltip/tooltip.hpp>
|
||
#endif
|
||
|
||
|
||
SmartPointer<ToolTip> mToolTipControl;
|
||
|
||
|
||
|
||
|
||
bool isValidFret(int fret);
|
||
bool haveElement(int elements[6]);
|
||
|
||
|
||
/*
|
||
bool Tablature::parseTab(void)
|
||
{
|
||
int elements[6];
|
||
|
||
for(int index=0;index<mTablature.size();index++)
|
||
{
|
||
TabLines &tabLines=mTablature[index];
|
||
int length=tabLines[0].length();
|
||
for(int index=0;index<length;index++)
|
||
{
|
||
tabLines[0].getElement(elements[0]);
|
||
tabLines[1].getElement(elements[1]);
|
||
tabLines[2].getElement(elements[2]);
|
||
tabLines[3].getElement(elements[3]);
|
||
tabLines[4].getElement(elements[4]);
|
||
tabLines[5].getElement(elements[5]);
|
||
if(!haveElement(elements))continue;
|
||
|
||
insert(&TabEntry());
|
||
TabEntry &tabEntry=operator[](size()-1);
|
||
|
||
if(-1!=elements[0])
|
||
{
|
||
if(!isValidFret(elements[0]))continue;
|
||
FrettedNote frettedNote(mFretboard.getAt(5,elements[0]),5,elements[0]);
|
||
tabEntry.insert(&frettedNote);
|
||
}
|
||
if(-1!=elements[1])
|
||
{
|
||
if(!isValidFret(elements[1]))continue;
|
||
FrettedNote frettedNote(mFretboard.getAt(4,elements[1]),4,elements[1]);
|
||
tabEntry.insert(&frettedNote);
|
||
}
|
||
if(-1!=elements[2])
|
||
{
|
||
if(!isValidFret(elements[2]))continue;
|
||
FrettedNote frettedNote(mFretboard.getAt(3,elements[2]),3,elements[2]);
|
||
tabEntry.insert(&frettedNote);
|
||
}
|
||
if(-1!=elements[3])
|
||
{
|
||
if(!isValidFret(elements[3]))continue;
|
||
FrettedNote frettedNote(mFretboard.getAt(2,elements[3]),2,elements[3]);
|
||
tabEntry.insert(&frettedNote);
|
||
}
|
||
if(-1!=elements[4])
|
||
{
|
||
if(!isValidFret(elements[4]))continue;
|
||
FrettedNote frettedNote(mFretboard.getAt(1,elements[4]),1,elements[4]);
|
||
tabEntry.insert(&frettedNote);
|
||
}
|
||
if(-1!=elements[5])
|
||
{
|
||
if(!isValidFret(elements[5]))continue;
|
||
FrettedNote frettedNote(mFretboard.getAt(0,elements[5]),0,elements[5]);
|
||
tabEntry.insert(&frettedNote);
|
||
}
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
|
||
bool Tablature::isValidFret(int fret)
|
||
{
|
||
if(fret<=Fretboard::Frets)return true;
|
||
outDebug("[Tablature::isValidFret]"+String("No such fret ")+String().fromInt(fret));
|
||
return false;
|
||
}
|
||
|
||
bool Tablature::haveElement(int elements[6])
|
||
{
|
||
for(int index=0;index<6;index++)
|
||
if(-1!=elements[index])return true;
|
||
return false;
|
||
}
|
||
|
||
*/
|
||
|
||
|
||
|
||
|
||
|
||
/*
|
||
//#include <guitar/GUIFretboard.hpp>
|
||
|
||
bool Tablature::play(MIDIOutputDevice &midiDevice,GUIFretboard &guiFretboard,GUIWindow &guiWindow)
|
||
{
|
||
PureDevice device(guiWindow);
|
||
if(!midiDevice.hasDevice())return false;
|
||
setCancelled(false);
|
||
for(int index=0;index<size();index++)
|
||
{
|
||
if(getCancelled())break;
|
||
TabEntry &tabEntry=operator[](index);
|
||
::OutputDebugString(String(String().fromInt(index)+String(":")+tabEntry.toString()+String("\n")).str());
|
||
for(int noteIndex=0;noteIndex<tabEntry.size();noteIndex++)
|
||
{
|
||
FrettedNote &frettedNote=tabEntry[noteIndex];
|
||
guiFretboard.drawAt(device,guiWindow,frettedNote.getString(),frettedNote.getFret(),Fret::Active);
|
||
guiWindow.update();
|
||
}
|
||
tabEntry.play(midiDevice);
|
||
for(noteIndex=0;noteIndex<tabEntry.size();noteIndex++)
|
||
{
|
||
FrettedNote &frettedNote=tabEntry[noteIndex];
|
||
guiFretboard.drawAt(device,guiWindow,frettedNote.getString(),frettedNote.getFret(),Fret::Inactive);
|
||
guiWindow.update();
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
*/
|
||
|
||
|
||
// bool play(MIDIOutputDevice &midiDevice,GUIFretboard &guiFretboard,GUIWindow &guiWindow);
|
||
|
||
|
||
|
||
void ViewWindow::enableFreePlaySelect(bool enable)
|
||
{
|
||
PureMenu &pureMenu=getMenu();
|
||
if(enable)
|
||
{
|
||
pureMenu.enableMenuItem(MENU_TABLATURE_PLAY,PureMenu::ByCommand,PureMenu::InsertFlags(PureMenu::ItemGrayed|PureMenu::ItemDisabled));
|
||
pureMenu.enableMenuItem(MENU_TABLATURE_PLAYREPEATED,PureMenu::ByCommand,PureMenu::InsertFlags(PureMenu::ItemGrayed|PureMenu::ItemDisabled));
|
||
pureMenu.enableMenuItem(MENU_TABLATURE_PLAYRANGE,PureMenu::ByCommand,PureMenu::InsertFlags(PureMenu::ItemGrayed|PureMenu::ItemDisabled));
|
||
pureMenu.enableMenuItem(MENU_TABLATURE_STOP,PureMenu::ByCommand,PureMenu::InsertFlags(PureMenu::ItemGrayed|PureMenu::ItemDisabled));
|
||
}
|
||
else
|
||
{
|
||
pureMenu.enableMenuItem(MENU_TABLATURE_PLAY,PureMenu::ByCommand,PureMenu::InsertFlags(PureMenu::ItemEnabled));
|
||
pureMenu.enableMenuItem(MENU_TABLATURE_PLAYREPEATED,PureMenu::ByCommand,PureMenu::InsertFlags(PureMenu::ItemEnabled));
|
||
pureMenu.enableMenuItem(MENU_TABLATURE_PLAYRANGE,PureMenu::ByCommand,PureMenu::InsertFlags(PureMenu::ItemEnabled));
|
||
pureMenu.enableMenuItem(MENU_TABLATURE_STOP,PureMenu::ByCommand,PureMenu::InsertFlags(PureMenu::ItemGrayed|PureMenu::ItemDisabled));
|
||
}
|
||
}
|
||
|
||
|
||
|
||
bool TabPage::outlineRect(const Rect &outlineRect)
|
||
{
|
||
if(!isOkay())return false;
|
||
|
||
if(mPrevOutlineRect==outlineRect)return false;
|
||
if(!mOverlay.isOkay())
|
||
{
|
||
mDIBitmap->getAt(mOverlay,outlineRect);
|
||
Rect rect(outlineRect);
|
||
rect.left(rect.left()+1);
|
||
rect.top(rect.top()+1);
|
||
rect.right(rect.right()-1);
|
||
rect.bottom(rect.bottom()-1);
|
||
mDIBitmap->outlineRect(rect);
|
||
invalidate(outlineRect);
|
||
// mParent->update();
|
||
// mParent->invalidate(true);
|
||
}
|
||
else
|
||
{
|
||
mDIBitmap->overlay(*mOverlay,Point(mPrevOutlineRect.left(),mPrevOutlineRect.top()));
|
||
invalidate(mPrevOutlineRect);
|
||
mDIBitmap->getAt(mOverlay,outlineRect);
|
||
Rect rect(outlineRect);
|
||
rect.left(rect.left()+1);
|
||
rect.top(rect.top()+1);
|
||
rect.right(rect.right()-1);
|
||
rect.bottom(rect.bottom()-1);
|
||
mDIBitmap->outlineRect(rect);
|
||
invalidate(outlineRect);
|
||
// mParent->update();
|
||
}
|
||
mPrevOutlineRect=outlineRect;
|
||
return true;
|
||
}
|
||
|
||
|
||
|
||
/*
|
||
File inFile;
|
||
String strLine;
|
||
String strIndex;
|
||
String strDelay;
|
||
|
||
if(!inFile.open(pathFileName))return false;
|
||
if(!inFile.readLine(strLine))return false;
|
||
if(!(strLine=="WINTABV1.00"))return false;
|
||
if(!inFile.readLine(strLine))return false;
|
||
if(!(strLine.betweenString(0,'=')==String("TABLATURE")))return false;
|
||
strLine=strLine.betweenString('=',0);
|
||
if(strLine.isNull())
|
||
{
|
||
::MessageBox(*this,strLine,"Project does not contain a reference to any tablature.",MB_OK);
|
||
return false;
|
||
}
|
||
if(!open(strLine))return false;
|
||
if(!inFile.readLine(strLine))return false;
|
||
if(!(strLine.betweenString(0,'=')==String("DELAYS")))return false;
|
||
strLine=strLine.betweenString('=',0);
|
||
char *ptr=strLine.str();
|
||
if(ptr)
|
||
{
|
||
ptr=::strtok(ptr,")");
|
||
while(true)
|
||
{
|
||
String str(ptr);
|
||
strIndex=str.betweenString('(',',');
|
||
strDelay=str.betweenString(',',0);
|
||
mTablature.setDelayAt(strIndex.toInt(),strDelay.toInt());
|
||
ptr=::strtok(0,")");
|
||
if(!ptr)break;
|
||
}
|
||
}
|
||
*/
|
||
|
||
|
||
|
||
/*
|
||
bool ViewWindow::saveProject(const String &pathFileName)
|
||
{
|
||
File outFile;
|
||
if(!outFile.open(pathFileName,"wb"))return false;
|
||
outFile.writeLine("WINTABV1.00");
|
||
if(mTablature.getPathFileName().isNull())outFile.writeLine("TABLATURE=");
|
||
else outFile.writeLine(String("TABLATURE=")+mTablature.getPathFileName());
|
||
outFile.writeLine(String("DELAYS=")+mTablature.getDelays());
|
||
setTitle(pathFileName);
|
||
return true;
|
||
}*/
|
||
|
||
|
||
|
||
|
||
/*
|
||
bool FretViewWindow::play(void)
|
||
{
|
||
ThreadMessage thMessage(ThreadMessage::TM_USER,THPlay);
|
||
MessageThread::postMessage(thMessage);
|
||
PureMenu &pureMenu=getMenu();
|
||
pureMenu.enableMenuItem(MENU_TABLATURE_PLAY,PureMenu::ByCommand,PureMenu::InsertFlags(PureMenu::ItemGrayed|PureMenu::ItemDisabled));
|
||
pureMenu.enableMenuItem(MENU_TABLATURE_PLAYREPEATED,PureMenu::ByCommand,PureMenu::InsertFlags(PureMenu::ItemGrayed|PureMenu::ItemDisabled));
|
||
pureMenu.enableMenuItem(MENU_TABLATURE_PLAYRANGE,PureMenu::ByCommand,PureMenu::InsertFlags(PureMenu::ItemGrayed|PureMenu::ItemDisabled));
|
||
pureMenu.enableMenuItem(MENU_TABLATURE_STOP,PureMenu::ByCommand,PureMenu::InsertFlags(PureMenu::ItemEnabled));
|
||
return true;
|
||
}*/
|
||
|
||
/*void FretViewWindow::stopPlay(void)
|
||
{
|
||
mTablature.setCancelled(true);
|
||
PureMenu &pureMenu=getMenu();
|
||
pureMenu.enableMenuItem(MENU_TABLATURE_PLAY,PureMenu::ByCommand,PureMenu::InsertFlags(PureMenu::ItemEnabled));
|
||
pureMenu.enableMenuItem(MENU_TABLATURE_PLAYREPEATED,PureMenu::ByCommand,PureMenu::InsertFlags(PureMenu::ItemEnabled));
|
||
pureMenu.enableMenuItem(MENU_TABLATURE_PLAYRANGE,PureMenu::ByCommand,PureMenu::InsertFlags(PureMenu::ItemEnabled));
|
||
pureMenu.enableMenuItem(MENU_TABLATURE_STOP,PureMenu::ByCommand,PureMenu::InsertFlags(PureMenu::ItemGrayed|PureMenu::ItemDisabled));
|
||
}*/
|
||
|
||
|
||
/*
|
||
void GUIFretboard::createVirtualFretboard(void)
|
||
{
|
||
PurePalette systemPalette;
|
||
int xStart=LeftBorder;
|
||
int yStart=TopBorder;
|
||
int width=CellWidth;
|
||
int height=CellHeight;
|
||
|
||
size(mTuning.size());
|
||
systemPalette.systemPalette();
|
||
PureDevice pureDevice(*mParent);
|
||
for(int strIndex=0;strIndex<size();strIndex++)
|
||
{
|
||
int x=xStart;
|
||
Note note=mTuning[mTuning.size()-strIndex-1];
|
||
GuitarString &string=operator[](strIndex);
|
||
string.size(mFrets+1);
|
||
for(int frIndex=0;frIndex<mFrets+1;frIndex++)
|
||
{
|
||
Fret &fret=string[frIndex];
|
||
fret.setNote(note);
|
||
fret.setStatus(Fret::Active);
|
||
note++;
|
||
fret.setBoundingRect(Rect(x,yStart,x+width,yStart+height));
|
||
if(!frIndex)x+=width+3;
|
||
else x+=width;
|
||
}
|
||
yStart+=height;
|
||
}
|
||
mDIBitmap=::new DIBitmap(pureDevice,mParent->width(),mParent->height(),systemPalette);
|
||
mDIBitmap.disposition(PointerDisposition::Delete);
|
||
mDIBitmap->setBits(255);
|
||
}
|
||
*/
|
||
|
||
|
||
|
||
if(!getDocumentClass(String(STRING_FRETVIEWWINDOWCLASSNAME),fretWindow))return;
|
||
fretWindow->top();
|
||
|
||
|
||
|
||
|
||
#include <midiseq/midiout.hpp>
|
||
#include <guitar/Tablature.hpp>
|
||
/* MIDIOutputDevice midiDevice;
|
||
if(!midiDevice.openDevice())return 0;
|
||
Tablature tab("LaVilla.tab");
|
||
|
||
tab.setDelayAt(4,1000);
|
||
tab.setDelayAt(5,750);
|
||
tab.setDelayAt(8,1000);
|
||
tab.setDelayAt(9,750);
|
||
tab.setDelayAt(10,750);
|
||
tab.setDelayAt(11,750);
|
||
tab.setDelayAt(12,750);
|
||
// tab.setDelayAtAndThereafter(13,100);
|
||
tab.setDelayAtAndThereafter(13,250);
|
||
tab.setDelayAt(64,1500);
|
||
|
||
tab.play(midiDevice);
|
||
midiDevice.closeDevice();
|
||
return 0; */
|
||
|
||
|
||
// mMIDIDevice->midiEvent(ProgramChange(30).getEvent()); // 25
|
||
|
||
|
||
|
||
CallbackData::ReturnType TabPage::sizeHandler(CallbackData &someCallbackData)
|
||
{
|
||
outDebug("[TabPage::sizeHandler]ENTER");
|
||
if(isInPlay())isPaused(true);
|
||
Point sizePoint(someCallbackData.loWord(),someCallbackData.hiWord());
|
||
|
||
if(!sizePoint.x()||!sizePoint.y())return false;
|
||
update(*mParent);
|
||
if(!mDIBitmap.isOkay())return false;
|
||
// mScrollInfo.handleSize(someCallbackData); // bitmap creation handles this
|
||
if(isInPlay())isPaused(false);
|
||
outDebug("[TabPage::sizeHandler]LEAVE");
|
||
return false;
|
||
}
|
||
|
||
|
||
|
||
//bool Tablature::setDelayAtAndThereafter(int index,int delay)
|
||
//{
|
||
// for(;index<size();index++)setDelayAt(index,delay);
|
||
// return true;
|
||
//}
|
||
|
||
// bool setDelayAtAndThereafter(int index,int delay);
|
||
|
||
|
||
|
||
/*
|
||
if(!inFile.readLine(strLine))return false;
|
||
if(!(strLine.betweenString(0,'=')==String("TYPES")))return false;
|
||
strLine=strLine.betweenString('=',0);
|
||
char *ptr=strLine.str();
|
||
if(ptr)
|
||
{
|
||
ptr=::strtok(ptr,")");
|
||
while(true)
|
||
{
|
||
String str(ptr);
|
||
strIndex=str.betweenString('(',',');
|
||
strType=str.betweenString(',',0);
|
||
setTypeAt(strIndex.toInt(),NoteType().fromInt(strType.toInt()));
|
||
ptr=::strtok(0,")");
|
||
if(!ptr)break;
|
||
}
|
||
}
|
||
*/
|
||
|
||
|
||
// Rect cRect(10,30,17,17);
|
||
/* mDIBitmap->outlineRect(cRect);
|
||
cRect.left(cRect.left()+1);
|
||
cRect.right(cRect.right()-1);
|
||
cRect.top(cRect.top()+1);
|
||
cRect.bottom(cRect.bottom()-1);
|
||
mDIBitmap->colorRect(cRect,208); */
|
||
|
||
// Point cPoint(20,20);
|
||
/*
|
||
mDIBitmap->circle(100,cPoint,5,208);
|
||
mDIBitmap->circle(100,cPoint,4,208);
|
||
mDIBitmap->circle(100,cPoint,3,208);
|
||
mDIBitmap->circle(100,cPoint,2,208);
|
||
mDIBitmap->circle(100,cPoint,1,208); */
|
||
|
||
// WORD circle(WORD aspectValue,const Point &xyPoint,WORD radius,WORD palIndex);
|
||
|
||
|
||
|
||
// WORD roundRectangle(const Point &upperLeftPoint,const Point &lowerRightPoint,DWORD width,DWORD height);
|
||
|
||
|
||
// device.circle(cPoint,7,RGBColor(255,255,255));
|
||
// device.floodFill(cPoint,RGBColor(231,33,33),RGBColor(0,0,0));
|
||
|
||
//,5,RGBColor(231,33,33)
|
||
/*
|
||
WORD circle(Window &displayWindow,const Point &xyPoint,WORD radius,const RGBColor &someRGBColor)const;
|
||
WORD circle(const Point &xyPoint,WORD radius,const RGBColor &someRGBColor)const;
|
||
WORD crossHair(const Point &midPoint,WORD sectionlength,const Pen &somePen);
|
||
WORD crossHairs(PureVector<Point> &midPoints,WORD sectionLength,const Pen &somePen);
|
||
WORD crossHairs(PureVector<Point> &midPoints,WORD sectionLength,RGBColor rgbColor);
|
||
WORD floodFill(const Point &xyPoint,const RGBColor &fillColor,const RGBColor &boundaryColor)const;
|
||
*/
|
||
|
||
|
||
|
||
/*
|
||
void GUIFretboard::setNote(const TabEntry &entry)
|
||
{
|
||
int offsetWidth=mCellWidth/OutlineRatio;
|
||
int offsetHeight=mCellHeight/OutlineRatio;
|
||
|
||
clearNotes();
|
||
for(int index=0;index<entry.size();index++)
|
||
{
|
||
const FrettedNote &frettedNote=((TabEntry&)entry)[index];
|
||
GuitarString &guitarString=operator[]((size()-1)-frettedNote.getString());
|
||
FrettedBoundingNote &currFret=guitarString[frettedNote.getFret()];
|
||
const Rect &rect=currFret.getBoundingRect();
|
||
Rect fillRect(rect);
|
||
fillRect.left(rect.left()+offsetWidth);
|
||
fillRect.top(rect.top()+offsetHeight);
|
||
fillRect.right(rect.right()-offsetWidth);
|
||
fillRect.bottom(rect.bottom()-offsetHeight);
|
||
mActiveFrets.insert(currFret);
|
||
mDIBitmap->colorRect(fillRect,FillColorBlack);
|
||
mParent->invalidate(fillRect,false);
|
||
}
|
||
mParent->update();
|
||
}
|
||
*/
|
||
|
||
|
||
|
||
void GUIFretboard::createVirtualFretboard(void)
|
||
{
|
||
/*
|
||
SmartPointer<FrettedBoundingNote> activeFret;
|
||
PurePalette systemPalette;
|
||
int xStart=LeftBorder;
|
||
int yStart=TopBorder;
|
||
|
||
mCellWidth=(mParent->width()-(LeftBorder+RightBorder+StockBorder+WindowBorder))/mFrets;
|
||
mCellHeight=(mParent->height()-(TopBorder+BottomBorder+(WindowBorder/2)))/DefaultStrings;
|
||
size(mTuning.size());
|
||
systemPalette.systemPalette();
|
||
PureDevice pureDevice(*mParent);
|
||
for(int strIndex=0;strIndex<size();strIndex++)
|
||
{
|
||
int x=xStart;
|
||
Note note=mTuning[mTuning.size()-strIndex-1];
|
||
GuitarString &string=operator[](strIndex);
|
||
string.size(mFrets+1);
|
||
for(int frIndex=0;frIndex<mFrets+1;frIndex++)
|
||
{
|
||
FrettedBoundingNote &frettedBoundingNote=string[frIndex];
|
||
frettedBoundingNote.setNote(note);
|
||
frettedBoundingNote.setString(strIndex);
|
||
frettedBoundingNote.setFret(frIndex);
|
||
note++;
|
||
frettedBoundingNote.setBoundingRect(Rect(x,yStart,x+mCellWidth,yStart+mCellHeight));
|
||
if(mActiveFrets.searchItem(frettedBoundingNote,activeFret))
|
||
{
|
||
activeFret->setBoundingRect(frettedBoundingNote.getBoundingRect());
|
||
}
|
||
if(!frIndex)x+=mCellWidth+StockBorder;
|
||
else x+=mCellWidth;
|
||
}
|
||
yStart+=mCellHeight;
|
||
}
|
||
if(mDIBitmap.isOkay())mDIBitmap.destroy();
|
||
mDIBitmap=::new DIBitmap(pureDevice,mParent->width(),mParent->height(),systemPalette);
|
||
mDIBitmap.disposition(PointerDisposition::Delete);
|
||
mDIBitmap->setBits(255);
|
||
*/
|
||
|
||
SmartPointer<FrettedBoundingNote> activeFret;
|
||
// PurePalette systemPalette;
|
||
// int xStart=LeftBorder;
|
||
// int yStart=TopBorder;
|
||
|
||
// mCellWidth=(mParent->width()-(LeftBorder+RightBorder+StockBorder+WindowBorder))/mFrets;
|
||
// mCellHeight=(mParent->height()-(TopBorder+BottomBorder+(WindowBorder/2)))/DefaultStrings;
|
||
size(mTuning.size());
|
||
// systemPalette.systemPalette();
|
||
// PureDevice pureDevice(*mParent);
|
||
for(int strIndex=0;strIndex<size();strIndex++)
|
||
{
|
||
// int x=xStart;
|
||
Note note=mTuning[mTuning.size()-strIndex-1];
|
||
GuitarString &string=operator[](strIndex);
|
||
string.size(mFrets+1);
|
||
for(int frIndex=0;frIndex<mFrets+1;frIndex++)
|
||
{
|
||
FrettedBoundingNote &frettedBoundingNote=string[frIndex];
|
||
frettedBoundingNote.setNote(note);
|
||
frettedBoundingNote.setString(strIndex);
|
||
frettedBoundingNote.setFret(frIndex);
|
||
note++;
|
||
// frettedBoundingNote.setBoundingRect(Rect(x,yStart,x+mCellWidth,yStart+mCellHeight));
|
||
if(mActiveFrets.searchItem(frettedBoundingNote,activeFret))
|
||
{
|
||
// activeFret->setBoundingRect(frettedBoundingNote.getBoundingRect());
|
||
}
|
||
// if(!frIndex)x+=mCellWidth+StockBorder;
|
||
// else x+=mCellWidth;
|
||
}
|
||
// yStart+=mCellHeight;
|
||
}
|
||
// if(mDIBitmap.isOkay())mDIBitmap.destroy();
|
||
// mDIBitmap=::new DIBitmap(pureDevice,mParent->width(),mParent->height(),systemPalette);
|
||
// mDIBitmap.disposition(PointerDisposition::Delete);
|
||
// mDIBitmap->setBits(255);
|
||
|
||
|
||
|
||
PureDevice pureDevice(*mParent);
|
||
if(mDIBitmap.isOkay())mDIBitmap.destroy();
|
||
mDIBitmap=::new DIBitmap(pureDevice,(BitmapInfo&)*mResBitmap,(PurePalette&)*mResBitmap);
|
||
for(int row=0;row<mResBitmap->height();row++)
|
||
{
|
||
for(int col=0;col<mResBitmap->width();col++)
|
||
{
|
||
mDIBitmap->setByte(row,col,*(mResBitmap->ptrData()+((row*mResBitmap->width())+col)));
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
CallbackData::ReturnType TabPage::setFocusHandler(CallbackData &someCallbackData)
|
||
{
|
||
hasFocus(true);
|
||
if(!mMIDIDevice.isOkay())mMIDIDevice=::new MIDIOutputDevice();
|
||
if(!mMIDIDevice->hasDevice()&&!mMIDIDevice->openDevice())return false;
|
||
if(isInPlay())isPaused(false);
|
||
// mParent->setCapture();
|
||
return false;
|
||
}
|
||
|
||
CallbackData::ReturnType TabPage::killFocusHandler(CallbackData &someCallbackData)
|
||
{
|
||
GlobalDefs::outDebug("TabPage::killFocusHandler");
|
||
hasFocus(false);
|
||
if(isInPlay())isPaused(true);
|
||
if(!mMIDIDevice.isOkay()||!mMIDIDevice->hasDevice())return false;
|
||
mMIDIDevice->closeDevice();
|
||
if(isInOutline()&&!keepOutline())
|
||
{
|
||
GlobalDefs::outDebug("[TabPage::killFocusHandler] Clearing last update region");
|
||
isInOutline(false);
|
||
clearUpdate();
|
||
}
|
||
// mParent->releaseCapture();
|
||
return false;
|
||
}
|
||
|
||
CallbackData::ReturnType TabPage::mouseMoveHandler(CallbackData &someCallbackData)
|
||
{
|
||
int entryIndex;
|
||
Rect outlineRect;
|
||
Rect clientRect;
|
||
|
||
if(isInPlay()) // if we're playing the tab just let go of the capture
|
||
{
|
||
// mParent->releaseCapture();
|
||
return false;
|
||
}
|
||
// user is free-playing
|
||
Point mousePoint(someCallbackData.loWord(),someCallbackData.hiWord());
|
||
mParent->clientRect(clientRect);
|
||
if(!clientRect.ptInRect(mousePoint)) // user glides off the tab window
|
||
{
|
||
// mParent->releaseCapture(); // let go of the capture
|
||
if(isInOutline()) // are we in an outline??
|
||
{
|
||
clearUpdate(); // if so, clear the outline rectangle
|
||
isInOutline(false); // we're no longer outlining
|
||
}
|
||
return false; // return
|
||
}
|
||
// else if(!mParent->hasCapture())mParent->setCapture(); // user is moving withing the tab window, make sure we have the capture
|
||
if(!hasFocus()) // we're within the window, but we don't have focus
|
||
{
|
||
if(isInOutline()) // are we outlining a rectangle??
|
||
{
|
||
clearUpdate(); // if so, clear the update
|
||
isInOutline(false); // we're no longer outlining
|
||
}
|
||
// if(mParent->hasCapture())mParent->releaseCapture(); // if we've got the capture, then let it go
|
||
return false; // we're done with this mouse movement
|
||
}
|
||
mousePoint.x(mousePoint.x()+mScrollInfo.currScrollx());
|
||
mousePoint.y(mousePoint.y()+mScrollInfo.currScrolly());
|
||
if(getOutlineRect(mousePoint,entryIndex,outlineRect))
|
||
{
|
||
isInOutline(true);
|
||
currEntryIndex(entryIndex);
|
||
bringOutlineIntoView(outlineRect,clientRect);
|
||
if(this->outlineRect(outlineRect))
|
||
{
|
||
TabEntry &entry=mTabEntries[entryIndex];
|
||
showFretEntry(entry);
|
||
if(mMIDIDevice.isOkay()&&mMIDIDevice->hasDevice())entry.play(*mMIDIDevice,0,false);
|
||
}
|
||
}
|
||
else if(isInOutline())
|
||
{
|
||
isInOutline(false);
|
||
clearUpdate();
|
||
}
|
||
return false;
|
||
}
|
||
|
||
|
||
|
||
|
||
CallbackData::ReturnType TabPage::setFocusHandler(CallbackData &someCallbackData)
|
||
{
|
||
hasFocus(true);
|
||
if(!mMIDIDevice.isOkay())mMIDIDevice=::new MIDIOutputDevice();
|
||
if(!mMIDIDevice->hasDevice()&&!mMIDIDevice->openDevice())return false;
|
||
if(isInPlay())isPaused(false);
|
||
// mParent->setCapture();
|
||
return false;
|
||
}
|
||
|
||
CallbackData::ReturnType TabPage::killFocusHandler(CallbackData &someCallbackData)
|
||
{
|
||
GlobalDefs::outDebug("TabPage::killFocusHandler");
|
||
hasFocus(false);
|
||
if(isInPlay())isPaused(true);
|
||
if(!mMIDIDevice.isOkay()||!mMIDIDevice->hasDevice())return false;
|
||
mMIDIDevice->closeDevice();
|
||
if(isInOutline()&&!keepOutline())
|
||
{
|
||
GlobalDefs::outDebug("[TabPage::killFocusHandler] Clearing last update region");
|
||
isInOutline(false);
|
||
clearUpdate();
|
||
}
|
||
// mParent->releaseCapture();
|
||
return false;
|
||
}
|
||
|
||
CallbackData::ReturnType TabPage::mouseMoveHandler(CallbackData &someCallbackData)
|
||
{
|
||
int entryIndex;
|
||
Rect outlineRect;
|
||
Rect clientRect;
|
||
|
||
if(isInPlay()) // if we're playing the tab just let go of the capture
|
||
{
|
||
// mParent->releaseCapture();
|
||
return false;
|
||
}
|
||
// user is free-playing
|
||
Point mousePoint(someCallbackData.loWord(),someCallbackData.hiWord());
|
||
mParent->clientRect(clientRect);
|
||
if(!clientRect.ptInRect(mousePoint)) // user glides off the tab window
|
||
{
|
||
// mParent->releaseCapture(); // let go of the capture
|
||
if(isInOutline()) // are we in an outline??
|
||
{
|
||
clearUpdate(); // if so, clear the outline rectangle
|
||
isInOutline(false); // we're no longer outlining
|
||
}
|
||
return false; // return
|
||
}
|
||
// else if(!mParent->hasCapture())mParent->setCapture(); // user is moving withing the tab window, make sure we have the capture
|
||
if(!hasFocus()) // we're within the window, but we don't have focus
|
||
{
|
||
if(isInOutline()) // are we outlining a rectangle??
|
||
{
|
||
clearUpdate(); // if so, clear the update
|
||
isInOutline(false); // we're no longer outlining
|
||
}
|
||
// if(mParent->hasCapture())mParent->releaseCapture(); // if we've got the capture, then let it go
|
||
return false; // we're done with this mouse movement
|
||
}
|
||
mousePoint.x(mousePoint.x()+mScrollInfo.currScrollx());
|
||
mousePoint.y(mousePoint.y()+mScrollInfo.currScrolly());
|
||
if(getOutlineRect(mousePoint,entryIndex,outlineRect))
|
||
{
|
||
isInOutline(true);
|
||
currEntryIndex(entryIndex);
|
||
bringOutlineIntoView(outlineRect,clientRect);
|
||
if(this->outlineRect(outlineRect))
|
||
{
|
||
TabEntry &entry=mTabEntries[entryIndex];
|
||
showFretEntry(entry);
|
||
if(mMIDIDevice.isOkay()&&mMIDIDevice->hasDevice())entry.play(*mMIDIDevice,0,false);
|
||
}
|
||
}
|
||
else if(isInOutline())
|
||
{
|
||
isInOutline(false);
|
||
clearUpdate();
|
||
}
|
||
return false;
|
||
}
|
||
|
||
|
||
// mChordList->insertString(strResource.betweenString(0,'[').+strResource.betweenString(']',0));
|
||
// mChordList->insertString(strResource.betweenString(0,'[')+String("(")+strResource.betweenString('(',')')+String(")"));
|
||
|
||
|
||
|
||
int LineParser::getElement(int &num)
|
||
{
|
||
char ch;
|
||
num=-1;
|
||
if(mPosition>=mLength)return -1;
|
||
ch=charAt(mPosition++);
|
||
if(::isdigit(ch))num=ch-48;
|
||
else if(::isalpha(ch))
|
||
{
|
||
if('o'==ch||'O'==ch)num=0; // instead of zero some tabs have an alpha 'O' - for (O)pen.
|
||
else if('p'==ch||'P'==ch)return 0; // pull-off
|
||
else if('b'==ch||'B'==ch)return 0; // bend
|
||
else if('h'==ch||'H'==ch)return 0; // hammer-on
|
||
else if('r'==ch||'R'==ch)return 0; // release previous bend
|
||
else return 0; // or any other inflections yet.
|
||
}
|
||
else if('\\'==ch)return 0; // slide-down
|
||
else if('/'==ch)return 0; // slide-up
|
||
else if('^'==ch)return 0; // bend
|
||
else return 0;
|
||
ch=charAt(mPosition);
|
||
if(!::isdigit(ch))return 1;
|
||
mPosition++;
|
||
num=(num*10)+(ch-48);
|
||
return 1;
|
||
}
|
||
|
||
|
||
int getElement(int &num);
|
||
|
||
|
||
|
||
/*
|
||
// if(validate(element[0]))
|
||
// {
|
||
// if(Element::Pick==element[0].getAction()&&Fretboard::isValidFret(element[0].getFret()))
|
||
// {
|
||
// FrettedNote frettedNote(fretboard.getAt(5,element[0].getFret()),5,element[0].getFret());
|
||
// entry.insert(&frettedNote);
|
||
entry.insert(&FrettedNote(fretboard.getAt(5,element[0].getFret()),5,element[0].getFret()));
|
||
}
|
||
if(validate(element[1]))
|
||
{
|
||
// if(Element::Pick==element[1].getAction()&&Fretboard::isValidFret(element[1].getFret()))
|
||
// {
|
||
// FrettedNote frettedNote(fretboard.getAt(4,element[1].getFret()),4,element[1].getFret());
|
||
// entry.insert(&frettedNote);
|
||
entry.insert(&FrettedNote(fretboard.getAt(4,element[1].getFret()),4,element[1].getFret()));
|
||
}
|
||
if(validate(element[2]))
|
||
{
|
||
// if(Element::Pick==element[2].getAction()&&Fretboard::isValidFret(element[2].getFret()))
|
||
// {
|
||
// FrettedNote frettedNote(fretboard.getAt(3,element[2].getFret()),3,element[2].getFret());
|
||
// entry.insert(&frettedNote);
|
||
entry.insert(&FrettedNote(fretboard.getAt(3,element[2].getFret()),3,element[2].getFret()));
|
||
}
|
||
// if(Element::Pick==element[3].getAction()&&Fretboard::isValidFret(element[3].getFret()))
|
||
// {
|
||
// FrettedNote frettedNote(fretboard.getAt(2,element[3].getFret()),2,element[3].getFret());
|
||
// entry.insert(&frettedNote);
|
||
entry.insert(&FrettedNote(fretboard.getAt(2,element[3].getFret()),2,element[3].getFret()));
|
||
// }
|
||
// if(Element::Pick==element[4].getAction()&&Fretboard::isValidFret(element[4].getFret()))
|
||
// {
|
||
// FrettedNote frettedNote(fretboard.getAt(1,element[4].getFret()),1,element[4].getFret());
|
||
// entry.insert(&frettedNote);
|
||
entry.insert(&FrettedNote(fretboard.getAt(1,element[4].getFret()),1,element[4].getFret()));
|
||
// }
|
||
// if(Element::Pick==element[5].getAction()&&Fretboard::isValidFret(element[5].getFret()))
|
||
// {
|
||
// FrettedNote frettedNote(fretboard.getAt(0,element[5].getFret()),0,element[5].getFret());
|
||
// entry.insert(&frettedNote);
|
||
entry.insert(&FrettedNote(fretboard.getAt(0,element[5].getFret()),0,element[5].getFret()));
|
||
// }
|
||
*/
|
||
|
||
|
||
|
||
void TabLines::synchronize(void)
|
||
{
|
||
int maxPos;
|
||
int index;
|
||
|
||
for(index=0;index<NumLines;index++)
|
||
{
|
||
if(!index)maxPos=operator[](0).getPosition();
|
||
if(operator[](index).getPosition()>maxPos)maxPos=operator[](index).getPosition();
|
||
}
|
||
for(index=0;index<NumLines;index++)
|
||
{
|
||
while(operator[](index).getPosition()!=maxPos)(operator[](index))++;
|
||
}
|
||
|
||
/*
|
||
maxPos=operator[](0).getPosition();
|
||
if(operator[](1).getPosition()>maxPos)maxPos=operator[](1).getPosition();
|
||
if(operator[](2).getPosition()>maxPos)maxPos=operator[](2).getPosition();
|
||
if(operator[](3).getPosition()>maxPos)maxPos=operator[](3).getPosition();
|
||
if(operator[](4).getPosition()>maxPos)maxPos=operator[](4).getPosition();
|
||
if(operator[](5).getPosition()>maxPos)maxPos=operator[](5).getPosition();
|
||
while(operator[](0).getPosition()!=maxPos)(operator[](0))++;
|
||
while(operator[](1).getPosition()!=maxPos)(operator[](1))++;
|
||
while(operator[](2).getPosition()!=maxPos)(operator[](2))++;
|
||
while(operator[](3).getPosition()!=maxPos)(operator[](3))++;
|
||
while(operator[](4).getPosition()!=maxPos)(operator[](4))++;
|
||
while(operator[](5).getPosition()!=maxPos)(operator[](5))++;
|
||
*/
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
/*
|
||
bool Tablature::isTabLine(const String &strLine,int &startElement)const
|
||
{
|
||
int lineLength=strLine.length();
|
||
char charAt0
|
||
|
||
if(lineLength>=2&&(strLine.charAt(0)=='e'||strLine.charAt(0)=='E')&&(strLine.charAt(1)==':'||strLine.charAt(1)=='|'))
|
||
{
|
||
startElement=2;
|
||
return true;
|
||
}
|
||
if(lineLength>=2&&strLine.charAt(0)=='|'&&strLine.charAt(1)=='-')
|
||
{
|
||
startElement=1;
|
||
return true;
|
||
}
|
||
if(lineLength>=2&&strLine.charAt(0)==':'&&(::isalnum(strLine.charAt(1))||strLine.charAt(1)=='-'))
|
||
{
|
||
startElement=1;
|
||
return true;
|
||
}
|
||
if(lineLength>=2&&strLine.charAt(0)==':'&&strLine.charAt(1)=='-')
|
||
{
|
||
startElement=1;
|
||
return true;
|
||
}
|
||
if(lineLength>=3&&strLine.charAt(0)=='E'&&strLine.charAt(1)==' '&&strLine.charAt(2)=='-')
|
||
{
|
||
startElement=2;
|
||
return true;
|
||
}
|
||
if(lineLength>=1&&strLine.charAt(0)=='-')
|
||
{
|
||
startElement=0;
|
||
return true;
|
||
}
|
||
if(lineLength>=5&&strLine.charAt(0)==' '&&strLine.charAt(1)==' '&&(strLine.charAt(2)=='E'||strLine.charAt(2)=='e')&&strLine.charAt(3)==' '&&strLine.charAt(4)=='|')
|
||
{
|
||
startElement=5;
|
||
return true;
|
||
}
|
||
if(lineLength>=2&&strLine.charAt(0)==' '&&strLine.charAt(1)=='|')
|
||
{
|
||
startElement=2;
|
||
return true;
|
||
}
|
||
if(lineLength>=2&&strLine.charAt(0)==' '&&strLine.charAt(1)=='-')
|
||
{
|
||
startElement=1;
|
||
return true;
|
||
}
|
||
if(lineLength>=4&&strLine.charAt(0)==' '&&strLine.charAt(1)==' '&&strLine.charAt(2)=='I'&&strLine.charAt(3)=='-')
|
||
{
|
||
startElement=3;
|
||
return true;
|
||
}
|
||
if(lineLength>=3&&strLine.charAt(0)==' '&&strLine.charAt(1)=='E'&&strLine.charAt(2)=='-')
|
||
{
|
||
startElement=2;
|
||
return true;
|
||
}
|
||
if(lineLength>=2&&strLine.charAt(0)=='E'&&strLine.charAt(1)=='-')
|
||
{
|
||
startElement=1;
|
||
return true;
|
||
}
|
||
if(lineLength>=3&&strLine.charAt(0)=='E'&&strLine.charAt(1)==' '&&strLine.charAt(2)=='|'&&strLine.charAt(3)=='-')
|
||
{
|
||
startElement=2;
|
||
return true;
|
||
}
|
||
if(lineLength>=3&&strLine.charAt(0)=='E'&&strLine.charAt(1)==' '&&strLine.charAt(2)=='|'&&strLine.charAt(3)=='-')
|
||
{
|
||
startElement=2;
|
||
return true;
|
||
}
|
||
if(lineLength>=3&&strLine.charAt(0)=='e'&&strLine.charAt(1)==']'&&strLine.charAt(2)=='-')
|
||
{
|
||
startElement=2;
|
||
return true;
|
||
}
|
||
if(lineLength>=3&&strLine.charAt(0)==':'&&strLine.charAt(1)==' '&&strLine.charAt(2)=='-')
|
||
{
|
||
startElement=2;
|
||
return true;
|
||
}
|
||
if(lineLength>=3&&strLine.charAt(0)==' '&&strLine.charAt(1)==' '&&strLine.charAt(2)=='-')
|
||
{
|
||
startElement=2;
|
||
return true;
|
||
}
|
||
if(lineLength>=3&&::isdigit(strLine.charAt(0))&&strLine.strstr("-"))
|
||
{
|
||
startElement=0;
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
*/
|
||
|
||
|
||
|
||
|
||
|
||
|
||
int LineParser::getElement(Element &element)
|
||
{
|
||
char ch;
|
||
|
||
element.setFret(-1);
|
||
element.setAction(Action::None);
|
||
if(mPosition>=mLength)return -1;
|
||
ch=charAt(mPosition++);
|
||
if(::isdigit(ch)&&(ch>='0'&&ch<='9'))
|
||
{
|
||
element.setAction(Action::Pick);
|
||
element.setFret(ch-48);
|
||
}
|
||
else if(::isalpha(ch))
|
||
{
|
||
if('o'==ch||'O'==ch) // instead of zero some tabs have an alpha 'O' - for (O)pen.
|
||
{
|
||
element.setAction(Action::Pick);
|
||
element.setFret(0);
|
||
return 1;
|
||
}
|
||
else if('p'==ch||'P'==ch) // pull-off
|
||
{
|
||
int result=getElement(element); // fetch the next element, this is what we are pulling into
|
||
if(1!=result)return result; // if we didn't get anything return;
|
||
element.setAction(Action::PullOff); // set action to pull-off
|
||
return result;
|
||
|
||
// element.setAction(Element::PullOff); // pull-off
|
||
// element.setFret(-1); // references previous note
|
||
// return 0; // return not-handled
|
||
}
|
||
else if('b'==ch||'B'==ch) // Bend
|
||
{
|
||
int result=getElement(element); // fetch the next element, this is what we are bending into
|
||
if(1!=result)return result; // if we didn't get anything return;
|
||
element.setAction(Action::Bend); // set action to bend
|
||
return result;
|
||
|
||
// element.setAction(Action::Bend); // bend
|
||
// element.setFret(-1); // references next note
|
||
// return 0; // return not-handled
|
||
}
|
||
else if('h'==ch||'H'==ch) // hammer-on
|
||
{
|
||
int result=getElement(element); // fetch the next element, this is what we are hammering
|
||
if(1!=result)return result; // if we didn't get anything return;
|
||
element.setAction(Action::HammerOn); // set action to hammer-on
|
||
return result;
|
||
|
||
// element.setAction(Element::HammerOn); // hammer-on
|
||
// element.setFret(-1); // references next note
|
||
// return 0; // return not-handled
|
||
}
|
||
else if('r'==ch||'R'==ch) // Release(bend) into this note
|
||
{
|
||
int result=getElement(element); // fetch the next element, this is what we are releasing into
|
||
if(1!=result)return result; // if we didn't get anything return;
|
||
element.setAction(Action::Release); // set action to Release
|
||
return result;
|
||
}
|
||
else if('s'==ch||'S'==ch) // Slide
|
||
{
|
||
int result=getElement(element); // fetch the next element, this is what we are sliding
|
||
if(1!=result)return result; // if we didn't get anything return;
|
||
element.setAction(Action::SlideUp); // set action to SlideUp
|
||
return result;
|
||
}
|
||
else
|
||
{
|
||
element.setAction(Action::None); // invalid entry
|
||
element.setFret(-1); // no referenced note
|
||
return 0; // return not-handled
|
||
}
|
||
}
|
||
else if('^'==ch) // Bend
|
||
{
|
||
int result=getElement(element); // fetch the next element, this is what we are bending into
|
||
if(1!=result)return result; // if we didn't get anything return;
|
||
element.setAction(Action::Bend); // set action to bend
|
||
return result;
|
||
}
|
||
else if('\\'==ch)
|
||
{
|
||
int result=getElement(element); // fetch the next element, this is what we are sliding
|
||
if(1!=result)return result; // if we didn't get anything return;
|
||
element.setAction(Action::SlideDown); // set action to SlideDown
|
||
return result;
|
||
|
||
// element.setAction(Action::SlideDown); // slide down
|
||
// element.setFret(-1); // no referenced fret
|
||
// return 0; // return not-handled
|
||
}
|
||
else if('/'==ch)
|
||
{
|
||
int result=getElement(element); // fetch the next element, this is what we are sliding
|
||
if(1!=result)return result; // if we didn't get anything return;
|
||
element.setAction(Action::SlideUp); // set action to SlideUp
|
||
return result;
|
||
|
||
// element.setAction(Action::SlideUp); // slide up
|
||
// element.setFret(-1); // no referenced fret
|
||
// return 0; // return not-handled
|
||
}
|
||
else
|
||
{
|
||
element.setAction(Action::None); // invalid entry
|
||
element.setFret(-1); // no referenced note
|
||
return 0; // return not-handled
|
||
}
|
||
ch=charAt(mPosition);
|
||
if(!::isdigit(ch))
|
||
{
|
||
element.setAction(Action::Pick); // fretted note
|
||
return 1; // return handled
|
||
}
|
||
mPosition++;
|
||
element.setFret((element.getFret()*10)+(ch-48));
|
||
return 1; // return handled
|
||
}
|
||
|
||
|
||
|
||
bool TabLines::haveElement(TabElement &elements)const
|
||
{
|
||
for(int index=0;index<NumLines;index++)
|
||
{
|
||
Element &element=elements[index];
|
||
if(Action::None!=element.getAction())return true;
|
||
// if(Action::Pick==element.getAction()||
|
||
// Action::HammerOn==element.getAction()||
|
||
// Action::PullOff==element.getAction()||
|
||
// Action::SlideDown==element.getAction()||
|
||
// Action::SlideUp==element.getAction()||
|
||
// Action::Bend==element.getAction()||
|
||
// Action::Release==element.getAction())return true;
|
||
}
|
||
return false;
|
||
}
|
||
|
||
bool TabLines::validate(Element &element)const
|
||
{
|
||
if(Fretboard::isValidFret(element.getFret())&&
|
||
Action::None!=element.getAction())return true;
|
||
|
||
// (Action::Pick==element.getAction()||
|
||
// Action::HammerOn==element.getAction()||
|
||
// Action::PullOff==element.getAction()||
|
||
// Action::SlideDown==element.getAction()||
|
||
// Action::SlideUp==element.getAction()||
|
||
// Action::Bend==element.getAction()||
|
||
// Action::Release==element.getAction()))return true;
|
||
|
||
// typedef enum Attribute{None,};
|
||
|
||
|
||
return false;
|
||
}
|
||
|
||
|
||
|
||
int TabLines::firstElement(TabEntry &entry,Fretboard &fretboard)
|
||
{
|
||
TabElement element;
|
||
|
||
entry.remove();
|
||
for(int index=0;index<NumLines;index++)
|
||
{
|
||
operator[](index).reset();
|
||
if(-1==operator[](index).getElement(element[index]))return -1;
|
||
}
|
||
|
||
// operator[](0).reset();
|
||
// operator[](1).reset();
|
||
// operator[](2).reset();
|
||
// operator[](3).reset();
|
||
// operator[](4).reset();
|
||
// operator[](5).reset();
|
||
// if(-1==operator[](0).getElement(element[0]))return -1;
|
||
// if(-1==operator[](1).getElement(element[1]))return -1;
|
||
// if(-1==operator[](2).getElement(element[2]))return -1;
|
||
// if(-1==operator[](3).getElement(element[3]))return -1;
|
||
// if(-1==operator[](4).getElement(element[4]))return -1;
|
||
// if(-1==operator[](5).getElement(element[5]))return -1;
|
||
if(!haveElement(element))return 0;
|
||
synchronize();
|
||
insert(entry,element,fretboard);
|
||
return 1;
|
||
}
|
||
|
||
int TabLines::nextElement(TabEntry &entry,Fretboard &fretboard)
|
||
{
|
||
TabElement element;
|
||
|
||
entry.remove();
|
||
for(int index=0;index<NumLines;index++)
|
||
if(-1==operator[](index).getElement(element[index]))return -1;
|
||
|
||
// if(-1==operator[](0).getElement(element[0]))return -1;
|
||
// if(-1==operator[](1).getElement(element[1]))return -1;
|
||
// if(-1==operator[](2).getElement(element[2]))return -1;
|
||
// if(-1==operator[](3).getElement(element[3]))return -1;
|
||
// if(-1==operator[](4).getElement(element[4]))return -1;
|
||
// if(-1==operator[](5).getElement(element[5]))return -1;
|
||
|
||
if(!haveElement(element))return 0;
|
||
synchronize();
|
||
insert(entry,element,fretboard);
|
||
return 1;
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
#include <midiseq/midiout.hpp>
|
||
#include <midiseq/note.hpp>
|
||
#include <midiseq/ProgramChange.hpp>
|
||
#include <midiseq/ChannelModeMessage.hpp>
|
||
#include <guitar/IonianScale.hpp>
|
||
|
||
/* MIDIOutputDevice midiDevice;
|
||
|
||
// 0 acoustic grand piano
|
||
// 1 bright acoustic piano
|
||
// 2 electric grand piano
|
||
// 24 acoustic guitar nylon
|
||
// 25 acoustic guitar steel
|
||
// 26 jazz electric
|
||
// 27 clean electric
|
||
// 28 muted electric
|
||
// 29 overdriven guitar
|
||
// 30 distorted guitar
|
||
|
||
|
||
// for(int index=51;index<127;index++)
|
||
// {
|
||
int index=2;
|
||
midiDevice.midiEvent(ChannelModeMessage(ChannelModeMessage::Sustain).getEvent(0,0,-127));
|
||
// midiDevice.midiEvent(ChannelModeMessage(ChannelModeMessage::AllNotesOff).getEvent());
|
||
|
||
|
||
midiDevice.midiEvent(ProgramChange(index).getEvent());
|
||
IonianScale scale(Note::C);
|
||
scale.play(midiDevice);
|
||
// }
|
||
return 0; */
|
||
|
||
|
||
|
||
|
||
inline
|
||
void TabEntry::delay(int offsetDelay)
|
||
{
|
||
int actualDelay=Timing::getDelay(mNoteType);
|
||
// int actualDelay=Timing::getDelay(mNoteType)-offsetDelay;
|
||
// if(actualDelay<=0)return;
|
||
GlobalDefs::outDebug("[TabEntry::delay]"+String().fromInt(actualDelay));
|
||
::Sleep(actualDelay);
|
||
}
|
||
|
||
|
||
|
||
|
||
CallbackData::ReturnType TabPage::mouseMoveHandler(CallbackData &someCallbackData)
|
||
{
|
||
int entryIndex;
|
||
Rect outlineRect;
|
||
Rect clientRect;
|
||
|
||
if(isInPlay())return false;
|
||
// user is free-playing
|
||
Point mousePoint(someCallbackData.loWord(),someCallbackData.hiWord());
|
||
mParent->clientRect(clientRect);
|
||
if(!clientRect.ptInRect(mousePoint)) // user glides off the tab window
|
||
{
|
||
if(isInOutline()) // are we in an outline??
|
||
{
|
||
clearUpdate(); // if so, clear the outline rectangle
|
||
isInOutline(false); // we're no longer outlining
|
||
// mMIDIDevice->clearNotes(); // smk
|
||
}
|
||
return false; // return
|
||
}
|
||
if(!hasFocus()) // we're within the window, but we don't have focus
|
||
{
|
||
if(isInOutline()) // are we outlining a rectangle??
|
||
{
|
||
clearUpdate(); // if so, clear the update
|
||
isInOutline(false); // we're no longer outlining
|
||
// mMIDIDevice->clearNotes(); // smk
|
||
}
|
||
return false; // we're done with this mouse movement
|
||
}
|
||
mousePoint.x(mousePoint.x()+mScrollInfo.currScrollx());
|
||
mousePoint.y(mousePoint.y()+mScrollInfo.currScrolly());
|
||
if(getOutlineRect(mousePoint,entryIndex,outlineRect))
|
||
{
|
||
isInOutline(true);
|
||
currEntryIndex(entryIndex);
|
||
bringOutlineIntoView(outlineRect,clientRect);
|
||
if(this->outlineRect(outlineRect))
|
||
{
|
||
TabEntry &entry=mTabEntries[entryIndex];
|
||
showFretEntry(entry);
|
||
// mMIDIDevice->clearNotes(); // smk
|
||
if(mMIDIDevice.isOkay()&&mMIDIDevice->hasDevice())entry.play(mMIDIDevice->getDevice(),false);
|
||
}
|
||
}
|
||
else if(isInOutline())
|
||
{
|
||
isInOutline(false);
|
||
clearUpdate();
|
||
// mMIDIDevice->clearNotes(); // smk
|
||
}
|
||
return false;
|
||
}
|
||
|
||
|
||
|
||
// void parseTiming(const String &strLine);
|
||
// else if(strLine.betweenString(0,'=')==String("TEMPO"))parseTiming(strLine);
|
||
//void Tablature::parseTiming(const String &strLine)
|
||
//{
|
||
// Timing::microsecondsPerQuarterNote(strLine.betweenString('=',0).toInt());
|
||
//}
|
||
// outFile.writeLine(String("TEMPO=")+String().fromInt(Timing::microsecondsPerQuarterNote()));
|
||
|
||
|
||
|
||
/*bool TabPage::insert(const TabEntry &entry)
|
||
{
|
||
mTabEntries.insert(&entry);
|
||
return true;
|
||
}*/
|
||
|
||
/*void TabPage::remove(const TabEntry &entry)
|
||
{
|
||
bool removed=false;
|
||
for(int index=0;index<mTabEntries.size();index++)
|
||
{
|
||
if(mTabEntries[index]==entry)
|
||
{
|
||
mTabEntries.remove(index);
|
||
removed=true;
|
||
index=-1;
|
||
}
|
||
}
|
||
}
|
||
*/
|
||
|
||
|
||
/*
|
||
|
||
// void handleShow(void);
|
||
|
||
void ScaleDialog::handleShow(void)
|
||
{
|
||
TabEntry entry;
|
||
|
||
FrettedNote note(Note(Note::C),3,3);
|
||
entry.insert(¬e);
|
||
CallbackData cbData(0,(DWORD)&entry);
|
||
mPlayNoteHandler.callback(cbData);
|
||
}
|
||
*/
|
||
|
||
|
||
|
||
void ScaleDialog::showScale(const Scale &scale)
|
||
{
|
||
bool map;
|
||
|
||
map=sendMessage(SCALEDLG_MAPOVERFRETBOARD,BM_GETCHECK,0,0L);
|
||
if(map)
|
||
{
|
||
CallbackData cbData(2,(LPARAM)&scale);
|
||
mPlayNoteHandler.callback(cbData);
|
||
}
|
||
else
|
||
{
|
||
Fingering fingering;
|
||
FrettedNotes frettedNotes=fingering.getFingering(scale);
|
||
CallbackData cbData(3,(LPARAM)&frettedNotes);
|
||
mPlayNoteHandler.callback(cbData);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
bool getPrinters(void);
|
||
bool getPrinter(String &strPrinterKey,Printer &printer);
|
||
|
||
Block<Printer> mPrinters;
|
||
|
||
bool getPrinters(void)
|
||
{
|
||
String strPrinterKey("System\\CurrentControlSet\\Control\\Print\\Printers");
|
||
String strDefaultPrinter;
|
||
// RegKey cfgKey(RegKey::CurrentConfig);
|
||
RegKey cfgKey(RegKey::LocalMachine);
|
||
Printer printer;
|
||
String strPrinter;
|
||
int enumKey(0);
|
||
|
||
mPrinters.remove();
|
||
if(!cfgKey.openKey(strPrinterKey))return FALSE;
|
||
cfgKey.queryValue("Default",strDefaultPrinter);
|
||
// if(getPrinter(strPrinterKey+String("\\")+strDefaultPrinter,printer))mDefaultPrinter=printer;
|
||
while(TRUE)
|
||
{
|
||
if(!cfgKey.enumKey(enumKey++,strPrinter))break;
|
||
if(getPrinter(strPrinterKey+String("\\")+strPrinter,printer))mPrinters.insert(&printer);
|
||
}
|
||
cfgKey.closeKey();
|
||
return TRUE;
|
||
}
|
||
|
||
bool getPrinter(String &strPrinterKey,Printer &printer)
|
||
{
|
||
RegKey mchKey(RegKey::LocalMachine);
|
||
String strPrinterNameKey("Name");
|
||
String strPrinterDriverKey("Printer Driver");
|
||
String strPrinterPortKey("Port");
|
||
String strQuery;
|
||
|
||
if(!mchKey.openKey(strPrinterKey))return FALSE;
|
||
mchKey.queryValue(strPrinterNameKey,strQuery);
|
||
printer.printerName(strQuery);
|
||
mchKey.queryValue(strPrinterDriverKey,strQuery);
|
||
printer.driverName(strQuery);
|
||
mchKey.queryValue(strPrinterPortKey,strQuery);
|
||
printer.portName(strQuery);
|
||
mchKey.closeKey();
|
||
return TRUE;
|
||
}
|
||
|
||
|
||
getPrinters();
|
||
return 0;
|
||
|
||
|
||
#include <printman/printman.hpp>
|
||
#include <common/regkey.hpp>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
/*
|
||
void GUIFretboard::prepareDevice(PureDevice &device,bool prepare)
|
||
{
|
||
if(prepare)
|
||
{
|
||
mPrevBrush=::SelectObject(device.getDC(),(GDIObj)mRedBrush);
|
||
if(getShowNotes())
|
||
{
|
||
mPrevFont=::SelectObject(device.getDC(),(GDIObj)mTextFont);
|
||
mPrevBkMode=device.setBkMode(PureDevice::Transparent);
|
||
mPrevTextColor=device.setTextColor(RGBColor(255,255,255));
|
||
}
|
||
}
|
||
else
|
||
{
|
||
::SelectObject(device.getDC(),mPrevBrush);
|
||
::SelectObject(device.getDC(),mPrevFont);
|
||
device.setBkMode(PureDevice::BkMode(mPrevBkMode));
|
||
device.setTextColor(mPrevTextColor);
|
||
}
|
||
}
|
||
*/
|
||
|
||
|
||
|
||
|
||
#include <guitar/notes.hpp>
|
||
#include <guitar/scales.hpp>
|
||
#include <guitar/GlobalDefs.hpp>
|
||
|
||
Note degreeI;
|
||
Note degreeIII;
|
||
Note degreeV;
|
||
Note degreeVII;
|
||
IonianScale ionianScale(Note::G);
|
||
degreeI=ionianScale.getDegree(Scale::I);
|
||
degreeIII=ionianScale.getDegree(Scale::III);
|
||
degreeV=ionianScale.getDegree(Scale::V);
|
||
degreeVII=ionianScale.getDegree(Scale::VII);
|
||
GlobalDefs::outDebug(String("I:")+degreeI.toString());
|
||
GlobalDefs::outDebug(String("III:")+degreeIII.toString());
|
||
GlobalDefs::outDebug(String("V:")+degreeV.toString());
|
||
GlobalDefs::outDebug(String("VII:")+degreeVII.toString());
|
||
|
||
// return 0;
|
||
|
||
|
||
// STRING_21747 "G or Gmaj [x 10 12 12 12 10] (D G B)"
|
||
|
||
|
||
/* Notes notes;
|
||
notes.size(3);
|
||
notes[0]=Note::D;
|
||
notes[1]=Note::CSh;
|
||
notes[2]=Note::A;
|
||
GlobalDefs::outDebug(notes.toString());
|
||
notes.sort();
|
||
GlobalDefs::outDebug(notes.toString());
|
||
*/
|
||
|
||
|
||
|
||
CallbackData::ReturnType TabPage::leftButtonDownHandler(CallbackData &someCallbackData)
|
||
{
|
||
if(isInPlay())
|
||
{
|
||
setCancelled(true);
|
||
return false;
|
||
}
|
||
|
||
|
||
/*
|
||
TabDialog tabDialog;
|
||
|
||
GlobalDefs::outDebug("TabPage::leftButtonDownHandler");
|
||
if(isInPlay())setCancelled(true);
|
||
|
||
if(!isInOutline()||isInPlay())return false;
|
||
Point mousePoint(someCallbackData.loWord(),someCallbackData.hiWord());
|
||
TabEntry &entry=mTabEntries[currEntryIndex()];
|
||
keepOutline(true);
|
||
if(tabDialog.perform(*mParent,mTabEntries,currEntryIndex(),mousePoint))isDirty(true);
|
||
keepOutline(false);
|
||
GDIPoint point(mousePoint.x(),mousePoint.y());
|
||
mParent->clientToScreen(point);
|
||
::SetCursorPos(point.x(),point.y());
|
||
*/
|
||
return false;
|
||
}
|
||
|
||
|
||
|
||
/*
|
||
GlobalDefs::outDebug(ptr);
|
||
String strItem=ptr;
|
||
char *pItem=strItem.str();
|
||
|
||
FrettedNote frettedNote;
|
||
|
||
pItem=::strtok(pItem,"=");
|
||
pItem=::strtok(0," ");
|
||
frettedNote.setString(::atoi(pItem));
|
||
|
||
|
||
|
||
|
||
pItem=::strtok(0,"=");
|
||
pItem=::strtok(0," ");
|
||
frettedNote.setFret(::atoi(pItem));
|
||
|
||
pItem=::strtok(0,"=");
|
||
pItem=::strtok(0," ");
|
||
frettedNote.setNote(fretboard.getAt(frettedNote.getString(),frettedNote.getFret()));
|
||
|
||
pItem=::strtok(0,"=");
|
||
pItem=::strtok(0,"]");
|
||
frettedNote.setAction(Action().fromString(pItem));
|
||
|
||
GlobalDefs::outDebug(frettedNote.toString());
|
||
insert(&frettedNote);
|
||
*/
|
||
|
||
|
||
|
||
|
||
|
||
/*
|
||
|
||
bool TabWriter::write(TabEntries &entries,const String &pathFileTablature)
|
||
{
|
||
VersionInfo versionInfo;
|
||
File outFile;
|
||
Array<String> outLines;
|
||
int outIndex;
|
||
outIndex=0;
|
||
|
||
if(pathFileTablature.isNull())return false;
|
||
if(!outFile.open(pathFileTablature,"wb"))return false;
|
||
outFile.writeLine(String("%")+versionInfo.getProductNameString()+String(" ")+versionInfo.getProductVersion()+String("%"));
|
||
|
||
initLines(outLines,BufferLength);
|
||
setHeader(outLines,outIndex);
|
||
|
||
for(int index=0;index<entries.size();index++)
|
||
{
|
||
if(outIndex>MaxChars)
|
||
{
|
||
outFile.writeLine(String(" "));
|
||
outFile.writeLine(String(" "));
|
||
writeLines(outLines,outFile);
|
||
outFile.writeLine(String(" "));
|
||
initLines(outLines,BufferLength);
|
||
setHeader(outLines,outIndex);
|
||
}
|
||
TabEntry &entry=entries[index];
|
||
for(int noteIndex=0;noteIndex<entry.size();noteIndex++)
|
||
{
|
||
FrettedNote ¬e=entry[noteIndex];
|
||
int string=note.getString();
|
||
int fret=note.getFret();
|
||
|
||
(outLines[5-string].str())[outIndex]=note.getFret()+48;
|
||
}
|
||
outIndex+=2;
|
||
}
|
||
outFile.writeLine(String(" "));
|
||
outFile.writeLine(String(" "));
|
||
writeLines(outLines,outFile);
|
||
outFile.writeLine(String(" "));
|
||
return true;
|
||
}
|
||
|
||
void TabWriter::writeLines(Array<String> &outLines,File &outFile)
|
||
{
|
||
for(int index=0;index<6;index++)outFile.writeLine(outLines[index]);
|
||
}
|
||
|
||
void TabWriter::initLines(Array<String> &outLines,int size)
|
||
{
|
||
outLines.size(6);
|
||
for(int line=0;line<6;line++)
|
||
{
|
||
outLines[line].reserve(size,true);
|
||
for(int charIndex=0;charIndex<size;charIndex++)outLines[line]+='-';
|
||
}
|
||
}
|
||
|
||
void TabWriter::setHeader(Array<String> &outLines,int &outIndex)
|
||
{
|
||
outIndex=0;
|
||
outLines[0].setAt(outIndex,'E');
|
||
outLines[1].setAt(outIndex,'B');
|
||
outLines[2].setAt(outIndex,'G');
|
||
outLines[3].setAt(outIndex,'D');
|
||
outLines[4].setAt(outIndex,'A');
|
||
outLines[5].setAt(outIndex,'E');
|
||
outIndex++;
|
||
outLines[0].setAt(outIndex,'|');
|
||
outLines[1].setAt(outIndex,'|');
|
||
outLines[2].setAt(outIndex,'|');
|
||
outLines[3].setAt(outIndex,'|');
|
||
outLines[4].setAt(outIndex,'|');
|
||
outLines[5].setAt(outIndex,'|');
|
||
outIndex++;
|
||
outLines[0].setAt(outIndex,'-');
|
||
outLines[1].setAt(outIndex,'-');
|
||
outLines[2].setAt(outIndex,'-');
|
||
outLines[3].setAt(outIndex,'-');
|
||
outLines[4].setAt(outIndex,'-');
|
||
outLines[5].setAt(outIndex,'-');
|
||
outIndex++;
|
||
}
|
||
|
||
|
||
*/
|
||
|
||
|
||
bool TabPage::getOutlineRect(int entryIndex,Rect &outlineRect)
|
||
{
|
||
Point xyPoint(LeftMargin,TopMargin);
|
||
|
||
GlobalDefs::outDebug(String("[TabPage::getOutlineRect]"),GlobalDefs::Debug);
|
||
if(!isOkay())return false;
|
||
for(int index=0;index<mTabEntries.size();index++)
|
||
{
|
||
outlineRect.left(xyPoint.x());
|
||
outlineRect.top(xyPoint.y());
|
||
outlineRect.right(xyPoint.x()+getCharWidth()-1);
|
||
if(outlineRect.right()>=getWidth()-(RightMargin+LeftMargin))
|
||
outlineRect.right(getWidth()-(RightMargin+1));
|
||
outlineRect.bottom(xyPoint.y()+TabHeight-TabSpacing);
|
||
if(index==entryIndex)return true;
|
||
if(xyPoint.x()+getCharWidth()>=getWidth()-(RightMargin+LeftMargin))
|
||
{
|
||
xyPoint.x(LeftMargin);
|
||
xyPoint.y(xyPoint.y()+TabHeight+TabSeparator);
|
||
}
|
||
else xyPoint.x(xyPoint.x()+getCharWidth());
|
||
}
|
||
return false;
|
||
}
|
||
|
||
|
||
|
||
bool Tablature::saveProject(const String &pathFileName)
|
||
{
|
||
// String strPathFileName;
|
||
File outFile;
|
||
|
||
if(pathFileName.isNull())return false;
|
||
mPathFileProject=pathFileName;
|
||
if(!outFile.open(pathFileName,"wb"))return false;
|
||
// if(pathFileName.isNull())strPathFileName=mPathFileProject;
|
||
// else strPathFileName=pathFileName;
|
||
// if(!outFile.open(strPathFileName,"wb"))return false;
|
||
outFile.writeLine("WINTABV1.00");
|
||
if(getPathFileTablature().isNull())outFile.writeLine("TABLATURE=");
|
||
else
|
||
{
|
||
String strFileTablature;
|
||
Profile::makeFileName(getPathFileTablature(),strFileTablature);
|
||
outFile.writeLine(String("TABLATURE=")+strFileTablature);
|
||
}
|
||
outFile.writeLine(String("TYPES=")+getTypes());
|
||
for(int index=0;index<mTabRanges.size();index++)
|
||
{
|
||
Range &range=mTabRanges[index];
|
||
String strLine="RANGE=";
|
||
strLine+=String().fromInt(range.getBeginRange());
|
||
strLine+=";";
|
||
strLine+=String().fromInt(range.getEndRange());
|
||
strLine+=";";
|
||
strLine+=range.getRangeName();
|
||
outFile.writeLine(strLine);
|
||
}
|
||
if(mPathFileName.isNull())mPathFileName=Profile::removeExtension(pathFileName)+String(".tab");
|
||
saveAs(mPathFileName);
|
||
return true;
|
||
}
|
||
|
||
|
||
|
||
|
||
bool Tablature::saveProject(const String &pathFileName)
|
||
{
|
||
File outFile;
|
||
|
||
// if(pathFileName.isNull())return false;
|
||
if(!pathFileName.isNull())mPathFileProject=pathFileName;
|
||
// mPathFileProject=pathFileName;
|
||
if(mPathFileProject.isNull())return false;
|
||
if(!outFile.open(mPathFileProject,"wb"))return false;
|
||
outFile.writeLine("WINTABV1.00");
|
||
// if(getPathFileTablature().isNull())outFile.writeLine("TABLATURE=");
|
||
if(mPathFileName.isNull())mPathFileName=Profile::removeExtension(mPathFileProject)+String(".tab");
|
||
// else
|
||
// {
|
||
// String strFileTablature;
|
||
// Profile::makeFileName(getPathFileTablature(),strFileTablature);
|
||
outFile.writeLine(String("TABLATURE=")+mPathFileName);
|
||
// }
|
||
outFile.writeLine(String("TYPES=")+getTypes());
|
||
for(int index=0;index<mTabRanges.size();index++)
|
||
{
|
||
Range &range=mTabRanges[index];
|
||
String strLine="RANGE=";
|
||
strLine+=String().fromInt(range.getBeginRange());
|
||
strLine+=";";
|
||
strLine+=String().fromInt(range.getEndRange());
|
||
strLine+=";";
|
||
strLine+=range.getRangeName();
|
||
outFile.writeLine(strLine);
|
||
}
|
||
// if(mPathFileName.isNull())mPathFileName=Profile::removeExtension(mPathFileProject)+String(".tab");
|
||
saveAs(mPathFileName);
|
||
return true;
|
||
}
|
||
|
||
|
||
|
||
|
||
int LineParser::getElement(Element &element)
|
||
{
|
||
char ch;
|
||
|
||
element.setFret(-1);
|
||
element.setAction(Action::None);
|
||
if(mPosition>=mLength)return -1;
|
||
ch=charAt(mPosition++);
|
||
if(::isdigit(ch)&&(ch>='0'&&ch<='9'))
|
||
{
|
||
element.setAction(Action::Pick);
|
||
element.setFret(ch-48);
|
||
}
|
||
else if(::isalpha(ch))
|
||
{
|
||
if('o'==ch||'O'==ch) // instead of zero some tabs have an alpha 'O' - for (O)pen.
|
||
{
|
||
element.setAction(Action::Pick);
|
||
element.setFret(0);
|
||
return 1;
|
||
}
|
||
else if('p'==ch||'P'==ch) // pull-off
|
||
{
|
||
int result=getElement(element); // fetch the next element, this is what we are pulling into
|
||
if(1!=result)return result; // if we didn't get anything return;
|
||
element.setAction(Action::PullOff); // set action to pull-off
|
||
return result;
|
||
}
|
||
else if('b'==ch||'B'==ch) // Bend
|
||
{
|
||
int result=getElement(element); // fetch the next element, this is what we are bending into
|
||
if(1!=result)return result; // if we didn't get anything return;
|
||
element.setAction(Action::Bend); // set action to bend
|
||
return result;
|
||
}
|
||
else if('h'==ch||'H'==ch) // hammer-on
|
||
{
|
||
int result=getElement(element); // fetch the next element, this is what we are hammering onto
|
||
if(1!=result)return result; // if we didn't get anything return;
|
||
element.setAction(Action::HammerOn); // set action to hammer-on
|
||
return result;
|
||
}
|
||
else if('r'==ch||'R'==ch) // Release(bend) into this note
|
||
{
|
||
int result=getElement(element); // fetch the next element, this is what we are releasing into
|
||
if(1!=result)return result; // if we didn't get anything return;
|
||
element.setAction(Action::Release); // set action to Release
|
||
return result;
|
||
}
|
||
else if('s'==ch||'S'==ch) // Slide
|
||
{
|
||
int result=getElement(element); // fetch the next element, this is what we are sliding into
|
||
if(1!=result)return result; // if we didn't get anything return;
|
||
element.setAction(Action::SlideUp); // set action to SlideUp
|
||
return result;
|
||
}
|
||
else
|
||
{
|
||
element.setAction(Action::None); // invalid entry
|
||
element.setFret(-1); // no referenced note
|
||
return 0; // return not-handled
|
||
}
|
||
}
|
||
else if('^'==ch) // Bend
|
||
{
|
||
int result=getElement(element); // fetch the next element, this is what we are bending into
|
||
if(1!=result)return result; // if we didn't get anything return;
|
||
element.setAction(Action::Bend); // set action to bend
|
||
return result;
|
||
}
|
||
else if('\\'==ch)
|
||
{
|
||
int result=getElement(element); // fetch the next element, this is what we are sliding into
|
||
if(1!=result)return result; // if we didn't get anything return;
|
||
element.setAction(Action::SlideDown); // set action to SlideDown
|
||
return result;
|
||
}
|
||
else if('/'==ch)
|
||
{
|
||
int result=getElement(element); // fetch the next element, this is what we are sliding
|
||
if(1!=result)return result; // if we didn't get anything return;
|
||
element.setAction(Action::SlideUp); // set action to SlideUp
|
||
return result;
|
||
}
|
||
else
|
||
{
|
||
element.setAction(Action::None); // invalid entry
|
||
element.setFret(-1); // no referenced note
|
||
return 0; // return not-handled
|
||
}
|
||
ch=charAt(mPosition);
|
||
|
||
/*
|
||
if(::isdigit(ch)&&(ch>='0'&&ch<='9'))
|
||
{
|
||
element.setAction(Action::Pick);
|
||
element.setFret(ch-48);
|
||
}
|
||
else if(::isalpha(ch))
|
||
*/
|
||
|
||
|
||
if(!(::isdigit(ch)&&(ch>='0'&&ch<='9'))&&!(::isalpha(ch)&&'O'==ch))
|
||
{
|
||
element.setAction(Action::Pick); // fretted note
|
||
return 1; // return handled
|
||
}
|
||
if('O'==ch||'o'==ch)ch='0';
|
||
|
||
// if(!::isdigit(ch))
|
||
// {
|
||
// element.setAction(Action::Pick); // fretted note
|
||
// return 1; // return handled
|
||
// }
|
||
mPosition++;
|
||
element.setFret((element.getFret()*10)+(ch-48));
|
||
return 1; // return handled
|
||
}
|
||
|
||
|
||
|
||
/*
|
||
|
||
Rect outlineRect;
|
||
Point clickPoint;
|
||
getOutlineRect(mCurrEntryIndex,outlineRect);
|
||
clickPoint.x(someCallbackData.loWord());
|
||
clickPoint.y(someCallbackData.hiWord());
|
||
::OutputDebugString(clickPoint.toString()+String("\n"));
|
||
::OutputDebugString(outlineRect.toString()+String("\n"));
|
||
|
||
distanceMap[abs(clickPoint.y()-outlineRect.top())]=6;
|
||
distanceMap[abs(clickPoint.y()-(outlineRect.top()+TabSpacing))]=5;
|
||
distanceMap[abs(clickPoint.y()-(outlineRect.top()+(TabSpacing*2)))]=4;
|
||
distanceMap[abs(clickPoint.y()-(outlineRect.top()+(TabSpacing*3)))]=3;
|
||
distanceMap[abs(clickPoint.y()-(outlineRect.top()+(TabSpacing*4)))]=2;
|
||
distanceMap[abs(clickPoint.y()-(outlineRect.top()+(TabSpacing*5)))]=1;
|
||
|
||
map<int,int>::iterator minItem=distanceMap.begin();
|
||
int minValue=(*minItem).first;
|
||
int minString=(*minItem).second;
|
||
::OutputDebugString(String("Closest string is:")+String().fromInt(minString)+String("\n"));
|
||
*/
|
||
|
||
|
||
::OutputDebugString(String("Closest string is:")+String().fromInt(nearestString)+String("\n"));
|
||
|
||
|
||
|
||
bool TabPage::modifyProperties(void)
|
||
{
|
||
TabDialog tabDialog;
|
||
POINT cursorPoint;
|
||
|
||
GlobalDefs::outDebug(String("[TabPage::modifyProperties]"),GlobalDefs::Debug);
|
||
if(!isInOutline()||isInPlay())return false;
|
||
::GetCursorPos(&cursorPoint);
|
||
GDIPoint mousePoint(cursorPoint.x,cursorPoint.y);
|
||
// mParent->screenToClient(mousePoint);
|
||
TabEntry &entry=mTabEntries[currEntryIndex()];
|
||
keepOutline(true);
|
||
if(tabDialog.perform(*mParent,mTabEntries,currEntryIndex(),mousePoint))isDirty(true);
|
||
keepOutline(false);
|
||
// mParent->clientToScreen(mousePoint);
|
||
::SetCursorPos(mousePoint.x(),mousePoint.y());
|
||
return true;
|
||
}
|
||
|
||
|
||
/*
|
||
LRESULT currSel;
|
||
String selText;
|
||
bool applyRemainder;
|
||
|
||
currSel=sendMessage(TABENTRY_NOTETYPE,CB_GETCURSEL,0,0L);
|
||
sendMessage(TABENTRY_NOTETYPE,CB_GETLBTEXT,currSel,(LPARAM)selText.str());
|
||
applyRemainder=sendMessage(TABENTRY_REMAINDER,BM_GETCHECK,0,0L);
|
||
NoteType noteType(NoteType().fromString(selText));
|
||
if(applyRemainder)
|
||
{
|
||
for(int index=mCurrEntryIndex;index<mTabEntries->size();index++)
|
||
{
|
||
TabEntry &entry=(*mTabEntries)[index];
|
||
entry.setNoteType(noteType);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
TabEntry &entry=(*mTabEntries)[mCurrEntryIndex];
|
||
entry.setNoteType(noteType);
|
||
// entry.setNoteType(NoteType().fromString(selText));
|
||
|
||
|
||
|
||
/*
|
||
CallbackData::ReturnType TabPage::leftButtonDownHandler(CallbackData &someCallbackData)
|
||
{
|
||
GlobalDefs::outDebug("[TabPage::leftButtonDownHandler]",GlobalDefs::Verbose);
|
||
if(isInPlay())setCancelled(true);
|
||
FretDialog fretDialog;
|
||
Point clickPoint;
|
||
int selectedString;
|
||
clickPoint.x(someCallbackData.loWord());
|
||
clickPoint.y(someCallbackData.hiWord());
|
||
if(!getNearestString(clickPoint,selectedString))return false;
|
||
|
||
|
||
keepOutline(true);
|
||
if(fretDialog.perform(*mParent,mTabEntries,selectedString,mCurrEntryIndex))
|
||
{
|
||
if(!mTabEntries[mCurrEntryIndex].size())
|
||
{
|
||
mTabEntries.remove(mCurrEntryIndex);
|
||
if(mCurrEntryIndex>=mTabEntries.size())mCurrEntryIndex--;
|
||
}
|
||
isDirty(true);
|
||
update(*mParent);
|
||
mParent->invalidate(true);
|
||
mParent->update();
|
||
showCurrent();
|
||
}
|
||
keepOutline(false);
|
||
return false;
|
||
}
|
||
*/
|
||
|
||
|
||
|
||
// if(!mTabEntries.size())
|
||
// {
|
||
// mTabEntries.insert(&entry);
|
||
// currEntryIndex(0);
|
||
// }
|
||
// else mTabEntries.insertAfter(currEntryIndex(),&entry);
|
||
// isDirty(true);
|
||
// update(*mParent);
|
||
// mParent->invalidate(true);
|
||
// mParent->update();
|
||
// showCurrent();
|
||
// return true;
|
||
|
||
|
||
|
||
else if(!keyData.shiftKeyPressed()&&Insert==keyData.virtualKey())
|
||
{
|
||
Rect outlineRect;
|
||
clearUpdate();
|
||
mTabEntries.insert(&TabEntry());
|
||
mCurrEntryIndex=mTabEntries.size()-1;
|
||
// getOutlineRect(mCurrEntryIndex,outlineRect);
|
||
// showCurrent();
|
||
if(!getFretEntry())
|
||
{
|
||
mTabEntries.remove(mCurrEntryIndex);
|
||
if(mCurrEntryIndex>=mTabEntries.size())mCurrEntryIndex=mTabEntries.size()-1;
|
||
}
|
||
clearUpdate();
|
||
showCurrent();
|
||
getOutlineRect(mCurrEntryIndex,outlineRect);
|
||
::SetCaretPos(outlineRect.left(),outlineRect.top());
|
||
}
|
||
|
||
|
||
/*
|
||
void MainFrame::handleFileNew(void)
|
||
{
|
||
OpenDialog openDialog;
|
||
String strPathTabFile;
|
||
|
||
if(!openDialog.getOpenFileName(*this,"*.tab","Open Tab","*.tab",strPathTabFile))return;
|
||
createProjectView(strPathTabFile);
|
||
}
|
||
*/
|
||
|
||
|
||
|
||
/*
|
||
bool TabEntry::setFret(int string,int fret)
|
||
{
|
||
int entryIndex;
|
||
if(!contains(string,entryIndex))return false;
|
||
operator[](entryIndex).setFret(fret);
|
||
return true;
|
||
}
|
||
|
||
bool TabEntry::add(int string,int fret)
|
||
{
|
||
Fretboard fretboard;
|
||
FrettedNote frettedNote(fretboard.getAt(string,fret),string,fret);
|
||
insert(&frettedNote);
|
||
return true;
|
||
}
|
||
|
||
*/
|
||
|
||
|
||
|
||
|
||
|
||
// PureNote pureNote(pureEvent.firstData(),pureEvent.secondData());
|
||
// Note note(pureNote);
|
||
// fretboard.getAt(note,frettedNote);
|
||
|
||
// ::OutputDebugString(note.toString()+String("\n"));
|
||
// ::OutputDebugString(frettedNote.toString()+String("\n"));
|
||
|
||
// TabEntry entry;
|
||
// entry.insert(&frettedNote);
|
||
|
||
|
||
|
||
// tabEntries[pureEvent.channel()].insert(&entry);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
#ifndef _GUITAR_MIDIHELPER_HPP_
|
||
#define _GUITAR_MIDIHELPER_HPP_
|
||
#ifndef _COMMON_ARRAY_HPP_
|
||
#include <common/array.hpp>
|
||
#endif
|
||
#ifndef _MIDISEQ_MIDIDATA_HPP_
|
||
#include <midiseq/mididata.hpp>
|
||
#endif
|
||
#ifndef _MIDISEQ_MIDICHANNELMESSAGE_HPP_
|
||
#include <midiseq/midimsg.hpp>
|
||
#endif
|
||
#ifndef _GUITAR_TABENTRY_HPP_
|
||
#include <guitar/tabentry.hpp>
|
||
#endif
|
||
#ifndef _GUITAR_FRETBOARD_HPP_
|
||
#include <guitar/fretboard.hpp>
|
||
#endif
|
||
#ifndef _GUITAR_TABLATURE_HPP_
|
||
#include <guitar/tablature.hpp>
|
||
#endif
|
||
|
||
class MIDIHelper
|
||
{
|
||
public:
|
||
static void import(const String &musicFileName);
|
||
private:
|
||
};
|
||
|
||
void MIDIHelper::import(const String &musicFileName)
|
||
{
|
||
// String musicFileName("D:\\WORK\\SCENE\\MEDIA\\BMP\\E1M2.MID");
|
||
String musicFileName("D:\\WORK\\GUITAR\\MIDI\\2112.mid");
|
||
// String musicFileName("C:\\WINNT\\MEDIA\\PASSPORT.MID");
|
||
// String musicFileName("D:\\WORK\\GUITAR\\MIDI\\PACO.MID");
|
||
|
||
WORD currPlayTime=0;
|
||
WORD prevPlayTime=0;
|
||
|
||
Fretboard fretboard;
|
||
TabEntries tabEntries;
|
||
Tablature tablature;
|
||
|
||
// Array<PureEvent> eventBlock;
|
||
// Block<FrettedNote> frettedNotes;
|
||
Block<PureWORD> tracks;
|
||
Block<Note> notes;
|
||
// TabEntry entry;
|
||
// bool found;
|
||
|
||
MidiData midiData(musicFileName);
|
||
midiData.makeRealTime();
|
||
// midiData.combineTracks(eventBlock);
|
||
|
||
midiData.getTracks(tracks);
|
||
if(!tracks.size())return;
|
||
WORD maxEvents=0;
|
||
int currentTrack;
|
||
for(int trIndex=0;trIndex<tracks.size();trIndex++)
|
||
{
|
||
if(midiData.getEventCount(tracks[trIndex].getValue())>maxEvents)
|
||
{
|
||
maxEvents=midiData.getEventCount(tracks[trIndex].getValue());
|
||
currentTrack=tracks[trIndex].getValue();
|
||
}
|
||
}
|
||
|
||
|
||
|
||
FrettedNote frettedNote;
|
||
// PureNote pureNote;
|
||
// Note note;
|
||
|
||
// entry.remove();
|
||
|
||
for(int index=0;index<midiData.getEventCount(currentTrack);index++)
|
||
// for(int index=0;index<eventBlock.size();index++)
|
||
{
|
||
PureEvent &pureEvent=midiData.getEventAt(currentTrack,index);
|
||
// PureEvent &pureEvent=eventBlock[index];
|
||
FrettedNote frettedNote;
|
||
|
||
currPlayTime=pureEvent.playTime();
|
||
if(!index)prevPlayTime=currPlayTime;
|
||
|
||
if(MIDINoteOn==(pureEvent.eventType()&0xF0))
|
||
{
|
||
if(currPlayTime!=prevPlayTime)
|
||
{
|
||
// create TabEntry from notes
|
||
// insert the TabEntry into TabEntries
|
||
notes.remove();
|
||
// if(entry.size())
|
||
// {
|
||
// tabEntries.insert(&entry);
|
||
// entry.remove();
|
||
// }
|
||
}
|
||
|
||
PureNote pureNote(pureEvent.firstData(),pureEvent.secondData());
|
||
Note note(pureNote);
|
||
notes.insert(¬e);
|
||
|
||
|
||
|
||
}
|
||
|
||
prevPlayTime=currPlayTime;
|
||
}
|
||
tablature.setTabEntries(tabEntries);
|
||
tablature.saveAs("c:\\midi.tab");
|
||
return;
|
||
}
|
||
|
||
|
||
|
||
void foo()
|
||
{
|
||
/*
|
||
fretboard.getAt(note,frettedNotes);
|
||
if(!frettedNotes.size())
|
||
{
|
||
int lowestOctave;
|
||
int highestOctave;
|
||
fretboard.getOctaveRange(lowestOctave,highestOctave);
|
||
if(note.getOctave()<=lowestOctave)note.setOctave(lowestOctave+1);
|
||
else if(note.getOctave()>=highestOctave)note.setOctave(highestOctave-1);
|
||
fretboard.getAt(note,frettedNotes);
|
||
}
|
||
found=false;
|
||
for(int fnIndex=0;fnIndex<frettedNotes.size();fnIndex++)
|
||
{
|
||
FrettedNote &frettedNote=frettedNotes[fnIndex];
|
||
if(!entry.contains(frettedNote.getString()))
|
||
{
|
||
::OutputDebugString(String("Inserting ")+frettedNote.toString()+String("\n"));
|
||
entry.insert(&frettedNote);
|
||
found=true;
|
||
break;
|
||
}
|
||
}
|
||
if(!found)
|
||
{
|
||
::OutputDebugString("*******************************************\n");
|
||
::OutputDebugString(String("Could not insert note, string is already being played...")+String("\n"));
|
||
for(int index=0;index<frettedNotes.size();index++)
|
||
{
|
||
FrettedNote &frettedNote=frettedNotes[index];
|
||
int entryIndex;
|
||
::OutputDebugString(String("Tried to insert ")+frettedNote.toString()+String("\n"));
|
||
entry.contains(frettedNote.getString(),entryIndex);
|
||
::OutputDebugString(String("Found note ")+entry[entryIndex].toString()+String(" was already at that location \n"));
|
||
}
|
||
::OutputDebugString("*******************************************\n");
|
||
}
|
||
entry.insert(&frettedNote);
|
||
|
||
*/
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
#endif
|
||
|
||
|
||
|
||
|
||
|
||
#include <guitar/MIDIHelper.hpp>
|
||
#include <common/qsort.hpp>
|
||
|
||
void MIDIHelper::import(const String &musicFileName)
|
||
{
|
||
TabEntries tabEntries;
|
||
Tablature tablature;
|
||
TabEntry entry;
|
||
WORD currPlayTime;
|
||
WORD prevPlayTime;
|
||
|
||
mMessages.remove();
|
||
currPlayTime=0;
|
||
prevPlayTime=0;
|
||
|
||
|
||
Block<PureWORD> tracks;
|
||
Block<Note> notes;
|
||
|
||
// ::OutputDebugString(mFretboard.toString());
|
||
|
||
|
||
MidiData midiData(musicFileName);
|
||
midiData.makeRealTime();
|
||
// midiData.combineTracks(eventBlock);
|
||
midiData.getTracks(tracks);
|
||
if(!tracks.size())return;
|
||
WORD maxEvents=0;
|
||
int currentTrack;
|
||
|
||
for(int trIndex=0;trIndex<tracks.size();trIndex++)
|
||
{
|
||
if(midiData.getEventCount(tracks[trIndex].getValue())>maxEvents)
|
||
{
|
||
maxEvents=midiData.getEventCount(tracks[trIndex].getValue());
|
||
currentTrack=tracks[trIndex].getValue();
|
||
}
|
||
}
|
||
|
||
for(int index=0;index<midiData.getEventCount(currentTrack);index++)
|
||
// for(int index=0;index<eventBlock.size();index++)
|
||
{
|
||
PureEvent &pureEvent=midiData.getEventAt(currentTrack,index);
|
||
// PureEvent &pureEvent=eventBlock[index];
|
||
|
||
currPlayTime=pureEvent.playTime();
|
||
if(!index)prevPlayTime=currPlayTime;
|
||
|
||
if(MIDINoteOn==(pureEvent.eventType()&0xF0))
|
||
{
|
||
if(currPlayTime!=prevPlayTime&¬es.size())
|
||
{
|
||
// create TabEntry from notes
|
||
// insert the TabEntry into TabEntries
|
||
if(createEntry(notes,entry))tabEntries.insert(&entry);
|
||
notes.remove();
|
||
}
|
||
PureNote pureNote(pureEvent.firstData(),pureEvent.secondData());
|
||
Note note(pureNote);
|
||
notes.insert(¬e);
|
||
}
|
||
prevPlayTime=currPlayTime;
|
||
}
|
||
tablature.setTabEntries(tabEntries);
|
||
tablature.saveAs("c:\\midi.tab");
|
||
return;
|
||
}
|
||
|
||
bool MIDIHelper::createEntry(Block<Note> ¬es,TabEntry &entry)
|
||
{
|
||
NotePaths notePaths;
|
||
Requirements requirements;
|
||
|
||
if(!notes.size())return false;
|
||
if(!filterNotesOnFretboard(notes))return false;
|
||
requirements.setRequirements(notes);
|
||
|
||
notePaths.size(notes.size());
|
||
|
||
for(int pathIndex=0;pathIndex<notePaths.size();pathIndex++)
|
||
{
|
||
NotePath ¬ePath=notePaths[pathIndex];
|
||
::OutputDebugString(notes[pathIndex].toStringWithOctave()+String("\n"));
|
||
mFretboard.getAt(notes[pathIndex],notePath);
|
||
}
|
||
|
||
requirements.satisfyRequirements(notePaths);
|
||
|
||
entry.remove();
|
||
for(int index=0;index<requirements.size();index++)
|
||
{
|
||
Requirement &requirement=requirements[index];
|
||
if(requirement.getSatisfied())entry.insert(&requirement);
|
||
}
|
||
|
||
return entry.size()?true:false;
|
||
}
|
||
|
||
bool MIDIHelper::filterNotesOnFretboard(Block<Note> ¬es)
|
||
{
|
||
for(int noteIndex=0;noteIndex<notes.size();noteIndex++)
|
||
{
|
||
if(!mFretboard.isOnFretboard(notes[noteIndex]))
|
||
{
|
||
mMessages.insert(&String(String("Note is not on the fretboard ")+notes[noteIndex].toString()));
|
||
notes.remove(noteIndex);
|
||
noteIndex--;
|
||
}
|
||
}
|
||
return notes.size()?true:false;
|
||
}
|
||
|
||
void foo()
|
||
{
|
||
/*
|
||
fretboard.getAt(note,frettedNotes);
|
||
if(!frettedNotes.size())
|
||
{
|
||
int lowestOctave;
|
||
int highestOctave;
|
||
fretboard.getOctaveRange(lowestOctave,highestOctave);
|
||
if(note.getOctave()<=lowestOctave)note.setOctave(lowestOctave+1);
|
||
else if(note.getOctave()>=highestOctave)note.setOctave(highestOctave-1);
|
||
fretboard.getAt(note,frettedNotes);
|
||
}
|
||
found=false;
|
||
for(int fnIndex=0;fnIndex<frettedNotes.size();fnIndex++)
|
||
{
|
||
FrettedNote &frettedNote=frettedNotes[fnIndex];
|
||
if(!entry.contains(frettedNote.getString()))
|
||
{
|
||
::OutputDebugString(String("Inserting ")+frettedNote.toString()+String("\n"));
|
||
entry.insert(&frettedNote);
|
||
found=true;
|
||
break;
|
||
}
|
||
}
|
||
if(!found)
|
||
{
|
||
::OutputDebugString("*******************************************\n");
|
||
::OutputDebugString(String("Could not insert note, string is already being played...")+String("\n"));
|
||
for(int index=0;index<frettedNotes.size();index++)
|
||
{
|
||
FrettedNote &frettedNote=frettedNotes[index];
|
||
int entryIndex;
|
||
::OutputDebugString(String("Tried to insert ")+frettedNote.toString()+String("\n"));
|
||
entry.contains(frettedNote.getString(),entryIndex);
|
||
::OutputDebugString(String("Found note ")+entry[entryIndex].toString()+String(" was already at that location \n"));
|
||
}
|
||
::OutputDebugString("*******************************************\n");
|
||
}
|
||
entry.insert(&frettedNote);
|
||
|
||
*/
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Rect clientRect;
|
||
parentWindow.clientRect(clientRect);
|
||
mDisplayPoint.x((clientRect.right()-clientRect.left())/2);
|
||
mDisplayPoint.y((clientRect.bottom()-clientRect.top())/2);
|
||
|
||
|
||
setFocus();
|
||
mDisplayPoint.x(mDisplayPoint.x()-(width()/2));
|
||
mDisplayPoint.y(mDisplayPoint.y()-(height()/2));
|
||
move(mDisplayPoint);
|
||
|
||
|
||
|
||
|
||
else if(!keyData.shiftKeyPressed()&&Insert==keyData.virtualKey()) // insert after current position
|
||
{
|
||
Rect outlineRect;
|
||
TabEntry entry;
|
||
GDIPoint cursorPos;
|
||
|
||
clearUpdate();
|
||
if(!mTabEntries.size())
|
||
{
|
||
mTabEntries.insert(&entry);
|
||
mCurrEntryIndex=0;
|
||
}
|
||
else
|
||
{
|
||
mTabEntries.insertAfter(mCurrEntryIndex,&entry);
|
||
mCurrEntryIndex++;
|
||
}
|
||
if(!getFretEntry())
|
||
{
|
||
mTabEntries.remove(mCurrEntryIndex);
|
||
mCurrEntryIndex--; // smk
|
||
if(mCurrEntryIndex>=mTabEntries.size())mCurrEntryIndex=mTabEntries.size()-1;
|
||
}
|
||
getOutlineRect(mCurrEntryIndex,outlineRect);
|
||
mParent->clientToScreen(outlineRect);
|
||
cursorPos.x(outlineRect.left());
|
||
cursorPos.y(outlineRect.top());
|
||
::SetCursorPos(cursorPos.x(),cursorPos.y());
|
||
|
||
// mParent->clientToScreen(outlineRect);
|
||
// cursorPos.x(outlineRect.left());
|
||
// ::SetCursorPos(cursorPos.x(),cursorPos.y());
|
||
|
||
/* Rect outlineRect;
|
||
GDIPoint cursorPos;
|
||
|
||
::GetCursorPos(&cursorPos.getPOINT());
|
||
clearUpdate();
|
||
mTabEntries.insert(&TabEntry());
|
||
mCurrEntryIndex=mTabEntries.size()-1;
|
||
if(!getFretEntry())
|
||
{
|
||
mTabEntries.remove(mCurrEntryIndex);
|
||
if(mCurrEntryIndex>=mTabEntries.size())mCurrEntryIndex=mTabEntries.size()-1;
|
||
}
|
||
clearUpdate();
|
||
showCurrent();
|
||
getOutlineRect(mCurrEntryIndex,outlineRect);
|
||
mParent->clientToScreen(outlineRect);
|
||
cursorPos.x(outlineRect.left());
|
||
::SetCursorPos(cursorPos.x(),cursorPos.y()); */
|
||
}
|
||
/* else if(keyData.shiftKeyPressed()&&Insert==keyData.virtualKey())
|
||
{
|
||
Rect outlineRect;
|
||
TabEntry entry;
|
||
GDIPoint cursorPos;
|
||
|
||
::GetCursorPos(&cursorPos.getPOINT());
|
||
clearUpdate();
|
||
if(!mTabEntries.size())
|
||
{
|
||
mTabEntries.insert(&entry);
|
||
mCurrEntryIndex=0;
|
||
}
|
||
else
|
||
{
|
||
mTabEntries.insertAfter(mCurrEntryIndex,&entry);
|
||
mCurrEntryIndex++;
|
||
}
|
||
if(!getFretEntry())
|
||
{
|
||
mTabEntries.remove(mCurrEntryIndex);
|
||
if(mCurrEntryIndex>=mTabEntries.size())mCurrEntryIndex=mTabEntries.size()-1;
|
||
}
|
||
getOutlineRect(mCurrEntryIndex,outlineRect);
|
||
mParent->clientToScreen(outlineRect);
|
||
cursorPos.x(outlineRect.left());
|
||
::SetCursorPos(cursorPos.x(),cursorPos.y());
|
||
} */
|
||
GlobalDefs::outDebug(String("Key Code=")+String().fromInt(keyData.virtualKey()));
|
||
return false;
|
||
}
|
||
|
||
|
||
void removeHistory(const String &pathFileName);
|
||
|
||
void MainFrame::removeHistory(const String &pathFileName)
|
||
{
|
||
Registry registry;
|
||
SmartPointer<MDIWindow> mdiWindow;
|
||
Array<SmartPointer<MDIWindow> > mdiWindows;
|
||
|
||
if(!registry.removeHistory(pathFileName))return;
|
||
removeHistory(getFrameMenu());
|
||
applyHistory(getFrameMenu());
|
||
if(!getDocuments(mdiWindows))return;
|
||
for(int index=0;index<mdiWindows.size();index++)
|
||
{
|
||
mdiWindow=mdiWindows[index];
|
||
removeHistory(mdiWindow->getMenu());
|
||
applyHistory(mdiWindow->getMenu());
|
||
}
|
||
}
|
||
|
||
|
||
void MainFrame::openProjectView(const String &strPathProjectFile)
|
||
{
|
||
SmartPointer<MDIWindow> mdiWindow;
|
||
ViewWindow *pViewWindow;
|
||
|
||
if(strPathProjectFile.isNull())return;
|
||
if(isActive(mdiWindow,strPathProjectFile))
|
||
{
|
||
mdiWindow->top();
|
||
return;
|
||
}
|
||
insert(*(pViewWindow=::new ViewWindow));
|
||
operator[](size()-1).createWindow(*this,String(STRING_TABVIEWWINDOWCLASSNAME),"Tablature","viewMenu","APP_ICON");
|
||
pViewWindow->setStatusControlRef(mStatusControl);
|
||
if(!pViewWindow->openProject(strPathProjectFile))
|
||
{
|
||
pViewWindow->close();
|
||
// removeHistory(strPathProjectFile);
|
||
return;
|
||
}
|
||
else pViewWindow->setFretboardHandler(CallbackPointer(&mGUIFretboardHandler));
|
||
updateHistory(strPathProjectFile);
|
||
}
|
||
|
||
|
||
//#define IDR_ACCELERATOR1 104
|
||
//#define IDD_DIALOG1 105
|
||
|
||
|
||
|
||
/*
|
||
|
||
bool MIDIHelper::import(const String &strPathMidiFileName,const String &strPathTabFileName)
|
||
{
|
||
String tabFileName;
|
||
TabEntries tabEntries;
|
||
Tablature tablature;
|
||
TabEntry entry;
|
||
WORD currPlayTime;
|
||
WORD prevPlayTime;
|
||
Block<PureWORD> tracks;
|
||
Block<Note> notes;
|
||
|
||
if(strPathMidiFileName.isNull()||strPathTabFileName.isNull())return false;
|
||
// if(midiFileName.isNull())return;
|
||
// tabFileName=Profile::removeExtension(midiFileName)+String(".tab");
|
||
|
||
mMessages.remove();
|
||
currPlayTime=0;
|
||
prevPlayTime=0;
|
||
|
||
// ::OutputDebugString(mFretboard.toString());
|
||
// MidiData midiData(midiFileName);
|
||
MidiData midiData(strPathMidiFileName);
|
||
midiData.makeRealTime();
|
||
// midiData.combineTracks(eventBlock);
|
||
midiData.getTracks(tracks);
|
||
if(!tracks.size())return false;
|
||
WORD maxEvents=0;
|
||
int currentTrack;
|
||
|
||
for(int trIndex=0;trIndex<tracks.size();trIndex++)
|
||
{
|
||
if(midiData.getEventCount(tracks[trIndex].getValue())>maxEvents)
|
||
{
|
||
maxEvents=midiData.getEventCount(tracks[trIndex].getValue());
|
||
currentTrack=tracks[trIndex].getValue();
|
||
}
|
||
}
|
||
|
||
for(int index=0;index<midiData.getEventCount(currentTrack);index++)
|
||
{
|
||
PureEvent &pureEvent=midiData.getEventAt(currentTrack,index);
|
||
|
||
currPlayTime=pureEvent.playTime();
|
||
if(!index)prevPlayTime=currPlayTime;
|
||
|
||
if(MIDINoteOn==(pureEvent.eventType()&0xF0))
|
||
{
|
||
if(currPlayTime!=prevPlayTime&¬es.size())
|
||
{
|
||
if(createEntry(notes,entry))tabEntries.insert(&entry);
|
||
notes.remove();
|
||
}
|
||
PureNote pureNote(pureEvent.firstData(),pureEvent.secondData());
|
||
Note note(pureNote);
|
||
notes.insert(¬e);
|
||
}
|
||
prevPlayTime=currPlayTime;
|
||
}
|
||
tablature.setTabEntries(tabEntries);
|
||
tablature.saveAs(strPathTabFileName);
|
||
// tablature.saveAs(tabFileName);
|
||
return true;
|
||
}
|
||
|
||
|
||
*/
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
//#include <midiseq/mididata.hpp>
|
||
|
||
int PASCAL WinMain(HINSTANCE /*hInstance*/,HINSTANCE /*hPrevInstance*/,LPSTR lpszCmdLine,int /*nCmdShow*/)
|
||
{
|
||
// MidiData midiData("D:\\WORK\\GUITAR\\MIDI\\2112.mid");
|
||
// midiData.play();
|
||
|
||
|
||
/*
|
||
// String musicFileName("D:\\WORK\\SCENE\\MEDIA\\BMP\\E1M2.MID");
|
||
String musicFileName("D:\\WORK\\GUITAR\\MIDI\\2112.mid");
|
||
// String musicFileName("C:\\WINNT\\MEDIA\\PASSPORT.MID");
|
||
// String musicFileName("D:\\WORK\\GUITAR\\MIDI\\PACO.MID");
|
||
|
||
|
||
|
||
MIDIHelper midiHelper;
|
||
midiHelper.import(musicFileName);
|
||
|
||
return 0;
|
||
*/
|
||
|
||
MainFrame mainFrame;
|
||
VersionInfo versionInfo;
|
||
|
||
if(lpszCmdLine&&!(String(lpszCmdLine)=="NOLOGO"))
|
||
{
|
||
SplashScreen splash("GUITAR","2002 - Diversified Software Solutions. \"http:\\www.guitartabpro.com\"",versionInfo.getProductNameString()+String(" ")+versionInfo.getProductVersion());
|
||
splash.perform();
|
||
}
|
||
String str=versionInfo.getProductVersion();
|
||
GlobalDefs::setLogLevel(GlobalDefs::Debug);
|
||
// GlobalDefs::setLogFile("TabMaster.log");
|
||
GlobalDefs::setRegisteredClipboardFormat(Clipboard::registerClipboardFormat(String("[")+versionInfo.getProductNameString()+String(",")+versionInfo.getProductVersion()+String("]")));
|
||
GlobalDefs::outDebug("Application started.");
|
||
GlobalDefs::outDebug("Creating main window.",GlobalDefs::Info);
|
||
mainFrame.createWindow("TabMaster",versionInfo.getProductNameString()+String(" ")+versionInfo.getProductVersion(),"mainMenu","APP_ICON");
|
||
GlobalDefs::outDebug("Loading accelerators.",GlobalDefs::Info);
|
||
mainFrame.loadAccelerators(TABACCELERATORS);
|
||
return mainFrame.messageLoop();
|
||
}
|
||
|
||
|
||
|
||
VersionInfo versionInfo;
|
||
SystemTime currDate;
|
||
String strVersion;
|
||
|
||
strVersion=versionInfo.getProductVersionString();
|
||
strVersion.removeTokens(", ");
|
||
strVersion.upper();
|
||
if(!(strVersion==mProductVersion))return false;
|
||
if(Permanent==mLicenseType)return true;
|
||
SystemTime expireDate(mIssueDate);
|
||
expireDate.daysAdd360(mDayCount);
|
||
if(expireDate>currDate)return false;
|
||
return true;
|
||
|
||
|
||
|
||
|
||
|
||
|
||
/*
|
||
#include <guitar/registration.hpp>
|
||
#include <guitar/license.hpp>
|
||
#include <guitar/uutool.hpp>
|
||
#include <common/systime.hpp>
|
||
|
||
void proto(void)
|
||
{
|
||
if(!Registration::getInstance().hasLicense())
|
||
{
|
||
if(Registration::getInstance().hasGID())
|
||
{
|
||
::OutputDebugString("User deleted license, prompt for new one, exit if none entered.\n");
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
License license;
|
||
Registration::getInstance().create30DayLicense();
|
||
Registration::getInstance().getLicense(license);
|
||
::OutputDebugString(String("Created 30 day license.")+String("There are ")+String().fromInt(license.getRemainingDays())+String(" days remaining\n"));
|
||
}
|
||
}
|
||
else
|
||
{
|
||
License license;
|
||
Registration::getInstance().getLicense(license);
|
||
if(!license.isValid())
|
||
{
|
||
::OutputDebugString("The license is no longer valid, please enter a valid license.\n");
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
if(!license.isExpiring())::OutputDebugString("Permanent license was accepted.\n");
|
||
else ::OutputDebugString(String("License accepted. ")+String("There are ")+String().fromInt(license.getRemainingDays())+String(" days remaining.\n"));
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
*/
|
||
|
||
|
||
|
||
LICENSEDIALOG DIALOGEX 0, 0, 223, 135
|
||
STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTERMOUSE | WS_POPUP | WS_CAPTION |
|
||
WS_SYSMENU
|
||
EXSTYLE WS_EX_TOOLWINDOW
|
||
CAPTION "License Helper"
|
||
FONT 8, "MS Sans Serif"
|
||
BEGIN
|
||
EDITTEXT LICENSE_DIALOG_LICENSE,2,117,215,14,ES_AUTOHSCROLL
|
||
DEFPUSHBUTTON "O&k",IDOK,154,2,65,14
|
||
PUSHBUTTON "Cancel",IDCANCEL,154,17,65,14
|
||
LTEXT "If you have received a new license, copy the license exactly as you",
|
||
IDC_STATIC,5,67,214,8
|
||
LTEXT "You are seeing this because you have an invalid or expired License.",
|
||
IDC_STATIC,5,53,216,8
|
||
LTEXT "received it and paste it below.",IDC_STATIC,5,80,95,8
|
||
LTEXT "You can request a new license by",IDC_STATIC,104,80,108,
|
||
8
|
||
LTEXT "choosing the ""Request License"" button above.",
|
||
IDC_STATIC,5,93,210,8
|
||
PUSHBUTTON "Request License",LICENSE_DIALOG_REQUEST_LICENSE,154,32,
|
||
65,14
|
||
END
|
||
|
||
|
||
|
||
|
||
|
||
#include <guitar/uutool.hpp>
|
||
#include <common/string.hpp>
|
||
#include <common/stdio.hpp>
|
||
|
||
String UUTool::encode(String strLine)
|
||
{
|
||
int stringLength=strLine.length();
|
||
char *ptrBuff;
|
||
int byteCount;
|
||
|
||
if(!stringLength)return String();
|
||
String lineString;
|
||
char *ptrLine=lineString.str();
|
||
*(ptrLine++)=chEncode(stringLength);
|
||
for(ptrBuff=strLine.str(),byteCount=stringLength;byteCount>0;byteCount-=3,ptrBuff+=3)
|
||
{
|
||
*(ptrLine++)=chEncode(*ptrBuff>>2);
|
||
*(ptrLine++)=chEncode((*ptrBuff<<4)&0x30|(ptrBuff[1]>>4)&0x0F);
|
||
*(ptrLine++)=chEncode((ptrBuff[1]<<2)&0x3C|(ptrBuff[2]>>6)&0x03);
|
||
*(ptrLine++)=chEncode(ptrBuff[2]&0x3F);
|
||
}
|
||
::OutputDebugString(encodeNumeric(lineString)+String("\n"));
|
||
return lineString;
|
||
}
|
||
|
||
String UUTool::decode(String strLine)
|
||
{
|
||
int stringLength=strLine.length();
|
||
char *ptrBuff;
|
||
char *ptrLine;
|
||
int byteCount;
|
||
int n;
|
||
char ch;
|
||
|
||
::OutputDebugString(encodeNumeric(strLine)+String("\n"));
|
||
if(!stringLength)return String();
|
||
String lineString;
|
||
ptrLine=lineString.str();
|
||
ptrBuff=strLine.str();
|
||
n=chDecode(*(ptrBuff));
|
||
if(n<=0)return String();
|
||
for(++ptrBuff;n>0;ptrBuff+=4,n-=3)
|
||
{
|
||
if(n>=3)
|
||
{
|
||
ch=chDecode(ptrBuff[0])<<2|chDecode(ptrBuff[1])>>4;
|
||
*(ptrLine++)=ch;
|
||
ch=chDecode(ptrBuff[1])<<4|chDecode(ptrBuff[2])>>2;
|
||
*(ptrLine++)=ch;
|
||
ch=chDecode(ptrBuff[2])<<6|chDecode(ptrBuff[3]);
|
||
*(ptrLine++)=ch;
|
||
}
|
||
else
|
||
{
|
||
if(n>=1)
|
||
{
|
||
ch=chDecode(ptrBuff[0])<<2|chDecode(ptrBuff[1])>>4;
|
||
(*ptrLine++)=ch;
|
||
}
|
||
else if(n>=2)
|
||
{
|
||
ch=chDecode(ptrBuff[1])<<4|chDecode(ptrBuff[2])>>2;
|
||
(*ptrLine++)=ch;
|
||
}
|
||
else if(n>=3)
|
||
{
|
||
ch=chDecode(ptrBuff[2])<<6|chDecode(ptrBuff[3]);
|
||
(*ptrLine++)=ch;
|
||
}
|
||
}
|
||
}
|
||
return lineString;
|
||
}
|
||
|
||
String UUTool::decode(Array<BYTE> &bytes) // strLine
|
||
{
|
||
// int stringLength=strLine.length();
|
||
int stringLength=bytes.size();
|
||
char *ptrBuff;
|
||
char *ptrLine;
|
||
int byteCount;
|
||
int n;
|
||
char ch;
|
||
|
||
if(!stringLength)return String();
|
||
String lineString;
|
||
ptrLine=lineString.str();
|
||
// ptrBuff=strLine.str();
|
||
ptrBuff=(char*)&bytes[0];
|
||
n=chDecode(*(ptrBuff));
|
||
if(n<=0)return String();
|
||
for(++ptrBuff;n>0;ptrBuff+=4,n-=3)
|
||
{
|
||
if(n>=3)
|
||
{
|
||
ch=chDecode(ptrBuff[0])<<2|chDecode(ptrBuff[1])>>4;
|
||
if(ch>=100)
|
||
{
|
||
::OutputDebugString(">=100");
|
||
// ::DebugBreak();
|
||
}
|
||
// *(ptrLine++)=ch;
|
||
ch=chDecode(ptrBuff[1])<<4|chDecode(ptrBuff[2])>>2;
|
||
if(ch>=100)
|
||
{
|
||
::OutputDebugString(">=100");
|
||
// ::DebugBreak();
|
||
}
|
||
// *(ptrLine++)=ch;
|
||
ch=chDecode(ptrBuff[2])<<6|chDecode(ptrBuff[3]);
|
||
if(ch>=100)
|
||
{
|
||
::OutputDebugString(">=100");
|
||
// ::DebugBreak();
|
||
}
|
||
// *(ptrLine++)=ch;
|
||
}
|
||
else
|
||
{
|
||
if(n>=1)
|
||
{
|
||
ch=chDecode(ptrBuff[0])<<2|chDecode(ptrBuff[1])>>4;
|
||
if(ch>=100)
|
||
{
|
||
::OutputDebugString(">=100");
|
||
// ::DebugBreak();
|
||
}
|
||
// (*ptrLine++)=ch;
|
||
}
|
||
else if(n>=2)
|
||
{
|
||
ch=chDecode(ptrBuff[1])<<4|chDecode(ptrBuff[2])>>2;
|
||
if(ch>=100)
|
||
{
|
||
::OutputDebugString(">=100");
|
||
// ::DebugBreak();
|
||
}
|
||
// (*ptrLine++)=ch;
|
||
}
|
||
else if(n>=3)
|
||
{
|
||
if(ch>=100)
|
||
{
|
||
::OutputDebugString(">=100");
|
||
// ::DebugBreak();
|
||
}
|
||
// if(ch>=100)::OutputDebugString(">=100");
|
||
// (*ptrLine++)=ch;
|
||
}
|
||
}
|
||
}
|
||
return lineString;
|
||
}
|
||
|
||
|
||
String UUTool::encodeNumeric(String strEncode)
|
||
{
|
||
String strNumeric;
|
||
String strHex;
|
||
for(int index=0;index<strEncode.length();index++)
|
||
{
|
||
::sprintf(strHex,"%02x",strEncode.charAt(index));
|
||
strNumeric+=strHex;
|
||
if(index&&!(index%4)&&index+1<strEncode.length())strNumeric+="-";
|
||
}
|
||
return strNumeric;
|
||
}
|
||
|
||
|
||
#include <common/openfile.hpp>
|
||
#include <common/array.hpp>
|
||
#include <guitar/uutool.hpp>
|
||
|
||
void proto();
|
||
void proto2();
|
||
|
||
String encodeNumeric(String strLine);
|
||
|
||
|
||
|
||
// Registration::getInstance().generatePermanentLicense();
|
||
// Version 2.00 must have permanent license.
|
||
// if(!Registration::getInstance().hasLicense()&&!Registration::getInstance().hasGID())
|
||
// Registration::getInstance().create15DayLicense();
|
||
|
||
// if(!()) lpszCmdLine&&!(String(lpszCmdLine)=="NOLOGO"))
|
||
|
||
|
||
|
||
|
||
void GUIFretboard::setNote(const TabEntry &entry,bool clear,bool play)
|
||
{
|
||
PureDevice device(*mParent);
|
||
getSequencer();
|
||
if(clear)clearNotes();
|
||
prepareDevice(device,true);
|
||
for(int index=0;index<entry.size();index++)
|
||
{
|
||
const FrettedNote &frettedNote=((TabEntry&)entry)[index];
|
||
GuitarString &guitarString=operator[]((size()-1)-frettedNote.getString());
|
||
FrettedBoundingNote &frettedBoundingNote=guitarString[frettedNote.getFret()];
|
||
frettedBoundingNote.setBkGndColor(smColorRed);
|
||
frettedBoundingNote.setTextColor(smColorWhite);
|
||
drawNote(frettedBoundingNote,device);
|
||
mActiveFrets.insert(frettedBoundingNote);
|
||
if(play)
|
||
{
|
||
// Note ¬e=frettedNote;
|
||
// Note ¬e=getAt(frettedNote.getString(),frettedNote.getFret());
|
||
((Note&)frettedNote).noteOn(mSequencer->getDevice());
|
||
}
|
||
}
|
||
prepareDevice(device,false);
|
||
// if(play)((TabEntry&)entry).play(mSequencer->getDevice());
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
void ChordDialog::handleChordSelection(void)
|
||
{
|
||
String strSelect;
|
||
TabEntry entry;
|
||
|
||
strSelect=String(mChordList->getCurrent()+ResBegin);
|
||
if(strSelect.isNull())return;
|
||
makeTabEntry(strSelect,entry);
|
||
CallbackData cbData(0,(DWORD)&entry);
|
||
mPlayNoteHandler.callback(cbData);
|
||
/* if(!mMIDIDevice->getDevice().hasDevice())
|
||
mMIDIDevice->getDevice().openDevice();
|
||
for(int index=0;index<entry.size();index++)
|
||
{
|
||
FrettedNote &frettedNote=entry[index];
|
||
Note note=mFretboard.getAt(frettedNote.getString(),frettedNote.getFret());
|
||
note.noteOn(mMIDIDevice->getDevice());
|
||
}
|
||
*/
|
||
}
|
||
|
||
|
||
|
||
CallbackData::ReturnType ScaleDialog::initHandler(CallbackData &someCallbackData)
|
||
{
|
||
GDIPoint cursorPoint;
|
||
|
||
mMIDIDevice=::new Sequencer();
|
||
mMIDIDevice.disposition(PointerDisposition::Delete);
|
||
::GetCursorPos(&cursorPoint.getPOINT());
|
||
move(cursorPoint);
|
||
mScaleList=::new OwnerDrawListAltColor(*this,getItem(SCALEDLG_LIST),SCALEDLG_LIST);
|
||
mScaleList.disposition(PointerDisposition::Delete);
|
||
mScaleList->addString("Ionian");
|
||
mScaleList->addString("Dorian");
|
||
mScaleList->addString("Phrygian");
|
||
mScaleList->addString("Lydian");
|
||
mScaleList->addString("Mixolydian");
|
||
mScaleList->addString("Aeolian");
|
||
mScaleList->addString("Locrian");
|
||
mScaleList->addString("Pentatonic Minor");
|
||
mScaleList->addString("Harmonic Minor");
|
||
mScaleList->addString("Melodic Minor");
|
||
mScaleList->addString("Dorian-II");
|
||
mScaleList->addString("Lydian Augmented");
|
||
mScaleList->addString("Lydian Dominant");
|
||
mScaleList->addString("Locrian2");
|
||
mScaleList->addString("Altered");
|
||
mScaleList->addString("Diminished(Whole Step)");
|
||
mScaleList->addString("Diminished(Half Step)");
|
||
mScaleList->addString("Whole Tone");
|
||
sendMessage(SCALEDLG_SPIN,UDM_SETRANGE,0,(LPARAM)MAKELONG(11,0));
|
||
sendMessage(SCALEDLG_SPIN,UDM_SETBUDDY,(WPARAM)getItem(SCALEDLG_ROOT),0L);
|
||
sendMessage(SCALEDLG_SPIN,UDM_SETPOS,0,0L);
|
||
setText(SCALEDLG_ROOT,"A");
|
||
mScaleList->setCurrent(0);
|
||
// showScale();
|
||
return (CallbackData::ReturnType)FALSE;
|
||
}
|
||
|
||
|
||
|
||
|
||
bool TabPage::insert(const TabEntries &entries)
|
||
{
|
||
GlobalDefs::outDebug("[TabPage::insert]TabEntries",GlobalDefs::Debug);
|
||
if(!entries.size())return false;
|
||
for(int index=0;index<entries.size();index++)
|
||
{
|
||
mTabEntries.insert(&((TabEntries&)entries)[index]);
|
||
}
|
||
GlobalDefs::outDebug(String("[TabPage::insert] Added ")+String().fromInt(entries.size())+String(" entries."),GlobalDefs::Debug);
|
||
// createBitmap(*mParent);
|
||
|
||
isDirty(true);
|
||
update(*mParent);
|
||
mParent->invalidate(true);
|
||
mParent->update();
|
||
showCurrent();
|
||
|
||
return true;
|
||
}
|
||
|
||
|
||
|
||
/*
|
||
bool Fretboard::getAt(const Music::Chord &chord,Block<FrettedNote> &frettedNotes)
|
||
{
|
||
FrettedNote frettedNote;
|
||
bool returnCode=true;
|
||
|
||
frettedNotes.remove();
|
||
if(getAt(chord.getRoot(),frettedNote,frettedNotes)) // try to set the root on the top string
|
||
{
|
||
frettedNotes.insert(&frettedNote);
|
||
}
|
||
for(int index=chord.size()-1;index>=0;index--)
|
||
{
|
||
Note ¬e=((Music::Chord&)chord)[index];
|
||
if(getAt(note,frettedNote,frettedNotes))
|
||
frettedNotes.insert(&frettedNote);
|
||
else returnCode=false;
|
||
}
|
||
return returnCode;
|
||
}
|
||
*/
|
||
|
||
|
||
|
||
|
||
using namespace Music;
|
||
#include <music/ChordCompiler.hpp>
|
||
#include <guitar/ChordMapper.hpp>
|
||
/* Block<FrettedNote> frettedNotes;
|
||
ChordCompiler chordCompiler;
|
||
ChordMapper chordMapper;
|
||
Music::Chord chord;
|
||
String strChord("C7b9");
|
||
|
||
chordCompiler.compile(strChord,chord);
|
||
chordMapper.map(chord,frettedNotes);
|
||
|
||
*/
|
||
|
||
|
||
|
||
|
||
|
||
/*
|
||
bool ChordMapper::map(const Music::Chord &chord,Block<Block<FrettedNote> > &frettedNotesBlock)
|
||
{
|
||
frettedNotesBlock.remove();
|
||
|
||
Music::Chord tmpChord(chord);
|
||
for(int rIndex=0;rIndex<tmpChord.size();rIndex++)
|
||
{
|
||
for(int string=0;string<Fretboard::Strings;string++)
|
||
{
|
||
Block<FrettedNote> tryBlock;
|
||
if(!generateMapping(tmpChord,string,tryBlock))continue;
|
||
|
||
// getFillerNotes(tryBlock[0].getFret(),tmpChord,tryBlock);
|
||
|
||
|
||
frettedNotesBlock.insert(&tryBlock);
|
||
Block<FrettedNote> &frettedNotes=frettedNotesBlock[frettedNotesBlock.size()-1];
|
||
::OutputDebugString("***************************************************************\n");
|
||
for(int index=0;index<frettedNotes.size();index++)
|
||
{
|
||
::OutputDebugString(String(frettedNotes[index].toString()+String("\n")).str());
|
||
}
|
||
}
|
||
shiftChord(tmpChord);
|
||
}
|
||
return false;
|
||
}
|
||
*/
|
||
|
||
|
||
|
||
/*
|
||
bool ChordMapper::generateMapping(const Music::Chord &chord,int startingString,Block<FrettedNote> &frettedNotes)
|
||
{
|
||
FrettedNote frettedNote;
|
||
bool returnCode=true;
|
||
|
||
frettedNotes.remove();
|
||
for(int index=0;index<chord.size();index++,startingString++)
|
||
{
|
||
Note ¬e=((Music::Chord&)chord)[index];
|
||
if(startingString>=Fretboard::Strings)startingString=0;
|
||
if(getAt(startingString,note,frettedNote,frettedNotes))frettedNotes.insert(&frettedNote);
|
||
else returnCode=false;
|
||
if(!returnCode)break;
|
||
}
|
||
return returnCode;
|
||
}
|
||
*/
|
||
|
||
/*
|
||
bool ChordMapper::map(const Music::Chord &chord,Block<FrettedNote> &frettedNotes)
|
||
{
|
||
FrettedNote frettedNote;
|
||
bool returnCode=true;
|
||
bool isBarChord=false;
|
||
|
||
frettedNotes.remove();
|
||
if(getAt(chord.getRoot(),frettedNote,frettedNotes)) // try to set the root on the top string
|
||
{
|
||
frettedNotes.insert(&frettedNote);
|
||
isBarChord=true;
|
||
}
|
||
for(int index=chord.size()-1;index>=0;index--)
|
||
{
|
||
Note ¬e=((Music::Chord&)chord)[index];
|
||
if(getAt(note,frettedNote,frettedNotes))frettedNotes.insert(&frettedNote);
|
||
else
|
||
{
|
||
returnCode=false;
|
||
}
|
||
}
|
||
// need to come up with a strategy here for mapping notes on the fretboard
|
||
if(isBarChord) // check to see if we can fill in some notes at the bar chord fret
|
||
{
|
||
getFillerNotes(frettedNotes[0].getFret(),chord,frettedNotes);
|
||
}
|
||
return returnCode;
|
||
}
|
||
*/
|
||
|
||
|
||
|
||
|
||
/*
|
||
Shift positions of notes in chord
|
||
@param Chord - The chord
|
||
@return None
|
||
*/
|
||
void ChordMapper::shiftChord(Music::Chord &chord)
|
||
{
|
||
Note note;
|
||
|
||
note=chord[0];
|
||
for(int index=1;index<chord.size();index++)
|
||
{
|
||
chord[index-1]=chord[index];
|
||
}
|
||
chord[chord.size()-1]=note;
|
||
}
|
||
|
||
|
||
|
||
|
||
/*
|
||
bool TabPage::outlineRect(const Rect &outlineRect)
|
||
{
|
||
if(!isOkay())return false;
|
||
|
||
GlobalDefs::outDebug(String("[TabPage::outlineRect]"),GlobalDefs::Debug);
|
||
|
||
if(!mTabEntries[mCurrEntryIndex].getComment().isNull())setStatusText(mTabEntries[mCurrEntryIndex].getComment());
|
||
else setStatusText(String("Entry #")+String().fromInt(mCurrEntryIndex+1)+String(" of ")+String().fromInt(mTabEntries.size()));
|
||
if(mPrevOutlineRect==outlineRect)return false;
|
||
if(!mOverlay.isOkay())
|
||
{
|
||
mDIBitmap->getAt(mOverlay,outlineRect);
|
||
|
||
mDIBitmap->bitBlt(mOverlay->getDevice(),PureDevice::DstInvert);
|
||
|
||
// Rect rect(outlineRect);
|
||
// rect.left(rect.left()+1);
|
||
// rect.top(rect.top()+1);
|
||
// rect.right(rect.right()-1);
|
||
// rect.bottom(rect.bottom()-1);
|
||
// mDIBitmap->outlineRect(rect);
|
||
invalidate(outlineRect);
|
||
}
|
||
else
|
||
{
|
||
mDIBitmap->overlay(*mOverlay,Point(mPrevOutlineRect.left(),mPrevOutlineRect.top()));
|
||
invalidate(mPrevOutlineRect);
|
||
mDIBitmap->getAt(mOverlay,outlineRect);
|
||
|
||
mDIBitmap->bitBlt(mOverlay->getDevice(),PureDevice::DstInvert);
|
||
|
||
|
||
// Rect rect(outlineRect);
|
||
// rect.left(rect.left()+1);
|
||
// rect.top(rect.top()+1);
|
||
// rect.right(rect.right()-1);
|
||
// rect.bottom(rect.bottom()-1);
|
||
// mDIBitmap->outlineRect(rect);
|
||
invalidate(outlineRect);
|
||
}
|
||
mPrevOutlineRect=outlineRect;
|
||
return true;
|
||
}
|
||
*/
|