Update modules and get it working on esp32 audio kit with es8388 audio codec
This commit is contained in:
@@ -8,3 +8,13 @@ The project has been tested on the ESP32 Audio Kit V2.2
|
||||
|
||||
Useful documents:
|
||||
ESP32 Audio Kit docu: http://myosuploads3.banggood.com/products/20210306/20210306011116instruction.pdf
|
||||
|
||||
---
|
||||
The latest update has been tested on the ESP32 Audio Kit V2.2 with an ES8388 audio codec.
|
||||
You can use it stand-alone when applied the analog button mod (https://youtu.be/r0af0DB1R68)
|
||||
Default configuration:
|
||||
- Key1: set length
|
||||
- Key2: toggle click
|
||||
- Key3 - Key6: toggle rec mode
|
||||
|
||||
I recommend using Tera Term or another VT100 compatible tool to see whats going on inside of the application
|
||||
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* The GNU GENERAL PUBLIC LICENSE (GNU GPLv3)
|
||||
*
|
||||
* Copyright (c) 2021 Marcel Licence
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* The GNU GENERAL PUBLIC LICENSE (GNU GPLv3)
|
||||
*
|
||||
* Copyright (c) 2021 Marcel Licence
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -51,17 +51,21 @@
|
||||
#include <cdt.h>
|
||||
#endif
|
||||
|
||||
#define MIDI_RECV_FROM_SERIAL
|
||||
#define AUDIO_KIT_BUTTON_ANALOG
|
||||
|
||||
/*
|
||||
* include the board configuration
|
||||
* there you will find the most hardware depending pin settings
|
||||
*/
|
||||
#define BOARD_ESP32_AUDIO_KIT_AC101
|
||||
#define BOARD_ESP32_AUDIO_KIT_ES8388
|
||||
|
||||
#include <ml_boards.h> /* requires https://github.com/marcel-licence/ML_SynthTools */
|
||||
|
||||
/* our samplerate */
|
||||
#define SAMPLE_RATE 44100
|
||||
|
||||
|
||||
/* on board led */
|
||||
#define LED_PIN 19
|
||||
|
||||
|
||||
@@ -100,6 +100,7 @@ void setup()
|
||||
#ifdef ESP32_AUDIO_KIT
|
||||
#ifdef ES8388_ENABLED
|
||||
ES8388_Setup();
|
||||
ES8388_SetIn2OoutVOL(0, 0);
|
||||
#else
|
||||
ac101_setup();
|
||||
/* using mic as default source */
|
||||
@@ -176,6 +177,7 @@ inline
|
||||
void Core0TaskLoop()
|
||||
{
|
||||
Status_Process();
|
||||
button_loop();
|
||||
}
|
||||
|
||||
void Core0Task(void *parameter)
|
||||
@@ -368,7 +370,6 @@ inline void audio_task()
|
||||
*/
|
||||
void loop_1Hz(void)
|
||||
{
|
||||
button_loop();
|
||||
#ifdef BLINK_LED_PIN
|
||||
Blink_Process();
|
||||
#endif
|
||||
@@ -402,3 +403,31 @@ void loop()
|
||||
midi_pre_scaler = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void App_ButtonCb(uint8_t key, uint8_t down)
|
||||
{
|
||||
if (down > 0)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case 0:
|
||||
Loop_SetLength(0, 1);
|
||||
break;
|
||||
case 1:
|
||||
Click_ToggleOnOff(0, 1);
|
||||
break;
|
||||
case 2:
|
||||
Loop_SelectTrack(0, 1);
|
||||
break;
|
||||
case 3:
|
||||
Loop_SelectTrack(1, 1);
|
||||
break;
|
||||
case 4:
|
||||
Loop_SelectTrack(2, 1);
|
||||
break;
|
||||
case 5:
|
||||
Loop_SelectTrack(3, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+239
-108
@@ -1,77 +1,46 @@
|
||||
/*
|
||||
* The GNU GENERAL PUBLIC LICENSE (GNU GPLv3)
|
||||
*
|
||||
* Copyright (c) 2021 Marcel Licence
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Dieses Programm ist Freie Software: Sie können es unter den Bedingungen
|
||||
* der GNU General Public License, wie von der Free Software Foundation,
|
||||
* Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren
|
||||
* veröffentlichten Version, weiter verteilen und/oder modifizieren.
|
||||
*
|
||||
* Dieses Programm wird in der Hoffnung bereitgestellt, dass es nützlich sein wird, jedoch
|
||||
* OHNE JEDE GEWÄHR,; sogar ohne die implizite
|
||||
* Gewähr der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
|
||||
* Siehe die GNU General Public License für weitere Einzelheiten.
|
||||
*
|
||||
* Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
|
||||
* Programm erhalten haben. Wenn nicht, siehe <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* this file includes all required function to setup and drive the i2s interface
|
||||
/**
|
||||
* @file i2s_interface.ino
|
||||
* @author Marcel Licence
|
||||
* @date 13.10.2021
|
||||
*
|
||||
* Author: Marcel Licence
|
||||
* @brief this file includes all required function to setup and drive the i2s interface
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __CDT_PARSER__
|
||||
#include <cdt.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <driver/i2s.h>
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* no dac not tested within this code
|
||||
* - it has the purpose to generate a quasy analog signal without a DAC
|
||||
*/
|
||||
//#define I2S_NODAC
|
||||
|
||||
|
||||
const i2s_port_t i2s_port_number = I2S_NUM_0;
|
||||
|
||||
/*
|
||||
* Define and connect your PINS to DAC here
|
||||
* please refer to https://www.hackster.io/janost/audio-hacking-on-the-esp8266-fa9464#toc-a-simple-909-drum-synth-0
|
||||
* for the following implementation
|
||||
*/
|
||||
#if 0
|
||||
#define I2S_BCLK_PIN 25
|
||||
#define I2S_WCLK_PIN 27
|
||||
#ifdef I2S_NODAC
|
||||
|
||||
#define I2S_DOUT_PIN 26
|
||||
bool writeDAC(float DAC_f);
|
||||
bool i2s_write_sample(uint32_t sample);
|
||||
|
||||
#else
|
||||
|
||||
#endif
|
||||
|
||||
const i2s_port_t i2s_num = I2S_NUM_0; // i2s port number
|
||||
|
||||
|
||||
|
||||
bool i2s_write_sample_32ch2(uint8_t *sample);
|
||||
|
||||
bool i2s_write_sample_32ch2(uint8_t *sample)
|
||||
bool i2s_write_sample(uint32_t sample)
|
||||
{
|
||||
static size_t bytes_written = 0;
|
||||
static size_t bytes_read = 0;
|
||||
i2s_read(i2s_num, (char *)sample, 8, &bytes_read, portMAX_DELAY);
|
||||
|
||||
i2s_write(i2s_num, (const char *)sample, 8, &bytes_written, portMAX_DELAY);
|
||||
i2s_write(i2s_port_number, (const char *)&sample, 4, &bytes_written, portMAX_DELAY);
|
||||
|
||||
if (bytes_written > 0)
|
||||
{
|
||||
@@ -83,18 +52,38 @@ bool i2s_write_sample_32ch2(uint8_t *sample)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SAMPLE_SIZE_24BIT
|
||||
static uint32_t i2sACC;
|
||||
static uint16_t err;
|
||||
|
||||
bool i2s_write_sample_24ch2(uint8_t *sample);
|
||||
|
||||
bool i2s_write_sample_24ch2(uint8_t *sample)
|
||||
bool writeDAC(float DAC_f)
|
||||
{
|
||||
static size_t bytes_written1 = 0;
|
||||
static size_t bytes_written2 = 0;
|
||||
i2s_write((i2s_port_t)i2s_num, (const char *)&sample[1], 3, &bytes_written1, portMAX_DELAY);
|
||||
i2s_write((i2s_port_t)i2s_num, (const char *)&sample[5], 3, &bytes_written2, portMAX_DELAY);
|
||||
uint16_t DAC = 0x8000 + int16_t(DAC_f * 32767.0f);
|
||||
for (uint8_t i = 0; i < 32; i++)
|
||||
{
|
||||
i2sACC = i2sACC << 1;
|
||||
if (DAC >= err)
|
||||
{
|
||||
i2sACC |= 1;
|
||||
err += 0xFFFF - DAC;
|
||||
}
|
||||
else
|
||||
{
|
||||
err -= DAC;
|
||||
}
|
||||
}
|
||||
bool ret = i2s_write_sample(i2sACC);
|
||||
|
||||
if ((bytes_written1 + bytes_written2) > 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
bool i2s_write_sample_32ch2(uint64_t sample)
|
||||
{
|
||||
static size_t bytes_written = 0;
|
||||
i2s_write((i2s_port_t)i2s_port_number, (const char *)&sample, 8, &bytes_written, portMAX_DELAY);
|
||||
|
||||
if (bytes_written > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -104,11 +93,15 @@ bool i2s_write_sample_24ch2(uint8_t *sample)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool i2s_write_stereo_samples(float *fl_sample, float *fr_sample)
|
||||
{
|
||||
|
||||
#ifdef SAMPLE_SIZE_32BIT
|
||||
static union sampleTUNT
|
||||
{
|
||||
uint64_t sample;
|
||||
int32_t ch[2];
|
||||
} sampleDataU;
|
||||
#endif
|
||||
#ifdef SAMPLE_SIZE_24BIT
|
||||
#if 0
|
||||
static union sampleTUNT
|
||||
@@ -132,12 +125,26 @@ bool i2s_write_stereo_samples(float *fl_sample, float *fr_sample)
|
||||
} sampleDataU;
|
||||
#endif
|
||||
|
||||
sampleDataU.ch[0] = int16_t(*fl_sample * 16383.0f);
|
||||
sampleDataU.ch[1] = int16_t(*fr_sample * 16383.0f);
|
||||
/*
|
||||
* using RIGHT_LEFT format
|
||||
*/
|
||||
#ifdef SAMPLE_SIZE_16BIT
|
||||
sampleDataU.ch[0] = int16_t(*fr_sample * 16383.0f); /* some bits missing here */
|
||||
sampleDataU.ch[1] = int16_t(*fl_sample * 16383.0f);
|
||||
#endif
|
||||
#ifdef SAMPLE_SIZE_32BIT
|
||||
sampleDataU.ch[0] = int32_t(*fr_sample * 1073741823.0f); /* some bits missing here */
|
||||
sampleDataU.ch[1] = int32_t(*fl_sample * 1073741823.0f);
|
||||
#endif
|
||||
|
||||
static size_t bytes_written = 0;
|
||||
|
||||
i2s_write(i2s_num, (const char *)&sampleDataU.sample, 4, &bytes_written, portMAX_DELAY);
|
||||
#ifdef SAMPLE_SIZE_16BIT
|
||||
i2s_write(i2s_port_number, (const char *)&sampleDataU.sample, 4, &bytes_written, portMAX_DELAY);
|
||||
#endif
|
||||
#ifdef SAMPLE_SIZE_32BIT
|
||||
i2s_write(i2s_port_number, (const char *)&sampleDataU.sample, 8, &bytes_written, portMAX_DELAY);
|
||||
#endif
|
||||
|
||||
if (bytes_written > 0)
|
||||
{
|
||||
@@ -149,6 +156,85 @@ bool i2s_write_stereo_samples(float *fl_sample, float *fr_sample)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SAMPLE_BUFFER_SIZE
|
||||
bool i2s_write_stereo_samples_buff(float *fl_sample, float *fr_sample, const int buffLen)
|
||||
{
|
||||
#ifdef SAMPLE_SIZE_32BIT
|
||||
static union sampleTUNT
|
||||
{
|
||||
uint64_t sample;
|
||||
int32_t ch[2];
|
||||
} sampleDataU[SAMPLE_BUFFER_SIZE];
|
||||
#endif
|
||||
#ifdef SAMPLE_SIZE_24BIT
|
||||
#if 0
|
||||
static union sampleTUNT
|
||||
{
|
||||
uint8_t sample[8];
|
||||
int32_t ch[2];
|
||||
} sampleDataU[SAMPLE_BUFFER_SIZE];
|
||||
#else
|
||||
static union sampleTUNT
|
||||
{
|
||||
int32_t ch[2];
|
||||
uint8_t bytes[8];
|
||||
} sampleDataU[SAMPLE_BUFFER_SIZE];
|
||||
#endif
|
||||
#endif
|
||||
#ifdef SAMPLE_SIZE_16BIT
|
||||
static union sampleTUNT
|
||||
{
|
||||
uint32_t sample;
|
||||
int16_t ch[2];
|
||||
} sampleDataU[SAMPLE_BUFFER_SIZE];
|
||||
#endif
|
||||
|
||||
for (int n = 0; n < buffLen; n++)
|
||||
{
|
||||
#ifdef ES8388_ENABLED
|
||||
/*
|
||||
* using LEFT_RIGHT format
|
||||
*/
|
||||
#ifdef SAMPLE_SIZE_16BIT
|
||||
sampleDataU[n].ch[1] = int16_t(fr_sample[n] * 16383.0f); /* some bits missing here */
|
||||
sampleDataU[n].ch[0] = int16_t(fl_sample[n] * 16383.0f);
|
||||
#endif
|
||||
#ifdef SAMPLE_SIZE_32BIT
|
||||
sampleDataU[n].ch[1] = int32_t(fr_sample[n] * 1073741823.0f); /* some bits missing here */
|
||||
sampleDataU[n].ch[0] = int32_t(fl_sample[n] * 1073741823.0f);
|
||||
#endif
|
||||
#else
|
||||
/*
|
||||
* using RIGHT_LEFT format
|
||||
*/
|
||||
#ifdef SAMPLE_SIZE_16BIT
|
||||
sampleDataU[n].ch[0] = int16_t(fr_sample[n] * 16383.0f); /* some bits missing here */
|
||||
sampleDataU[n].ch[1] = int16_t(fl_sample[n] * 16383.0f);
|
||||
#endif
|
||||
#ifdef SAMPLE_SIZE_32BIT
|
||||
sampleDataU[n].ch[0] = int32_t(fr_sample[n] * 1073741823.0f); /* some bits missing here */
|
||||
sampleDataU[n].ch[1] = int32_t(fl_sample[n] * 1073741823.0f);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static size_t bytes_written = 0;
|
||||
|
||||
calcCycleCountPre();
|
||||
i2s_write(i2s_port_number, (const char *)&sampleDataU[0].sample, 4 * buffLen, &bytes_written, portMAX_DELAY);
|
||||
calcCycleCount();
|
||||
|
||||
if (bytes_written > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void i2s_read_stereo_samples(float *fl_sample, float *fr_sample)
|
||||
{
|
||||
static size_t bytes_read = 0;
|
||||
@@ -160,78 +246,123 @@ void i2s_read_stereo_samples(float *fl_sample, float *fr_sample)
|
||||
} sampleData;
|
||||
|
||||
|
||||
i2s_read(i2s_num, (char *)&sampleData.sample, 4, &bytes_read, portMAX_DELAY);
|
||||
i2s_read(i2s_port_number, (char *)&sampleData.sample, 4, &bytes_read, portMAX_DELAY);
|
||||
|
||||
//sampleData.ch[0] &= 0xFFFE;
|
||||
//sampleData.ch[1] &= 0;
|
||||
|
||||
*fl_sample = ((float)sampleData.ch[0] * (5.5f / 65535.0f));
|
||||
*fr_sample = ((float)sampleData.ch[1] * (5.5f / 65535.0f));
|
||||
/*
|
||||
* using RIGHT_LEFT format
|
||||
*/
|
||||
*fr_sample = ((float)sampleData.ch[0] * (5.5f / 65535.0f));
|
||||
*fl_sample = ((float)sampleData.ch[1] * (5.5f / 65535.0f));
|
||||
}
|
||||
|
||||
#ifdef SAMPLE_BUFFER_SIZE
|
||||
void i2s_read_stereo_samples_buff(float *fl_sample, float *fr_sample, const int buffLen)
|
||||
{
|
||||
#ifdef I2S_DIN_PIN
|
||||
static size_t bytes_read = 0;
|
||||
|
||||
#ifdef SAMPLE_SIZE_16BIT
|
||||
static union
|
||||
{
|
||||
uint32_t sample;
|
||||
int16_t ch[2];
|
||||
} sampleData[SAMPLE_BUFFER_SIZE];
|
||||
#endif
|
||||
|
||||
i2s_read(i2s_port_number, (char *)&sampleData[0].sample, 4 * SAMPLE_BUFFER_SIZE, &bytes_read, portMAX_DELAY);
|
||||
|
||||
//sampleData.ch[0] &= 0xFFFE;
|
||||
//sampleData.ch[1] &= 0;
|
||||
|
||||
for (int n = 0; n < SAMPLE_BUFFER_SIZE; n++)
|
||||
{
|
||||
/*
|
||||
* using RIGHT_LEFT format
|
||||
*/
|
||||
//fr_sample[n] = ((float)sampleData[n].ch[0] * (5.5f / 65535.0f));
|
||||
//fl_sample[n] = ((float)sampleData[n].ch[1] * (5.5f / 65535.0f));
|
||||
fr_sample[n] = ((float)sampleData[n].ch[0] / (16383.0f));
|
||||
fl_sample[n] = ((float)sampleData[n].ch[1] / (16383.0f));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* i2s configuration
|
||||
*/
|
||||
|
||||
#if 1
|
||||
i2s_config_t i2s_config =
|
||||
i2s_config_t i2s_configuration =
|
||||
{
|
||||
#ifdef I2S_DIN_PIN
|
||||
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_RX), // | I2S_MODE_DAC_BUILT_IN
|
||||
#else
|
||||
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX),
|
||||
#endif
|
||||
.sample_rate = SAMPLE_RATE,
|
||||
#ifdef I2S_NODAC
|
||||
.bits_per_sample = I2S_BITS_PER_SAMPLE_32BIT,
|
||||
.channel_format = I2S_CHANNEL_FMT_ONLY_LEFT,
|
||||
.communication_format = (i2s_comm_format_t)I2S_COMM_FORMAT_I2S_MSB,
|
||||
#else
|
||||
#ifdef SAMPLE_SIZE_32BIT
|
||||
.bits_per_sample = I2S_BITS_PER_SAMPLE_32BIT, /* the DAC module will only take the 8bits from MSB */
|
||||
#endif
|
||||
#ifdef SAMPLE_SIZE_24BIT
|
||||
.bits_per_sample = I2S_BITS_PER_SAMPLE_24BIT, /* the DAC module will only take the 8bits from MSB */
|
||||
#endif
|
||||
#ifdef SAMPLE_SIZE_16BIT
|
||||
.bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT, /* the DAC module will only take the 8bits from MSB */
|
||||
#endif
|
||||
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
|
||||
.communication_format = (i2s_comm_format_t)( I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB),
|
||||
.intr_alloc_flags = 0, // default interrupt priority
|
||||
#if 0
|
||||
.dma_buf_count = 2,
|
||||
.dma_buf_len = 1024,
|
||||
#else
|
||||
.dma_buf_count = 8,
|
||||
.dma_buf_len = 64,
|
||||
#endif
|
||||
.use_apll = 0
|
||||
};
|
||||
#else
|
||||
i2s_config_t i2s_config =
|
||||
{
|
||||
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX ),
|
||||
.sample_rate = SAMPLE_RATE,
|
||||
#ifdef I2S_NODAC
|
||||
.bits_per_sample = I2S_BITS_PER_SAMPLE_32BIT,
|
||||
.channel_format = I2S_CHANNEL_FMT_ONLY_LEFT,
|
||||
.communication_format = (i2s_comm_format_t)I2S_COMM_FORMAT_I2S_MSB,
|
||||
#else
|
||||
.bits_per_sample = I2S_BITS_PER_SAMPLE_32BIT,
|
||||
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
|
||||
.communication_format = (i2s_comm_format_t)(I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB),
|
||||
#endif
|
||||
.intr_alloc_flags = 0,
|
||||
.intr_alloc_flags = 0, // default interrupt priority
|
||||
.dma_buf_count = 8,
|
||||
.dma_buf_len = 64,
|
||||
.use_apll = 0
|
||||
};
|
||||
#ifdef I2S_USE_APLL
|
||||
.use_apll = true,
|
||||
#else
|
||||
.use_apll = false,
|
||||
#endif
|
||||
// .fixed_mclk = (44100 * 256),
|
||||
};
|
||||
|
||||
|
||||
#ifdef I2S_NODAC
|
||||
i2s_pin_config_t pins =
|
||||
{
|
||||
.bck_io_num = IIS_SCLK,
|
||||
.ws_io_num = IIS_LCLK,
|
||||
.data_out_num = IIS_DSIN,
|
||||
.data_in_num = IIS_DSOUT
|
||||
.bck_io_num = I2S_PIN_NO_CHANGE,
|
||||
.ws_io_num = I2S_PIN_NO_CHANGE,
|
||||
.data_out_num = I2S_NODAC_OUT_PIN,
|
||||
.data_in_num = I2S_PIN_NO_CHANGE
|
||||
};
|
||||
|
||||
|
||||
#else
|
||||
i2s_pin_config_t pins =
|
||||
{
|
||||
.bck_io_num = I2S_BCLK_PIN,
|
||||
.ws_io_num = I2S_WCLK_PIN,
|
||||
.data_out_num = I2S_DOUT_PIN,
|
||||
#ifdef I2S_DIN_PIN
|
||||
.data_in_num = I2S_DIN_PIN
|
||||
#else
|
||||
.data_in_num = I2S_PIN_NO_CHANGE
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
void setup_i2s()
|
||||
{
|
||||
i2s_driver_install(i2s_num, &i2s_config, 0, NULL);
|
||||
i2s_driver_install(i2s_port_number, &i2s_configuration, 0, NULL);
|
||||
i2s_set_pin(I2S_NUM_0, &pins);
|
||||
i2s_set_sample_rates(i2s_num, SAMPLE_RATE);
|
||||
i2s_start(i2s_num);
|
||||
i2s_set_sample_rates(i2s_port_number, SAMPLE_RATE);
|
||||
i2s_start(i2s_port_number);
|
||||
#ifdef ES8388_ENABLED
|
||||
REG_WRITE(PIN_CTRL, 0xFFFFFFF0);
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0_CLK_OUT1);
|
||||
#endif
|
||||
}
|
||||
|
||||
+5
-7
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* The GNU GENERAL PUBLIC LICENSE (GNU GPLv3)
|
||||
*
|
||||
* Copyright (c) 2021 Marcel Licence
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -98,7 +96,7 @@ void Loop_init(void)
|
||||
Serial.printf("Total PSRAM: %d\n", ESP.getPsramSize());
|
||||
Serial.printf("Free PSRAM: %d\n", ESP.getFreePsram());
|
||||
|
||||
loopGainIn = 0.0f;
|
||||
loopGainIn = 1.0f;
|
||||
loopInCh = 0;
|
||||
|
||||
Serial.printf("Loop Max Length: %0.0f seconds\n", ((float)MAX_LOOP) / 44100.0f);
|
||||
@@ -122,8 +120,8 @@ void Loop_Process(float *signal_l, float *signal_r)
|
||||
{
|
||||
float tempL = 0.0f, tempR = 0.0f;
|
||||
|
||||
loopMeter[TRACK_CNT] = max(absf(*signal_l), loopMeter[TRACK_CNT] );
|
||||
loopMeter[TRACK_CNT] = max(absf(*signal_r), loopMeter[TRACK_CNT] );
|
||||
loopMeter[TRACK_CNT] = max(absf(*signal_l), loopMeter[TRACK_CNT]);
|
||||
loopMeter[TRACK_CNT] = max(absf(*signal_r), loopMeter[TRACK_CNT]);
|
||||
|
||||
loopSubCnt++;
|
||||
|
||||
@@ -210,8 +208,8 @@ void Loop_Process(float *signal_l, float *signal_r)
|
||||
/*
|
||||
* get max value of left and right channel
|
||||
*/
|
||||
loopMeter[TRACK_CNT + 1] = max(absf(*signal_l), loopMeter[TRACK_CNT + 1] );
|
||||
loopMeter[TRACK_CNT + 1] = max(absf(*signal_r), loopMeter[TRACK_CNT + 1] );
|
||||
loopMeter[TRACK_CNT + 1] = max(absf(*signal_l), loopMeter[TRACK_CNT + 1]);
|
||||
loopMeter[TRACK_CNT + 1] = max(absf(*signal_r), loopMeter[TRACK_CNT + 1]);
|
||||
|
||||
Loop_ProcessButton();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* The GNU GENERAL PUBLIC LICENSE (GNU GPLv3)
|
||||
*
|
||||
* Copyright (c) 2021 Marcel Licence
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
+5
-4
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* The GNU GENERAL PUBLIC LICENSE (GNU GPLv3)
|
||||
*
|
||||
* Copyright (c) 2021 Marcel Licence
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -169,7 +167,7 @@ void Status_PrintAll(void)
|
||||
Serial.printf("--------------------------------\n");
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
if ( i == (int)(Loop_GetRelPos() * 32.0f))
|
||||
if (i == (int)(Loop_GetRelPos() * 32.0f))
|
||||
{
|
||||
Serial.printf("O");
|
||||
}
|
||||
@@ -189,7 +187,7 @@ void Status_PrintAll(void)
|
||||
Serial.printf("Click: <");
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
if ( i == (int)(Click_GetRelPos() * 32.0f))
|
||||
if (i == (int)(Click_GetRelPos() * 32.0f))
|
||||
{
|
||||
Serial.printf("%d", (i % 4) + 1);
|
||||
}
|
||||
@@ -226,6 +224,7 @@ void Status_Process(void)
|
||||
void Status_ValueChangedFloat(const char *descr, float value)
|
||||
{
|
||||
status_cnt = 0;
|
||||
memset(statusMsg, 0, sizeof(statusMsg));
|
||||
sprintf(statusMsg, "%s: %0.2f", descr, value);
|
||||
}
|
||||
|
||||
@@ -235,6 +234,7 @@ void Status_ValueChangedFloat(const char *descr, float value)
|
||||
void Status_ValueChangedInt(const char *descr, int value)
|
||||
{
|
||||
status_cnt = 0;
|
||||
memset(statusMsg, 0, sizeof(statusMsg));
|
||||
sprintf(statusMsg, "%s: %d", descr, value);
|
||||
}
|
||||
|
||||
@@ -244,5 +244,6 @@ void Status_ValueChangedInt(const char *descr, int value)
|
||||
void Status_TestMsg(const char *text)
|
||||
{
|
||||
status_cnt = 0;
|
||||
memset(statusMsg, 0, sizeof(statusMsg));
|
||||
sprintf(statusMsg, "%s", text);
|
||||
}
|
||||
|
||||
+5
-5
@@ -39,6 +39,10 @@
|
||||
* Author: Marcel Licence
|
||||
*/
|
||||
|
||||
#ifdef AUDIO_KIT_BUTTON_ANALOG
|
||||
audioKitButtonCb audioKitButtonCallback = App_ButtonCb;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* this mapping is used for the edirol pcr-800
|
||||
* this should be changed when using another controller
|
||||
@@ -109,11 +113,7 @@ struct midiControllerMapping edirolMapping[] =
|
||||
{ 0x0, 0x12, "R9", NULL, Loop_SetChannelGainIn, 0},
|
||||
|
||||
/* Central slider */
|
||||
#ifndef AS5600_ENABLED
|
||||
// { 0x0, 0x13, "H1", NULL, App_SetBrightness, 0},
|
||||
#else
|
||||
{ 0x0, 0x13, "H1", NULL, Sampler_ScratchFader, 0},
|
||||
#endif
|
||||
{ 0x0, 0x13, "H1", NULL, NULL, 0},
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user