-
Notifications
You must be signed in to change notification settings - Fork 1
Add noise node #29
base: master
Are you sure you want to change the base?
Add noise node #29
Conversation
src/modules/AudioContextManager.ts
Outdated
| * Get current time of audio context | ||
| * @return {Number} | ||
| */ | ||
| public getCurrentTime(): number { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
можно сделать геттер currentTime
src/modules/Noise.ts
Outdated
| /** | ||
| * Class represents noise node | ||
| */ | ||
| export default class Noise { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| export default class Noise { | |
| export default abstract class Noise { |
src/modules/Noise.ts
Outdated
| * @param destination {AudioDestinationNode} - audio context destination | ||
| */ | ||
| public connect(destination: AudioDestinationNode): void { | ||
| if (this.isConfigured) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
зачем везде эти проверки?
src/modules/Noise.ts
Outdated
| /** | ||
| * Configure noise node | ||
| */ | ||
| private configure(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
приваты идут ниже пабликов
src/modules/Noise.ts
Outdated
| this.buffer = audioContextManager.getAudioContext().createBuffer(1, 4096, audioContextManager.getAudioContext().sampleRate); | ||
| this.buffersChannelData = this.buffer.getChannelData(0); | ||
|
|
||
| for (let i = 0; i < 4096; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
нужен коммент, или вынести в отдельный метод
…team/codex.music into noise-node � Conflicts: � dist/index.js
…to noise-node � Conflicts: � dist/index.js
src/modules/noises/Noise.ts
Outdated
| /** | ||
| * Noise node status | ||
| */ | ||
| private isConfigured: boolean = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
избыточное свойство
src/modules/noises/Noise.ts
Outdated
| this.bufferSourceNode.loop = true; | ||
|
|
||
| /** | ||
| * Add bandpass filter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не написано, для чего
src/modules/noises/Noise.ts
Outdated
| if (frequency) { | ||
| this.setNoiseFrequency(frequency); | ||
| } else { | ||
| this.setNoiseFrequency(1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
просто внеси 1000 как дефолтное значение параметра
src/modules/noises/Noise.ts
Outdated
| constructor(frequency?: number) { | ||
| this.configure(); | ||
| if (frequency) { | ||
| this.currentFrequency = frequency; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
дублирование кода
src/modules/noises/Noise.ts
Outdated
| private currentFrequency: number = 1000; | ||
|
|
||
| /** | ||
| * Destination for noise node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
коммент не понятен
| /** | ||
| * Current frequency of noise node in hertz | ||
| */ | ||
| private currentFrequency: number = 1000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это свойство сейчас нигде не используется
| /** | ||
| * Configure noise node | ||
| */ | ||
| private configure(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
может этот код лучше в конструктор перенести? тк тут определяются основные свойства, а приватный метод где-то внизу. Пусть лучше будет в конструкторе наверху
src/modules/noises/Noise.ts
Outdated
| if (newDestination) { | ||
| this.destination = newDestination; | ||
| } | ||
| if (this.destination) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
я не вижу в коде, где назначается this.destination
| /** | ||
| * Add bandpass filter for filtering required noise frequency | ||
| */ | ||
| this.bandpass = new BandPassFilter(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это можно сразу при объявлении свойства назначить
Closes #26