Skip to content

Commit

Permalink
Merge branch 'volume' of https://github.com/yvesgurcan/web-midi-player
Browse files Browse the repository at this point in the history
…into volume
  • Loading branch information
yvesgurcan committed Mar 4, 2020
2 parents 07c3ddc + 7bd1c27 commit 3e48819
Show file tree
Hide file tree
Showing 6 changed files with 6,837 additions and 1,308 deletions.
233 changes: 206 additions & 27 deletions doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Documentation
</title>

<meta name='description' content='🎹 Event-driven JavaScript library to enable MIDI playback in the browser.'>
<meta name='description' content='🎹 Event-driven JavaScript library that enables MIDI playback in the browser.'>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link href="assets/styles.css" rel="stylesheet" />
</head>
Expand Down Expand Up @@ -64,6 +64,14 @@ <h3 class="mb0 no-anchor project-name">
<code>#stop</code>
</a>

<a href="#midiplayergetvolume" class="button-indent regular block">
<code>#getVolume</code>
</a>

<a href="#midiplayersetvolume" class="button-indent regular block">
<code>#setVolume</code>
</a>

<a href="#midiplayeremitevent" class="button-indent regular block">
<code>#emitEvent</code>
</a>
Expand Down Expand Up @@ -354,6 +362,20 @@ <h3 class='regular'>



<tr>
<td class='col-2 strong'>configuration.volume</td>
<td class="col-2 quiet">
<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>

(default <code>80</code>)

</td>
<td class='col-8'>Set playback volume when initializing the player.
</td>
</tr>





</table>
Expand All @@ -367,18 +389,6 @@ <h3 class='regular'>
<th class='col-8 small caps quiet'>description</th>
</thead>

<tr>
<td class='col-2 strong'>playerId</td>
<td class='col-2 quiet'>
<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>

</td>
<td class='col-8'>: ID of this instance of Midi Player.
</td>
</tr>



<tr>
<td class='col-2 strong'>context</td>
<td class='col-2 quiet'>
Expand All @@ -392,36 +402,36 @@ <h3 class='regular'>


<tr>
<td class='col-2 strong'>sampleRate</td>
<td class='col-2 strong'>eventLogger</td>
<td class='col-2 quiet'>
<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>
<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">function</a>

</td>
<td class='col-8'>: The sample rate of the AudioContext.
<td class='col-8'>: The function that is called to emit events.
</td>
</tr>



<tr>
<td class='col-2 strong'>eventLogger</td>
<td class='col-2 strong'>logging</td>
<td class='col-2 quiet'>
<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">function</a>
<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>

</td>
<td class='col-8'>: The function that is called to emit events.
<td class='col-8'>: Whether console logging is ON or OFF.
</td>
</tr>



<tr>
<td class='col-2 strong'>logging</td>
<td class='col-2 strong'>isFirstInstance</td>
<td class='col-2 quiet'>
<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>

</td>
<td class='col-8'>: Whether console logging is ON or OFF.
<td class='col-8'>: Whether this is the first instance of the Midi Player or
</td>
</tr>

Expand Down Expand Up @@ -463,6 +473,30 @@ <h3 class='regular'>



<tr>
<td class='col-2 strong'>playerId</td>
<td class='col-2 quiet'>
<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>

</td>
<td class='col-8'>: ID of this instance of Midi Player.
</td>
</tr>



<tr>
<td class='col-2 strong'>sampleRate</td>
<td class='col-2 quiet'>
<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>

</td>
<td class='col-8'>: The sample rate of the AudioContext.
</td>
</tr>



<tr>
<td class='col-2 strong'>source</td>
<td class='col-2 quiet'>
Expand Down Expand Up @@ -500,24 +534,25 @@ <h3 class='regular'>


<tr>
<td class='col-2 strong'>waveBuffer</td>
<td class='col-2 strong'>volume</td>
<td class='col-2 quiet'>
any
<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>

</td>
<td class='col-8'>: The buffer with the MIDI data converted to WAV.
<td class='col-8'>: Playback volume.
</td>
</tr>



<tr>
<td class='col-2 strong'>isFirstInstance</td>
<td class='col-2 strong'>waveBuffer</td>
<td class='col-2 quiet'>
<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>
any

</td>
<td class='col-8'>: Whether this is the first instance of the Midi Player or not.
<td class='col-8'>: The buffer with the MIDI data converted to WAV.
not.
</td>
</tr>

Expand Down Expand Up @@ -1101,6 +1136,150 @@ <h4 class='caps quiet mb1 mt3'>Examples</h4>



</section>

<section id='midiplayergetvolume' class='mt2 mb2 px3 py1 keyline-top'>

<div class='right py2'>


</div>

<h3 class='regular'>
<a class='black' href='#midiplayergetvolume'>
<code>
getVolume<span class='gray'>()</span>
</code>
</a>
</h3>

<p>Gets the current volume of the playback.</p>
















<h4 class='caps quiet mb1 mt3'>Returns</h4>
<code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
:
<span class='force-inline'>The current volume.
</span>







<h4 class='caps quiet mb1 mt3'>Examples</h4>


<pre class='p1 overflow-auto round fill-light'><code><span class="hljs-keyword">const</span> volume = midiPlayer.getVolume();</code></pre>










</section>

<section id='midiplayersetvolume' class='mt2 mb2 px3 py1 keyline-top'>

<div class='right py2'>


</div>

<h3 class='regular'>
<a class='black' href='#midiplayersetvolume'>
<code>
setVolume<span class='gray'>(input)</span>
</code>
</a>
</h3>

<p>Sets the current volume of the playback.</p>











<table class='table-light mt3 rounded keyline-all keyline-light overflow-hidden bg-cloudy-light'>
<thead class='fill-light'>
<th class='col-3 small caps quiet'>parameter</th>
<th class='col-3 small caps quiet'>type</th>
<th class='col-6 small caps quiet'>description</th>
</thead>

<tr>
<td class='col-3 strong'><code>input</code></td>
<td class='col-3 quiet'>
<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>

</td>
<td class='col-6'></td>
</tr>


<tr>
<td class='col-2 strong'>input.volume</td>
<td class="col-2 quiet">
<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>

</td>
<td class='col-8'>The new value for the volume (also known as gain). Typically, a whole number between 0 and 100 but can actually be negative, greater, or even a decimal number.
</td>
</tr>





</table>









<h4 class='caps quiet mb1 mt3'>Examples</h4>


<pre class='p1 overflow-auto round fill-light'><code>midiPlayer.setVolume({ <span class="hljs-attr">volume</span>: <span class="hljs-number">80</span> });</code></pre>










</section>

<section id='midiplayeremitevent' class='mt2 mb2 px3 py1 keyline-top'>
Expand Down
2 changes: 1 addition & 1 deletion example/react/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
</head>
<body>
<div id="app"></div>
<script type="text/javascript" src="main.0e6ae4f6132903eb3120.js"></script></body>
<script type="text/javascript" src="main.d81c0edb59847e81a452.js"></script></body>
</html>
Loading

0 comments on commit 3e48819

Please sign in to comment.