diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..3fa32fb --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,14 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +polar: # Replace with a single Polar username +buy_me_a_coffee: philschatzh +custom: ['https://www.paypal.com/paypalme/pschatzmann?country.x=CH&locale.x=en_US'] diff --git a/.github/ISSUE_TEMPLATE/Issue-report.yml b/.github/ISSUE_TEMPLATE/Issue-report.yml new file mode 100644 index 0000000..37c3236 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Issue-report.yml @@ -0,0 +1,58 @@ +name: Bug report +description: Report only a bugs here! +body: + - type: markdown + attributes: + value: | + * Before reporting a new bug please check and search the [list of existing issues](https://github.com/pschatzmann/arduino-audio-tools/issues?q=) + * Please check [the Readme](https://github.com/pschatzmann/arduino-audio-tools) and [Wiki](https://github.com/pschatzmann/arduino-audio-tools/wiki) + * Don't forget to check [the discusions](https://github.com/pschatzmann/arduino-audio-tools/discussions) + * If still experiencing the issue, please provide as many details as possible below about your hardware, computer setup and code. + - type: textarea + id: Description + attributes: + label: Problem Description + description: Please describe your problem here and expected behaviour + placeholder: ex. Can't connect/weird behaviour/wrong function/missing parameter.. + validations: + required: true + - type: textarea + id: Board + attributes: + label: Device Description + description: What development board are you using + placeholder: e.g. ESP32 Wroom, Desktop Build, RP2040 + validations: + required: true + - type: textarea + id: sketch + attributes: + label: Sketch + description: Please provide full minimal sketch/code which can be run to reproduce your issue + placeholder: ex. Related part of the code to replicate the issue + render: cpp + validations: + required: true + + - type: textarea + id: other-remarks + attributes: + label: Other Steps to Reproduce + description: Is there any other information you can think of which will help us reproduce this problem? Any additional info can be added as well. + placeholder: ex. I also tried on other OS, HW...it works correctly on that setup. + + - type: textarea + id: sceanario + attributes: + label: What is your development environment (with Arduino Core Version information) + description: Please provide the information about your development/runtime environment + placeholder: Arduino ESP 2.0.14, Desktop Build, IDF 5.3.2, STM32-Cube MX, PlatformIO ESP32 6.10.0, JupyterLab + + - type: checkboxes + id: confirmation + attributes: + label: I have checked existing issues, discussions and online documentation + description: You agree to check all the resources above before opening a new issue. + options: + - label: I confirm I have checked existing issues, discussions and online documentation + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..3ba13e0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/.gitignore b/.gitignore index bf2eee5..9457897 100644 --- a/.gitignore +++ b/.gitignore @@ -3,10 +3,7 @@ # VS code .vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json +.vscode/settings.json *.code-workspace # Local History for Visual Studio Code diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a42c31..bc65c85 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,28 +1,42 @@ cmake_minimum_required(VERSION 3.16) -# set the project name -project(arduino_helix) +if (DEFINED ESP_PLATFORM) + # idf component + idf_component_register( + SRC_DIRS src src/utils src/libhelix-aac src/libhelix-mp3 + INCLUDE_DIRS src src/utils src/libhelix-aac src/libhelix-mp3 + # REQUIRES arduino-esp32 + ) -# lots of warnings and all warnings as errors -## add_compile_options(-Wall -Wextra ) -set(CMAKE_CXX_STANDARD 17) + target_compile_options(${COMPONENT_LIB} INTERFACE -Wno-error -Wno-format) + target_compile_options(${COMPONENT_LIB} PRIVATE -DUSE_DEFAULT_STDLIB) + add_compile_definitions(ESP32) +else() -option(MP3_EXAMPLES "build examples" OFF) + # set the project name + project(arduino_helix) -file(GLOB_RECURSE SRC_LIST_C CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/src/*.c" ) -file(GLOB_RECURSE SRC_LIST_CPP CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/src/*.cpp" ) + # lots of warnings and all warnings as errors + ## add_compile_options(-Wall -Wextra ) + set(CMAKE_CXX_STANDARD 17) -# define libraries -add_library (arduino_helix ${SRC_LIST_C} ${SRC_LIST_CPP}) + option(MP3_EXAMPLES "build examples" OFF) -# prevent compile errors -target_compile_options(arduino_helix PRIVATE -DUSE_DEFAULT_STDLIB) + file(GLOB_RECURSE SRC_LIST_C CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/src/*.c" ) + file(GLOB_RECURSE SRC_LIST_CPP CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/src/*.cpp" ) -# define location for header files -target_include_directories(arduino_helix PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/src/libhelix-mp3 ${CMAKE_CURRENT_SOURCE_DIR}/src/libhelix-aac ) + # define libraries + add_library (arduino_helix ${SRC_LIST_C} ${SRC_LIST_CPP}) -# build examples -if(MP3_EXAMPLES) - add_subdirectory( "${CMAKE_CURRENT_SOURCE_DIR}/examples/output_mp3") - add_subdirectory( "${CMAKE_CURRENT_SOURCE_DIR}/examples/output_aac") + # prevent compile errors + target_compile_options(arduino_helix PRIVATE -DUSE_DEFAULT_STDLIB -DHELIX_LOGGING_ACTIVE=0) + + # define location for header files + target_include_directories(arduino_helix PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/src/libhelix-mp3 ${CMAKE_CURRENT_SOURCE_DIR}/src/libhelix-aac ) + + # build examples + if(MP3_EXAMPLES) + add_subdirectory( "${CMAKE_CURRENT_SOURCE_DIR}/examples/output_mp3") + add_subdirectory( "${CMAKE_CURRENT_SOURCE_DIR}/examples/output_aac") + endif() endif() \ No newline at end of file diff --git a/README.md b/README.md index 48f7b37..70dc482 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,8 @@ LOGLEVEL_HELIX = LogLevelHelix::Info; ## Documentation - The [Class Documentation can be found here](https://pschatzmann.github.io/arduino-libhelix/html/annotated.html) +- aac [readme.txt](https://github.com/pschatzmann/arduino-libhelix/blob/main/src/libhelix-aac/readme.txt) +- mp3 [readme.txt](https://github.com/pschatzmann/arduino-libhelix/blob/main/src/libhelix-mp3/readme.txt) - I also suggest that you have a look at [my related blogs](https://www.pschatzmann.ch/home/tag/codecs/) I recommend to use this library together with my [Arduino Audio Tools](https://github.com/pschatzmann/arduino-audio-tools). diff --git a/docs/html/_a_a_c_decoder_helix_8h_source.html b/docs/html/_a_a_c_decoder_helix_8h_source.html index c924cc3..25ed065 100644 --- a/docs/html/_a_a_c_decoder_helix_8h_source.html +++ b/docs/html/_a_a_c_decoder_helix_8h_source.html @@ -111,7 +111,7 @@
48  _AACFrameInfo audioInfo() { return aacFrameInfo; }
49 
51  virtual void end() override {
-
52  LOG_HELIX(LogLevelHelix::Debug, "end");
+
52  LOGD_HELIX( "end");
53  if (decoder != nullptr) {
54  flush();
55  AACFreeDecoder(decoder);
@@ -162,49 +162,54 @@
103  }
104 
106  int decode() override {
-
107  int processed = 0;
-
108  int available = frame_buffer.available();
-
109  int bytes_left = frame_buffer.available();
-
110  uint8_t *data = frame_buffer.data();
-
111  int rc = AACDecode(decoder, &data, &bytes_left, (short *)pcm_buffer.data());
-
112  if (rc == 0) {
-
113  processed = data - frame_buffer.data();
-
114  // return the decoded result
-
115  _AACFrameInfo info;
-
116  AACGetLastFrameInfo(decoder, &info);
-
117  provideResult(info);
-
118  }
-
119  return processed;
-
120  }
-
121 
-
122  // return the result PCM data
-
123  void provideResult(_AACFrameInfo &info) {
-
124  // increase PCM size if this fails
-
125  int sampleSize = info.bitsPerSample / 8;
-
126  assert(info.outputSamps * sampleSize <= maxPCMSize());
-
127 
-
128  LOG_HELIX(LogLevelHelix::Debug, "==> provideResult: %d samples", info.outputSamps);
-
129  if (info.outputSamps > 0) {
-
130  // provide result
-
131  if (pcmCallback != nullptr) {
-
132  // output via callback
-
133  pcmCallback(info, (short *)pcm_buffer.data(), info.outputSamps,
-
134  p_caller_data);
-
135  } else {
-
136  // output to stream
-
137  if (info.sampRateOut != aacFrameInfo.sampRateOut &&
-
138  infoCallback != nullptr) {
-
139  infoCallback(info, p_caller_ref);
-
140  }
-
141 #if defined(ARDUINO) || defined(HELIX_PRINT)
-
142  out->write((uint8_t *)pcm_buffer.data(), info.outputSamps * sampleSize);
-
143 #endif
-
144  }
-
145  aacFrameInfo = info;
-
146  }
-
147  }
-
148 };
-
149 } // namespace libhelix
+
107  LOGD_HELIX( "decode");
+
108  int processed = 0;
+
109  int available = frame_buffer.available();
+
110  int bytes_left = frame_buffer.available();
+
111  uint8_t *data = frame_buffer.data();
+
112  int rc = AACDecode(decoder, &data, &bytes_left, (short *)pcm_buffer.data());
+
113  if (rc == 0) {
+
114  processed = data - frame_buffer.data();
+
115  // return the decoded result
+
116  _AACFrameInfo info;
+
117  AACGetLastFrameInfo(decoder, &info);
+
118  provideResult(info);
+
119  }
+
120  return processed;
+
121  }
+
122 
+
123  // return the result PCM data
+
124  void provideResult(_AACFrameInfo &info) {
+
125  // increase PCM size if this fails
+
126  int sampleSize = info.bitsPerSample / 8;
+
127  assert(info.outputSamps * sampleSize <= maxPCMSize());
+
128 
+
129  LOGD_HELIX( "==> provideResult: %d samples", info.outputSamps);
+
130  if (info.outputSamps > 0) {
+
131  // provide result
+
132  if (pcmCallback != nullptr) {
+
133  // output via callback
+
134  pcmCallback(info, (short *)pcm_buffer.data(), info.outputSamps,
+
135  p_caller_data);
+
136  } else {
+
137  // output to stream
+
138  if (info.sampRateOut != aacFrameInfo.sampRateOut &&
+
139  infoCallback != nullptr) {
+
140  infoCallback(info, p_caller_ref);
+
141  }
+
142 #if defined(ARDUINO) || defined(HELIX_PRINT)
+
143  if (out != nullptr){
+
144  size_t to_write = info.outputSamps * sampleSize;
+
145  size_t written = out->write((uint8_t *)pcm_buffer.data(), to_write);
+
146  assert(written == to_write);
+
147  }
+
148 #endif
+
149  }
+
150  aacFrameInfo = info;
+
151  }
+
152  }
+
153 };
+
154 } // namespace libhelix
libhelix::AACDecoderHelix
A simple Arduino API for the libhelix AAC decoder. The data us provided with the help of write() call...
Definition: AACDecoderHelix.h:19
libhelix::AACDecoderHelix::audioInfo
_AACFrameInfo audioInfo()
Provides the last available _AACFrameInfo_t.
Definition: AACDecoderHelix.h:48
libhelix::AACDecoderHelix::maxPCMSize
size_t maxPCMSize() override
Definition: AACDecoderHelix.h:66
@@ -215,9 +220,9 @@
libhelix::AACDecoderHelix::maxFrameSize
size_t maxFrameSize() override
Definition: AACDecoderHelix.h:62
libhelix::AACDecoderHelix::findSynchWord
int findSynchWord(int offset=0) override
finds the sync word in the buffer
Definition: AACDecoderHelix.h:97
libhelix::CommonHelix
Common Simple Arduino API.
Definition: CommonHelix.h:33
-
libhelix::CommonHelix::flush
void flush()
Decode all open packets.
Definition: CommonHelix.h:102
+
libhelix::CommonHelix::flush
void flush()
Decode all open packets.
Definition: CommonHelix.h:104
libhelix::CommonHelix::end
virtual void end()
Releases the reserved memory.
Definition: CommonHelix.h:63
-
libhelix::CommonHelix::setMinFrameBufferSize
virtual void setMinFrameBufferSize(int size)
Defines the minimum frame buffer size which is required before starting the decoding.
Definition: CommonHelix.h:243
+
libhelix::CommonHelix::setMinFrameBufferSize
virtual void setMinFrameBufferSize(int size)
Defines the minimum frame buffer size which is required before starting the decoding.
Definition: CommonHelix.h:251