/* 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 #include #include #include #include #include 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=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=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;indexwidestEntry)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=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=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=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=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 #endif SmartPointer mToolTipControl; bool isValidFret(int fret); bool haveElement(int elements[6]); /* bool Tablature::parseTab(void) { int elements[6]; for(int index=0;index bool Tablature::play(MIDIOutputDevice &midiDevice,GUIFretboard &guiFretboard,GUIWindow &guiWindow) { PureDevice device(guiWindow); if(!midiDevice.hasDevice())return false; setCancelled(false); for(int index=0;indexgetAt(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;strIndexwidth(),mParent->height(),systemPalette); mDIBitmap.disposition(PointerDisposition::Delete); mDIBitmap->setBits(255); } */ if(!getDocumentClass(String(STRING_FRETVIEWWINDOWCLASSNAME),fretWindow))return; fretWindow->top(); #include #include /* 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(;indexoutlineRect(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 &midPoints,WORD sectionLength,const Pen &somePen); WORD crossHairs(PureVector &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;indexcolorRect(fillRect,FillColorBlack); mParent->invalidate(fillRect,false); } mParent->update(); } */ void GUIFretboard::createVirtualFretboard(void) { /* SmartPointer 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;strIndexsetBoundingRect(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 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;strIndexsetBoundingRect(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;rowheight();row++) { for(int col=0;colwidth();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;indexmaxPos)maxPos=operator[](index).getPosition(); } for(index=0;indexmaxPos)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 #include #include #include #include /* 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 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 #include /* 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 #include #include 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 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;indexMaxChars) { 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 &outLines,File &outFile) { for(int index=0;index<6;index++)outFile.writeLine(outLines[index]); } void TabWriter::initLines(Array &outLines,int size) { outLines.size(6); for(int line=0;line<6;line++) { outLines[line].reserve(size,true); for(int charIndex=0;charIndex &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=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=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::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;indexsize();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 #endif #ifndef _MIDISEQ_MIDIDATA_HPP_ #include #endif #ifndef _MIDISEQ_MIDICHANNELMESSAGE_HPP_ #include #endif #ifndef _GUITAR_TABENTRY_HPP_ #include #endif #ifndef _GUITAR_FRETBOARD_HPP_ #include #endif #ifndef _GUITAR_TABLATURE_HPP_ #include #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 eventBlock; // Block frettedNotes; Block tracks; Block 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;trIndexmaxEvents) { maxEvents=midiData.getEventCount(tracks[trIndex].getValue()); currentTrack=tracks[trIndex].getValue(); } } FrettedNote frettedNote; // PureNote pureNote; // Note note; // entry.remove(); for(int index=0;index=highestOctave)note.setOctave(highestOctave-1); fretboard.getAt(note,frettedNotes); } found=false; for(int fnIndex=0;fnIndex #include void MIDIHelper::import(const String &musicFileName) { TabEntries tabEntries; Tablature tablature; TabEntry entry; WORD currPlayTime; WORD prevPlayTime; mMessages.remove(); currPlayTime=0; prevPlayTime=0; Block tracks; Block 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;trIndexmaxEvents) { maxEvents=midiData.getEventCount(tracks[trIndex].getValue()); currentTrack=tracks[trIndex].getValue(); } } for(int index=0;index ¬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 ¬es) { for(int noteIndex=0;noteIndex=highestOctave)note.setOctave(highestOctave-1); fretboard.getAt(note,frettedNotes); } found=false; for(int fnIndex=0;fnIndex=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; Array > mdiWindows; if(!registry.removeHistory(pathFileName))return; removeHistory(getFrameMenu()); applyHistory(getFrameMenu()); if(!getDocuments(mdiWindows))return; for(int index=0;indexgetMenu()); applyHistory(mdiWindow->getMenu()); } } void MainFrame::openProjectView(const String &strPathProjectFile) { SmartPointer 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 tracks; Block 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;trIndexmaxEvents) { maxEvents=midiData.getEventCount(tracks[trIndex].getValue()); currentTrack=tracks[trIndex].getValue(); } } for(int index=0;index 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 #include #include #include 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 #include #include 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 &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 #include #include 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;indexgetDevice()); } } 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;indexgetDevice()); } */ } 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;indexinvalidate(true); mParent->update(); showCurrent(); return true; } /* bool Fretboard::getAt(const Music::Chord &chord,Block &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 #include /* Block 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 > &frettedNotesBlock) { frettedNotesBlock.remove(); Music::Chord tmpChord(chord); for(int rIndex=0;rIndex tryBlock; if(!generateMapping(tmpChord,string,tryBlock))continue; // getFillerNotes(tryBlock[0].getFret(),tmpChord,tryBlock); frettedNotesBlock.insert(&tryBlock); Block &frettedNotes=frettedNotesBlock[frettedNotesBlock.size()-1]; ::OutputDebugString("***************************************************************\n"); for(int index=0;index &frettedNotes) { FrettedNote frettedNote; bool returnCode=true; frettedNotes.remove(); for(int index=0;index=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 &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;indexgetAt(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; } */