Skip to content

Commit

Permalink
revert accidental refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Raffaello committed Nov 12, 2023
1 parent b1ae500 commit 303e4c2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace HyperSonicDrivers::files
m_sound = std::make_shared<audio::PCMSound>(
group,
m_channels == 2,
m_freq,
m_sampleRate,
size,
data
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ namespace HyperSonicDrivers::files
virtual ~IPCMFile() = default;

inline int getChannels() const noexcept { return m_channels; };
inline uint32_t getSampleRate() const noexcept { return m_freq; };
inline uint32_t getSampleRate() const noexcept { return m_sampleRate; };
inline uint8_t getBitsDepth() const noexcept { return m_bitsDepth; };
inline uint32_t getDataSize() const noexcept { return m_dataSize; };
inline std::shared_ptr<uint8_t[]> getData() const noexcept { return m_data; };
inline std::shared_ptr<audio::PCMSound> getSound() const noexcept { return m_sound; };

protected:
int m_channels = 0;
uint32_t m_freq = 0;
uint32_t m_sampleRate = 0;
uint8_t m_bitsDepth = 0;
uint32_t m_dataSize = 0;
std::shared_ptr<uint8_t[]> m_data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ namespace HyperSonicDrivers::files
// channels default = 1
// timeConstant = 65536 - (256000000 / (channels * sampleRate);
// sampleRate = 256000000 / ((65536 - (timeConstant<<8))*channels)
m_freq = 256000000L / ((65536 - (timeConstant << 8)) * m_channels);
m_sampleRate = 256000000L / ((65536 - (timeConstant << 8)) * m_channels);
//m_sampleRate = 1000000 / (256 - timeConstant);
assertValid_(m_freq == (1000000 / (256 - timeConstant)));
assertValid_(m_sampleRate == (1000000 / (256 - timeConstant)));
// pack Method
switch (packMethod)
{
Expand Down Expand Up @@ -137,7 +137,7 @@ namespace HyperSonicDrivers::files
case 9: // extended 2
{
assertValid_(m_version >= 0x0114);
m_freq = db.data[0] + (db.data[1] << 8) + (db.data[2] << 16) + (db.data[3] << 24);
m_sampleRate = db.data[0] + (db.data[1] << 8) + (db.data[2] << 16) + (db.data[3] << 24);
m_bitsDepth = db.data[4];
m_channels = db.data[5];
uint16_t format = db.data[6] + (db.data[7] << 8);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ namespace HyperSonicDrivers::files
m_expDataChunk = true;
m_bitsDepth = static_cast<uint8_t>(m_fmt_chunk.bitsPerSample);
m_channels = m_fmt_chunk.channels;
m_freq = m_fmt_chunk.samplesPerSec;
m_sampleRate = m_fmt_chunk.samplesPerSec;

return true;
}
Expand Down

0 comments on commit 303e4c2

Please sign in to comment.