//+------------------------------------------------------------------------- // // Microsoft Windows // // Copyright (c) 1998-1999 Microsoft Corporation // // File: iodmcomp.h // //-------------------------------------------------------------------------- #ifndef PERSONALITYRIFF_H #define PERSONALITYRIFF_H // runtime chunks #define FOURCC_PERSONALITY mmioFOURCC('D','M','P','R') #define FOURCC_IOPERSONALITY mmioFOURCC('p','e','r','h') #define DM_FOURCC_GUID_CHUNK mmioFOURCC('g','u','i','d') #define DM_FOURCC_INFO_LIST mmioFOURCC('I','N','F','O') #define DM_FOURCC_VERSION_CHUNK mmioFOURCC('v','e','r','s') #define FOURCC_SUBCHORD mmioFOURCC('c','h','d','t') #define FOURCC_CHORDENTRY mmioFOURCC('c','h','e','h') #define FOURCC_SUBCHORDID mmioFOURCC('s','b','c','n') #define FOURCC_IONEXTCHORD mmioFOURCC('n','c','r','d') #define FOURCC_NEXTCHORDSEQ mmioFOURCC('n','c','s','q') #define FOURCC_IOSIGNPOST mmioFOURCC('s','p','s','h') #define FOURCC_CHORDNAME mmioFOURCC('I','N','A','M') // runtime list chunks #define FOURCC_LISTCHORDENTRY mmioFOURCC('c','h','o','e') #define FOURCC_LISTCHORDMAP mmioFOURCC('c','m','a','p') #define FOURCC_LISTCHORD mmioFOURCC('c','h','r','d') #define FOURCC_LISTCHORDPALETTE mmioFOURCC('c','h','p','l') #define FOURCC_LISTCADENCE mmioFOURCC('c','a','d','e') #define FOURCC_LISTSIGNPOSTITEM mmioFOURCC('s','p','s','t') #define FOURCC_SIGNPOSTLIST mmioFOURCC('s','p','s','q') // constants const int MaxSubChords = 4; // simple riff read/writers inline HRESULT ReadWord(IAARIFFStream* pIRiffStream, WORD& val) { assert(pIRiffStream); IStream* pIStream = pIRiffStream->GetStream(); assert(pIStream); if(pIStream) { HRESULT hr = pIStream->Read(&val, sizeof(WORD), 0); pIStream->Release(); return hr; } else { return E_FAIL; } } class ReadChunk { MMCKINFO m_ck; MMCKINFO* m_pckParent; IAARIFFStream* m_pRiffStream; HRESULT m_hr; public: ReadChunk(IAARIFFStream* pRiffStream, MMCKINFO* pckParent) : m_pRiffStream(pRiffStream) { m_pckParent = pckParent; m_hr = pRiffStream->Descend( &m_ck, m_pckParent, 0 ); } ~ReadChunk() { if(m_hr == 0) { m_hr = m_pRiffStream->Ascend(&m_ck, 0); } } HRESULT State(MMCKINFO* pck=0) { if(pck) { memcpy(pck, &m_ck, sizeof(MMCKINFO)); } return m_hr; } FOURCC Id() { if(m_ck.ckid = FOURCC_LIST) { return m_ck.fccType; } else { return m_ck.ckid; } } }; // run time data structs struct ioPersonality { char szLoadName[20]; DWORD dwScalePattern; DWORD dwFlags; }; struct ioSubChord { DWORD dwChordPattern; DWORD dwScalePattern; DWORD dwInvertPattern; BYTE bChordRoot; BYTE bScaleRoot; WORD wCFlags; DWORD dwLevels; // parts or which subchord levels this chord supports }; struct ioChordEntry { DWORD dwFlags; WORD wConnectionID; // replaces runtime "pointer to this" }; struct ioNextChord { DWORD dwFlags; WORD nWeight; WORD wMinBeats; WORD wMaxBeats; WORD wConnectionID; // points to an ioChordEntry }; struct ioSignPost { DWORD dwChords; // 1bit per group DWORD dwFlags; }; /* RIFF ( 'DMPR' // Personality header chunk [] // guid chunk [] // version chunk (two DWORDS) // standard MS Info chunk // subchord database // chord palette // chord map // signpost list [] // optional chordmap position data ) ::= chdt( ... ) ::= LIST('chpl' ... // chord definition ) ::= LIST('chrd' // name of chord in wide char format // list of subchords composing chord [] // optional chord edit flags ) ::= LIST('cmap' ) ::= LIST('choe' // chord entry data // chord definition // connecting(next) chords ) ::= LIST('spst' [] ) ::= LIST('cade' ...) ::= sbcn() ::= ceed(ioChordEntryEdit) ::= ched(DMChordEdit) ::= cheh(i) ::= ncrd() ::= ncsq( ...) ::= spsh() */ struct ioDMSignPost { MUSIC_TIME m_mtTime; DWORD m_dwChords; WORD m_wMeasure; }; #endif