Skip to content

Commit fce0de5

Browse files
committed
WiP: routing tests
1 parent 358ad09 commit fce0de5

36 files changed

+186123
-45
lines changed

MIMXRT1052.svd

+184,708
Large diffs are not rendered by default.

module-apps/CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ endif()
1717

1818
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BUILD_DIRECTORY})
1919

20-
set(CMAKE_CXX_STANDARD 14)
21-
2220
if(${PROJECT_TARGET} STREQUAL "TARGET_RT1051")
2321
include(targets/Target_RT1051.cmake)
2422
elseif(${PROJECT_TARGET} STREQUAL "TARGET_Linux")

module-apps/application-call/windows/CallWindow.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "i18/i18.hpp"
1818

1919
#include "service-cellular/api/CellularServiceAPI.hpp"
20+
#include "service-audio/api/AudioServiceAPI.hpp"
2021

2122
#include "Label.hpp"
2223
#include "Margins.hpp"
@@ -130,6 +131,8 @@ void CallWindow::onBeforeShow( ShowMode mode, uint32_t command, SwitchData* data
130131
bool CallWindow::handleLeftButton() {
131132
if( state == State::INCOMMING_CALL ) {
132133
auto ret = CellularServiceAPI::AnswerIncomingCall(application);
134+
AudioServiceAPI::RoutingStart(application);
135+
133136
LOG_INFO("AnswerIncomingCall: %s",(ret?"OK":"FAIL"));
134137
if( ret ) {
135138
state = State::CALL_IN_PROGRESS;
@@ -156,6 +159,7 @@ bool CallWindow::handleLeftButton() {
156159
bool CallWindow::handleCenterButton() {
157160
if( state == State::INCOMMING_CALL ) {
158161
auto ret = CellularServiceAPI::HangupCall(application);
162+
AudioServiceAPI::Stop(application);
159163
LOG_INFO("HangupCall: %s",(ret?"OK":"FAIL"));
160164
//TODO switch to message templates window
161165
return true;

module-audio/Audio/Audio.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace audio {
3535
Audio(std::function<int32_t(AudioEvents event)> asyncCallback);
3636

3737
//Events
38-
int32_t SendEvent(const Operation::Event evt, const EventData *data);
38+
int32_t SendEvent(const Operation::Event evt, const EventData *data=nullptr);
3939

4040
//utilities
4141
Position GetPosition();
@@ -57,7 +57,7 @@ namespace audio {
5757
//TODO:M.P Set/Get inputGain/outputVolume for each profile
5858

5959
//Operations
60-
int32_t Start(Operation::Type op, const char *fileName);
60+
int32_t Start(Operation::Type op, const char *fileName="");
6161

6262
int32_t Stop();
6363

module-audio/Audio/Operation/Operation.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace audio {
3737
inst = std::make_unique<PlaybackOperation>(fileName);
3838
break;
3939
case Type::Router:
40-
//TODO:M.P inst = std::make_unique<RouterOperation>(fileName,prof);
40+
inst = std::make_unique<RouterOperation>(fileName);
4141
break;
4242
case Type::Recorder:
4343
inst = std::make_unique<RecorderOperation>(fileName);

module-audio/Audio/Operation/Operation.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ namespace audio {
5252
BTHeadsetOff,
5353
BTA2DPOn,
5454
BTA2DPOff,
55+
StartCallRecording,
56+
StopCallRecording,
5557
};
5658

5759
virtual ~Operation() {}
@@ -67,7 +69,7 @@ namespace audio {
6769

6870
virtual int32_t Resume() = 0;
6971

70-
virtual int32_t SendEvent(const Event evt, const EventData *data) = 0;
72+
virtual int32_t SendEvent(const Event evt, const EventData *data=nullptr) = 0;
7173

7274
virtual int32_t SetOutputVolume(float vol) = 0;
7375

module-audio/Audio/Operation/RecorderOperation.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -56,26 +56,27 @@ namespace audio {
5656
currentProfile = availableProfiles[0].get();
5757

5858
uint32_t channels = 0;
59-
if (currentProfile->GetInOutFlags() & static_cast<uint32_t >(AudioDevice::Flags::InputLeft)) {
60-
channels++;
61-
}
62-
if (currentProfile->GetInOutFlags() & static_cast<uint32_t >(AudioDevice::Flags::InputRight)) {
63-
channels++;
59+
if ((currentProfile->GetInOutFlags() & static_cast<uint32_t >(AudioDevice::Flags::InputLeft)) ||
60+
(currentProfile->GetInOutFlags() & static_cast<uint32_t >(AudioDevice::Flags::InputRight))) {
61+
channels = 1;
62+
} else if (currentProfile->GetInOutFlags() & static_cast<uint32_t >(AudioDevice::Flags::InputStereo)) {
63+
channels = 2;
6464
}
6565

66+
6667
enc = Encoder::Create(file, Encoder::Format{
6768
.chanNr=channels,
6869
.sampleRate=currentProfile->GetSampleRate()
6970
});
7071

71-
if(enc == nullptr){
72+
if (enc == nullptr) {
7273
LOG_ERROR("Error during initializing encoder");
7374
return;
7475
}
7576

7677

7778
audioDevice = AudioDevice::Create(currentProfile->GetAudioDeviceType(), audioCallback).value_or(nullptr);
78-
if(audioDevice == nullptr){
79+
if (audioDevice == nullptr) {
7980
LOG_ERROR("Error creating AudioDevice");
8081
return;
8182
}

module-audio/Audio/Operation/RecorderOperation.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
namespace audio {
2121

22-
class Encoder;
23-
2422

2523
class RecorderOperation : public Operation {
2624
public:

0 commit comments

Comments
 (0)