4 个版本

0.2.1 2022年11月13日
0.2.0 2022年8月20日
0.1.1 2022年5月16日
0.1.0 2022年4月26日

#1593游戏开发

自定义许可

1.5MB
810

包含 (WOFF 字体,400KB) NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2,(WOFF 字体,135KB) FiraSans-Medium-8f9a781e4970d388.woff2,(WOFF 字体,130KB) FiraSans-Regular-018c141bf0843ffd.woff2,(WOFF 字体,82KB) SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2,(WOFF 字体,77KB) SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2,(WOFF 字体,45KB) SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 以及 3 个其他文件。

bevy-rrise

Crates.io MIT/Apache 2.0 Crates.io

什么是 bevy-rrise?

它是为 Bevy 引擎而设计的插件,用于集成 Wwise 音频引擎。

它依赖于我的 Rrise 包,用于 Wwise 的 Rust 绑定。

欢迎提交PR!

使用方法

首先,查看Rrise的系统要求:它们与 bevy-rrise 相同!

请务必查看示例,以了解如何使用此包的最佳方式。要编译和运行示例,您首先需要生成示例 Wwise 项目的音效库(位于examples/WwiseProject)。

示例还展示了如何使用自动生成的模块 rrise_headers::rr 获取您的音效事件、总线等定义为 Rust 常量(从音效库定义文件生成)。更多信息 这里

要开始使用插件,只需将其添加到您的 Bevy 应用中即可。就是这样,您现在可以生成 RrEmitter 组件、RrEmitterBundleRrDynamicEmitterBundle 了!

// ... 'use' directives...

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        // Use Rrise with default settings 
        .add_plugin(RrisePlugin::default())
        .add_startup_system(setup_scene)
        .add_system(update)
        .run();
}

fn setup_scene(
    mut commands: Commands,
    mut meshes: ResMut<Assets<Mesh>>,
    mut materials: ResMut<Assets<StandardMaterial>>,
) {
    // Load soundbank containing our PlayHelloWorld event structure and media
    if let Err(akr) = load_bank_by_name("TheBank.bnk") {
        panic!("Couldn't load TheBank: {}", akr);
    }

    // Setup mesh audio emitter
    commands
        .spawn(PbrBundle {
            mesh: meshes.add(Mesh::from(shape::Icosphere::default())),
            material: materials.add(Color::RED.into()),
            ..default()
        })
        .with_children(|parent| {
            // Attach dynamic emitter in the center of the parent
            parent.spawn(
                RrDynamicEmitterBundle::new(Vec3::default())
                    .with_event("PlayHelloWorld", true),
            );
        });

    // ... setup rest of scene
}

fn update(/* ... */) {
    // ... update scene
}

RrDynamicEmitterBundle(或具有 TransformBundle 的实体的 RrEmitter 组件)将自动将转换更新转发给 Wwise。

如果它们有 bevy:core::Name 组件,则音效器将向 Wwise 发送其实体的名称,以便轻松监视。

在您能听到任何声音之前,请确保您已从 Wwise 创作工具生成音效库,并将生成的资产放置在 bevy-rrise 可以找到的位置。再次,查看提供的示例配置以开始使用 😊

不要犹豫,为 bevy-rrise 启用调试级别的日志,以便了解底层发生了什么!这也可以帮助诊断为什么你的声音可能不起作用。

插件配置

从 v0.2.1(以及 Bevy 0.9)开始,配置比以往任何时候都更加直观!从 RrisePlugin::default() 开始,然后使用一系列的 with_*_settings(...) 函数来自定义声音引擎和插件行为

  • with_plugin_settings(RriseBasicSettings)
  • with_mem_settings(AkMemSettings)
  • with_music_settings(AkMusicSettings)
  • with_engine_settings(AkInitSettings)
  • with_stream_settings(AkStreamMgrSettings)
  • with_dev_settings(AkDeviceSettings)
  • with_platform_settings(AkPlatformInitSettings)
  • with_comms_settings(AkCommSettings)

所有 *Settings 类都有详细文档,描述了所有成员,并实现了 Default 特性,当您只想覆盖少量值时,具有最大化的直观性。

Bevy 兼容表

Bevy rrise bevy-rrise
0.7 0.2 0.1
0.8 0.2 0.2
0.9 0.2 0.2.1

Wwise 和 Wwise 标志是 Audiokinetic Inc. 的商标,在美国和其他国家注册。

本项目与 Audiokinetic 无任何关联。

您仍然需要安装授权版本的 Wwise 来编译和运行此项目。您需要一个有效的 Wwise 许可证来分发基于此crate的任何项目。

依赖关系

~19–37MB
~560K SLoC