diff --git a/README.md b/README.md
index 2b31f23..908052a 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,8 @@
+ + +
@@ -21,7 +24,7 @@ ## Example ```typescript -import { play } from "https://deno.land/audio@0.1.0/mod.ts"; +import { play } from "https://deno.land/x/audio@0.1.0/mod.ts"; // supports mp3, wav, vorbis, flac await play("music.mp3"); @@ -52,4 +55,6 @@ Pull request, issues and feedback are very welcome. Code style is formatted with ## Copyright +Logo by [@carazmatic](https://picsart.com/i/284157719013211) at picsart.com (cute, isn't it?) + deno_audio is licensed under the MIT license. Please see the [LICENSE](LICENSE) file. diff --git a/core_type.ts b/core_type.ts index b022bd8..1582095 100644 --- a/core_type.ts +++ b/core_type.ts @@ -1,10 +1,10 @@ // @ts-ignore export const core = Deno.core as { - ops: () => { [key: string]: number }; - setAsyncHandler(rid: number, handler: (response: Uint8Array) => void): void; - dispatch( - rid: number, - msg?: any, - buf?: ArrayBufferView, - ): Uint8Array | undefined; + ops: () => { [key: string]: number }; + setAsyncHandler(rid: number, handler: (response: Uint8Array) => void): void; + dispatch( + rid: number, + msg?: any, + buf?: ArrayBufferView, + ): Uint8Array | undefined; }; diff --git a/detect.ts b/detect.ts index 93d6287..bcdc7e4 100644 --- a/detect.ts +++ b/detect.ts @@ -1,15 +1,14 @@ - export default function filename(filenameBase: string): string { - let filenameSuffix = ".so"; - let filenamePrefix = "lib"; - - if (Deno.build.os === "windows") { - filenameSuffix = ".dll"; - filenamePrefix = ""; - } - if (Deno.build.os === "darwin") { - filenameSuffix = ".dylib"; - } - - return `${filenamePrefix}${filenameBase}${filenameSuffix}`; - } \ No newline at end of file + let filenameSuffix = ".so"; + let filenamePrefix = "lib"; + + if (Deno.build.os === "windows") { + filenameSuffix = ".dll"; + filenamePrefix = ""; + } + if (Deno.build.os === "darwin") { + filenameSuffix = ".dylib"; + } + + return `${filenamePrefix}${filenameBase}${filenameSuffix}`; +} diff --git a/example.ts b/example.ts index 312f143..b468586 100644 --- a/example.ts +++ b/example.ts @@ -1,4 +1,3 @@ import { play } from "./mod.ts"; await play("music.mp3"); - diff --git a/icon.webp b/icon.webp new file mode 100644 index 0000000..1378814 Binary files /dev/null and b/icon.webp differ diff --git a/op.ts b/op.ts index 88956a8..b1cc1e9 100644 --- a/op.ts +++ b/op.ts @@ -2,20 +2,19 @@ import "./plugin.ts"; import { core } from "./core_type.ts"; const { - play: op_play, + play: op_play, } = core.ops(); - + const textDecoder = new TextDecoder(); const decoder = new TextDecoder(); - export async function play(file: string) { - const encoder = new TextEncoder(); - const view = encoder.encode(file); - return new Promise((resolve, reject) => { - core.setAsyncHandler(op_play, (bytes) => { - resolve(textDecoder.decode(bytes)); - }); - core.dispatch(op_play, view); + const encoder = new TextEncoder(); + const view = encoder.encode(file); + return new Promise((resolve, reject) => { + core.setAsyncHandler(op_play, (bytes) => { + resolve(textDecoder.decode(bytes)); }); + core.dispatch(op_play, view); + }); } diff --git a/plugin.ts b/plugin.ts index 840dde9..77fd3f0 100644 --- a/plugin.ts +++ b/plugin.ts @@ -22,4 +22,3 @@ if (isDev) { }, }); } -