From c80405f880ba5fe4ef5760ed227c3dc9c137a7e9 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Tue, 21 Mar 2023 03:04:22 +0300 Subject: [PATCH] WAV Player fixes by @LTVA1 --- ReadMe.md | 2 +- applications/external/wav_player/README.md | 2 ++ applications/external/wav_player/wav_player.c | 14 ++++++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ReadMe.md b/ReadMe.md index 12cca6715..68c78239a 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -132,7 +132,7 @@ You can support us by using links or addresses below: - ESP8266 Deauther plugin [(by SequoiaSan)](https://github.com/SequoiaSan/FlipperZero-Wifi-ESP8266-Deauther-Module) - WiFi Scanner plugin [(by SequoiaSan)](https://github.com/SequoiaSan/FlipperZero-WiFi-Scanner_Module) - MultiConverter plugin [(by theisolinearchip)](https://github.com/theisolinearchip/flipperzero_stuff) -- WAV Player [(OFW: DrZlo13)](https://github.com/flipperdevices/flipperzero-firmware/tree/zlo/wav-player) - Fixed and improved by [LTVA1](https://github.com/LTVA1/wav_player) +- WAV Player [(OFW: DrZlo13)](https://github.com/flipperdevices/flipperzero-firmware/tree/zlo/wav-player) - Fixed and improved by [LTVA1](https://github.com/LTVA1/wav_player) -> Also outputs audio on `PA6` - `3(A6)` pin - Barcode generator plugin [(original by McAzzaMan)](https://github.com/McAzzaMan/flipperzero-firmware/tree/UPC-A_Barcode_Generator/applications/barcode_generator) - [EAN-8 and refactoring](https://github.com/DarkFlippers/unleashed-firmware/pull/154) by @msvsergey - GPIO: Sentry Safe plugin [(by H4ckd4ddy)](https://github.com/H4ckd4ddy/flipperzero-sentry-safe-plugin) - ESP32: WiFi Marauder companion plugin [(by 0xchocolate)](https://github.com/0xchocolate/flipperzero-firmware-with-wifi-marauder-companion) - Saving .pcap on flipper microSD [by tcpassos](https://github.com/tcpassos/flipperzero-firmware-with-wifi-marauder-companion) -> Only with custom marauder build (It is necessary to uncomment "#define WRITE_PACKETS_SERIAL" in configs.h (in marauder fw) and compile the firmware for the wifi board.) Or download precompiled build -> [Download esp32_marauder_ver_flipper_sd_serial.bin](https://github.com/justcallmekoko/ESP32Marauder/releases/latest) diff --git a/applications/external/wav_player/README.md b/applications/external/wav_player/README.md index 89052646e..b57afda87 100644 --- a/applications/external/wav_player/README.md +++ b/applications/external/wav_player/README.md @@ -2,3 +2,5 @@ A Flipper Zero application for playing wav files. My fork adds support for correct playback speed (for files with different sample rates) and for mono files (original wav player only plays stereo). ~~You still need to convert your file to unsigned 8-bit PCM format for it to played correctly on flipper~~. Now supports 16-bit (ordinary) wav files too, both mono and stereo! Original app by https://github.com/DrZlo13. + +Also outputs audio on `PA6` - `3(A6)` pin \ No newline at end of file diff --git a/applications/external/wav_player/wav_player.c b/applications/external/wav_player/wav_player.c index ce1428682..9c1b4e5b6 100644 --- a/applications/external/wav_player/wav_player.c +++ b/applications/external/wav_player/wav_player.c @@ -404,14 +404,20 @@ static void app_run(WavPlayerApp* app) { } else if(event.type == WavPlayerEventCtrlMoveL) { int32_t seek = stream_tell(app->stream) - wav_parser_get_data_start(app->parser); - seek = - MIN(seek, (int32_t)(wav_parser_get_data_len(app->parser) / (size_t)100)); + seek = MIN( + seek, + (int32_t)(wav_parser_get_data_len(app->parser) / (size_t)100) % 2 ? + ((int32_t)(wav_parser_get_data_len(app->parser) / (size_t)100) - 1) : + (int32_t)(wav_parser_get_data_len(app->parser) / (size_t)100)); stream_seek(app->stream, -seek, StreamOffsetFromCurrent); wav_player_view_set_current(app->view, stream_tell(app->stream)); } else if(event.type == WavPlayerEventCtrlMoveR) { int32_t seek = wav_parser_get_data_end(app->parser) - stream_tell(app->stream); - seek = - MIN(seek, (int32_t)(wav_parser_get_data_len(app->parser) / (size_t)100)); + seek = MIN( + seek, + (int32_t)(wav_parser_get_data_len(app->parser) / (size_t)100) % 2 ? + ((int32_t)(wav_parser_get_data_len(app->parser) / (size_t)100) - 1) : + (int32_t)(wav_parser_get_data_len(app->parser) / (size_t)100)); stream_seek(app->stream, seek, StreamOffsetFromCurrent); wav_player_view_set_current(app->view, stream_tell(app->stream)); } else if(event.type == WavPlayerEventCtrlOk) {