Mercurial > hg > ugly-duckling
comparison src/app/app.component.ts @ 206:1db0bb28688b
Introduce id field for analysis items, currently optional but arguably shouldn't be. Currently an incrementing counter uniquely identifies an item - not ideal.
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Fri, 24 Mar 2017 16:14:57 +0000 |
parents | f9088265a1fc |
children | 4865567d9e43 |
comparison
equal
deleted
inserted
replaced
205:b638c714bd1d | 206:1db0bb28688b |
---|---|
19 audioBuffer: AudioBuffer; // TODO consider revising | 19 audioBuffer: AudioBuffer; // TODO consider revising |
20 canExtract: boolean; | 20 canExtract: boolean; |
21 private onAudioDataSubscription: Subscription; | 21 private onAudioDataSubscription: Subscription; |
22 private analyses: AnalysisItem[]; // TODO some immutable state container describing entire session | 22 private analyses: AnalysisItem[]; // TODO some immutable state container describing entire session |
23 private nRecordings: number; // TODO user control for naming a recording | 23 private nRecordings: number; // TODO user control for naming a recording |
24 private countingId: number; // TODO improve uniquely identifying items | |
24 private rootAudioUri: string; | 25 private rootAudioUri: string; |
25 | 26 |
26 constructor(private audioService: AudioPlayerService, | 27 constructor(private audioService: AudioPlayerService, |
27 private piperService: FeatureExtractionService, | 28 private piperService: FeatureExtractionService, |
28 private iconRegistry: MdIconRegistry, | 29 private iconRegistry: MdIconRegistry, |
29 private sanitizer: DomSanitizer) { | 30 private sanitizer: DomSanitizer) { |
30 this.analyses = []; | 31 this.analyses = []; |
31 this.canExtract = false; | 32 this.canExtract = false; |
32 this.nRecordings = 0; | 33 this.nRecordings = 0; |
34 this.countingId = 1; | |
35 | |
33 iconRegistry.addSvgIcon( | 36 iconRegistry.addSvgIcon( |
34 'duck', | 37 'duck', |
35 sanitizer.bypassSecurityTrustResourceUrl('assets/duck.svg') | 38 sanitizer.bypassSecurityTrustResourceUrl('assets/duck.svg') |
36 ); | 39 ); |
37 | 40 |
74 rootAudioUri: url, | 77 rootAudioUri: url, |
75 hasSharedTimeline: true, | 78 hasSharedTimeline: true, |
76 extractorKey: 'not:real', | 79 extractorKey: 'not:real', |
77 isRoot: true, | 80 isRoot: true, |
78 title: title, | 81 title: title, |
79 description: new Date().toLocaleString() | 82 description: new Date().toLocaleString(), |
83 id: `${this.countingId++}` | |
80 }); | 84 }); |
81 } | 85 } |
82 | 86 |
83 extractFeatures(outputInfo: ExtractorOutputInfo): void { | 87 extractFeatures(outputInfo: ExtractorOutputInfo): void { |
84 if (!this.canExtract || !outputInfo) return; | 88 if (!this.canExtract || !outputInfo) return; |
88 rootAudioUri: this.rootAudioUri, | 92 rootAudioUri: this.rootAudioUri, |
89 hasSharedTimeline: true, | 93 hasSharedTimeline: true, |
90 extractorKey: outputInfo.combinedKey, | 94 extractorKey: outputInfo.combinedKey, |
91 isRoot: false, | 95 isRoot: false, |
92 title: outputInfo.name, | 96 title: outputInfo.name, |
93 description: outputInfo.outputId | 97 description: outputInfo.outputId, |
98 id: `${this.countingId++}` | |
94 }); | 99 }); |
95 | 100 |
96 this.piperService.collect({ | 101 this.piperService.collect({ |
97 audioData: [...Array(this.audioBuffer.numberOfChannels).keys()] | 102 audioData: [...Array(this.audioBuffer.numberOfChannels).keys()] |
98 .map(i => this.audioBuffer.getChannelData(i)), | 103 .map(i => this.audioBuffer.getChannelData(i)), |