mirror of
https://github.com/ghaisanghaisan/morse_rs.git
synced 2026-08-11 21:46:18 -05:00
fixed in memory bug
This commit is contained in:
Generated
+1
-1
@@ -10,7 +10,7 @@ checksum = "62adaabb884c94955b19907d60019f4e145d091c75345379e70d1ee696f7854f"
|
||||
|
||||
[[package]]
|
||||
name = "morse_rs"
|
||||
version = "0.1.3"
|
||||
version = "0.1.5"
|
||||
dependencies = [
|
||||
"hound",
|
||||
]
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
name = "morse_rs"
|
||||
description = "A simple morse code translator, with the abilty to write to WAV files using Hound."
|
||||
license = "MIT"
|
||||
version = "0.1.4"
|
||||
version = "0.1.41"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -7,15 +7,6 @@ A simple Morse code translator written in Rust, with the ability to write Morse
|
||||
- Translate text to Morse code and vice versa
|
||||
- Generate WAV files from Morse code sequences
|
||||
|
||||
## Installation
|
||||
|
||||
Add this to your `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
morse_rs = "0.1.4"
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Converts a string to morse then writes the encoded message into a wav file, specifying the pause times.
|
||||
|
||||
@@ -233,6 +233,10 @@ pub fn write_morse_in_memory(
|
||||
pause_between_char_time: f32,
|
||||
pause_between_words_time: f32,
|
||||
) -> Vec<u8> {
|
||||
// Convert from MS;
|
||||
let pause_between_char_time = pause_between_char_time / 1000.0;
|
||||
let pause_between_words_time = pause_between_words_time / 1000.0;
|
||||
|
||||
let mut buffer = Vec::new(); // Create a buffer to hold the WAV data
|
||||
{
|
||||
let mut writer = hound::WavWriter::new(Cursor::new(&mut buffer), SPEC).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user