fixed in memory bug

This commit is contained in:
ghaisanghaisan
2024-12-11 13:02:23 +07:00
parent 943eaa52cc
commit 8f49516979
4 changed files with 6 additions and 11 deletions
Generated
+1 -1
View File
@@ -10,7 +10,7 @@ checksum = "62adaabb884c94955b19907d60019f4e145d091c75345379e70d1ee696f7854f"
[[package]]
name = "morse_rs"
version = "0.1.3"
version = "0.1.5"
dependencies = [
"hound",
]
+1 -1
View File
@@ -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]
-9
View File
@@ -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.
+4
View File
@@ -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();