Skip to content

Commit

Permalink
Update changelog.
Browse files Browse the repository at this point in the history
  • Loading branch information
AldaronLau committed Jan 29, 2022
1 parent 9d728ae commit 0da249a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to `fon` will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://github.com/AldaronLau/semver).

## [0.6.0] - Unreleased
## [0.6.0] - 2022-01-29
### Added
- Support for no-std!
- `chan::Ch24`, a 24-bit integer channel
Expand All @@ -20,6 +20,9 @@ and this project adheres to [Semantic Versioning](https://github.com/AldaronLau/
- `Frame::pan()`
- `Frame::gain()`
- `SinkTo` struct for converting audio while streaming
- `Sink::len()`
- `Sink::sink_with()`
- `Sink::is_empty()`

### Changed
- Renamed `Audio::as_slice()` to `Audio::as_mut_slice()`, and
Expand All @@ -29,6 +32,8 @@ and this project adheres to [Semantic Versioning](https://github.com/AldaronLau/
- Rename `Frame::convert()` to `Frame::to()`
- Merged `Stream` trait and `Resampler` struct into a new `Stream` struct
- Changed `Audio` back to being backed by a `Box<[Frame]>`
- `Sink` is now object-safe
- Sample rates are now represented as `NonZeroU32`

### Removed
- `chan::Ch8` because 8-bit audio is uncommon today and you can use `Ch16`
Expand All @@ -42,6 +47,10 @@ and this project adheres to [Semantic Versioning](https://github.com/AldaronLau/
- `Frame::from_channel()`
- `Frame::from_channels()`
- `Frame::from_mono()`
- `Sink::buffer()`
- `Sink::resampler()`
- `Sink::flush()`
- `Sink::stream()`

### Fixed
- Resampler now does proper resampling
Expand Down
6 changes: 4 additions & 2 deletions src/chan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ impl Channel for Ch16 {

#[inline(always)]
fn to_f32(self) -> f32 {
(f32::from(self.0) + 0.5) * 32_767.5_f32.recip()
const MULTIPLIER: f32 = 1.0 / 32_767.5;
(f32::from(self.0) + 0.5) * MULTIPLIER
}
}

Expand Down Expand Up @@ -175,7 +176,8 @@ impl Channel for Ch24 {

#[inline(always)]
fn to_f32(self) -> f32 {
(i32::from(self) as f32 + 0.5) * 8_388_607.5_f32.recip()
const MULTIPLIER: f32 = 1.0 / 8_388_607.5;
(i32::from(self) as f32 + 0.5) * MULTIPLIER
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,8 @@ impl<Chan: Channel, const CH: usize> Frame<Chan, CH> {
let left = self.0[LEFT].into();
let right = self.0[RIGHT].into();
if N == 1 {
frame.0[0] = left * 0.5.into() + right * 0.5.into();
let half = 0.5.into();
frame.0[0] = left * half + right * half;
} else {
// stereo should always be mixed up to first two channels.
frame.0[0] = left;
Expand Down

0 comments on commit 0da249a

Please sign in to comment.