2个不稳定版本
0.2.0 | 2020年4月16日 |
---|---|
0.1.1 | 2020年4月16日 |
0.1.0 |
|
#2374 in 解析器实现
23KB
235 行
ltc
这个库允许将线性时间码音频解码成单独的时间码帧。目前不支持编码。
解码围绕LTCDecoder
结构体进行,它表示单个解码过程的状态,该过程产生一系列LTCFrame
并将其放入内部队列。可以使用LTCDecoder
的IntoIterator
实现从队列中提取帧。
示例
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.