Skip to content

Commit 478eb75

Browse files
committed
Changed function names
1 parent 5d53491 commit 478eb75

File tree

3 files changed

+38
-38
lines changed

3 files changed

+38
-38
lines changed

WaveFileManagerCPP/class_defines.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ class WAVEFORMATEX
2323
/// <summary>
2424
/// Monaural 16bits 44100Hz
2525
/// </summary>
26-
WAVEFORMATEX GetMonaural16bitsDefault();
26+
WAVEFORMATEX getMonaural16bitsDefault();
2727

2828
/// <summary>
2929
/// Monaural 8bits 44100Hz
3030
/// </summary>
31-
WAVEFORMATEX GetMonaural8bitsDefault();
31+
WAVEFORMATEX getMonaural8bitsDefault();
3232
};
3333

3434
#pragma region WAVEFORMATEX Implement
3535

36-
WAVEFORMATEX WAVEFORMATEX::GetMonaural16bitsDefault()
36+
WAVEFORMATEX WAVEFORMATEX::getMonaural16bitsDefault()
3737
{
3838
WAVEFORMATEX format;
3939
format.wFormatTag = 1;
@@ -45,7 +45,7 @@ WAVEFORMATEX WAVEFORMATEX::GetMonaural16bitsDefault()
4545
return format;
4646
}
4747

48-
WAVEFORMATEX WAVEFORMATEX::GetMonaural8bitsDefault()
48+
WAVEFORMATEX WAVEFORMATEX::getMonaural8bitsDefault()
4949
{
5050
WAVEFORMATEX format;
5151
format.wFormatTag = 1;
@@ -98,15 +98,15 @@ class WaveFileManager
9898
public:
9999
MusicPropertyMonaural16bit LoadFileMonaural16bits(std::string path);
100100

101-
void CreateFile(std::string path, MusicPropertyMonaural16bit prop);
102-
void CreateFile(std::string path, MusicPropertyMonaural8bit prop);
101+
void createFile(std::string path, MusicPropertyMonaural16bit prop);
102+
void createFile(std::string path, MusicPropertyMonaural8bit prop);
103103

104104
private:
105-
void WriteMusicProperty(std::fstream* fs, MusicProperty prop);
106-
void WriteWAVEFORMATEX(std::fstream* fs, WAVEFORMATEX format);
105+
void writeMusicProperty(std::fstream* fs, MusicProperty prop);
106+
void writeWAVEFORMATEX(std::fstream* fs, WAVEFORMATEX format);
107107

108-
void ReadMusicProperty(std::fstream* fs, MusicProperty* prop);
109-
void ReadWAVEFORMATEX(std::fstream* fs, WAVEFORMATEX* format);
108+
void readMusicProperty(std::fstream* fs, MusicProperty* prop);
109+
void readWAVEFORMATEX(std::fstream* fs, WAVEFORMATEX* format);
110110
};
111111

112112
//
@@ -119,15 +119,15 @@ Int8 data_CONST[]{ 0x64, 0x61, 0x74, 0x61 };
119119

120120
#pragma region ConvertFromArrayToNumber
121121

122-
Int32 ConvertToInt32(Int8* bytes)
122+
Int32 convertToInt32(Int8* bytes)
123123
{
124124
Int32 i;
125125
memcpy(&i, bytes, sizeof(Int8) * 4);
126126
return i;
127127

128128
}
129129

130-
Int16 ConvertToInt16(Int8* bytes)
130+
Int16 convertToInt16(Int8* bytes)
131131
{
132132
Int16 i;
133133
memcpy(&i, bytes, sizeof(Int16));
@@ -141,7 +141,7 @@ Int16 ConvertToInt16(Int8* bytes)
141141
/// The arrays are same ?
142142
/// </summary>
143143
template<typename T>
144-
bool SequenceEqual(T* a, T* b, int count)
144+
bool sequenceEqual(T* a, T* b, int count)
145145
{
146146
for (int i = 0; i < count; i++)
147147
{
@@ -153,7 +153,7 @@ bool SequenceEqual(T* a, T* b, int count)
153153
/// <summary>
154154
/// The arrays are same ?
155155
/// </summary>
156-
bool SequenceEqual(Int8* a, Int8* b, int count)
156+
bool sequenceEqual(Int8* a, Int8* b, int count)
157157
{
158158
for (int i = 0; i < count; i++)
159159
{

WaveFileManagerCPP/wavefile_loader.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ MusicPropertyMonaural16bit WaveFileManager::LoadFileMonaural16bits(std::string p
1818

1919
fs.read(byte_32, 4);
2020

21-
if (!SequenceEqual(byte_32, RIFF, 4))
21+
if (!sequenceEqual(byte_32, RIFF, 4))
2222
{
2323
throw "It's not RIFF format file.";
2424
}
@@ -28,7 +28,7 @@ MusicPropertyMonaural16bit WaveFileManager::LoadFileMonaural16bits(std::string p
2828
#pragma region Get FileSize
2929
fs.read(byte_32, 4);
3030

31-
property.m_FileSize = ConvertToInt32(byte_32);
31+
property.m_FileSize = convertToInt32(byte_32);
3232

3333
#pragma endregion
3434

@@ -38,7 +38,7 @@ MusicPropertyMonaural16bit WaveFileManager::LoadFileMonaural16bits(std::string p
3838
// this function will return "WAVE".
3939
fs.read(byte_32, 4);
4040

41-
if (!SequenceEqual(byte_32, WAVE, 4))
41+
if (!sequenceEqual(byte_32, WAVE, 4))
4242
{
4343
throw "It's not WAVE file.";
4444
}
@@ -49,7 +49,7 @@ MusicPropertyMonaural16bit WaveFileManager::LoadFileMonaural16bits(std::string p
4949

5050
fs.read(byte_32, 4);
5151

52-
if (!SequenceEqual(byte_32, fmt, 4))
52+
if (!sequenceEqual(byte_32, fmt, 4))
5353
{
5454
throw "It's not WAVE file.";
5555
}
@@ -60,7 +60,7 @@ MusicPropertyMonaural16bit WaveFileManager::LoadFileMonaural16bits(std::string p
6060

6161
fs.read(byte_32, 4);
6262

63-
if (ConvertToInt32(byte_32) != 16)
63+
if (convertToInt32(byte_32) != 16)
6464
{
6565
throw "It will have unnecessary chank.";
6666
}
@@ -69,13 +69,13 @@ MusicPropertyMonaural16bit WaveFileManager::LoadFileMonaural16bits(std::string p
6969

7070
WAVEFORMATEX format;
7171

72-
ReadWAVEFORMATEX(&fs, &format);
72+
readWAVEFORMATEX(&fs, &format);
7373

7474
#pragma region Get data(It will be threw away)
7575

7676
fs.read(byte_32, 4);
7777

78-
if (!SequenceEqual(byte_32, data_CONST, 4))
78+
if (!sequenceEqual(byte_32, data_CONST, 4))
7979
{
8080
throw "It's not WAVE file.";
8181
}
@@ -88,7 +88,7 @@ MusicPropertyMonaural16bit WaveFileManager::LoadFileMonaural16bits(std::string p
8888

8989
fs.read(byte_32, 4);
9090

91-
musicData.m_DataSize = ConvertToInt32(byte_32);
91+
musicData.m_DataSize = convertToInt32(byte_32);
9292

9393
#pragma endregion
9494

@@ -101,7 +101,7 @@ MusicPropertyMonaural16bit WaveFileManager::LoadFileMonaural16bits(std::string p
101101
fs.read(byte_16, 2);
102102
if (fs.eof())
103103
break;
104-
list.push_back(ConvertToInt16(byte_16));
104+
list.push_back(convertToInt16(byte_16));
105105
}
106106

107107
musicData.m_Data = list;
@@ -117,25 +117,25 @@ MusicPropertyMonaural16bit WaveFileManager::LoadFileMonaural16bits(std::string p
117117
return property;
118118
}
119119

120-
void WaveFileManager::ReadWAVEFORMATEX(std::fstream* fs, WAVEFORMATEX* format)
120+
void WaveFileManager::readWAVEFORMATEX(std::fstream* fs, WAVEFORMATEX* format)
121121
{
122122
Int8 i[4];
123123

124124
fs->read(i, 2);
125-
format->wFormatTag = ConvertToInt16(i);
125+
format->wFormatTag = convertToInt16(i);
126126

127127
fs->read(i, 2);
128-
format->nChannels = ConvertToInt16(i);
128+
format->nChannels = convertToInt16(i);
129129

130130
fs->read(i, 4);
131-
format->nSamplesPerSec = ConvertToInt32(i);
131+
format->nSamplesPerSec = convertToInt32(i);
132132

133133
fs->read(i, 4);
134-
format->nAvgBytePerSec = ConvertToInt32(i);
134+
format->nAvgBytePerSec = convertToInt32(i);
135135

136136
fs->read(i, 2);
137-
format->nBlockAlign = ConvertToInt16(i);
137+
format->nBlockAlign = convertToInt16(i);
138138

139139
fs->read(i, 2);
140-
format->wBitsPerSample = ConvertToInt16(i);
140+
format->wBitsPerSample = convertToInt16(i);
141141
}

WaveFileManagerCPP/wavefile_writer.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
/// <summary>
66
/// Create simple wave file.
77
/// </summary>
8-
void WaveFileManager::CreateFile(std::string path, MusicPropertyMonaural16bit prop)
8+
void WaveFileManager::createFile(std::string path, MusicPropertyMonaural16bit prop)
99
{
1010
std::fstream fs(path, std::ios::out | std::ios::binary);
1111

12-
WriteMusicProperty(&fs, prop);
12+
writeMusicProperty(&fs, prop);
1313

1414
WAVEFORMATEX format = prop.m_WaveFormatEx;
1515

16-
WriteWAVEFORMATEX(&fs, format);
16+
writeWAVEFORMATEX(&fs, format);
1717

1818
fs.write(data_CONST, 4);
1919

@@ -43,15 +43,15 @@ void WaveFileManager::CreateFile(std::string path, MusicPropertyMonaural16bit pr
4343
/// <summary>
4444
/// Create simple wave file.
4545
/// </summary>
46-
void WaveFileManager::CreateFile(std::string path, MusicPropertyMonaural8bit prop)
46+
void WaveFileManager::createFile(std::string path, MusicPropertyMonaural8bit prop)
4747
{
4848
std::fstream fs(path, std::ios::out | std::ios::binary);
4949

50-
WriteMusicProperty(&fs, prop);
50+
writeMusicProperty(&fs, prop);
5151

5252
WAVEFORMATEX format = prop.m_WaveFormatEx;
5353

54-
WriteWAVEFORMATEX(&fs, format);
54+
writeWAVEFORMATEX(&fs, format);
5555

5656
fs.write(data_CONST, 4);
5757

@@ -81,7 +81,7 @@ void WaveFileManager::CreateFile(std::string path, MusicPropertyMonaural8bit pro
8181
//
8282
// private member
8383
//
84-
void WaveFileManager::WriteMusicProperty(std::fstream* fs, MusicProperty prop)
84+
void WaveFileManager::writeMusicProperty(std::fstream* fs, MusicProperty prop)
8585
{
8686
Int8 i[4];
8787

@@ -98,7 +98,7 @@ void WaveFileManager::WriteMusicProperty(std::fstream* fs, MusicProperty prop)
9898
fs->write(i, 4);
9999
}
100100

101-
void WaveFileManager::WriteWAVEFORMATEX(std::fstream* fs, WAVEFORMATEX format)
101+
void WaveFileManager::writeWAVEFORMATEX(std::fstream* fs, WAVEFORMATEX format)
102102
{
103103
Int8 i[4];
104104

0 commit comments

Comments
 (0)