@@ -9,14 +9,20 @@ export class WavePropertiesPanel implements IComponent {
99
1010 nameInput : HTMLInputElement ;
1111 noteSelect : HTMLSelectElement ;
12+ sampleRateInput : HTMLInputElement ;
1213
1314 name : string ;
1415 note : number ;
16+ sampleRate : number ;
1517
16- constructor ( app : Appl , name : string , note : number ) {
18+ constructor ( app : Appl , name : string , note : number , sampleRate : number ) {
19+ if ( ! sampleRate ) {
20+ throw new Error ( "samplerate missing!" )
21+ }
1722 this . app = app ;
1823 this . name = name ;
1924 this . note = note ;
25+ this . sampleRate = sampleRate ;
2026
2127 this . container = VInset ( undefined , [ "flex-1" , "gap-1" ] ) ;
2228 this . container . tabIndex = - 1 ;
@@ -40,10 +46,22 @@ export class WavePropertiesPanel implements IComponent {
4046
4147 const noteGroup = FormGroup ( "Note" , this . noteSelect ) ;
4248
49+
50+ this . sampleRateInput = document . createElement ( "input" ) ;
51+ this . sampleRateInput . type = "number" ;
52+ this . sampleRateInput . className = "w-full rounded-lg p-1 bg-neutral-800" ;
53+ this . sampleRateInput . value = this . sampleRate . toString ( ) ;
54+ this . sampleRateInput . addEventListener ( "change" , ( ) => {
55+ this . sampleRate = parseInt ( this . sampleRateInput . value ) ;
56+ } ) ;
57+
58+ const sampleRateGroup = FormGroup ( "Sample Rate" , this . sampleRateInput ) ;
59+
4360 const modalButtonBar = new ModalButtonBar ( this . app ) ;
4461
4562 this . container . appendChild ( nameGroup ) ;
4663 this . container . appendChild ( noteGroup ) ;
64+ this . container . appendChild ( sampleRateGroup ) ;
4765 this . container . appendChild ( modalButtonBar . getDomNode ( ) ) ;
4866 }
4967
0 commit comments