Skip to content

Commit

Permalink
Added Unit-test(packetWithFSKTest, waveRenderTest) on CMakeLists.txt
Browse files Browse the repository at this point in the history
> minor refactoring on TxEngine
  • Loading branch information
designe committed Sep 13, 2021
1 parent dc67bf8 commit 5e89ae6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 6 additions & 4 deletions euphony/src/main/cpp/core/source/TxEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class TxEngine::TxEngineImpl : public IRestartable{
std::shared_ptr<oboe::AudioStream> mStream;
oboe::AudioStreamBuilder mStreamBuilder;
std::unique_ptr<AudioStreamCallback> mCallback;
shared_ptr<EuphonyAudioSource> mAudioSource = nullptr;
std::shared_ptr<EuphonyAudioSource> mAudioSource = nullptr;
bool mIsLatencyDetectionSupported = false;

double eupiFreq;
Expand Down Expand Up @@ -71,9 +71,7 @@ class TxEngine::TxEngineImpl : public IRestartable{
return std::make_shared<WaveRenderer>(modulationResult, kChannelCount);
}
case ModeType::EUPI:
mAudioSource = std::make_shared<EuPIRenderer>(kSampleRate, kChannelCount);
std::dynamic_pointer_cast<EuPIRenderer>(mAudioSource)->setFrequency(eupiFreq);
return mAudioSource;
return std::make_shared<EuPIRenderer>(kSampleRate, kChannelCount);
}
}

Expand Down Expand Up @@ -159,10 +157,14 @@ class TxEngine::TxEngineImpl : public IRestartable{
mModeType = ModeType::DEFAULT;
break;
case 1:
if(mModeType == ModeType::EUPI)
return;

mModeType = ModeType::EUPI;
break;
}


mAudioSource = createAudioSource(mModeType);
}

Expand Down
2 changes: 2 additions & 0 deletions euphony/src/main/cpp/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ add_executable(
packetTest.cpp
packetBuilderTest.cpp
packetErrorDetectorTest.cpp
packetWithFSKTest.cpp
waveTest.cpp
waveBuilderTest.cpp
waveRendererTest.cpp
)

target_link_libraries(${TEST_EUPHONY} PUBLIC euphony gtest)
Expand Down

0 comments on commit 5e89ae6

Please sign in to comment.