pinebuds/apps/audioplayers/digmici2splay.cpp

46 lines
1.3 KiB
C++
Raw Normal View History

2022-08-15 04:20:27 -05:00
/***************************************************************************
*
* Copyright 2015-2019 BES.
* All rights reserved. All unpublished rights reserved.
*
* No part of this work may be used or reproduced in any form or by any
* means, or stored in a database or retrieval system, without prior written
* permission of BES.
*
* Use of this work is governed by a license granted by BES.
* This work contains confidential and proprietary information of
* BES. which is protected by copyright, trade secret,
* trademark and other intellectual property rights.
*
****************************************************************************/
// Standard C Included Files
#include "cqueue.h"
#include "hal_timer.h"
#include "hal_trace.h"
#include "hal_uart.h"
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
2022-08-15 04:20:27 -05:00
uint8_t digmic_buf[100 * 1024];
2022-08-15 04:20:27 -05:00
uint32_t digmic_buf_len = 0;
uint32_t dig_mic_audio_more_data(uint8_t *buf, uint32_t len) {
TRACE(2, "%s:%d\n", __func__, __LINE__);
memcpy(buf, digmic_buf, len);
2022-08-15 04:20:27 -05:00
return len;
2022-08-15 04:20:27 -05:00
}
uint32_t dig_mic_audio_data_come(uint8_t *buf, uint32_t len) {
TRACE(2, "%s:%d\n", __func__, __LINE__);
2022-08-15 04:20:27 -05:00
memcpy(digmic_buf + digmic_buf_len, buf, len);
2022-08-15 04:20:27 -05:00
#if 1
digmic_buf_len = (digmic_buf_len + len) % (100 * 1024);
2022-08-15 04:20:27 -05:00
#endif
return len;
2022-08-15 04:20:27 -05:00
}