Skip to content

Commit

Permalink
Merge pull request sonydevworld#42 from SPRESENSE/merge-v2.0.2-develop
Browse files Browse the repository at this point in the history
Merge tag v2.0.2 for develop
  • Loading branch information
SPRESENSE authored Dec 17, 2020
2 parents 8d272fb + 5490cbd commit 4a90fc7
Show file tree
Hide file tree
Showing 37 changed files with 242 additions and 85 deletions.
28 changes: 14 additions & 14 deletions Arduino15/package_spresense_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
{
"category": "SPRESENSE",
"name": "Spresense Reference Board",
"url": "https://github.com/sonydevworld/spresense-arduino-compatible/releases/download/v2.0.1/spresense-v2.0.1.tar.gz",
"url": "https://github.com/sonydevworld/spresense-arduino-compatible/releases/download/v2.0.2/spresense-v2.0.2.tar.gz",
"help": {
"online": "https://github.com/sonydevworld/spresense-arduino-compatible/releases"
},
"version": "1.0.0",
"architecture": "spresense",
"archiveFileName": "spresense-v2.0.1.tar.gz",
"archiveFileName": "spresense-v2.0.2.tar.gz",
"boards": [
{
"name": "Generic Spresense Module"
Expand Down Expand Up @@ -49,22 +49,22 @@
"name": "spresense-sdk",
"systems": [
{
"url": "https://github.com/sonydevworld/spresense-arduino-compatible/releases/download/v2.0.1/spresense-sdk-v2.0.1.tar.gz",
"url": "https://github.com/sonydevworld/spresense-arduino-compatible/releases/download/v2.0.2/spresense-sdk-v2.0.2.tar.gz",
"host": "i686-mingw32",
"archiveFileName": "spresense-sdk-v2.0.1.tar.gz",
"archiveFileName": "spresense-sdk-v2.0.2.tar.gz",
"size": "6257789"
},
{
"_comment": "Allow x64-Linux build",
"url": "https://github.com/sonydevworld/spresense-arduino-compatible/releases/download/v2.0.1/spresense-sdk-v2.0.1.tar.gz",
"url": "https://github.com/sonydevworld/spresense-arduino-compatible/releases/download/v2.0.2/spresense-sdk-v2.0.2.tar.gz",
"host": "x86_64-pc-linux-gnu",
"archiveFileName": "spresense-sdk-v2.0.1.tar.gz",
"archiveFileName": "spresense-sdk-v2.0.2.tar.gz",
"size": "6257789"
},
{
"url": "https://github.com/sonydevworld/spresense-arduino-compatible/releases/download/v2.0.1/spresense-sdk-v2.0.1.tar.gz",
"url": "https://github.com/sonydevworld/spresense-arduino-compatible/releases/download/v2.0.2/spresense-sdk-v2.0.2.tar.gz",
"host": "i386-apple-darwin11",
"archiveFileName": "spresense-sdk-v2.0.1.tar.gz",
"archiveFileName": "spresense-sdk-v2.0.2.tar.gz",
"size": "6257789"
}
]
Expand All @@ -74,21 +74,21 @@
"name": "spresense-tools",
"systems": [
{
"url": "https://github.com/sonydevworld/spresense-arduino-compatible/releases/download/v2.0.1/spresense-tools-v2.0.1.tar.gz",
"url": "https://github.com/sonydevworld/spresense-arduino-compatible/releases/download/v2.0.2/spresense-tools-v2.0.2.tar.gz",
"host": "i686-mingw32",
"archiveFileName": "spresense-tools-v2.0.1.tar.gz",
"archiveFileName": "spresense-tools-v2.0.2.tar.gz",
"size": "59294138"
},
{
"_comment": "Allow x64-Linux build",
"url": "https://github.com/sonydevworld/spresense-arduino-compatible/releases/download/v2.0.1/spresense-tools-v2.0.1.tar.gz",
"url": "https://github.com/sonydevworld/spresense-arduino-compatible/releases/download/v2.0.2/spresense-tools-v2.0.2.tar.gz",
"host": "x86_64-pc-linux-gnu",
"archiveFileName": "spresense-tools-v2.0.1.tar.gz",
"archiveFileName": "spresense-tools-v2.0.2.tar.gz",
"size": "59294138"
}, {
"url": "https://github.com/sonydevworld/spresense-arduino-compatible/releases/download/v2.0.1/spresense-tools-v2.0.1.tar.gz",
"url": "https://github.com/sonydevworld/spresense-arduino-compatible/releases/download/v2.0.2/spresense-tools-v2.0.2.tar.gz",
"host": "i386-apple-darwin11",
"archiveFileName": "spresense-tools-v2.0.1.tar.gz",
"archiveFileName": "spresense-tools-v2.0.2.tar.gz",
"size": "59294138"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ void setup()

/* Mount SD card */

theSD.begin();
while (!theSD.begin())
{
/* wait until SD card is mounted. */
Serial.println("Insert SD card.");
}

/* Set output device to speaker */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,11 @@ void setup()

/* Mount SD card */

theSD.begin();
while (!theSD.begin())
{
/* wait until SD card is mounted. */
Serial.println("Insert SD card.");
}

/* Initialize memory pools and message libs */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ static void audio_attention_cb(const ErrorAttentionParam *atprm)
*/
void setup()
{
/* Initialize SD */
while (!theSD.begin())
{
/* wait until SD card is mounted. */
Serial.println("Insert SD card.");
}

// start audio system
theAudio = AudioClass::getInstance();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ void setup()
exit(1);
}

/* Initialize SD */
while (!theSD.begin())
{
/* wait until SD card is mounted. */
Serial.println("Insert SD card.");
}

/* Open file placed on SD card */
myFile = theSD.open("HiResSound.wav");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ void setup()
*/
thePlayer->init(MediaPlayer::Player0, AS_CODECTYPE_MP3, "/mnt/sd0/BIN", AS_SAMPLINGRATE_48000, AS_CHANNEL_STEREO);

/* Initialize SD */
while (!theSD.begin())
{
/* wait until SD card is mounted. */
Serial.println("Insert SD card.");
}

myFile = theSD.open("Sound.mp3");

/* Verify file open */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,12 @@ void setup()
printf("Repeat=%s\n", (preset.repeat) ? "On" : "Off");
printf("Auto=%s\n", (preset.autoplay) ? "On" : "Off");

/* Use SD card */

theSD.begin();
/* Initialize SD */
while (!theSD.begin())
{
/* wait until SD card is mounted. */
Serial.println("Insert SD card.");
}

/* Initialize playlist */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ static const uint32_t sc_prestore_frames = 10;

void setup()
{
theSD.begin();
/* Initialize SD */
while (!theSD.begin())
{
/* wait until SD card is mounted. */
Serial.println("Insert SD card.");
}

// Get wav file info

Expand Down Expand Up @@ -218,4 +223,4 @@ stop_player:
theAudio->stopPlayer(AudioClass::Player0);
myFile.close();
exit(1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ static void audio_attention_cb(const ErrorAttentionParam *atprm)
*/
void setup()
{
/* Initialize SD */
while (!theSD.begin())
{
/* wait until SD card is mounted. */
Serial.println("Insert SD card.");
}

// start audio system
theAudio = AudioClass::getInstance();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ static const int32_t recoding_size = recoding_byte_per_second * recoding_time;

void setup()
{
/* Initialize SD */
while (!theSD.begin())
{
/* wait until SD card is mounted. */
Serial.println("Insert SD card.");
}

theAudio = AudioClass::getInstance();

theAudio->begin(audio_attention_cb);
Expand All @@ -92,8 +99,6 @@ void setup()

/* Open file for data write on SD card */

theSD.begin();

if (theSD.exists(RECORD_FILE_NAME))
{
printf("Remove existing file [%s].\n", RECORD_FILE_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ static bool mediarecorder_done_callback(AsRecorderEvent event, uint32_t result,

void setup()
{
/* Initialize SD */
while (!theSD.begin())
{
/* wait until SD card is mounted. */
Serial.println("Insert SD card.");
}

/* Initialize memory pools and message libs */

initMemoryPools();
Expand Down Expand Up @@ -161,8 +168,6 @@ void setup()

/* Open file for data write on SD card */

theSD.begin();

if (theSD.exists(RECORD_FILE_NAME))
{
printf("Remove existing file [%s].\n", RECORD_FILE_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ static const int32_t recoding_size = recoding_byte_per_second * recoding_time;

void setup()
{
/* Initialize SD */
while (!theSD.begin())
{
/* wait until SD card is mounted. */
Serial.println("Insert SD card.");
}

theAudio = AudioClass::getInstance();

theAudio->begin(audio_attention_cb);
Expand All @@ -108,8 +115,6 @@ void setup()

/* Open file for data write on SD card */

theSD.begin();

if (theSD.exists(RECORD_FILE_NAME))
{
printf("Remove existing file [%s].\n", RECORD_FILE_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ void setup()

usleep(100 * 1000); /* waiting for Mic startup */

/* Initialize SD */
while (!theSD.begin())
{
/* wait until SD card is mounted. */
Serial.println("Insert SD card.");
}

/*
* Initialize recorder to decode stereo wav stream with 48kHz sample rate
* Search for SRC filter in "/mnt/sd0/BIN" directory
Expand All @@ -156,8 +163,6 @@ void setup()
"/mnt/sd0/BIN");

/* Open file for data write on SD card */

theSD.begin();

if (theSD.exists(RECORD_FILE_NAME))
{
Expand Down Expand Up @@ -218,7 +223,7 @@ err_t execute_aframe(uint32_t* size)
{
signal_process(*size);
}else{
return err;
return err;
}
int ret = s_myFile.write((uint8_t*)&s_buffer, *size);
if (ret < 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,12 @@ void mediaplayer_decode_callback(AsPcmDataParam pcm_param)

void setup()
{
theSD.begin();
/* Initialize SD */
while (!theSD.begin())
{
/* wait until SD card is mounted. */
Serial.println("Insert SD card.");
}

/* Initialize memory pools and message libs */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <stdio.h>
#include <stdlib.h>

#include <arch/board/board.h>

#define READSAMPLE (240)
#define BYTEWIDTH (2)
#define CHNUM (2)
Expand Down Expand Up @@ -129,7 +131,7 @@ static enum State {
Stopping,
} s_state = Ready;

static bool getFrame(AsPcmDataParam *pcm)
static bool getFrame(AsPcmDataParam *pcm, bool direct_read)
{
/* Alloc MemHandle */
if (pcm->mh.allocSeg(S0_REND_PCM_BUF_POOL, READSIZE) != ERR_OK) {
Expand All @@ -140,14 +142,18 @@ static bool getFrame(AsPcmDataParam *pcm)
pcm->identifier = 0;
pcm->callback = 0;
pcm->bit_length = 16;
pcm->size = myBuffer.readbuf((uint8_t *)pcm->mh.getPa());
pcm->size = (direct_read) ? myFile.read((uint8_t *)pcm->mh.getPa(), READSIZE) : myBuffer.readbuf((uint8_t *)pcm->mh.getPa());
pcm->sample = pcm->size / BYTEWIDTH / CHNUM;
pcm->is_end = (pcm->size < READSIZE);
pcm->is_valid = (pcm->size > 0);

return true;
}

static bool getFrame(AsPcmDataParam *pcm)
{
return getFrame(pcm, false);
}

static bool start(uint8_t no)
{
Expand Down Expand Up @@ -179,7 +185,7 @@ static bool start(uint8_t no)
/* Start rendering. */
for (int i = 0; i < RREREQUEST; i++) {
AsPcmDataParam pcm_param;
if (!getFrame(&pcm_param)) {
if (!getFrame(&pcm_param, true)) {
break;
}

Expand Down Expand Up @@ -214,7 +220,7 @@ static bool restart()

for (int i = 0; i < RREREQUEST; i++) {
AsPcmDataParam pcm_param;
if (getFrame(&pcm_param)) {
if (getFrame(&pcm_param, true)) {
/* Send PCM */
int err = theMixer->sendData(OutputMixer0,
outmixer_send_callback,
Expand Down Expand Up @@ -345,8 +351,12 @@ void setup()
initMemoryPools();
createStaticPools(MEM_LAYOUT_PLAYER);

/* Use SD card */
theSD.begin();
/* Initialize SD */
while (!theSD.begin())
{
/* wait until SD card is mounted. */
Serial.println("Insert SD card.");
}

/* Start audio system */
theMixer = OutputMixer::getInstance();
Expand All @@ -370,6 +380,9 @@ void setup()
/* Set main volume */
theMixer->setVolume(0, 0, 0);

/* Unmute */
board_external_amp_mute_control(false);

printf("setup() complete\n");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Audio
version=1.4.4
version=1.4.5
author=Sony Semiconductor Solutions
maintainer=Sony Semiconductor Solutions
sentence=Spresense Audio Subsystem Library
Expand Down
Loading

0 comments on commit 4a90fc7

Please sign in to comment.