Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deny missing_docs #90

Merged
merged 4 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Learn more [here][FMOD attribution].
Currently, this crate is only tested and developed for Windows (non-UWP) and Linux. More platforms are planned
eventually.

MacOS: https://github.com/Salzian/bevy_fmod/issues/2
Web: https://github.com/Salzian/bevy_fmod/issues/51
MacOS: <https://github.com/Salzian/bevy_fmod/issues/2>
Web: <https://github.com/Salzian/bevy_fmod/issues/51>

Pull requests are welcome.

Expand Down Expand Up @@ -57,7 +57,7 @@ in [build.rs](https://github.com/Salzian/bevy_fmod/blob/main/build.rs) for more

```toml
[dependencies]
bevy_fmod = { git = "https://github.com/Salzian/bevy_fmod.git", tag = "<bevy_fmod release tag>" }
bevy_fmod = "0.5.0"
```

Get the latest release tag [on the releases page][GitHub releases].
Expand Down
2 changes: 2 additions & 0 deletions src/components/audio_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use crate::attributes_3d::attributes3d;
use crate::components::velocity::Velocity;
use crate::fmod_studio::FmodStudio;

/// Component that represents an audio listener in 3D space.
///
/// See the [`Velocity`] component for information on enabling the Doppler effect.
#[derive(Component, Default)]
pub struct AudioListener;
Expand Down
18 changes: 17 additions & 1 deletion src/components/bundles.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
//! [`Bundle`]s for spatial audio components in a Bevy application.
//!
//! For more information on bundles, see the [`Bundle`] trait.

use crate::prelude::{AudioListener, AudioSource, Velocity};
use bevy::prelude::{Bundle, TransformBundle};
use libfmod::{EventDescription, StopMode};

/// A bundle that includes all components required for emitting spatial audio.
#[derive(Bundle)]
pub struct SpatialAudioBundle {
audio_source: AudioSource,
Expand All @@ -10,7 +15,17 @@ pub struct SpatialAudioBundle {
}

impl SpatialAudioBundle {
#[deprecated = "Use `AudioSource::from` instead."]
/// Creates a new `SpatialAudioBundle` from the given `EventDescription`.
///
/// # Arguments
///
/// * `event_description` - An [`EventDescription`] that provides the necessary information to
/// create an [`AudioSource`].
///
/// # Returns
///
/// A new instance of [`SpatialAudioBundle`] containing the components required for emitting
/// spatial audio.
pub fn new(event_description: EventDescription) -> Self {
SpatialAudioBundle {
audio_source: AudioSource {
Expand All @@ -33,6 +48,7 @@ impl From<AudioSource> for SpatialAudioBundle {
}
}

/// A bundle that includes all components required for listening to spatial audio.
#[derive(Bundle, Default)]
pub struct SpatialListenerBundle {
audio_listener: AudioListener,
Expand Down
16 changes: 16 additions & 0 deletions src/components/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
//! Components used for integrating FMOD in a Bevy application.
//!
//! The components provided in this module are essential for implementing spatial audio functionality,
//! including audio sources, listeners, and velocity. These components can be used individually or
//! grouped together using bundles for easier management.

#[doc(hidden)]
pub mod audio_listener;
#[doc(hidden)]
pub mod audio_source;
pub mod bundles;
#[doc(hidden)]
pub mod velocity;

#[doc(inline)]
pub use audio_listener::AudioListener;
#[doc(inline)]
pub use audio_source::AudioSource;
#[doc(inline)]
pub use velocity::Velocity;
9 changes: 6 additions & 3 deletions src/components/velocity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ use bevy::app::{App, Plugin, Update};
use bevy::math::Vec3;
use bevy::prelude::{Component, GlobalTransform, Local, Query, Res, Time};

/// Automatic velocity updates for [`AudioListener`] and [`AudioSource`]
/// Automatic velocity updates for
/// [`AudioListener`](crate::components::audio_listener::AudioListener) and
/// [`AudioSource`](crate::components::audio_source::AudioSource) components.
///
/// Make sure to add this component to your listener and source entities in order
/// to enable the Doppler effect. The recommended way to do this is to use the [`SpatialAudioBundle`]
/// and [`SpatialListenerBundle`].
/// to enable the Doppler effect. The recommended way to do this is to use the
/// [`SpatialAudioBundle`](crate::components::bundles::SpatialAudioBundle) and
/// [`SpatialListenerBundle`](crate::components::bundles::SpatialListenerBundle).
#[derive(Component, Default)]
pub struct Velocity {
last_position: Vec3,
Expand Down
3 changes: 2 additions & 1 deletion src/fmod_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ use crate::components::audio_source::AudioSource;
use crate::components::velocity::VelocityPlugin;
use crate::fmod_studio::FmodStudio;

/// Initializes the FMOD Studio API and provides systems to update the audio sources and listeners.
pub struct FmodPlugin {
/// Paths to the audio banks which are usually in the Build folder of the FMOD project.
pub audio_banks_paths: &'static [&'static str],

/// Optionally you can provide paths to FMOD plugins which will then be loaded automatically.
/// For more information see: https://www.fmod.com/docs/2.01/api/core-guide.html#dynamic
/// For more information see: <https://www.fmod.com/docs/2.01/api/core-guide.html#dynamic>
pub plugin_paths: Option<&'static [&'static str]>,
}

Expand Down
4 changes: 4 additions & 0 deletions src/fmod_studio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ use libfmod::ffi::{
};
use libfmod::{Studio, System};

/// A resource that wraps the `Studio` object from the FMOD library.
///
/// This struct provides convenient access to the FMOD Studio API within the Bevy ECS.
/// It derives `Deref` and `DerefMut` to allow direct access to the inner `Studio` object.
#[derive(Resource, Deref, DerefMut)]
pub struct FmodStudio(pub Studio);

Expand Down
10 changes: 9 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
#![deny(clippy::wildcard_imports)]
#![doc = include_str!("../README.md")]
#![deny(clippy::wildcard_imports, missing_docs)]

mod attributes_3d;
pub mod components;
#[doc(hidden)]
pub mod fmod_plugin;
#[doc(hidden)]
pub mod fmod_studio;
pub mod prelude;

#[doc(inline)]
pub use fmod_plugin::FmodPlugin;
#[doc(inline)]
pub use fmod_studio::FmodStudio;
8 changes: 8 additions & 0 deletions src/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
//! Re-exports the most commonly used types, traits, and functions in this crate.
//!
//! ## Usage
//!
//! ```
//! use bevy_fmod::prelude::*;
//! ```

pub use crate::components::audio_listener::AudioListener;
pub use crate::components::audio_source::AudioSource;
pub use crate::components::bundles::SpatialAudioBundle;
Expand Down