@fluex/fluexgl-dsp 0.1.2 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +86 -86
  2. package/lib/dist/core/classes/AudioClip.d.ts +5 -4
  3. package/lib/dist/core/classes/AudioClip.d.ts.map +1 -1
  4. package/lib/dist/core/classes/AudioClip.js +2 -6
  5. package/lib/dist/core/classes/Channel.d.ts +12 -0
  6. package/lib/dist/core/classes/Channel.d.ts.map +1 -1
  7. package/lib/dist/core/classes/Channel.js +68 -2
  8. package/lib/dist/core/classes/Effector.d.ts +1 -0
  9. package/lib/dist/core/classes/Effector.d.ts.map +1 -1
  10. package/lib/dist/core/classes/Effector.js +1 -0
  11. package/lib/dist/effects/classes/Chorus.d.ts +2 -0
  12. package/lib/dist/effects/classes/Chorus.d.ts.map +1 -1
  13. package/lib/dist/effects/classes/Chorus.js +2 -0
  14. package/lib/dist/effects/classes/Distortion.d.ts +5 -1
  15. package/lib/dist/effects/classes/Distortion.d.ts.map +1 -1
  16. package/lib/dist/effects/classes/Distortion.js +8 -1
  17. package/lib/dist/effects/classes/Saturation.d.ts.map +1 -1
  18. package/lib/dist/effects/classes/SoftClip.d.ts +2 -0
  19. package/lib/dist/effects/classes/SoftClip.d.ts.map +1 -1
  20. package/lib/dist/effects/classes/SoftClip.js +2 -0
  21. package/lib/dist/effects/classes/StereoPanner.d.ts +1 -0
  22. package/lib/dist/effects/classes/StereoPanner.d.ts.map +1 -1
  23. package/lib/dist/effects/classes/StereoPanner.js +1 -0
  24. package/lib/dist/index.d.ts +1 -1
  25. package/lib/dist/index.d.ts.map +1 -1
  26. package/lib/dist/index.js +1 -1
  27. package/lib/dist/utilities/helpers.d.ts +4 -0
  28. package/lib/dist/utilities/helpers.d.ts.map +1 -1
  29. package/lib/dist/utilities/helpers.js +12 -0
  30. package/lib/dist/utilities/web-assembly.d.ts.map +1 -1
  31. package/lib/src/console-codes.ts +15 -15
  32. package/lib/src/core/classes/AudioClip.ts +539 -544
  33. package/lib/src/core/classes/AudioDevice.ts +38 -38
  34. package/lib/src/core/classes/Channel.ts +288 -198
  35. package/lib/src/core/classes/DpsPipeline.ts +152 -152
  36. package/lib/src/core/classes/Effector.ts +11 -10
  37. package/lib/src/core/classes/Master.ts +49 -49
  38. package/lib/src/core/exports.ts +5 -5
  39. package/lib/src/effects/classes/Chorus.ts +111 -108
  40. package/lib/src/effects/classes/Distortion.ts +14 -1
  41. package/lib/src/effects/classes/Saturation.ts +3 -1
  42. package/lib/src/effects/classes/SoftClip.ts +44 -41
  43. package/lib/src/effects/classes/StereoPanner.ts +3 -1
  44. package/lib/src/effects/exports.ts +22 -22
  45. package/lib/src/index.ts +93 -92
  46. package/lib/src/typings.ts +78 -78
  47. package/lib/src/utilities/constants.ts +8 -8
  48. package/lib/src/utilities/debugger.ts +65 -65
  49. package/lib/src/utilities/helpers.ts +237 -215
  50. package/lib/src/utilities/web-assembly.ts +12 -13
  51. package/package.json +51 -50
@@ -1 +1,14 @@
1
- export class Distortion {}
1
+ import { Effector } from "../../core/classes/Effector";
2
+
3
+ export class Distortion extends Effector {
4
+
5
+ public name: string = "Distortion";
6
+
7
+ constructor() {
8
+ super();
9
+ }
10
+
11
+ public async InitializeOnAttachment(parentialContext: AudioContext): Promise<void> {
12
+
13
+ }
14
+ }
@@ -1 +1,3 @@
1
- export class Saturation {}
1
+ export class Saturation {
2
+
3
+ }
@@ -1,42 +1,45 @@
1
- import { compiledWebAssemblyModule } from "../../utilities/web-assembly";
2
- import { Effector } from "../../core/classes/Effector";
3
- import { Debug } from "../../utilities/debugger";
4
-
5
- export class SoftClip extends Effector {
6
-
7
- constructor(public drive: number = 1) {
8
- super();
9
- }
10
-
11
- public async InitializeOnAttachment(parentialContext: AudioContext): Promise<void> {
12
-
13
- if(!compiledWebAssemblyModule) return Debug.Error("Could not initialize effector because the nessecary WASM file has not been specified.", [
14
- `Effector type: SoftClip`
15
- ]);
16
-
17
- this.audioWorkletNode = new AudioWorkletNode(parentialContext, "SoftClipProcessor", {
18
- numberOfInputs: 1,
19
- numberOfOutputs: 1,
20
- outputChannelCount: [2],
21
- parameterData: {
22
- drive: this.drive
23
- },
24
- processorOptions: {
25
- module: compiledWebAssemblyModule
26
- }
27
- });
28
-
29
- this.parentialContext = parentialContext;
30
- }
31
-
32
- public SetDrive(drive: number): SoftClip {
33
-
34
- if(this.audioWorkletNode) this.audioWorkletNode.port.postMessage({
35
- type: "set-drive",
36
- value: drive
37
- });
38
-
39
- this.drive = drive;
40
- return this;
41
- }
1
+ import { compiledWebAssemblyModule } from "../../utilities/web-assembly";
2
+ import { Effector } from "../../core/classes/Effector";
3
+ import { Debug } from "../../utilities/debugger";
4
+
5
+ export class SoftClip extends Effector {
6
+
7
+ public label: string | null = "SoftClip";
8
+ public name: string = "SoftClip";
9
+
10
+ constructor(public drive: number = 1) {
11
+ super();
12
+ }
13
+
14
+ public async InitializeOnAttachment(parentialContext: AudioContext): Promise<void> {
15
+
16
+ if(!compiledWebAssemblyModule) return Debug.Error("Could not initialize effector because the nessecary WASM file has not been specified.", [
17
+ `Effector type: SoftClip`
18
+ ]);
19
+
20
+ this.audioWorkletNode = new AudioWorkletNode(parentialContext, "SoftClipProcessor", {
21
+ numberOfInputs: 1,
22
+ numberOfOutputs: 1,
23
+ outputChannelCount: [2],
24
+ parameterData: {
25
+ drive: this.drive
26
+ },
27
+ processorOptions: {
28
+ module: compiledWebAssemblyModule
29
+ }
30
+ });
31
+
32
+ this.parentialContext = parentialContext;
33
+ }
34
+
35
+ public SetDrive(drive: number): SoftClip {
36
+
37
+ if(this.audioWorkletNode) this.audioWorkletNode.port.postMessage({
38
+ type: "set-drive",
39
+ value: drive
40
+ });
41
+
42
+ this.drive = drive;
43
+ return this;
44
+ }
42
45
  }
@@ -1 +1,3 @@
1
- export class StereoPanner {}
1
+ export class StereoPanner {
2
+ public name: string = "StereoPanner";
3
+ }
@@ -1,22 +1,22 @@
1
- export { Chorus } from "./classes/Chorus";
2
- export { Distortion } from "./classes/Distortion";
3
- export { Equalizer } from "./classes/Equalizer";
4
- export { Filter } from "./classes/Filter";
5
- export { Limiter } from "./classes/Limiter";
6
- export { Saturation } from "./classes/Saturation";
7
- export { StereoPanner } from "./classes/StereoPanner";
8
- export { SoftClip } from "./classes/SoftClip";
9
-
10
- export { Compressor } from "./classes/compressors/Compressor";
11
- export { MultibandCompressor } from "./classes/compressors/MultibandCompressor";
12
-
13
- export { AdvancedDelay } from "./classes/delays/AdvancedDelay";
14
- export { MonoDelay } from "./classes/delays/MonoDelay";
15
- export { PingPongDelay } from "./classes/delays/PingPongDelay";
16
- export { StereoDelay } from "./classes/delays/StereoDelay";
17
-
18
- export { ChamberReverb } from "./classes/reverbs/ChamberReverb";
19
- export { ConvolverReverb } from "./classes/reverbs/ConvolverReverb";
20
- export { GenericReverb } from "./classes/reverbs/GenericReverb";
21
- export { HallReverb } from "./classes/reverbs/HallReverb";
22
- export { RoomReverb } from "./classes/reverbs/RoomReverb";
1
+ export { Chorus } from "./classes/Chorus";
2
+ export { Distortion } from "./classes/Distortion";
3
+ export { Equalizer } from "./classes/Equalizer";
4
+ export { Filter } from "./classes/Filter";
5
+ export { Limiter } from "./classes/Limiter";
6
+ export { Saturation } from "./classes/Saturation";
7
+ export { StereoPanner } from "./classes/StereoPanner";
8
+ export { SoftClip } from "./classes/SoftClip";
9
+
10
+ export { Compressor } from "./classes/compressors/Compressor";
11
+ export { MultibandCompressor } from "./classes/compressors/MultibandCompressor";
12
+
13
+ export { AdvancedDelay } from "./classes/delays/AdvancedDelay";
14
+ export { MonoDelay } from "./classes/delays/MonoDelay";
15
+ export { PingPongDelay } from "./classes/delays/PingPongDelay";
16
+ export { StereoDelay } from "./classes/delays/StereoDelay";
17
+
18
+ export { ChamberReverb } from "./classes/reverbs/ChamberReverb";
19
+ export { ConvolverReverb } from "./classes/reverbs/ConvolverReverb";
20
+ export { GenericReverb } from "./classes/reverbs/GenericReverb";
21
+ export { HallReverb } from "./classes/reverbs/HallReverb";
22
+ export { RoomReverb } from "./classes/reverbs/RoomReverb";
package/lib/src/index.ts CHANGED
@@ -1,93 +1,94 @@
1
- /**
2
- * FluexGL Audio
3
- * A javascript digital audio processor library.
4
- */
5
-
6
- import { FluexGLAudioDescriptor } from "./typings";
7
-
8
- export const FluexGLAudio: FluexGLAudioDescriptor = {
9
- name: "FluexGL Audio",
10
- author: "Rohan Kanhaisingh",
11
- version: "0.0.2",
12
- license: "MIT",
13
- repository: "https://github.com/rohankanhaisingh/FluexGL-Audio",
14
- options: {
15
- maxMasterChannels: 8,
16
- maxTotalChannels: 128,
17
- sampleRate: 44000,
18
- spatialization: "stereo",
19
- debugger: {
20
- showErrors: true,
21
- showInfo: true,
22
- showWarnings: true,
23
- breakOnError: true
24
- }
25
- }
26
- }
27
-
28
- export {
29
- Chorus,
30
- Distortion,
31
- Equalizer,
32
- Filter,
33
- Limiter,
34
- Saturation,
35
- StereoPanner,
36
- Compressor,
37
- MultibandCompressor,
38
- AdvancedDelay,
39
- MonoDelay,
40
- PingPongDelay,
41
- StereoDelay,
42
- ChamberReverb,
43
- ConvolverReverb,
44
- GenericReverb,
45
- HallReverb,
46
- RoomReverb,
47
- SoftClip
48
- } from "./effects/exports";
49
-
50
- export {
51
- AudioDevice,
52
- Channel,
53
- Effector,
54
- Master,
55
- AudioClip,
56
- DspPipeline
57
- } from "./core/exports";
58
-
59
- export {
60
- InitializeDspPipeline,
61
- ResolveAudioOutputDevices,
62
- ResolveAudioInputDevices,
63
- ResolveDefaultAudioInputDevice,
64
- ResolveDefaultAudioOutputDevice,
65
- LoadAudioSource,
66
- LoadWorkletOnMasterChannel,
67
- } from "./utilities/helpers";
68
-
69
- export {
70
- SUPPORTED_FILE_TYPES
71
- } from "./utilities/constants";
72
-
73
- export {
74
- hasInitializedWasm,
75
- } from "./utilities/web-assembly";
76
-
77
- export type {
78
- FluexGLAudioDescriptor,
79
- FluexGLAudioDebuggerOptions,
80
- FluexGLAudioOptions,
81
- LoadAudioSourceOptions,
82
- AudioSourceData,
83
- ChannelOptions,
84
- ChannelSpatialization,
85
- AudioClipEventMap,
86
- AudioClipEvents,
87
- AudioClipOnProgressEvent,
88
- AudioClipAnalyserProperty,
89
- AudioClipAnalyserType,
90
- DspPipelineInitializationOptions,
91
- DspPipelineInitializationState,
92
- ChorusEffectOptions
1
+ /**
2
+ * FluexGL Audio
3
+ * A javascript digital audio processor library.
4
+ */
5
+
6
+ import { FluexGLAudioDescriptor } from "./typings";
7
+
8
+ export const FluexGLAudio: FluexGLAudioDescriptor = {
9
+ name: "FluexGL Audio",
10
+ author: "Rohan Kanhaisingh",
11
+ version: "0.0.2",
12
+ license: "MIT",
13
+ repository: "https://github.com/rohankanhaisingh/FluexGL-Audio",
14
+ options: {
15
+ maxMasterChannels: 8,
16
+ maxTotalChannels: 128,
17
+ sampleRate: 44000,
18
+ spatialization: "stereo",
19
+ debugger: {
20
+ showErrors: true,
21
+ showInfo: true,
22
+ showWarnings: true,
23
+ breakOnError: true
24
+ }
25
+ }
26
+ }
27
+
28
+ export {
29
+ Chorus,
30
+ Distortion,
31
+ Equalizer,
32
+ Filter,
33
+ Limiter,
34
+ Saturation,
35
+ StereoPanner,
36
+ Compressor,
37
+ MultibandCompressor,
38
+ AdvancedDelay,
39
+ MonoDelay,
40
+ PingPongDelay,
41
+ StereoDelay,
42
+ ChamberReverb,
43
+ ConvolverReverb,
44
+ GenericReverb,
45
+ HallReverb,
46
+ RoomReverb,
47
+ SoftClip
48
+ } from "./effects/exports";
49
+
50
+ export {
51
+ AudioDevice,
52
+ Channel,
53
+ Effector,
54
+ Master,
55
+ AudioClip,
56
+ DspPipeline
57
+ } from "./core/exports";
58
+
59
+ export {
60
+ InitializeDspPipeline,
61
+ ResolveAudioOutputDevices,
62
+ ResolveAudioInputDevices,
63
+ ResolveDefaultAudioInputDevice,
64
+ ResolveDefaultAudioOutputDevice,
65
+ LoadAudioSource,
66
+ LoadAudioSourceFromBlob,
67
+ LoadWorkletOnMasterChannel,
68
+ } from "./utilities/helpers";
69
+
70
+ export {
71
+ SUPPORTED_FILE_TYPES
72
+ } from "./utilities/constants";
73
+
74
+ export {
75
+ hasInitializedWasm,
76
+ } from "./utilities/web-assembly";
77
+
78
+ export type {
79
+ FluexGLAudioDescriptor,
80
+ FluexGLAudioDebuggerOptions,
81
+ FluexGLAudioOptions,
82
+ LoadAudioSourceOptions,
83
+ AudioSourceData,
84
+ ChannelOptions,
85
+ ChannelSpatialization,
86
+ AudioClipEventMap,
87
+ AudioClipEvents,
88
+ AudioClipOnProgressEvent,
89
+ AudioClipAnalyserProperty,
90
+ AudioClipAnalyserType,
91
+ DspPipelineInitializationOptions,
92
+ DspPipelineInitializationState,
93
+ ChorusEffectOptions
93
94
  } from "./typings";
@@ -1,79 +1,79 @@
1
- export type ChannelSpatialization = "mono" | "stereo" | "surround";
2
-
3
- export type AudioClipAnalyserType = "pre" | "post";
4
- export type AudioClipAnalyserProperty = "fftSize" | "minDecibels" | "maxDecibels" | "smoothingTimeConstant";
5
-
6
- export type AudioClipEvents = {
7
- [K in keyof AudioClipEventMap]: AudioClipEventMap[K][];
8
- }
9
-
10
- export interface FluexGLAudioDebuggerOptions {
11
- breakOnError: boolean;
12
- showInfo: boolean;
13
- showErrors: boolean;
14
- showWarnings: boolean;
15
- }
16
-
17
- export interface FluexGLAudioOptions {
18
- maxMasterChannels: number;
19
- maxTotalChannels: number;
20
- sampleRate: number;
21
- spatialization: ChannelSpatialization;
22
- debugger: FluexGLAudioDebuggerOptions;
23
- }
24
-
25
- export interface FluexGLAudioDescriptor {
26
- name: string;
27
- author: string;
28
- version: string;
29
- license: string;
30
- repository: string;
31
- options: FluexGLAudioOptions;
32
- }
33
-
34
- export interface LoadAudioSourceOptions {
35
- allowForeignFileTypes: boolean;
36
- }
37
-
38
- export interface AudioSourceData {
39
- arrayBuffer: ArrayBuffer;
40
- audioBuffer: AudioBuffer;
41
- id: string;
42
- timestamp: number;
43
- }
44
-
45
- export interface ChannelOptions {
46
- label: string | null;
47
- maxAudioNodes: number;
48
- maxEffects: number;
49
- }
50
-
51
- export interface AudioClipOnProgressEvent {
52
- startTime: number;
53
- offset: number;
54
- current: number;
55
- contextTimestamp: number;
56
- formatted: string;
57
- }
58
-
59
- export interface AudioClipEventMap {
60
- "progress": (event: AudioClipOnProgressEvent) => void;
61
- }
62
-
63
- export interface DspPipelineInitializationOptions {
64
- pathToWasm: string;
65
- pathToWorklet: string;
66
- }
67
-
68
- export interface DspPipelineInitializationState {
69
- success: boolean;
70
- workletBlobUrl: string;
71
- }
72
-
73
- export interface ChorusEffectOptions {
74
- baseDelayMs?: number;
75
- depthMs?: number;
76
- rateHz?: number;
77
- mix?: number;
78
- feedback?: number;
1
+ export type ChannelSpatialization = "mono" | "stereo" | "surround";
2
+
3
+ export type AudioClipAnalyserType = "pre" | "post";
4
+ export type AudioClipAnalyserProperty = "fftSize" | "minDecibels" | "maxDecibels" | "smoothingTimeConstant";
5
+
6
+ export type AudioClipEvents = {
7
+ [K in keyof AudioClipEventMap]: AudioClipEventMap[K][];
8
+ }
9
+
10
+ export interface FluexGLAudioDebuggerOptions {
11
+ breakOnError: boolean;
12
+ showInfo: boolean;
13
+ showErrors: boolean;
14
+ showWarnings: boolean;
15
+ }
16
+
17
+ export interface FluexGLAudioOptions {
18
+ maxMasterChannels: number;
19
+ maxTotalChannels: number;
20
+ sampleRate: number;
21
+ spatialization: ChannelSpatialization;
22
+ debugger: FluexGLAudioDebuggerOptions;
23
+ }
24
+
25
+ export interface FluexGLAudioDescriptor {
26
+ name: string;
27
+ author: string;
28
+ version: string;
29
+ license: string;
30
+ repository: string;
31
+ options: FluexGLAudioOptions;
32
+ }
33
+
34
+ export interface LoadAudioSourceOptions {
35
+ allowForeignFileTypes: boolean;
36
+ }
37
+
38
+ export interface AudioSourceData {
39
+ arrayBuffer: ArrayBuffer;
40
+ audioBuffer: AudioBuffer;
41
+ id: string;
42
+ timestamp: number;
43
+ }
44
+
45
+ export interface ChannelOptions {
46
+ label: string | null;
47
+ maxAudioNodes: number;
48
+ maxEffects: number;
49
+ }
50
+
51
+ export interface AudioClipOnProgressEvent {
52
+ startTime: number;
53
+ offset: number;
54
+ current: number;
55
+ contextTimestamp: number;
56
+ formatted: string;
57
+ }
58
+
59
+ export interface AudioClipEventMap {
60
+ "progress": (event: AudioClipOnProgressEvent) => void;
61
+ }
62
+
63
+ export interface DspPipelineInitializationOptions {
64
+ pathToWasm: string;
65
+ pathToWorklet: string;
66
+ }
67
+
68
+ export interface DspPipelineInitializationState {
69
+ success: boolean;
70
+ workletBlobUrl: string;
71
+ }
72
+
73
+ export interface ChorusEffectOptions {
74
+ baseDelayMs?: number;
75
+ depthMs?: number;
76
+ rateHz?: number;
77
+ mix?: number;
78
+ feedback?: number;
79
79
  }
@@ -1,9 +1,9 @@
1
- export const SUPPORTED_FILE_TYPES: string[] = [
2
- "audio/aac",
3
- "audio/mp3",
4
- "audio/mpeg",
5
- "audio/ogg",
6
- "audio/wav",
7
- "audio/wave",
8
- "audio/webm"
1
+ export const SUPPORTED_FILE_TYPES: string[] = [
2
+ "audio/aac",
3
+ "audio/mp3",
4
+ "audio/mpeg",
5
+ "audio/ogg",
6
+ "audio/wav",
7
+ "audio/wave",
8
+ "audio/webm"
9
9
  ];
@@ -1,66 +1,66 @@
1
- import { ErrorCodes, WarningCodes } from "../console-codes";
2
-
3
- import { FluexGLAudio } from "../index";
4
-
5
- export namespace Debug {
6
-
7
- export function Log(message: string, additionalDetails?: string[]) {
8
-
9
- if (!FluexGLAudio.options.debugger.showInfo) return;
10
-
11
- let outputString: string = `%c[INFO]: %c${message} %c`;
12
-
13
- additionalDetails && additionalDetails.forEach(function (detail: string) {
14
- outputString += `\n\u0009 > ${detail}`
15
- });
16
-
17
- return console.log(outputString, "color: white;", "color: gray", "color: gray");
18
- }
19
-
20
- export function Success(message: string, additionalDetails?: string[]) {
21
-
22
- if (!FluexGLAudio.options.debugger.showInfo) return;
23
-
24
- let outputString: string = `%c[SUCCESS]: %c${message} %c`;
25
-
26
- additionalDetails && additionalDetails.forEach(function (detail: string) {
27
- outputString += `\n\u0009 > ${detail}`
28
- });
29
-
30
- return console.log(outputString, "color: lime;", "color: white", "color: gray");
31
- }
32
-
33
- export function Warn(message: string, additionalDetails?: string[], warningCode?: WarningCodes) {
34
-
35
- if (!FluexGLAudio.options.debugger.showWarnings) return;
36
-
37
- let outputString: string = `%c(${warningCode ? warningCode : "Unknown".toUpperCase()}) %c[WARNING]: %c${message} %c`;
38
-
39
- (additionalDetails && additionalDetails !== null) && additionalDetails.forEach(function (detail: string) {
40
- outputString += `\n\u0009 > ${detail}`
41
- });
42
-
43
- return console.log(outputString, "color: gray", "color: yellow;", "color: white", "color: white; font-style: italic;");
44
- }
45
-
46
- export function Error(message: string, additionalDetails?: string[], errorCode?: ErrorCodes) {
47
-
48
- if (!FluexGLAudio.options.debugger.showErrors) return;
49
-
50
- let outputString: string = `%c(${errorCode ? errorCode : "Unknown".toUpperCase()}) %c[ERROR]: %c${message} %c`;
51
-
52
- (additionalDetails && additionalDetails !== null) && additionalDetails.forEach(function (detail: string) {
53
- outputString += `\n\u0009 > ${detail}`
54
- });
55
-
56
- console.log(outputString, "color: red", "color: red;", "color: white", "color: white; font-style: italic;");
57
-
58
- if (FluexGLAudio.options.debugger.breakOnError) {
59
-
60
- for (let char of message)
61
- outputString = outputString.replace("%c", "");
62
-
63
- throw new window.Error(outputString);
64
- }
65
- }
1
+ import { ErrorCodes, WarningCodes } from "../console-codes";
2
+
3
+ import { FluexGLAudio } from "../index";
4
+
5
+ export namespace Debug {
6
+
7
+ export function Log(message: string, additionalDetails?: string[]) {
8
+
9
+ if (!FluexGLAudio.options.debugger.showInfo) return;
10
+
11
+ let outputString: string = `%c[INFO]: %c${message} %c`;
12
+
13
+ additionalDetails && additionalDetails.forEach(function (detail: string) {
14
+ outputString += `\n\u0009 > ${detail}`
15
+ });
16
+
17
+ return console.log(outputString, "color: white;", "color: gray", "color: gray");
18
+ }
19
+
20
+ export function Success(message: string, additionalDetails?: string[]) {
21
+
22
+ if (!FluexGLAudio.options.debugger.showInfo) return;
23
+
24
+ let outputString: string = `%c[SUCCESS]: %c${message} %c`;
25
+
26
+ additionalDetails && additionalDetails.forEach(function (detail: string) {
27
+ outputString += `\n\u0009 > ${detail}`
28
+ });
29
+
30
+ return console.log(outputString, "color: lime;", "color: white", "color: gray");
31
+ }
32
+
33
+ export function Warn(message: string, additionalDetails?: string[], warningCode?: WarningCodes) {
34
+
35
+ if (!FluexGLAudio.options.debugger.showWarnings) return;
36
+
37
+ let outputString: string = `%c(${warningCode ? warningCode : "Unknown".toUpperCase()}) %c[WARNING]: %c${message} %c`;
38
+
39
+ (additionalDetails && additionalDetails !== null) && additionalDetails.forEach(function (detail: string) {
40
+ outputString += `\n\u0009 > ${detail}`
41
+ });
42
+
43
+ return console.log(outputString, "color: gray", "color: yellow;", "color: white", "color: white; font-style: italic;");
44
+ }
45
+
46
+ export function Error(message: string, additionalDetails?: string[], errorCode?: ErrorCodes) {
47
+
48
+ if (!FluexGLAudio.options.debugger.showErrors) return;
49
+
50
+ let outputString: string = `%c(${errorCode ? errorCode : "Unknown".toUpperCase()}) %c[ERROR]: %c${message} %c`;
51
+
52
+ (additionalDetails && additionalDetails !== null) && additionalDetails.forEach(function (detail: string) {
53
+ outputString += `\n\u0009 > ${detail}`
54
+ });
55
+
56
+ console.log(outputString, "color: red", "color: red;", "color: white", "color: white; font-style: italic;");
57
+
58
+ if (FluexGLAudio.options.debugger.breakOnError) {
59
+
60
+ for (let char of message)
61
+ outputString = outputString.replace("%c", "");
62
+
63
+ throw new window.Error(outputString);
64
+ }
65
+ }
66
66
  }