{"id":23318467,"url":"https://github.com/mcb2003/rg3d-sound-sdl","last_synced_at":"2025-04-07T05:18:27.494Z","repository":{"id":57676684,"uuid":"488967207","full_name":"mcb2003/rg3d-sound-sdl","owner":"mcb2003","description":"Use rg3d-sound with SDL's audio subsystem","archived":false,"fork":false,"pushed_at":"2022-05-05T12:58:05.000Z","size":153,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T00:33:34.400Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcb2003.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-05T12:40:28.000Z","updated_at":"2022-05-05T12:45:32.000Z","dependencies_parsed_at":"2022-09-14T09:21:30.345Z","dependency_job_id":null,"html_url":"https://github.com/mcb2003/rg3d-sound-sdl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcb2003%2Frg3d-sound-sdl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcb2003%2Frg3d-sound-sdl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcb2003%2Frg3d-sound-sdl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcb2003%2Frg3d-sound-sdl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcb2003","download_url":"https://codeload.github.com/mcb2003/rg3d-sound-sdl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247595335,"owners_count":20963943,"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-12-20T17:17:08.107Z","updated_at":"2025-04-07T05:18:27.456Z","avatar_url":"https://github.com/mcb2003.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rg3d-sound-sdl\n\nUse rg3d-sound with SDL's audio subsystem\n\nThis crate allows you to use [SDL2's][sdl2] audio backend to output rendered audio data from\n[`rg3d_sound`]. This provides maximum portability between operating systems as SDL audio works\nalmost everywhere SDL does, and it will also take advantage of newer audio interfaces like\nPulseaudio and PipeWire on Linux.\n\n# Example\n\n```rust\nuse std::{error::Error, fs::File, io::BufReader, thread, time::Duration};\n\nuse rg3d_sound::{\n    buffer::{DataSource, SoundBufferResource},\n    context::SoundContext,\n    source::{generic::GenericSourceBuilder, Status},\n};\n\nfn main() -\u003e Result\u003c(), Box\u003cdyn Error\u003e\u003e {\n    let sdl = sdl2::init()?;\n    let audio = sdl.audio()?;\n    let (engine, device) = rg3d_sound_sdl::open(\u0026audio, None)?;\n    device.resume();\n\n    let ctx = SoundContext::new();\n    engine.lock().unwrap().add_context(ctx.clone());\n\n    let sound_buffer = SoundBufferResource::new_generic(DataSource::File {\n        path: \"ding.wav\".into(),\n        data: BufReader::new(File::open(\"ding.wav\")?),\n    })\n    .expect(\"Failed to create data source\");\n\n    let source = GenericSourceBuilder::new()\n        .with_buffer(sound_buffer)\n        .with_status(Status::Playing)\n        .build_source()?;\n\n    ctx.state().add_source(source);\n\n    thread::sleep(Duration::from_millis(1090));\n    Ok(())\n}\n```\n\n# License\n\nMIT License\n\nCopyright (c) 2022 Michael Connor Buchan \u003cmikey@blindcomputing.org\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcb2003%2Frg3d-sound-sdl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcb2003%2Frg3d-sound-sdl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcb2003%2Frg3d-sound-sdl/lists"}