Skip to content

[0.4.x] libvisual-plugins: Make actor "lv_scope" show silence as a solid line#198

Merged
hartwork merged 2 commits into0.4.xfrom
0.4.x-lv-scope-solid-line
Jan 21, 2023
Merged

[0.4.x] libvisual-plugins: Make actor "lv_scope" show silence as a solid line#198
hartwork merged 2 commits into0.4.xfrom
0.4.x-lv-scope-solid-line

Conversation

@hartwork
Copy link
Copy Markdown
Member

No description provided.

@hartwork hartwork added this to the 0.4.2 milestone Jan 21, 2023
@hartwork hartwork requested a review from kaixiong January 21, 2023 19:31
Copy link
Copy Markdown
Member

@kaixiong kaixiong left a comment

Choose a reason for hiding this comment

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

@hartwork Nice idea.

With better names, the code is clearer e.g.

const int max_displacement = video->height / 4;
...
const int y_origin = video->height / 2;
...
const int y_tip = y_origin + pcmbuf[(i >> 1) % PCM_SIZE] * max_displacement;
...

As suggested:
- Renamed y_old to y_origin
- Rename y to y_tip
- Extract variable max_displacement
@hartwork hartwork force-pushed the 0.4.x-lv-scope-solid-line branch from 166a1ab to 3a7d32c Compare January 21, 2023 22:13
@hartwork
Copy link
Copy Markdown
Member Author

@hartwork Nice idea.

With better names, the code is clearer e.g.

const int max_displacement = video->height / 4;
...
const int y_origin = video->height / 2;
...
const int y_tip = y_origin + pcmbuf[(i >> 1) % PCM_SIZE] * max_displacement;
...

@kaixiong true, applied

@hartwork hartwork requested a review from kaixiong January 21, 2023 22:13
Copy link
Copy Markdown
Member

@kaixiong kaixiong left a comment

Choose a reason for hiding this comment

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

@hartwork The multiplication used to calculate the pixel buffer index is horrifying to me but I guess we'll optimize it in another PR.

@hartwork hartwork merged commit d85e176 into 0.4.x Jan 21, 2023
@hartwork hartwork deleted the 0.4.x-lv-scope-solid-line branch January 21, 2023 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants