#include #include void testNotes(void); void testFile(void); void testEvent(void); void testSort(); int PASCAL WinMain(HINSTANCE /*hInstance*/,HINSTANCE /*hPrevInstance*/,LPSTR /*lpszCmdLine*/,int /*nCmdShow*/) { // testEvent(); // testSort(); testFile(); // testNotes(); return 0; } void testFile(void) { // String musicFileName("E:\\WORK\\SCENE\\MEDIA\\BMP\\E1M2.MID"); // String musicFileName("E:\\WORK\\GUITAR\\MIDI\\DIANA.MID"); // OK // String musicFileName("E:\\WORK\\GUITAR\\MIDI\\JESU_1.MID"); // OK // String musicFileName("E:\\WORK\\GUITAR\\MIDI\\paco.MID"); // OK String musicFileName("E:\\WORK\\GUITAR\\MIDI\\zapatead.mid"); // String musicFileName("C:\\WINNT\\MEDIA\\PASSPORT.MID"); // String musicFileName("E:\\WORK\\GUITAR\\MIDI\\BUMBLEBEE.MID"); // OK // String musicFileName("C:\\WINNT\\MEDIA\\CANYON.MID"); MidiData midiData(musicFileName); midiData.play(); while(midiData.isInPlay()); midiData.stop(); ::MessageBox(::GetFocus(),(LPSTR)musicFileName,(LPSTR)"End Play",MB_OK); return; } void testEvent(void) { String musicFileName("D:\\WORK\\SCENE\\MEDIA\\BMP\\E1M2.MID"); int requiredChannel=0; MidiData midiData(musicFileName); midiData.makeRealTime(); ::OutputDebugString(String("MIDI events=")+String().fromInt(midiData.getEventCount())); for(int index=0;index void testSort() { /* list lst; PureEvent p1; PureEvent p2; PureEvent p3; PureEvent p4; PureEvent p5; PureEvent p6; PureEvent p7; PureEvent p8; PureEvent p9; p1.eventType(128); p2.eventType(128); p3.eventType(128); p4.eventType(144); p5.eventType(128); p6.eventType(128); p7.eventType(128); p8.eventType(128); p9.eventType(144); lst.push_back(p1); lst.push_back(p2); lst.push_back(p3); lst.push_back(p4); lst.push_back(p5); lst.push_back(p6); lst.push_back(p7); lst.push_back(p8); lst.push_back(p9); lst.sort(); list::iterator p=lst.begin(); while(p!=lst.end()) { ::OutputDebugString((*p).toString()+String("\n")); p++; } */ Array pureEvents; QuickSort eventSorter; PureEvent pureEvent; pureEvents.size(9); pureEvent.eventType(128); pureEvents[0]=pureEvent; pureEvent.eventType(128); pureEvents[1]=pureEvent; pureEvent.eventType(128); pureEvents[2]=pureEvent; pureEvent.eventType(144); pureEvents[3]=pureEvent; pureEvent.eventType(128); pureEvents[4]=pureEvent; pureEvent.eventType(128); pureEvents[5]=pureEvent; pureEvent.eventType(128); pureEvents[6]=pureEvent; pureEvent.eventType(128); pureEvents[7]=pureEvent; pureEvent.eventType(144); pureEvents[8]=pureEvent; eventSorter.sortItems(pureEvents); ::OutputDebugString("\n"); for(int index=0;indexMaxPitch)pitch=MaxPitch; mPitch=pitch; } inline WORD PitchBend::getPitch(void)const { return mPitch; } inline void PitchBend::centerWheel(void) { mPitch=CenterPitch; } inline BYTE PitchBend::getLo(void)const { return mPitch&0xFF; } inline BYTE PitchBend::getHi(void)const { return mPitch>>8; } inline PureEvent PitchBend::getEvent(void)const { String strPitch; ::sprintf(strPitch.str(),"lo:0x%04lx hi:0x%04lx\n",getLo(),getHi()); ::OutputDebugString(strPitch.str()); PureEvent pureEvent(MIDIPitchBend,0,0,getHi(),getLo()); return pureEvent; } void testNotes(void) { MIDIOutputDevice midiOut; NoteOn noteOn(PureNote(70,60)); PitchBend pitchBend; pitchBend.setPitch(0x0); pitchBend.setPitch(0x2000+128); // pitchBend.setPitch(0x3FFF); NoteOff noteOff(PureNote(70,60)); if(!midiOut.openDevice())return; midiOut.midiEvent(noteOn.getEvent()); midiOut.midiEvent(pitchBend.getEvent()); pitchBend.setPitch(0x2000); midiOut.midiEvent(pitchBend.getEvent()); midiOut.midiEvent(noteOn.getEvent()); midiOut.midiEvent(noteOff.getEvent()); midiOut.closeDevice(); return; } // String musicFileName("C:\\WORK\\SCENE\\MEDIA\\WALTHIUS\\DEMON21T.MID"); // String musicFileName("C:\\WORK\\SCENE\\MEDIA\\CYBRBEAT.MID"); // String musicFileName("C:\\WINDOWS\\CANYON.MID"); // String musicFileName("C:\\WORK\\SCENE\\MEDIA\\MID\\D_STALKS.MID"); // String musicFileName("C:\\WORK\\SCENE\\MEDIA\\MID\\E1M9.MID"); // String musicFileName("C:\\WORK\\SCENE\\MEDIA\\EXORCIST.MID"); // String musicFileName("C:\\WORK\\SCENE\\MEDIA\\YYZ.MID"); // String musicFileName("C:\\WORK\\SCENE\\MEDIA\\K330-1.MID"); // String musicFileName("C:\\WORK\\SCENE\\MEDIA\\K330-2.MID");