Comments (3)
Running deno_bindgen --release
in my laptop, it generated the following binding (using the library locally, from ../target/release
):
// 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 bigint)
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 url = new URL("../target/release", import.meta.url)
let uri = url.toString()
if (!uri.endsWith("/")) uri += "/"
let darwin: string | { aarch64: string; x86_64: string } = uri
+ "libdeno_audio.dylib"
if (url.protocol !== "file:") {
// Assume that remote assets follow naming scheme
// for each macOS artifact.
darwin = {
aarch64: uri + "libdeno_audio_arm64.dylib",
x86_64: uri + "libdeno_audio.dylib",
}
}
const opts = {
name: "deno_audio",
urls: {
darwin,
windows: uri + "deno_audio.dll",
linux: uri + "libdeno_audio.so",
},
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)
const a0_ptr = Deno.UnsafePointer.of(a0_buf)
let rawResult = _lib.symbols.play(a0_ptr, a0_buf.byteLength)
const result = rawResult
return result
}
...and this library below:
...that worked like a charm.
Anyway, it would be nice to provide arm64 binary at littledivy/deno_audio/releases too.
from deno_audio.
Good news from GitHub blog:
GitHub Actions: Self-hosted runners now support Apple M1 hardware
- https://github.blog/changelog/2022-08-09-github-actions-self-hosted-runners-now-support-apple-m1-hardware
- https://github.com/actions/runner/blob/main/docs/start/envosx.md
- github/roadmap#528
from deno_audio.
Running
deno_bindgen --release
in my laptop, it generated the following binding (using the library locally, from../target/release
):// 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 bigint) 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 url = new URL("../target/release", import.meta.url) let uri = url.toString() if (!uri.endsWith("/")) uri += "/" let darwin: string | { aarch64: string; x86_64: string } = uri + "libdeno_audio.dylib" if (url.protocol !== "file:") { // Assume that remote assets follow naming scheme // for each macOS artifact. darwin = { aarch64: uri + "libdeno_audio_arm64.dylib", x86_64: uri + "libdeno_audio.dylib", } } const opts = { name: "deno_audio", urls: { darwin, windows: uri + "deno_audio.dll", linux: uri + "libdeno_audio.so", }, 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) const a0_ptr = Deno.UnsafePointer.of(a0_buf) let rawResult = _lib.symbols.play(a0_ptr, a0_buf.byteLength) const result = rawResult return result }...and this library below:
...that worked like a charm.
Anyway, it would be nice to provide arm64 binary at littledivy/deno_audio/releases too.
How would I use your .dylib to use the play function in my code?
from deno_audio.
Related Issues (10)
- Question HOT 2
- Internet Streams and Capture Metadata from Same Streams
- mod files
- Update to use Deno FFI
- `play()` doesn't work with latest deno `1.26.2` on Windows
- Stop sound
- [feature request]: play for `buffer` or `stream`
- [feature request]: volume options and support for rodio spatial
- undefined symbol: init_deno_bindgen
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deno_audio.