Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SDFileSystem_Warning_Fixed
Diff: SD_WavReader.hpp
- Revision:
- 18:6631cd0fbbcd
- Parent:
- 16:299cc1052baa
diff -r abfd6af9a236 -r 6631cd0fbbcd SD_WavReader.hpp
--- a/SD_WavReader.hpp Thu Mar 23 02:58:48 2017 +0000
+++ b/SD_WavReader.hpp Tue Jun 04 21:35:59 2019 +0000
@@ -1,10 +1,4 @@
-//--------------------------------------------------------------
-// SD_WavReader class ---- Header
-// SD カードの *.wav ファイルの内容を読み出す
-// 以下の型式のファイルのみ扱う
-// PCM,16 ビットステレオ,標本化周波数 44.1 kHz
-//
-// 2017/03/22, Copyright (c) 2017 MIKAMI, Naoki
+
//--------------------------------------------------------------
#ifndef SD_WAV_READER_HPP
@@ -28,16 +22,16 @@
void Close() { fclose(fp_); }
- // ファイルのヘッダ読み込み
+ // Đọc tiêu đề của tệp
bool IsWavFile();
- // ファイルからステレオデータの取得
+ // Nhận dữ liệu âm thanh nổi từ tệp
void ReadStereo(Array<int16_t>& dataL, Array<int16_t>& dataR);
- // ファイルからデータをモノラルに変換しての取得
+ // Chuyển đổi dữ liệu từ tệp thành đơn âm
void ReadAndToMono(Array<int16_t>& data);
- // データサイズ(標本化点の数)の取得
+ // Lấy kích thước dữ liệu (số điểm lấy mẫu)
int32_t GetSize();
private:
@@ -46,25 +40,24 @@
struct WaveFormatEx
{
uint16_t wFormatTag; // 1: PCM
- uint16_t nChannels; // 1:モノラル,2: ステレオ
- uint32_t nSamplesPerSec; // 標本化周波数 (Hz)
- uint32_t nAvgBytesPerSec; // 転送速度 (bytes/s)
- uint16_t nBlockAlign; // 4: 16ビットステレオの場合
- uint16_t wBitsPerSample; // データのビット数,8 または 16
- uint16_t cbSize; // PCM の場合使わない
+ uint16_t nChannels; // 1: 1: đơn âm, 2: âm thanh nổi
+ uint32_t nSamplesPerSec; // Tần số lấy mẫu (Hz)
+ uint32_t nAvgBytesPerSec; // Tốc độ truyền (byte / s)
+ uint16_t nBlockAlign; // 4: Trong trường hợp âm thanh nổi 16 bit
+ uint16_t wBitsPerSample; // Số bit dữ liệu, 8 hoặc 16
+ uint16_t cbSize; // Không được sử dụng cho PCM
};
SDFileSystem *sd_;
FILE *fp_;
bool ok_;
- int32_t size_; // データサイズ(標本化点の数)
- Array<int16_t> buffer; // 作業領域
+ int32_t size_; // Kích thước dữ liệu (số điểm lấy mẫu)
+ Array<int16_t> buffer; // Khu vực làm việc
void ErrorMsg(char msg[])
{ BlinkLabel errLabel(240, 100, msg, Label::CENTER); }
-
- // コピー・コンストラクタとオブジェクトの代入演算子は使用禁止
+// Không sử dụng hàm tạo sao chép và toán tử gán đối tượng
SD_WavReader(const SD_WavReader&);
SD_WavReader& operator=(const SD_WavReader&);
};