Initial
This commit is contained in:
61
midiseq/midiblck.cpp
Normal file
61
midiseq/midiblck.cpp
Normal file
@@ -0,0 +1,61 @@
|
||||
#include <midiseq/midiblck.hpp>
|
||||
#include <midiseq/midimsg.hpp>
|
||||
#include <midiseq/pureevnt.hpp>
|
||||
#include <common/string.hpp>
|
||||
#include <common/openfile.hpp>
|
||||
|
||||
MIDIBlock &MIDIBlock::operator=(const MIDIBlock &someMIDIBlock)
|
||||
{
|
||||
for(short itemIndex=0;itemIndex<MaxTracks;itemIndex++)
|
||||
mMIDIBlock[itemIndex]=((MIDIBlock&)someMIDIBlock)[itemIndex];
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool MIDIBlock::getTrackInfo(TrackInfos &trackInfos)
|
||||
{
|
||||
trackInfos.remove();
|
||||
for(int trIndex=0;trIndex<MaxTracks;trIndex++)
|
||||
{
|
||||
if(mMIDIBlock[trIndex].size())
|
||||
{
|
||||
trackInfos.insert(&TrackInfo());
|
||||
TrackInfo &trackInfo=trackInfos[trackInfos.size()-1];
|
||||
trackInfo.setTrackNo(trIndex);
|
||||
trackInfo.setEventCount(mMIDIBlock[trIndex].size());
|
||||
}
|
||||
}
|
||||
return trackInfos.size()?true:false;
|
||||
}
|
||||
|
||||
|
||||
/*inline
|
||||
bool MIDIBlock::getTracks(Block<PureWORD> &tracks)
|
||||
{
|
||||
tracks.remove();
|
||||
for(int trackIndex=0;trackIndex<MaxTracks;trackIndex++)
|
||||
{
|
||||
if(mMIDIBlock[trackIndex].size())tracks.insert(&PureWORD(trackIndex));
|
||||
}
|
||||
return tracks.size()?true:false;
|
||||
}
|
||||
*/
|
||||
|
||||
void MIDIBlock::printBlock(const String &pathFileName)
|
||||
{
|
||||
FileHandle writeFile(pathFileName,FileHandle::Write,FileHandle::ShareRead,FileHandle::Overwrite);
|
||||
String eventString;
|
||||
|
||||
if(!writeFile.isOkay())return;
|
||||
for(short channel=0;channel<MaxTracks;channel++)
|
||||
{
|
||||
EventBlock &eventBlock=(mMIDIBlock[channel]);
|
||||
WORD eventCount(eventBlock.size());
|
||||
for(short eventIndex=0;eventIndex<eventCount;eventIndex++)
|
||||
{
|
||||
String eventString(String("Track:")+String().fromInt(channel+1)+String(" ")+eventBlock[eventIndex].toString());
|
||||
writeFile.writeLine(eventString);
|
||||
}
|
||||
writeFile.writeLine("****************************************************************************");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user