Skip to content

Commit

Permalink
add bar height parameter (#1020)
Browse files Browse the repository at this point in the history
* add barHeight parameter

* Update drawer.multicanvas.js

* Update drawer.canvas.js
  • Loading branch information
entonbiba authored and mspae committed Aug 20, 2017
1 parent 1c346ff commit 49fc6d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/drawer.multicanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export default class MultiCanvas extends Drawer {
const gap = Math.max(this.params.pixelRatio, ~~(bar / 2));
const step = bar + gap;

let absmax = 1;
let absmax = 1 / this.params.barHeight;
if (this.params.normalize) {
const max = util.max(peaks);
const min = util.min(peaks);
Expand Down Expand Up @@ -321,7 +321,7 @@ export default class MultiCanvas extends Drawer {
const offsetY = height * channelIndex || 0;
const halfH = height / 2;

let absmax = 1;
let absmax = 1 / this.params.barHeight;
if (this.params.normalize) {
const max = util.max(peaks);
const min = util.min(peaks);
Expand Down
2 changes: 2 additions & 0 deletions src/wavesurfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import PeakCache from './peakcache';
* @property {string} backend='WebAudio' `'WebAudio'|'MediaElement'` In most cases
* you don't have to set this manually. MediaElement is a fallback for
* unsupported browsers.
* @property {number} barHeight=1 The height of the wave
* @property {boolean} closeAudioContext=false Close and nullify all audio
* contexts when the destroy method is called.
* @property {!string|HTMLElement} container CSS selector or HTML element where
Expand Down Expand Up @@ -172,6 +173,7 @@ export default class WaveSurfer extends util.Observer {
audioRate : 1,
autoCenter : true,
backend : 'WebAudio',
barHeight : 1,
container : null,
cursorColor : '#333',
cursorWidth : 1,
Expand Down

0 comments on commit 49fc6d9

Please sign in to comment.