-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
555d0db
commit 458a5cb
Showing
10 changed files
with
56 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Auto-generated with deno_bindgen | ||
import { CachePolicy, prepare } from "https://deno.land/x/[email protected]/plug.ts" | ||
function encode(v: string | Uint8Array): Uint8Array { | ||
if (typeof v !== "string") return v | ||
return new TextEncoder().encode(v) | ||
} | ||
function decode(v: Uint8Array): string { | ||
return new TextDecoder().decode(v) | ||
} | ||
function readPointer(v: any): Uint8Array { | ||
const ptr = new Deno.UnsafePointerView(v as Deno.UnsafePointer) | ||
const lengthBe = new Uint8Array(4) | ||
const view = new DataView(lengthBe.buffer) | ||
ptr.copyInto(lengthBe, 0) | ||
const buf = new Uint8Array(view.getUint32(0)) | ||
ptr.copyInto(buf, 4) | ||
return buf | ||
} | ||
const opts = { | ||
name: "deno_audio", | ||
url: (new URL("../target/release", import.meta.url)).toString(), | ||
policy: undefined, | ||
} | ||
const _lib = await prepare(opts, { | ||
play: { parameters: ["pointer", "usize"], result: "void", nonblocking: true }, | ||
}) | ||
|
||
export function play(a0: string) { | ||
const a0_buf = encode(a0) | ||
let rawResult = _lib.symbols.play(a0_buf, a0_buf.byteLength) | ||
const result = rawResult | ||
return result | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { play } from "./op.ts"; | ||
export { play } from "./bindings/bindings.ts"; |