diff options
author | Chris Xiong <chirs241097@gmail.com> | 2019-06-16 20:12:14 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2019-06-16 20:12:14 +0800 |
commit | 795043d6851a355d70aa2341e2edfd526c24d041 (patch) | |
tree | 203991e9a062934254bc9c6ca2053bdf4c096773 /core/qmpmidiread.cpp | |
parent | 7b03fd544837fbe0bc5a5373b60dfd5de50892e1 (diff) | |
download | QMidiPlayer-795043d6851a355d70aa2341e2edfd526c24d041.tar.xz |
Inital implementation of the device properties API.
Added new interfaces to qmpMidiOutDevice.
Implemented the new interfaces for qmpMidiOutFluid.
Initial infra for device initialization file parsing.
Move to the new interfaces for getting list of presets.
Use DevIL instead of CxImage.
External output devices are broken now but that is for
another commit.
Diffstat (limited to 'core/qmpmidiread.cpp')
-rw-r--r-- | core/qmpmidiread.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/core/qmpmidiread.cpp b/core/qmpmidiread.cpp index 7f5bdfc..48a149d 100644 --- a/core/qmpmidiread.cpp +++ b/core/qmpmidiread.cpp @@ -94,7 +94,8 @@ int CSMFReader::read_event()//returns 0 if End of Track encountered uint32_t len=read_varlen();char* str=nullptr; if(len<=1024&&len>0)str=new char[len+8]; if(str)fread(str,1,len,f);else fseek(f,len,SEEK_CUR); - if(str)str[len]='\0'; + std::string sstr; + if(str){str[len]='\0';sstr=std::string(str,len);} switch(metatype) { case 0x00://Sequence Number @@ -108,24 +109,24 @@ int CSMFReader::read_event()//returns 0 if End of Track encountered return 0; case 0x51://Set Tempo assert(len==3); - curTrack->appendEvent(SEvent(curid,curt,type,metatype,0,str)); + curTrack->appendEvent(SEvent(curid,curt,type,metatype,0,sstr)); break; case 0x54://SMTPE offset, not handled. assert(len==5); break; case 0x58://Time signature assert(len==4); - curTrack->appendEvent(SEvent(curid,curt,type,metatype,0,str)); + curTrack->appendEvent(SEvent(curid,curt,type,metatype,0,sstr)); break; case 0x59://Key signature assert(len==2); - curTrack->appendEvent(SEvent(curid,curt,type,metatype,0,str)); + curTrack->appendEvent(SEvent(curid,curt,type,metatype,0,sstr)); break; case 0x01:case 0x02:case 0x03: case 0x04:case 0x05:case 0x06: case 0x07:case 0x7F:default://text-like meta { - curTrack->appendEvent(SEvent(curid,curt,type,metatype,0,str)); + curTrack->appendEvent(SEvent(curid,curt,type,metatype,0,sstr)); if(str&&metatype==0x03&&!ret->title) { ret->title=new char[len+8]; |