Skip to content

Commit 1ba4c67

Browse files
committed
Prepare for v1.1.0
1 parent dde7aa4 commit 1ba4c67

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v1.1.0
4+
5+
- Add APIs for player status and seekings (`seekPlayer` etc.)
6+
- Add APIs for 'sequencer' processings
7+
- Add 'waitForReady' API
8+
39
## v1.0.0
410

511
- Initial version (using [fluidsynth-emscripten v2.0.1-em](https://github.com/jet2jet/fluidsynth-emscripten/releases/tag/v2.0.1-em))

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ If you prefer to load fluid-js as an ES module, you can use `import` statement s
6464
Notes:
6565

6666
* `fluid.js` intends the ES2015-supported environment. If you need to run the script without errors on non-ES2015 environment such as IE11 (to notify 'unsupported'), you should load those scripts dynamically, or use transpiler such as babel.
67+
* When just after the scripts loaded, some APIs may fail since libfluidsynth is not ready. To avoid this, you can use the Promise object returned by `Fluid.waitForReady`.
6768
* libfluidsynth JS file is not `import`-able and its license (LGPL v2.1) is differ from fluid-js's (BSD-3-Clause).
6869

6970
### With AudioWorklet
@@ -96,6 +97,26 @@ context.audioWorklet.addModule('libfluidsynth-2.0.1.js')
9697
});
9798
```
9899

100+
### With Web Worker
101+
102+
fluid-js and libfluidsynth can be executed on a Web Worker. Executing on a Web Worker prevents from blocking main thread while rendering.
103+
104+
To use fluid-js on a Web Worker, simply call `importScripts` as followings:
105+
106+
```js
107+
self.importScripts('libfluidsynth-2.0.1.js');
108+
self.importScripts('fluid.js');
109+
```
110+
111+
(You can also load fluid-js as an ES Module from the Web Worker.)
112+
113+
Note that since the Web Audio is not supported on the Web Worker, the APIs/methods related to the Web Audio will not work. If you want to use both Web Worker and AudioWorklet, you should implement AudioWorkletProcessor manually as followings:
114+
115+
* main thread -- create AudioWorkletNode and establish connections between Web Worker and AudioWorklet
116+
* You must transfer rendered audio frames from Web Worker to AudioWorklet because AudioWorklet environment does not support creating Web Worker. By creating `MessageChannel` and sending its port instances to Web Worker and AudioWorklet, they can communicate each other directly.
117+
* Web Worker thread -- render audio frames into raw buffers and send it for AudioWorklet thread
118+
* AudioWorklet thread -- receive audio frames and 'render' it in the `process` method
119+
99120
## API
100121

101122
### Creation of Synthesizer instance
@@ -106,6 +127,24 @@ These classes implement the interface named `Fluid.ISynthesizer`.
106127
* Creates the general synthesizer instance. No parameters are available.
107128
* `Fluid.AudioWorkletNodeSynthesizer` (construct: `new Fluid.AudioWorkletNodeSynthesizer()`)
108129
* Creates the synthesizer instance communicating AudioWorklet (see above). No parameters are available.
130+
* You must call `createAudioNode` method to use other instance methods.
131+
132+
### Creation of Sequencer instance
133+
134+
The `Sequencer` instance is created only via following methods:
135+
136+
* `Fluid.Synthesizer.createSequencer` (static method)
137+
* Returns the Promise object that resolves with `Fluid.ISequencer` instance. The instance can be used with `Fluid.Synthesizer` instances.
138+
* `Fluid.AudioWorkletNodeSynthesizer.prototype.createSequencer` (instance method)
139+
* Returns the Promise object that resolves with `Fluid.ISequencer` instance. The instance can be used with `Fluid.AudioWorkletNodeSynthesizer` instances which handled `createSequencer` calls.
140+
141+
### `Fluid` methods
142+
143+
#### `waitForReady`
144+
145+
Can be used to wait for the synthesizer engine's ready.
146+
147+
Return: `Promise` object (resolves when the synthesizer engine (libfluidsynth) is ready)
109148

110149
### `Fluid.ISynthesizer` methods
111150

0 commit comments

Comments
 (0)