Crates.io | ltc |
lib.rs | ltc |
version | 0.2.0 |
source | src |
created_at | 2020-04-16 08:13:44.902782 |
updated_at | 2020-04-16 09:42:02.831596 |
description | A crate for decoding Linear/Longitudinal Timecode data from audio samples, potentially in real time |
homepage | https://gitlab.com/tcnj/rs-ltc |
repository | https://gitlab.com/tcnj/rs-ltc |
max_upload_size | |
id | 230708 |
size | 23,830 |
This library allows for decoding linear time code audio into individual timecode frames. Encoding support is not currently offered.
Decoding centers around the LTCDecoder
struct, representing the state of a single decoding process that produces a series of LTCFrame
into an internal queue. Frames can be extracted from this queue using LTCDecoder
's IntoIterator
implementation.
use ltc::LTCDecoder;
// First argument specifies "samples per frame" which should
// be the approximate number of audio samples that a single
// frame takes up. Automatically adjusted to the rate of the
// data internally with an exponential smoothing function.
let decoder = LTCDecoder::with_capacity(48000.0 / 30.0, 10);
let buffer: &[f32] = ...;
if decoder.write_samples(buffer) {
println!("Decoded LTC frames!")
for frame in &mut decoder {
println!("Got frame with time {}", frame.format_time())
}
}
Copyright (c) 2020, Danny Wensley
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the the copyright holder nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL Danny Wensley BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.