@@ -19,8 +19,9 @@ import type { Score } from '@coderline/alphatab/model/Score';
1919import { Settings } from '@coderline/alphatab/Settings' ;
2020import { AlphaSynth } from '@coderline/alphatab/synth/AlphaSynth' ;
2121import { AudioExportOptions } from '@coderline/alphatab/synth/IAudioExporter' ;
22- import { Hydra } from '@coderline/alphatab/synth/soundfont/Hydra' ;
22+ import { Hydra , HydraGenAmount } from '@coderline/alphatab/synth/soundfont/Hydra' ;
2323import { SynthConstants } from '@coderline/alphatab/synth/SynthConstants' ;
24+ import { GenOperators , Region } from '@coderline/alphatab/synth/synthesis/Region' ;
2425import { TinySoundFont } from '@coderline/alphatab/synth/synthesis/TinySoundFont' ;
2526import { Mdct } from '@coderline/alphatab/synth/vorbis/Mdct' ;
2627import { VorbisDecoder } from '@coderline/alphatab/synth/vorbis/VorbisDecoder' ;
@@ -522,4 +523,19 @@ describe('AlphaSynthTests', () => {
522523
523524 await testPlaythrough ( midi ) ;
524525 } ) ;
526+
527+ it ( 'soundfont-attenuation-local-overrides-global' , ( ) => {
528+ const attenuation = GenOperators . InitialAttenuation as number ;
529+ const amount = ( v : number ) =>
530+ new HydraGenAmount ( ByteBuffer . fromBuffer ( new Uint8Array ( [ v & 0xff , ( v >> 8 ) & 0xff ] ) ) ) ;
531+ const globalZone = new Region ( ) ;
532+ globalZone . clear ( true ) ;
533+ globalZone . operator ( attenuation , amount ( 100 ) ) ;
534+ const localZone = new Region ( globalZone ) ;
535+ expect ( localZone . attenuation ) . toBeCloseTo ( 10 ) ;
536+ localZone . operator ( attenuation , amount ( 60 ) ) ;
537+ expect ( localZone . attenuation ) . toBeCloseTo ( 6 ) ;
538+ localZone . operator ( attenuation , amount ( 0 ) ) ;
539+ expect ( localZone . attenuation ) . toBe ( 0 ) ;
540+ } ) ;
525541} ) ;
0 commit comments