(readable: IReadable)
| 66 | } |
| 67 | |
| 68 | public load(readable: IReadable): void { |
| 69 | const chunkHead: RiffChunk = new RiffChunk(); |
| 70 | const chunkFastList: RiffChunk = new RiffChunk(); |
| 71 | if (!RiffChunk.load(null, chunkHead, readable) || chunkHead.id !== 'sfbk') { |
| 72 | throw new FormatError('Soundfont is not a valid Soundfont2 file'); |
| 73 | } |
| 74 | |
| 75 | while (RiffChunk.load(chunkHead, chunkFastList, readable)) { |
| 76 | const chunk: RiffChunk = new RiffChunk(); |
| 77 | if (chunkFastList.id === 'pdta') { |
| 78 | while (RiffChunk.load(chunkFastList, chunk, readable)) { |
| 79 | switch (chunk.id) { |
| 80 | case 'phdr': |
| 81 | for ( |
| 82 | let i: number = 0, count: number = (chunk.size / HydraPhdr.SizeInFile) | 0; |
| 83 | i < count; |
| 84 | i++ |
| 85 | ) { |
| 86 | this.phdrs.push(new HydraPhdr(readable)); |
| 87 | } |
| 88 | break; |
| 89 | case 'pbag': |
| 90 | for ( |
| 91 | let i: number = 0, count: number = (chunk.size / HydraPbag.SizeInFile) | 0; |
| 92 | i < count; |
| 93 | i++ |
| 94 | ) { |
| 95 | this.pbags.push(new HydraPbag(readable)); |
| 96 | } |
| 97 | break; |
| 98 | case 'pmod': |
| 99 | for ( |
| 100 | let i: number = 0, count: number = (chunk.size / HydraPmod.SizeInFile) | 0; |
| 101 | i < count; |
| 102 | i++ |
| 103 | ) { |
| 104 | this.pmods.push(new HydraPmod(readable)); |
| 105 | } |
| 106 | break; |
| 107 | case 'pgen': |
| 108 | for ( |
| 109 | let i: number = 0, count: number = (chunk.size / HydraPgen.SizeInFile) | 0; |
| 110 | i < count; |
| 111 | i++ |
| 112 | ) { |
| 113 | this.pgens.push(new HydraPgen(readable)); |
| 114 | } |
| 115 | break; |
| 116 | case 'inst': |
| 117 | for ( |
| 118 | let i: number = 0, count: number = (chunk.size / HydraInst.SizeInFile) | 0; |
| 119 | i < count; |
| 120 | i++ |
| 121 | ) { |
| 122 | this.insts.push(new HydraInst(readable)); |
| 123 | } |
| 124 | break; |
| 125 | case 'ibag': |
no test coverage detected