Skip to content

Commit

Permalink
Version 4.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
hvianna committed Aug 15, 2023
2 parents 0ab85eb + 124ce82 commit a9482f1
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 11 deletions.
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

## version 4.1.1 (2023-08-14)

+ Fix a rendering bug when `roundBars` is combined with `mirror` and `radial`;
+ Add a polyfill for `Array.findLastIndex()` to restore compatibility with not-so-recent browsers.


## version 4.1.0 (2023-07-30)

### Added: <!-- {docsify-ignore} -->
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

**audioMotion-analyzer** is a high-resolution real-time audio spectrum analyzer built upon **Web Audio** and **Canvas** JavaScript APIs.

It was originally conceived as part of a full-featured music player called [**audioMotion**](https://audiomotion.me),
but I later decided to make only the spectrum analyzer available as a self-contained module, so other developers could use it in their own projects.
It was originally conceived as part of my full-featured music player called [**audioMotion**](https://audiomotion.me), but I later decided
to make the spectrum analyzer available as a self-contained module, so other developers could use it in their own JS projects.

My goal is to make this the best looking, most accurate and customizable spectrum analyzer around, in a small-footprint and high-performance package.

Expand Down
2 changes: 1 addition & 1 deletion demo/fluid.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h1><a href="https://audiomotion.dev" class="logo">audioMotion-analyzer</a> | fl
<ul class="header-nav">
<li><a href="index.html">Demos</a></li>
<li><a href="https://audiomotion.dev">Home</a></li>
<li><a href="https://github.com/hvianna/audioMotion-analyzer/tree/master/demo/src/fluid.js">View on GitHub</a></li>
<li><a href="https://github.com/hvianna/audioMotion-analyzer/blob/master/demo/fluid.js">View on GitHub</a></li>
</ul>
</header>

Expand Down
2 changes: 1 addition & 1 deletion demo/minimal.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h1><a href="https://audiomotion.dev" class="logo">audioMotion-analyzer</a> | mi
<ul class="header-nav">
<li><a href="index.html">Demos</a></li>
<li><a href="https://audiomotion.dev">Home</a></li>
<li><a href="https://github.com/hvianna/audioMotion-analyzer/tree/master/demo/src/fluid.js">View on GitHub</a></li>
<li><a href="https://github.com/hvianna/audioMotion-analyzer/blob/master/demo/minimal.html">View on GitHub</a></li>
</ul>
</header>

Expand Down
2 changes: 1 addition & 1 deletion demo/multi.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h1><a href="https://audiomotion.dev" class="logo">audioMotion-analyzer</a> | mu
<ul class="header-nav">
<li><a href="index.html">Demos</a></li>
<li><a href="https://audiomotion.dev">Home</a></li>
<li><a href="https://github.com/hvianna/audioMotion-analyzer/tree/master/demo/src/multi.js">View on GitHub</a></li>
<li><a href="https://github.com/hvianna/audioMotion-analyzer/blob/master/demo/multi.js">View on GitHub</a></li>
</ul>
</header>

Expand Down
2 changes: 1 addition & 1 deletion demo/overlay.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h1><a href="https://audiomotion.dev" class="logo">audioMotion-analyzer</a> | ov
<ul class="header-nav">
<li><a href="index.html">Demos</a></li>
<li><a href="https://audiomotion.dev">Home</a></li>
<li><a href="https://github.com/hvianna/audioMotion-analyzer/tree/master/demo/src/overlay.js">View on GitHub</a></li>
<li><a href="https://github.com/hvianna/audioMotion-analyzer/blob/master/demo/overlay.js">View on GitHub</a></li>
</ul>
</header>

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "audiomotion-analyzer",
"description": "High-resolution real-time graphic audio spectrum analyzer JavaScript module with no dependencies.",
"version": "4.1.0",
"version": "4.1.1",
"main": "./src/audioMotion-analyzer.js",
"module": "./src/audioMotion-analyzer.js",
"types": "./src/index.d.ts",
Expand Down
20 changes: 16 additions & 4 deletions src/audioMotion-analyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* audioMotion-analyzer
* High-resolution real-time graphic audio spectrum analyzer JS module
*
* @version 4.1.0
* @version 4.1.1
* @author Henrique Avila Vianna <hvianna@gmail.com> <https://henriquevianna.com>
* @license AGPL-3.0-or-later
*/

const VERSION = '4.1.0';
const VERSION = '4.1.1';

// internal constants
const TAU = 2 * Math.PI,
Expand Down Expand Up @@ -102,6 +102,18 @@ const deprecate = ( name, alternative ) => console.warn( `${name} is deprecated.
// returns the validated value, or the first element of `list` if `value` is not found in the array
const validateFromList = ( value, list, modifier = 'toLowerCase' ) => list[ Math.max( 0, list.indexOf( ( '' + value )[ modifier ]() ) ) ];

// Polyfill for Array.findLastIndex()
if ( ! Array.prototype.findLastIndex ) {
Array.prototype.findLastIndex = function( callback ) {
let index = this.length;
while ( index-- > 0 ) {
if ( callback( this[ index ] ) )
return index;
}
return -1;
}
}

// AudioMotionAnalyzer class

export default class AudioMotionAnalyzer {
Expand Down Expand Up @@ -1684,12 +1696,12 @@ export default class AudioMotionAnalyzer {
ctx.moveTo( ...radialXY( x, y, dir ) );
ctx.lineTo( ...radialXY( x, y + h, dir ) );
if ( isRound )
ctx.arc( centerX, centerY, radius + y + h, startAngle, endAngle );
ctx.arc( centerX, centerY, radius + y + h, startAngle, endAngle, dir != 1 );
else
ctx.lineTo( ...radialXY( x + w, y + h, dir ) );
ctx.lineTo( ...radialXY( x + w, y, dir ) );
if ( isRound && ! stroke ) // close the bottom line only when not in outline mode
ctx.arc( centerX, centerY, radius + y, endAngle, startAngle, true );
ctx.arc( centerX, centerY, radius + y, endAngle, startAngle, dir == 1 );
}
strokeIf( stroke );
ctx.fill();
Expand Down

0 comments on commit a9482f1

Please sign in to comment.