{"id":18041637,"url":"https://github.com/katyo/oboe-rs","last_synced_at":"2025-04-04T19:06:02.142Z","repository":{"id":36943165,"uuid":"230429565","full_name":"katyo/oboe-rs","owner":"katyo","description":"Rust bindings for Oboe high-performance audio IO Android library","archived":false,"fork":false,"pushed_at":"2024-03-03T06:53:07.000Z","size":305,"stargazers_count":67,"open_issues_count":5,"forks_count":25,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T18:07:11.028Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/katyo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-27T11:09:24.000Z","updated_at":"2025-03-03T08:34:54.000Z","dependencies_parsed_at":"2023-02-12T08:01:19.581Z","dependency_job_id":"a755a4d3-118f-4aca-987a-6aaa5884a43c","html_url":"https://github.com/katyo/oboe-rs","commit_stats":{"total_commits":154,"total_committers":12,"mean_commits":"12.833333333333334","dds":0.2012987012987013,"last_synced_commit":"82514910dbc37923c4e0485ad70257530649030b"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyo%2Foboe-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyo%2Foboe-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyo%2Foboe-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyo%2Foboe-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/katyo","download_url":"https://codeload.github.com/katyo/oboe-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234921,"owners_count":20905854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-30T16:11:09.684Z","updated_at":"2025-04-04T19:06:02.097Z","avatar_url":"https://github.com/katyo.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# Rust bindings for Oboe library\n\n[![github](https://img.shields.io/badge/github-katyo/oboe--rs-8da0cb.svg?style=for-the-badge\u0026logo=github)](https://github.com/katyo/oboe-rs)\n[![Crates.io Package](https://img.shields.io/crates/v/oboe.svg?style=for-the-badge\u0026color=fc8d62\u0026logo=rust)](https://crates.io/crates/oboe)\n[![Docs.rs API Docs](https://img.shields.io/badge/docs.rs-oboe-66c2a5?style=for-the-badge\u0026logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K)](https://docs.rs/oboe)\n[![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-brightgreen.svg?style=for-the-badge)](https://opensource.org/licenses/Apache-2.0)\n[![CI Status](https://img.shields.io/github/actions/workflow/status/katyo/oboe-rs/rust.yml?branch=master\u0026style=for-the-badge\u0026logo=github-actions\u0026logoColor=white)](https://github.com/katyo/oboe-rs/actions?query=workflow%3ARust)\n\nSafe Rust interface for [Oboe](https://github.com/google/oboe) High-Performance Audio library for Android.\nAlso it provides interface for some platform APIs significant to Audio IO.\n\n__Oboe__ is a C++ library which makes it easy to build high-performance audio apps on Android. It was created primarily to allow developers to target a simplified API that works across multiple API levels back to API level 16 (Jelly Bean).\n\n## Crate features\n\n- __java-interface__ Add interface for some Android platform APIs.\n- __generate-bindings__ Generate bindings at compile-time. By default the pregenerated bindings will be used.\n- __compile-library__ Compile _oboe_ C++ library at compile-time using __cmake__. By default the precompiled library will be used.\n- __shared-link__ Use shared linking. By default the static Oboe libarary will be used.\n\nThe crate already has pregenerated bindings and precompiled static libraries for the following Android targets:\n\n- __armv7__\n- __aarch64__\n- __i686__\n- __x86_64__\n\n## Build issues\n\nThe **[clang-sys](https://crates.io/crates/clang-sys)** crate uses **[llvm-config](http://llvm.org/docs/CommandGuide/llvm-config.html)** for searching [libclang](https://clang.llvm.org/docs/Tooling.html) library and preparing _C_/_C++_ compiler configuration. In order to get proper setup you should add *llvm-config* to your executables search path.\n\nIn case of using tools with libclang under the hood like __bindgen__ you must be sure in proper your setup. Otherwise you get an errors related to missing headers or definitions.\n\nTo build applications you need recent version of __cargo-apk__, which supports latest Android [SDK](https://developer.android.com/studio#command-tools) (28+) and [NDK](https://developer.android.com/ndk) (20+). Don't forget to set ANDROID_SDK_ROOT environment variable with paths to installed SDK.\n\nFor building host crates which requires C-compiler you may also set __HOST_CC__ environment variable with path to your C-compiler.\n\n## Usage example\n\nPlaying sine wave in asynchronous (callback-driven) mode:\n\n```rust\nuse oboe::{\n    AudioOutputCallback,\n    AudioOutputStream,\n    AudioStreamBuilder,\n    DataCallbackResult,\n    PerformanceMode,\n    SharingMode,\n    Mono,\n};\n\n// Structure for sound generator\npub struct SineWave {\n    frequency: f32,\n    gain: f32,\n    phase: f32,\n    delta: Option\u003cf32\u003e,\n}\n\n// Default constructor for sound generator\nimpl Default for SineWave {\n    fn default() -\u003e Self {\n        Self {\n            frequency: 440.0,\n            gain: 0.5,\n            phase: 0.0,\n            delta: None,\n        }\n    }\n}\n\n// Audio output callback trait implementation\nimpl AudioOutputCallback for SineWave {\n    // Define type for frames which we would like to process\n    type FrameType = (f32, Mono);\n\n    // Implement sound data output callback\n    fn on_audio_ready(\u0026mut self, stream: \u0026mut dyn AudioOutputStream, frames: \u0026mut [f32]) -\u003e DataCallbackResult {\n        // Configure out wave generator\n        if self.delta.is_none() {\n            let sample_rate = stream.get_sample_rate() as f32;\n            self.delta = (self.frequency * 2.0 * PI / sample_rate).into();\n            println!(\"Prepare sine wave generator: samplerate={}, time delta={}\", sample_rate, self.delta.unwrap());\n        }\n\n        let delta = self.delta.unwrap();\n\n        // Generate audio frames to fill the output buffer\n        for frame in frames {\n            *frame = self.gain * self.phase.sin();\n            self.phase += delta;\n            while self.phase \u003e 2.0 * PI {\n                self.phase -= 2.0 * PI;\n            }\n        }\n\n        // Notify the oboe that stream is continued\n        DataCallbackResult::Continue\n    }\n}\n\n// ...\n\n// Create playback stream\nlet mut sine = AudioStreamBuilder::default()\n    // select desired performance mode\n    .set_performance_mode(PerformanceMode::LowLatency)\n    // select desired sharing mode\n    .set_sharing_mode(SharingMode::Shared)\n    // select sound sample format\n    .set_format::\u003cf32\u003e()\n    // select channels configuration\n    .set_channel_count::\u003cMono\u003e()\n    // set our generator as callback\n    .set_callback(SineWave::default())\n    // open the output stream\n    .open_stream()\n    .unwrap();\n\n// Start playback\nsine.start().unwrap();\n\n// ...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatyo%2Foboe-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkatyo%2Foboe-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatyo%2Foboe-rs/lists"}