Skip to content
This repository was archived by the owner on Jan 16, 2023. It is now read-only.

Add noise node - #29

Open
ilyamore88 wants to merge 17 commits into
masterfrom
noise-node
Open

Add noise node#29
ilyamore88 wants to merge 17 commits into
masterfrom
noise-node

Conversation

@ilyamore88

Copy link
Copy Markdown
Member

Closes #26

Comment thread src/modules/AudioContextManager.ts Outdated
* Get current time of audio context
* @return {Number}
*/
public getCurrentTime(): number {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

можно сделать геттер currentTime

Comment thread src/modules/Noise.ts Outdated
/**
* Class represents noise node
*/
export default class Noise {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export default class Noise {
export default abstract class Noise {

Comment thread src/modules/Noise.ts Outdated
* @param destination {AudioDestinationNode} - audio context destination
*/
public connect(destination: AudioDestinationNode): void {
if (this.isConfigured) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

зачем везде эти проверки?

Comment thread src/modules/Noise.ts Outdated
/**
* Configure noise node
*/
private configure(): void {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

приваты идут ниже пабликов

Comment thread 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++) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нужен коммент, или вынести в отдельный метод

Comment thread src/modules/noises/Noise.ts Outdated
/**
* Noise node status
*/
private isConfigured: boolean = false;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

избыточное свойство

Comment thread src/modules/noises/Noise.ts
Comment thread src/modules/noises/Noise.ts
Comment thread src/modules/noises/Noise.ts Outdated
this.bufferSourceNode.loop = true;

/**
* Add bandpass filter

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не написано, для чего

Comment thread src/modules/noises/Noise.ts Outdated
if (frequency) {
this.setNoiseFrequency(frequency);
} else {
this.setNoiseFrequency(1000);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

просто внеси 1000 как дефолтное значение параметра

Comment thread src/modules/noises/Noise.ts Outdated
constructor(frequency?: number) {
this.configure();
if (frequency) {
this.currentFrequency = frequency;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

дублирование кода

Comment thread src/modules/noises/Noise.ts Outdated
private currentFrequency: number = 1000;

/**
* Destination for noise node

Copy link
Copy Markdown
Member

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;

Copy link
Copy Markdown
Member

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 {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

может этот код лучше в конструктор перенести? тк тут определяются основные свойства, а приватный метод где-то внизу. Пусть лучше будет в конструкторе наверху

Comment thread src/modules/noises/Noise.ts Outdated
if (newDestination) {
this.destination = newDestination;
}
if (this.destination) {

Copy link
Copy Markdown
Member

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();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это можно сразу при объявлении свойства назначить

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create noise module

2 participants