bool CInstrument2A03::Load(CDocumentFile *pDocFile) { int SeqCnt; int Octaves = OCTAVE_RANGE; int Index; int Version = pDocFile->GetBlockVersion(); SeqCnt = pDocFile->GetBlockInt(); ASSERT_FILE_DATA(SeqCnt < (SEQUENCE_COUNT + 1)); for (int i = 0; i < SeqCnt; ++i) { SetSeqEnable(i, pDocFile->GetBlockChar()); Index = pDocFile->GetBlockChar(); ASSERT_FILE_DATA(Index < MAX_SEQUENCES); SetSeqIndex(i, Index); } if (Version == 1) Octaves = 6; for (int i = 0; i < Octaves; ++i) { for (int j = 0; j < 12; ++j) { Index = pDocFile->GetBlockChar(); if (Index >= MAX_DSAMPLES) Index = 0; SetSample(i, j, Index); SetSamplePitch(i, j, pDocFile->GetBlockChar()); } } return true; }
bool CInstrumentFDS::LoadSequence(CDocumentFile *pDocFile, CSequence *pSeq) { int SeqCount; unsigned int LoopPoint; unsigned int ReleasePoint; unsigned int Settings; SeqCount = (unsigned char)pDocFile->GetBlockChar(); LoopPoint = pDocFile->GetBlockInt(); ReleasePoint = pDocFile->GetBlockInt(); Settings = pDocFile->GetBlockInt(); ASSERT_FILE_DATA(SeqCount <= MAX_SEQUENCE_ITEMS); pSeq->Clear(); pSeq->SetItemCount(SeqCount); pSeq->SetLoopPoint(LoopPoint); pSeq->SetReleasePoint(ReleasePoint); pSeq->SetSetting(Settings); for (int x = 0; x < SeqCount; ++x) { char Value = pDocFile->GetBlockChar(); pSeq->SetItem(x, Value); } return true; }
bool CInstrumentS5B::Load(CDocumentFile *pDocFile) { int SeqCnt = pDocFile->GetBlockInt(); ASSERT_FILE_DATA(SeqCnt < (SEQUENCE_COUNT + 1)); SeqCnt = SEQUENCE_COUNT; for (int i = 0; i < SeqCnt; i++) { SetSeqEnable(i, pDocFile->GetBlockChar()); int Index = pDocFile->GetBlockChar(); ASSERT_FILE_DATA(Index < MAX_SEQUENCES); SetSeqIndex(i, Index); } return true; }
bool CInstrumentN163::Load(CDocumentFile *pDocFile) { int SeqCnt = pDocFile->GetBlockInt(); ASSERT_FILE_DATA(SeqCnt < (SEQUENCE_COUNT + 1)); SeqCnt = SEQUENCE_COUNT; for (int i = 0; i < SeqCnt; ++i) { SetSeqEnable(i, pDocFile->GetBlockChar()); int Index = pDocFile->GetBlockChar(); ASSERT_FILE_DATA(Index < MAX_SEQUENCES); SetSeqIndex(i, Index); } m_iWaveSize = pDocFile->GetBlockInt(); ASSERT_FILE_DATA(m_iWaveSize >= 0 && m_iWaveSize <= MAX_WAVE_SIZE); m_iWavePos = pDocFile->GetBlockInt(); ASSERT_FILE_DATA(m_iWavePos >= 0 && m_iWavePos < 128); // m_bAutoWavePos = (pDocFile->GetBlockInt() == 0) ? false : true; //pDocFile->GetBlockInt(); m_iWaveCount = pDocFile->GetBlockInt(); ASSERT_FILE_DATA(m_iWaveCount >= 1 && m_iWaveCount <= MAX_WAVE_COUNT); for (int i = 0; i < m_iWaveCount; ++i) { for (int j = 0; j < m_iWaveSize; ++j) { unsigned char WaveSample = pDocFile->GetBlockChar(); ASSERT_FILE_DATA(WaveSample < 16); m_iSamples[i][j] = WaveSample; } } return true; }