Skip to content

Commit

Permalink
review ADLFile
Browse files Browse the repository at this point in the history
  • Loading branch information
Raffaello committed Dec 31, 2023
1 parent 2939550 commit e73a9b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ namespace HyperSonicDrivers::files::westwood

readDataFromFile_(m_meta_version.data_offset, m_meta_version.data_header_size);

// TODO: count_loop_ for version 3 is wrong to be 8 bit i think
m_num_tracks = count_loop_<uint8_t>(0, m_header);
m_num_track_offsets = count_loop_<uint16_t>(m_meta_version.offset_start, m_track_offsets);
m_num_instrument_offsets = count_loop_<uint16_t>(m_meta_version.offset_start, m_instrument_offsets);
Expand Down Expand Up @@ -262,6 +263,8 @@ namespace HyperSonicDrivers::files::westwood
void ADLFile::readHeaderFromFile_(const int header_size, std::function<uint16_t()> read)
{
m_header.resize(header_size);
// TODO: pass the byte size instead of a function read and read at once,
// and do read in LE when is greter than 1, basically if version 3
for (int i = 0; i < header_size; i++)
{
m_header[i] = read();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace HyperSonicDrivers::files::westwood
ADLFileMock f("../fixtures/DUNE0.ADL");

EXPECT_EQ(f.getVersion(), 2);
EXPECT_EQ(f.getNumTracks(), 18);
EXPECT_EQ(f.getNumTracks(), 200);
EXPECT_EQ(f.getNumTrackOffsets(), 52);
EXPECT_EQ(f.getNumInstrumentOffsets(), 63);
EXPECT_EQ(f.parentSize(), 14473);
Expand Down

0 comments on commit e73a9b3

Please sign in to comment.