Skip to content

Commit

Permalink
release: 0.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
joshstoik1 committed Sep 28, 2023
2 parents 1cbe8cf + 9af4848 commit 314ecf1
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 5 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# Changelog


## [0.2.3](https://github.com/Blobfolio/cdtoc/releases/tag/v0.2.3) - 2023-09-27

### New

* `Toc::audio_leadin_normalized`
* `Toc::audio_leadout_normalized`
* `Toc::data_sector_normalized`
* `Toc::leadin_normalized`
* `Toc::leadout_normalized`



## [0.2.2](https://github.com/Blobfolio/cdtoc/releases/tag/v0.2.2) - 2023-09-12

### New
Expand Down
8 changes: 4 additions & 4 deletions CREDITS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Project Dependencies
Package: cdtoc
Version: 0.2.2
Generated: 2023-09-12 16:13:26 UTC
Version: 0.2.3
Generated: 2023-09-28 06:05:20 UTC

| Package | Version | Author(s) | License |
| ---- | ---- | ---- | ---- |
Expand All @@ -14,6 +14,6 @@
| [generic-array](https://github.com/fizyk20/generic-array.git) | 0.14.7 | [Bartłomiej Kamiński](mailto:[email protected]) and [Aaron Trent](mailto:[email protected]) | MIT |
| [itoa](https://github.com/dtolnay/itoa) | 1.0.9 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
| [num-traits](https://github.com/rust-num/num-traits) | 0.2.16 | The Rust Project Developers | Apache-2.0 or MIT |
| [sha1](https://github.com/RustCrypto/hashes) | 0.10.5 | RustCrypto Developers | Apache-2.0 or MIT |
| [sha1](https://github.com/RustCrypto/hashes) | 0.10.6 | RustCrypto Developers | Apache-2.0 or MIT |
| [trimothy](https://github.com/Blobfolio/trimothy) | 0.1.8 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [typenum](https://github.com/paholg/typenum) | 1.16.0 | [Paho Lurie-Gregg](mailto:[email protected]) and [Andre Bogus](mailto:[email protected]) | Apache-2.0 or MIT |
| [typenum](https://github.com/paholg/typenum) | 1.17.0 | [Paho Lurie-Gregg](mailto:[email protected]) and [Andre Bogus](mailto:[email protected]) | Apache-2.0 or MIT |
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cdtoc"
version = "0.2.2"
version = "0.2.3"
authors = ["Blobfolio, LLC. <[email protected]>"]
edition = "2021"
rust-version = "1.70"
Expand Down
98 changes: 98 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,23 @@ impl Toc {
/// ```
pub fn audio_leadin(&self) -> u32 { self.audio[0] }

#[must_use]
/// # Normalized Audio Leadin.
///
/// This is the same as [`Toc::audio_leadin`], but _without_ the mandatory
/// 150-sector CD lead-in.
///
/// ## Examples
///
/// ```
/// use cdtoc::Toc;
///
/// let toc = Toc::from_cdtoc("4+96+2D2B+6256+B327+D84A").unwrap();
/// assert_eq!(toc.audio_leadin(), 150);
/// assert_eq!(toc.audio_leadin_normalized(), 0);
/// ```
pub fn audio_leadin_normalized(&self) -> u32 { self.audio[0] - 150 }

#[must_use]
/// # Audio Leadout.
///
Expand All @@ -603,6 +620,25 @@ impl Toc {
else { self.leadout }
}

#[must_use]
/// # Normalized Audio Leadout.
///
/// This is the same as [`Toc::audio_leadout`], but _without_ the mandatory
/// 150-sector CD lead-in.
///
/// ## Examples
///
/// ```
/// use cdtoc::Toc;
///
/// let toc = Toc::from_cdtoc("4+96+2D2B+6256+B327+D84A").unwrap();
/// assert_eq!(toc.audio_leadout(), 55370);
/// assert_eq!(toc.audio_leadout_normalized(), 55220);
/// ```
pub const fn audio_leadout_normalized(&self) -> u32 {
self.audio_leadout() - 150
}

#[must_use]
/// # Number of Audio Tracks.
///
Expand Down Expand Up @@ -686,6 +722,31 @@ impl Toc {
else { None }
}

#[must_use]
/// # Normalized Data Sector.
///
/// This is the same as [`Toc::data_sector`], but _without_ the mandatory
/// 150-sector CD lead-in.
///
/// ## Examples
///
/// ```
/// use cdtoc::Toc;
///
/// // No data here.
/// let toc = Toc::from_cdtoc("4+96+2D2B+6256+B327+D84A").unwrap();
/// assert_eq!(toc.data_sector(), None);
///
/// // This CD-Extra has data, though!
/// let toc = Toc::from_cdtoc("3+96+2D2B+6256+B327+D84A").unwrap();
/// assert_eq!(toc.data_sector(), Some(45_863));
/// assert_eq!(toc.data_sector_normalized(), Some(45_713));
/// ```
pub const fn data_sector_normalized(&self) -> Option<u32> {
if self.kind.has_data() { Some(self.data.saturating_sub(150)) }
else { None }
}

#[must_use]
/// # Has Data?
///
Expand Down Expand Up @@ -791,6 +852,26 @@ impl Toc {
else { self.audio[0] }
}

#[must_use]
/// # Normalized Absolute Leadin.
///
/// This is the same as [`Toc::leadin`], but _without_ the mandatory
/// 150-sector CD lead-in.
///
/// ## Examples
///
/// ```
/// use cdtoc::Toc;
///
/// let toc = Toc::from_cdtoc("4+96+2D2B+6256+B327+D84A").unwrap();
/// assert_eq!(toc.leadin(), 150);
/// assert_eq!(toc.leadin_normalized(), 0);
/// ```
pub fn leadin_normalized(&self) -> u32 {
if matches!(self.kind, TocKind::DataFirst) { self.data.saturating_sub(150) }
else { self.audio[0] - 150 }
}

#[must_use]
/// # Absolute Leadout.
///
Expand All @@ -807,6 +888,23 @@ impl Toc {
/// ```
pub const fn leadout(&self) -> u32 { self.leadout }

#[must_use]
/// # Normalized Absolute Leadout.
///
/// This is the same as [`Toc::leadout`], but _without_ the mandatory
/// 150-sector CD lead-in.
///
/// ## Examples
///
/// ```
/// use cdtoc::Toc;
///
/// let toc = Toc::from_cdtoc("4+96+2D2B+6256+B327+D84A").unwrap();
/// assert_eq!(toc.leadout(), 55_370);
/// assert_eq!(toc.leadout_normalized(), 55_220);
/// ```
pub const fn leadout_normalized(&self) -> u32 { self.leadout - 150 }

#[must_use]
/// # Duration.
///
Expand Down

0 comments on commit 314ecf1

Please sign in to comment.