clang-format

custom
jacqueline 3 years ago
parent cc45d1ead0
commit 58ed7b1e10
  1. 2
      main/dac.hpp
  2. 4
      main/gay-ipod-fw.cpp
  3. 2
      main/gpio-expander.hpp
  4. 2
      main/i2c.cpp
  5. 2
      main/i2c.hpp
  6. 29
      main/playback.cpp
  7. 2
      main/playback.hpp

@ -2,8 +2,8 @@
#include "gpio-expander.hpp" #include "gpio-expander.hpp"
#include <functional>
#include <stdint.h> #include <stdint.h>
#include <functional>
#include "esp_err.h" #include "esp_err.h"
#include "result.hpp" #include "result.hpp"

@ -4,10 +4,10 @@
#include "playback.hpp" #include "playback.hpp"
#include "storage.hpp" #include "storage.hpp"
#include <cstdint>
#include <dirent.h> #include <dirent.h>
#include <memory>
#include <stdio.h> #include <stdio.h>
#include <cstdint>
#include <memory>
#include "audio_common.h" #include "audio_common.h"
#include "audio_element.h" #include "audio_element.h"

@ -1,9 +1,9 @@
#pragma once #pragma once
#include <stdint.h>
#include <atomic> #include <atomic>
#include <functional> #include <functional>
#include <mutex> #include <mutex>
#include <stdint.h>
#include <tuple> #include <tuple>
#include <utility> #include <utility>

@ -10,7 +10,7 @@ static constexpr int kCmdLinkSize = I2C_LINK_RECOMMENDED_SIZE(12);
I2CTransaction::I2CTransaction() { I2CTransaction::I2CTransaction() {
// Use a fixed size buffer to avoid many many tiny allocations. // Use a fixed size buffer to avoid many many tiny allocations.
buffer_ = (uint8_t*) calloc(sizeof(uint8_t), kCmdLinkSize); buffer_ = (uint8_t*)calloc(sizeof(uint8_t), kCmdLinkSize);
handle_ = i2c_cmd_link_create_static(buffer_, kCmdLinkSize); handle_ = i2c_cmd_link_create_static(buffer_, kCmdLinkSize);
assert(handle_ != NULL && "failed to create command link"); assert(handle_ != NULL && "failed to create command link");
} }

@ -78,7 +78,7 @@ class I2CTransaction {
private: private:
i2c_cmd_handle_t handle_; i2c_cmd_handle_t handle_;
uint8_t *buffer_; uint8_t* buffer_;
}; };
} // namespace gay_ipod } // namespace gay_ipod

@ -17,7 +17,7 @@ static const i2s_port_t kI2SPort = I2S_NUM_0;
namespace gay_ipod { namespace gay_ipod {
static audio_element_status_t status_from_the_void(void *status) { static audio_element_status_t status_from_the_void(void* status) {
uintptr_t as_pointer_int = reinterpret_cast<uintptr_t>(status); uintptr_t as_pointer_int = reinterpret_cast<uintptr_t>(status);
return static_cast<audio_element_status_t>(as_pointer_int); return static_cast<audio_element_status_t>(as_pointer_int);
} }
@ -182,35 +182,38 @@ void DacAudioPlayback::Pause() {
void DacAudioPlayback::ProcessEvents() { void DacAudioPlayback::ProcessEvents() {
while (1) { while (1) {
audio_event_iface_msg_t event; audio_event_iface_msg_t event;
esp_err_t err = audio_event_iface_listen(event_interface_, &event, portMAX_DELAY); esp_err_t err =
audio_event_iface_listen(event_interface_, &event, portMAX_DELAY);
if (err != ESP_OK) { if (err != ESP_OK) {
ESP_LOGI(kTag, "error listening for event:%x", err); ESP_LOGI(kTag, "error listening for event:%x", err);
continue; continue;
} }
ESP_LOGI(kTag, "received event, cmd %i", event.cmd); ESP_LOGI(kTag, "received event, cmd %i", event.cmd);
if (event.source_type == AUDIO_ELEMENT_TYPE_ELEMENT if (event.source_type == AUDIO_ELEMENT_TYPE_ELEMENT &&
&& event.source == (void *) mp3_decoder_ event.source == (void*)mp3_decoder_ &&
&& event.cmd == AEL_MSG_CMD_REPORT_MUSIC_INFO) { event.cmd == AEL_MSG_CMD_REPORT_MUSIC_INFO) {
audio_element_info_t music_info = {0}; audio_element_info_t music_info = {0};
audio_element_getinfo(mp3_decoder_, &music_info); audio_element_getinfo(mp3_decoder_, &music_info);
ESP_LOGI(kTag, "sample_rate=%d, bits=%d, ch=%d", music_info.sample_rates, music_info.bits, music_info.channels); ESP_LOGI(kTag, "sample_rate=%d, bits=%d, ch=%d", music_info.sample_rates,
music_info.bits, music_info.channels);
audio_element_setinfo(i2s_stream_writer_, &music_info); audio_element_setinfo(i2s_stream_writer_, &music_info);
i2s_stream_set_clk(i2s_stream_writer_, music_info.sample_rates, music_info.bits, music_info.channels); i2s_stream_set_clk(i2s_stream_writer_, music_info.sample_rates,
music_info.bits, music_info.channels);
} }
if (event.source_type == AUDIO_ELEMENT_TYPE_ELEMENT if (event.source_type == AUDIO_ELEMENT_TYPE_ELEMENT &&
&& event.source == (void *) fatfs_stream_reader_ event.source == (void*)fatfs_stream_reader_ &&
&& event.cmd == AEL_MSG_CMD_REPORT_STATUS) { event.cmd == AEL_MSG_CMD_REPORT_STATUS) {
audio_element_status_t status = status_from_the_void(event.data); audio_element_status_t status = status_from_the_void(event.data);
if (status == AEL_STATUS_STATE_FINISHED) { if (status == AEL_STATUS_STATE_FINISHED) {
// TODO: enqueue next track? // TODO: enqueue next track?
} }
} }
if (event.source_type == AUDIO_ELEMENT_TYPE_ELEMENT if (event.source_type == AUDIO_ELEMENT_TYPE_ELEMENT &&
&& event.source == (void *) i2s_stream_writer_ event.source == (void*)i2s_stream_writer_ &&
&& event.cmd == AEL_MSG_CMD_REPORT_STATUS) { event.cmd == AEL_MSG_CMD_REPORT_STATUS) {
audio_element_status_t status = status_from_the_void(event.data); audio_element_status_t status = status_from_the_void(event.data);
if (status == AEL_STATUS_STATE_FINISHED) { if (status == AEL_STATUS_STATE_FINISHED) {
// TODO. // TODO.

@ -13,9 +13,9 @@
#include "audio_pipeline.h" #include "audio_pipeline.h"
#include "esp_err.h" #include "esp_err.h"
#include "fatfs_stream.h" #include "fatfs_stream.h"
#include "result.hpp"
#include "i2s_stream.h" #include "i2s_stream.h"
#include "mp3_decoder.h" #include "mp3_decoder.h"
#include "result.hpp"
namespace gay_ipod { namespace gay_ipod {

Loading…
Cancel
Save