Skip to content

Conversation

@olekspickle
Copy link
Contributor

@olekspickle olekspickle commented Jan 28, 2026

This is initial bulk and my first time working Rust <-> C for real, but I hope it provides something to base on.

Overview

  • new crates/firewheel-c crate that uses cbindgen to generate header (include/firewheel-c.h)
  • examples/bindings example with one main.c example and two bash scripts for simplicity (cpal.sh and rtaudio.sh)
  • I had to alter visibility of some elements to expose it but if there is a way to avoid that I'm all ears

Disclaimer: I hope it will be useful, but feel free to fix or alter it in any way. I for sure lack C audio usage experience since with both backends I have issue when trying to connect nodes (with cpal core dumping and rtaudio giving hell of a cpp error dump)

crates/forewheel-c/src/lib.rs content

Opaque types

  • FwSample
  • FwConfig
  • FwContext
  • FwAudioDeviceList
  • FwStreamConfig

Unions

  • FwBackend
  • FwFactoryNode
  • FwStreamConfigField
  • FwStreamConfigValue

Functions

  • fw_get_last_error
  • fw_config_create
  • fw_config_free
  • fw_config_set_num_graph_inputs
  • fw_config_set_num_graph_outputs
  • fw_config_set_hard_clip_outputs
  • fw_config_set_declick_seconds
  • fw_context_create
  • fw_context_free
  • fw_context_set_playing
  • fw_context_is_playing
  • fw_context_set_static_beats_per_minute
  • fw_context_get_beats_per_minute
  • fw_context_set_playhead
  • fw_context_get_playhead
  • fw_context_set_speed_multiplier
  • fw_context_update
  • fw_node_remove
  • fw_node_add
  • fw_node_connect
  • fw_node_set_f32_parameter
  • fw_node_set_u32_parameter
  • fw_node_disconnect
  • fw_sample_load_from_file
  • fw_sample_free
  • fw_stream_config_create
  • fw_stream_config_free
  • fw_stream_config_set
  • fw_audio_device_list_create
  • fw_audio_device_list_free
  • fw_audio_device_list_get_len
  • fw_audio_device_list_get_name

@olekspickle olekspickle marked this pull request as ready for review January 30, 2026 15:17
@BillyDM
Copy link
Owner

BillyDM commented Jan 30, 2026

Sorry, been busy with other things. I'll get to this soon!

@olekspickle
Copy link
Contributor Author

No rush, I'm busy with GGJ 2026 anyways :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants