-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #358 from lucianomartin/feature/fix_empty_pipeline
Update empty pipeline in set of pipelines with reference audio
- Loading branch information
Showing
4 changed files
with
125 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
modules/audio_pipelines/reference/empty/audio_pipeline_dsp.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2024 XMOS LIMITED. | ||
// This Software is subject to the terms of the XMOS Public Licence: Version 1. | ||
|
||
#ifndef AUDIO_PIPELINE_DSP_H_ | ||
#define AUDIO_PIPELINE_DSP_H_ | ||
|
||
#include <stdint.h> | ||
#include "app_conf.h" | ||
|
||
|
||
/* Note: Changing the order here will effect the channel order for | ||
* audio_pipeline_input() and audio_pipeline_output() | ||
*/ | ||
typedef struct { | ||
int32_t samples[appconfAUDIO_PIPELINE_CHANNELS][appconfAUDIO_PIPELINE_FRAME_ADVANCE]; | ||
int32_t aec_reference_audio_samples[appconfAUDIO_PIPELINE_CHANNELS][appconfAUDIO_PIPELINE_FRAME_ADVANCE]; | ||
int32_t mic_samples_passthrough[appconfAUDIO_PIPELINE_CHANNELS][appconfAUDIO_PIPELINE_FRAME_ADVANCE]; | ||
} frame_data_t; | ||
|
||
#endif /* AUDIO_PIPELINE_DSP_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
modules/audio_pipelines/reference/empty/audio_pipeline_t1.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
// Copyright 2024 XMOS LIMITED. | ||
// This Software is subject to the terms of the XMOS Public Licence: Version 1. | ||
|
||
/* STD headers */ | ||
#include <string.h> | ||
#include <stdint.h> | ||
#include <xcore/hwtimer.h> | ||
|
||
/* FreeRTOS headers */ | ||
#include "FreeRTOS.h" | ||
#include "task.h" | ||
#include "timers.h" | ||
#include "queue.h" | ||
#include "stream_buffer.h" | ||
|
||
/* Library headers */ | ||
#include "generic_pipeline.h" | ||
|
||
/* App headers */ | ||
#include "app_conf.h" | ||
#include "audio_pipeline.h" | ||
#include "audio_pipeline_dsp.h" | ||
|
||
#if appconfAUDIO_PIPELINE_FRAME_ADVANCE != 240 | ||
#error This pipeline is only configured for 240 frame advance | ||
#endif | ||
|
||
#if ON_TILE(1) | ||
|
||
static void *audio_pipeline_input_i(void *input_app_data) | ||
{ | ||
frame_data_t *frame_data; | ||
frame_data = pvPortMalloc(sizeof(frame_data_t)); | ||
memset(frame_data, 0x00, sizeof(frame_data_t)); | ||
|
||
audio_pipeline_input(input_app_data, | ||
(int32_t **)frame_data->aec_reference_audio_samples, | ||
4, | ||
appconfAUDIO_PIPELINE_FRAME_ADVANCE); | ||
|
||
memcpy(frame_data->samples, frame_data->mic_samples_passthrough, sizeof(frame_data->samples)); | ||
|
||
return frame_data; | ||
} | ||
|
||
static int audio_pipeline_output_i(frame_data_t *frame_data, | ||
void *output_app_data) | ||
{ | ||
|
||
rtos_intertile_tx(intertile_ctx, | ||
appconfAUDIOPIPELINE_PORT, | ||
frame_data, | ||
sizeof(frame_data_t)); | ||
|
||
return AUDIO_PIPELINE_FREE_FRAME; | ||
} | ||
|
||
void empty_stage(void) | ||
{ | ||
; | ||
} | ||
|
||
static void initialize_pipeline_stages(void) | ||
{ | ||
; | ||
} | ||
|
||
void audio_pipeline_init( | ||
void *input_app_data, | ||
void *output_app_data) | ||
{ | ||
const int stage_count = 2; | ||
const pipeline_stage_t stages[] = { | ||
(pipeline_stage_t)empty_stage, | ||
(pipeline_stage_t)empty_stage, | ||
}; | ||
|
||
const configSTACK_DEPTH_TYPE stage_stack_sizes[] = { | ||
configMINIMAL_STACK_SIZE + RTOS_THREAD_STACK_SIZE(empty_stage) + RTOS_THREAD_STACK_SIZE(audio_pipeline_input_i), | ||
configMINIMAL_STACK_SIZE + RTOS_THREAD_STACK_SIZE(empty_stage) + RTOS_THREAD_STACK_SIZE(audio_pipeline_output_i), | ||
}; | ||
|
||
initialize_pipeline_stages(); | ||
|
||
generic_pipeline_init((pipeline_input_t)audio_pipeline_input_i, | ||
(pipeline_output_t)audio_pipeline_output_i, | ||
input_app_data, | ||
output_app_data, | ||
stages, | ||
(const size_t*) stage_stack_sizes, | ||
appconfAUDIO_PIPELINE_TASK_PRIORITY, | ||
stage_count); | ||
|
||
} | ||
#endif /* ON_TILE(1)*/ |