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]]
|
[[package]]
|
||||||
name = "morse_rs"
|
name = "morse_rs"
|
||||||
version = "0.1.3"
|
version = "0.1.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hound",
|
"hound",
|
||||||
]
|
]
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
name = "morse_rs"
|
name = "morse_rs"
|
||||||
description = "A simple morse code translator, with the abilty to write to WAV files using Hound."
|
description = "A simple morse code translator, with the abilty to write to WAV files using Hound."
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
version = "0.1.4"
|
version = "0.1.41"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[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
|
- Translate text to Morse code and vice versa
|
||||||
- Generate WAV files from Morse code sequences
|
- Generate WAV files from Morse code sequences
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
Add this to your `Cargo.toml`:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
[dependencies]
|
|
||||||
morse_rs = "0.1.4"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Converts a string to morse then writes the encoded message into a wav file, specifying the pause times.
|
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_char_time: f32,
|
||||||
pause_between_words_time: f32,
|
pause_between_words_time: f32,
|
||||||
) -> Vec<u8> {
|
) -> 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 buffer = Vec::new(); // Create a buffer to hold the WAV data
|
||||||
{
|
{
|
||||||
let mut writer = hound::WavWriter::new(Cursor::new(&mut buffer), SPEC).unwrap();
|
let mut writer = hound::WavWriter::new(Cursor::new(&mut buffer), SPEC).unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user