diff --git a/keywords.txt b/keywords.txt
index c7536a0..b66a009 100644
--- a/keywords.txt
+++ b/keywords.txt
@@ -1,5 +1,6 @@
AudioFileSource KEYWORD1
AudioFileSourceSPIFFS KEYWORD1
+AudioFileSourceFastROMFS KEYWORD1
AudioFileSourcePROGMEM KEYWORD1
AudioFileSourceHTTPStream KEYWORD1
AudioFileSourceSD KEYWORD1
@@ -12,5 +13,6 @@ AudioOutput KEYWORD1
AudioOutputI2SDAC KEYWORD1
AudioOutputI2SNoDAC KEYWORD1
AudioOutputNull KEYWORD1
+AudioOutputBuffer KEYWORD1
AudioOutputSerialWAV KEYWORD1
AudioOutputSPIFFSWAV KEYWORD1
diff --git a/src/AudioFileSourceFastROMFS.cpp b/src/AudioFileSourceFastROMFS.cpp
new file mode 100644
index 0000000..358c82d
--- /dev/null
+++ b/src/AudioFileSourceFastROMFS.cpp
@@ -0,0 +1,73 @@
+/*
+ AudioFileSourceFastROMFS
+ Input FastROMFS "file" to be used by AudioGenerator
+
+ Copyright (C) 2017 Earle F. Philhower, III
+
+ 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 .
+*/
+
+#include "AudioFileSourceFastROMFS.h"
+
+AudioFileSourceFastROMFS::AudioFileSourceFastROMFS()
+{
+
+}
+
+AudioFileSourceFastROMFS::AudioFileSourceFastROMFS(FastROMFilesystem *fs, const char *filename)
+{
+ this->fs = fs;
+ open(filename);
+}
+
+bool AudioFileSourceFastROMFS::open(const char *filename)
+{
+ f = fs->open(filename, "r");
+ return f;
+}
+
+AudioFileSourceFastROMFS::~AudioFileSourceFastROMFS()
+{
+ if (f) f->close();
+ f = NULL;
+}
+
+uint32_t AudioFileSourceFastROMFS::read(void *data, uint32_t len)
+{
+ return f->read(reinterpret_cast(data), len);
+}
+
+bool AudioFileSourceFastROMFS::seek(int32_t pos, int dir)
+{
+ return f->seek(pos, dir);
+}
+
+bool AudioFileSourceFastROMFS::close()
+{
+ f->close();
+ return true;
+}
+
+bool AudioFileSourceFastROMFS::isOpen()
+{
+ return f?true:false;
+}
+
+uint32_t AudioFileSourceFastROMFS::getSize()
+{
+ if (!f) return 0;
+ return f->size();
+}
+
+
diff --git a/src/AudioFileSourceFastROMFS.h b/src/AudioFileSourceFastROMFS.h
new file mode 100644
index 0000000..cf325bb
--- /dev/null
+++ b/src/AudioFileSourceFastROMFS.h
@@ -0,0 +1,49 @@
+/*
+ AudioFileSourceFastROMFS
+ Input FastROMFS "file" to be used by AudioGenerator
+
+ Copyright (C) 2017 Earle F. Philhower, III
+
+ 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 .
+*/
+
+#ifndef _AUDIOFILESOURCEFASTROMFS_H
+#define _AUDIOFILESOURCEFASTROMFS_H
+
+#include
+#include
+
+#include "AudioFileSource.h"
+
+class AudioFileSourceFastROMFS : public AudioFileSource
+{
+ public:
+ AudioFileSourceFastROMFS();
+ AudioFileSourceFastROMFS(FastROMFilesystem *fs, const char *filename);
+ virtual ~AudioFileSourceFastROMFS() override;
+
+ virtual bool open(const char *filename) override;
+ virtual uint32_t read(void *data, uint32_t len) override;
+ virtual bool seek(int32_t pos, int dir) override;
+ virtual bool close() override;
+ virtual bool isOpen() override;
+ virtual uint32_t getSize() override;
+ virtual uint32_t getPos() override { if (!f) return 0; else return f->position(); };
+
+ private:
+ FastROMFilesystem *fs;
+ FastROMFile *f;
+};
+
+#endif
diff --git a/src/AudioOutputBuffer.cpp b/src/AudioOutputBuffer.cpp
new file mode 100644
index 0000000..a22f72e
--- /dev/null
+++ b/src/AudioOutputBuffer.cpp
@@ -0,0 +1,89 @@
+/*
+ AudioOutputBuffer
+ Adds additional bufferspace to the output chain
+
+ Copyright (C) 2017 Earle F. Philhower, III
+
+ 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 .
+*/
+
+#include
+#include "AudioOutputBuffer.h"
+
+AudioOutputBuffer::AudioOutputBuffer(int buffSizeSamples, AudioOutput *dest)
+{
+ buffSize = buffSizeSamples;
+ leftSample = (int16_t*)malloc(sizeof(int16_t) * buffSize);
+ rightSample = (int16_t*)malloc(sizeof(int16_t) * buffSize);
+ writePtr = 0;
+ readPtr = 0;
+ sink = dest;
+}
+
+AudioOutputBuffer::~AudioOutputBuffer()
+{
+ free(leftSample);
+ free(rightSample);
+}
+
+bool AudioOutputBuffer::SetRate(int hz)
+{
+ return sink->SetRate(hz);
+}
+
+bool AudioOutputBuffer::SetBitsPerSample(int bits)
+{
+ return sink->SetBitsPerSample(bits);
+}
+
+bool AudioOutputBuffer::SetChannels(int channels)
+{
+ return sink->SetChannels(channels);
+}
+
+bool AudioOutputBuffer::begin()
+{
+ filled = false;
+ return sink->begin();
+}
+
+bool AudioOutputBuffer::ConsumeSample(int16_t sample[2])
+{
+ // First, try and fill I2S...
+ if (filled) {
+ while (readPtr != writePtr) {
+ int16_t s[2] = {leftSample[readPtr], rightSample[readPtr]};
+ if (!sink->ConsumeSample(s)) break; // Can't stuff any more in I2S...
+ readPtr = (readPtr + 1) % buffSize;
+ }
+ }
+
+ // Now, do we have space for a new sample?
+ int nextWritePtr = (writePtr + 1) % buffSize;
+ if (nextWritePtr == readPtr) {
+ filled = true;
+ return false;
+ }
+ leftSample[writePtr] = sample[LEFTCHANNEL];
+ rightSample[writePtr] = sample[RIGHTCHANNEL];
+ writePtr = nextWritePtr;
+ return true;
+}
+
+bool AudioOutputBuffer::stop()
+{
+ return sink->stop();
+}
+
+
diff --git a/src/AudioOutputBuffer.h b/src/AudioOutputBuffer.h
new file mode 100644
index 0000000..56c10a7
--- /dev/null
+++ b/src/AudioOutputBuffer.h
@@ -0,0 +1,49 @@
+/*
+ AudioOutputBuffer
+ Adds additional bufferspace to the output chain
+
+ Copyright (C) 2017 Earle F. Philhower, III
+
+ 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 .
+*/
+
+#ifndef _AUDIOOUTPUTBUFFER_H
+#define _AUDIOOUTPUTBUFFER_H
+
+#include "AudioOutput.h"
+
+class AudioOutputBuffer : public AudioOutput
+{
+ public:
+ AudioOutputBuffer(int bufferSizeSamples, AudioOutput *dest);
+ virtual ~AudioOutputBuffer() override;
+ virtual bool SetRate(int hz) override;
+ virtual bool SetBitsPerSample(int bits) override;
+ virtual bool SetChannels(int channels) override;
+ virtual bool begin() override;
+ virtual bool ConsumeSample(int16_t sample[2]) override;
+ virtual bool stop() override;
+
+ protected:
+ AudioOutput *sink;
+ int buffSize;
+ int16_t *leftSample;
+ int16_t *rightSample;
+ int writePtr;
+ int readPtr;
+ bool filled;
+};
+
+#endif
+