luminol_audio/lib.rs
1// Copyright (C) 2024 Melody Madeline Lyons
2//
3// This file is part of Luminol.
4//
5// Luminol is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// Luminol is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with Luminol. If not, see <http://www.gnu.org/licenses/>.
17//
18// Additional permission under GNU GPL version 3 section 7
19//
20// If you modify this Program, or any covered work, by linking or combining
21// it with Steamworks API by Valve Corporation, containing parts covered by
22// terms of the Steamworks API by Valve Corporation, the licensors of this
23// Program grant you additional permission to convey the resulting work.
24
25mod error;
26mod midi;
27pub use error::{Error, Result};
28
29pub use luminol_config::VolumeScale;
30
31mod native;
32#[cfg(target_arch = "wasm32")]
33mod wrapper;
34
35#[cfg(not(target_arch = "wasm32"))]
36pub use native::Audio;
37#[cfg(target_arch = "wasm32")]
38pub use wrapper::Audio;
39
40/// Different sound sources.
41#[derive(strum::EnumIter, strum::Display, PartialEq, Eq, Clone, Copy, Hash)]
42#[allow(clippy::upper_case_acronyms)]
43#[allow(missing_docs)]
44pub enum Source {
45 BGM,
46 BGS,
47 ME,
48 SE,
49}
50
51impl Source {
52 pub fn as_path(&self) -> &camino::Utf8Path {
53 camino::Utf8Path::new(match self {
54 Source::BGM => "BGM",
55 Source::BGS => "BGS",
56 Source::ME => "ME",
57 Source::SE => "SE",
58 })
59 }
60}