Commit graph

73 commits

Author SHA1 Message Date
Aaron Kofsky
d20a3c661e Fix reading WAV of different encodings. (#199)
* Read 32 bit float and 24 bit int encoded files correctly.

Before, we were assuming that all WAV files are encoded as 16 bit integers.
This is not true, WAVs can actually also be encoded as 32 bit floats and
24 bit integers. Hound returns `Err` when we attempt to read files as the
wrong encoding, which was getting `unwrap_or`'d to just zero. This explains
why the file would load but not play any sound. We fix this by first
checking for the appropriate encoding, and then converting to an i16. This
might cause some slight dither issues but hopefully it is quiet enough that
it doesn't matter.

Fixes #195.

* Add tests of reading wav files different encodings

* Use `.map()` instead of control flow & unwrapping.

This makes things slightly cleaner to read.
Also remove extraneous print statement.
2018-11-09 21:58:43 +01:00
Jacob Kiesel
d839e53078 Prepare 0.8 release 2018-06-22 08:50:19 -06:00
Erin Moon
5c54078126 decoders: implement minimp3-based MP3 decoder
Closes #36.
2018-05-26 18:42:22 -05:00
Erin Moon
c5725b8a37 vorbis decoder: implement filetype check and fallthrough 2018-05-26 18:42:22 -05:00
Francesco Zardi
6a8c71bdb2 Run cargo fmt 2018-04-19 10:03:48 +02:00
Francesco Zardi
74ceb63c3c Update cpal dependency to 0.7
The update required adapting to the breaking changes introduced by the new version, as reported in the `cpal`'s
[changelog](a2fe9386af/CHANGELOG.md), namely:

- Rename `ChannelsCount` to `ChannelCount`.
- Rename `SamplesRate` to `SampleRate`.
- Rename the `min_samples_rate` field of `SupportedFormat` to `min_sample_rate`
- Rename the `with_max_samples_rate()` method of`SupportedFormat` to `with_max_sample_rate()`
- Rename the `samples_rate` field of `Format` to `sample_rate`
- Changed the type of the `channels` field of the `SupportedFormat` struct from `Vec<ChannelPosition>` to `ChannelCount` (an alias to `u16`)
2018-04-18 14:24:33 +02:00
Andriy S. from cobalt
b14006ec99 have play_once fn and Decoder trait even if decoders are turned off 2017-10-29 21:18:01 +02:00
Andriy S. from cobalt
bfad440f6a use allow attr instead of _ vars 2017-10-29 20:39:02 +02:00
Andriy S. from cobalt
3ef6b0564f make wav/flac/vorbis decoding features optional 2017-10-29 17:57:21 +02:00
Pierre Krieger
88b0d40e4b Run rustfmt on the code 2017-07-03 10:10:00 +02:00
Pierre Krieger
44a8a2b923 Rustfmt 2017-05-04 13:51:33 +02:00
Pierre Krieger
7df741665d Rename methods of the Source trait 2017-05-01 11:11:33 +02:00
Pierre Krieger
cbecbc8093 Decoder now produces i16s 2017-05-01 10:46:20 +02:00
est31
89635a3f71 Update to lewton 0.5 2017-02-27 19:26:16 +01:00
tomaka
b1a560eb41 Merge pull request #100 from tomaka/flac
Implement decoding Flac
2017-02-10 09:49:23 +01:00
Pierre Krieger
c9338891d5 More documentation rework 2017-02-09 14:02:38 +01:00
Pierre Krieger
90c6339376 Fix channels not interleaved 2017-02-09 12:37:32 +01:00
Pierre Krieger
99419b64ec Implement decoding Flac 2017-02-09 11:54:25 +01:00
Pierre Krieger
642f11c824 Run rustfmt on the code 2017-02-01 10:14:50 +01:00
Simon Heath
f564978fc7 Implemented std::error::Error on DecoderError
Resolves issue #86
2017-01-31 09:59:36 -05:00
est31
043b2074b8 Use lewton
Fixes #74.
2016-10-04 16:10:02 +02:00
Pierre Krieger
b27f0a87cc Rewrite Repeat to use Buffered 2015-10-23 16:29:14 +02:00
Pierre Krieger
5d58d9188f Add some docs at various places 2015-10-22 20:30:07 +02:00
Pierre Krieger
069faf762d Add a DecoderError and publish 0.3 2015-10-22 16:45:33 +02:00
Pierre Krieger
0d96bd3883 Remove mentions of ExactSizeIterator 2015-10-16 14:25:03 +02:00
Pierre Krieger
ce0165a0de Restore the vorbis decoder 2015-10-16 14:21:37 +02:00
Pierre Krieger
9d80295d5d Better duration handling 2015-10-16 14:02:44 +02:00
Pierre Krieger
d3052bc986 Add play() and make the decoder public 2015-10-16 13:43:23 +02:00
Pierre Krieger
5ab65b7a31 Hide the implementation of the decoder 2015-10-16 13:42:57 +02:00
Pierre Krieger
2e09c3494d Remove the Decoder trait and switch to the Source trait 2015-10-16 13:35:30 +02:00
Pierre Krieger
4806aebf61 Arc<Decoder> -> Box<Decoder> 2015-09-27 11:30:27 +02:00
Pierre Krieger
95b2f5a45e Fix the wav decoder 2015-09-27 10:50:11 +02:00
Pierre Krieger
112c8c94e5 Use a proper type for WAVE decoding instead of a Box 2015-09-27 10:41:46 +02:00
Pierre Krieger
f339184d75 Fix all warnings 2015-09-27 10:24:41 +02:00
Pierre Krieger
bc6f78de4c Handle the volume in the engine core instead of the decoders 2015-09-27 10:04:32 +02:00
Pierre Krieger
92a4567f08 Start using one voice per endpoint and mixing samples manually 2015-09-27 09:56:29 +02:00
Pierre Krieger
a6b5197a59 Use loops of 17ms 2015-09-27 08:58:40 +02:00
Pierre Krieger
43171fab08 Remove sounds that are finished playing 2015-09-24 12:56:36 +02:00
tomaka
8f623f757c Merge pull request #24 from tomaka/fix-warnings
Fix warnings
2015-09-23 18:32:27 +02:00
Pierre Krieger
86eab17039 Fix the vorbis decoder 2015-09-23 17:11:44 +02:00
Pierre Krieger
4ca0c7f42a Fix warnings 2015-09-23 10:57:43 +02:00
Pierre Krieger
5060063e5d Also add get_total_duration_ms() 2015-09-23 10:47:15 +02:00
Pierre Krieger
5c68d37055 Add Handle::sleep_until_end and rework decoder handling 2015-09-23 10:33:45 +02:00
Pierre Krieger
ba13cb3da0 Fix samples rate converter not working when from == to 2015-09-22 21:47:09 +02:00
Pierre Krieger
65f699038d Remove a debugging println! 2015-09-22 21:21:26 +02:00
tomaka
5058b708a8 Merge pull request #19 from tomaka/prefer-wav-format
Prefer the more lightweight compatible format for WAV
2015-09-22 21:09:28 +02:00
Pierre Krieger
0ba1f4ee4e Prefer the more lightweight compatible format for WAV 2015-09-22 20:24:34 +02:00
Pierre Krieger
5848128386 Fix wav waiting time and improve background thread sleeping functionnality 2015-09-22 17:58:03 +02:00
tomaka
930f9b30e9 Merge pull request #16 from tomaka/faster-format-determination
Faster format determination for wav files
2015-09-22 16:59:02 +02:00
Pierre Krieger
24252a64fe Faster format determination for wav files 2015-09-22 16:49:36 +02:00