Skip to content

Commit

Permalink
Refactor automation function & options
Browse files Browse the repository at this point in the history
- Move automation function to automation file
- Move AudioRampType and AudioAdjustmentOptions to automation file
- Update imports
- Change MusicMixer.volume() to use automation function
  • Loading branch information
almic committed Apr 6, 2024
1 parent dec054f commit df84ad6
Show file tree
Hide file tree
Showing 16 changed files with 253 additions and 224 deletions.
41 changes: 1 addition & 40 deletions docs/js/lib/AudioSourceNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,4 @@
/**
* Ramp types for audio adjustments
*/
export declare enum AudioRampType {
/**
* Linear ramp
*/
LINEAR = "linear",
/**
* Exponential ramp
*/
EXPONENTIAL = "exponential",
/**
* Natural ramp. Depending on the adjustment being made, this will either be a
* logarithmic adjustment, or an equal-power adjustment. In general, this option
* will produce the best sounding results compared to the other options, and in
* general should always be preferred over the others.
*/
NATURAL = "natural"
}
/**
* Adjustment options to use when changing volume, panning, etc.
*/
export type AudioAdjustmentOptions = {
/**
* Ramping method to use. Use 'natural' option for good equal power crossfading.
* Supports a custom ramp by providing an array of numbers, where 0 is the initial state, and
* 1 is the adjusted state. Going below 0 or above 1 does what you would expect, going beyond
* the initial and adjusted state respectively.
*/
ramp: AudioRampType | number[] | null;
/**
* Delay of seconds before applying this adjustment.
*/
delay?: number;
/**
* Duration of seconds this adjustment should take, after the delay.
*/
duration?: number;
};
import { AudioAdjustmentOptions } from './automation.js';
/**
* AudioSourceNode, interchangeable with the standard AudioBufferSourceNode.
*
Expand Down
23 changes: 1 addition & 22 deletions docs/js/lib/AudioSourceNode.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion docs/js/lib/MusicMixer.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import AudioSourceNode, { AudioAdjustmentOptions } from './AudioSourceNode.js';
import AudioSourceNode from './AudioSourceNode.js';
import { Track, TrackGroup } from './Track.js';
import { AudioAdjustmentOptions } from './automation.js';
/**
* MusicMixer
*/
Expand Down
50 changes: 4 additions & 46 deletions docs/js/lib/MusicMixer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion docs/js/lib/Track.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import AudioSourceNode, { AudioAdjustmentOptions } from './AudioSourceNode.js';
import AudioSourceNode from './AudioSourceNode.js';
import { AudioAdjustmentOptions } from './automation.js';
/**
* Type representing a beat of a Track. Contains cancellation logic so third-parties can cancel specific
* beat rules on a given Track. Also used for passing beat events to callbacks.
Expand Down
Loading

0 comments on commit df84ad6

Please sign in to comment.