| 15 | JASBank *createBank(const void *p, JKRHeap *pHeap) { return createBasicBank(p, pHeap); } |
| 16 | |
| 17 | JASBasicBank *createBasicBank(const void *p, JKRHeap *pHeap) |
| 18 | { |
| 19 | if (pHeap == NULL) |
| 20 | pHeap = JASDram; |
| 21 | |
| 22 | u32 oldSize = pHeap->getFreeSize(); |
| 23 | const THeader *headerp = (const THeader *)p; |
| 24 | JASBasicBank *bank = new (pHeap, 0) JASBasicBank(); |
| 25 | |
| 26 | if (bank == NULL) |
| 27 | return NULL; |
| 28 | |
| 29 | for (int i = 0; i < 0x80; i++) |
| 30 | { |
| 31 | const TInst *instrument = headerp->bank.instOffsets[i].ptr(headerp); |
| 32 | |
| 33 | if (instrument == NULL) |
| 34 | continue; |
| 35 | |
| 36 | JASBasicInst *instp = new (pHeap, 0) JASBasicInst(); |
| 37 | #line 56 |
| 38 | JUT_ASSERT(instp != 0); |
| 39 | instp->setVolume(instrument->volume); |
| 40 | instp->setPitch(instrument->pitch); |
| 41 | |
| 42 | for (int osc_no = 0, j = 0; j < 2; j++) |
| 43 | { |
| 44 | TOsc *oscp = instrument->oscOffsets[j].ptr(headerp); |
| 45 | if (oscp == NULL) |
| 46 | continue; |
| 47 | |
| 48 | JASOscillator::Data *osc = findOscPtr(bank, headerp, oscp); |
| 49 | if (osc == NULL) |
| 50 | { |
| 51 | osc = new (pHeap, 0) JASOscillator::Data; |
| 52 | #line 71 |
| 53 | JUT_ASSERT(osc != 0); |
| 54 | osc->mTarget = oscp->target; |
| 55 | osc->_04 = oscp->_4; |
| 56 | const JASOscillator::Point *start = oscp->oscPointOffset.ptr(headerp); |
| 57 | if (start != NULL) |
| 58 | { |
| 59 | const JASOscillator::Point *end = getOscTableEndPtr(start); |
| 60 | JASOscillator::Point *table = new (pHeap, 0) JASOscillator::Point[(end - start)]; |
| 61 | #line 81 |
| 62 | JUT_ASSERT(table != 0); |
| 63 | JASCalc::bcopy(start, table, (end - start) * sizeof(JASOscillator::Point)); |
| 64 | osc->mTable = table; |
| 65 | } |
| 66 | else |
| 67 | { |
| 68 | osc->mTable = nullptr; |
| 69 | } |
| 70 | start = oscp->oscPointOffset2.ptr(headerp); |
| 71 | if (start != NULL) |
| 72 | { |
| 73 | const JASOscillator::Point *end = getOscTableEndPtr(start); |
| 74 | JASOscillator::Point *table = new (pHeap, 0) JASOscillator::Point[(end - start)]; |
no test coverage detected