@@ -106,23 +106,21 @@ export class DownloadableSoundsArticulation extends DLSVerifier {
106106 * @param chunks
107107 */
108108 public read ( chunks : RIFFChunk [ ] ) {
109- const lart = RIFFChunk . findType ( chunks , "lart" ) ;
110- const lar2 = RIFFChunk . findType ( chunks , "lar2" ) ;
109+ const lart = RIFFChunk . findListType ( chunks , "lart" ) ;
110+ const lar2 = RIFFChunk . findListType ( chunks , "lar2" ) ;
111111
112112 if ( lart ) {
113113 this . mode = "dls1" ;
114114 while ( lart . data . currentIndex < lart . data . length ) {
115- const art1 = RIFFChunk . read ( lart . data ) ;
115+ const chunk = RIFFChunk . read ( lart . data ) ;
116116 // Note:
117117 // DLS Specification says that lar2 should only have art2, but a DirectMusic Producer example
118118 // "FarmGame.dls" has 'art1' in there.
119119 // Hence, we allow art2 in lart and art1 in lar2.
120- DownloadableSoundsArticulation . verifyHeader (
121- art1 ,
122- "art1" ,
123- "art2"
124- ) ;
125- const artData = art1 . data ;
120+ if ( chunk . header !== "art1" && chunk . header !== "art2" )
121+ // There may be a cdl chunk, testcase romania_main.dls
122+ continue ;
123+ const artData = chunk . data ;
126124 const cbSize = readLittleEndianIndexed ( artData , 4 ) ;
127125 if ( cbSize !== 8 ) {
128126 SpessaSynthWarn (
@@ -137,17 +135,15 @@ export class DownloadableSoundsArticulation extends DLSVerifier {
137135 } else if ( lar2 ) {
138136 this . mode = "dls2" ;
139137 while ( lar2 . data . currentIndex < lar2 . data . length ) {
140- const art2 = RIFFChunk . read ( lar2 . data ) ;
138+ const chunk = RIFFChunk . read ( lar2 . data ) ;
141139 // Note:
142140 // DLS Specification says that lar2 should only have art2, but a DirectMusic Producer example
143141 // "FarmGame.dls" has 'art1' in there.
144142 // Hence, we allow art2 in lart and art1 in lar2.
145- DownloadableSoundsArticulation . verifyHeader (
146- art2 ,
147- "art2" ,
148- "art1"
149- ) ;
150- const artData = art2 . data ;
143+ if ( chunk . header !== "art1" && chunk . header !== "art2" )
144+ // There may be a cdl chunk, testcase romania_main.dls
145+ continue ;
146+ const artData = chunk . data ;
151147 const cbSize = readLittleEndianIndexed ( artData , 4 ) ;
152148 if ( cbSize !== 8 ) {
153149 SpessaSynthWarn (
0 commit comments