-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Audio refactor #178
base: master
Are you sure you want to change the base?
Audio refactor #178
Conversation
- Add support for dynamic reconfiguraton of drop rate - Remove methods and events associates with runtime reconfiguration - Fix minor bug in dissemination of data rate
- Refactor to have a common base class - Standardize implementation - reduce duplicted code n.b. this is a first cut, compiling but untestsed code.
Compiles, but not tested.
- add - bugfix
float StreamRecording::getSampleRate() | ||
{ | ||
if( this->lastUpstreamRate == DATASTREAM_SAMPLE_RATE_UNKNOWN ) | ||
return this->upStream.getSampleRate(); | ||
|
||
return this->lastUpstreamRate; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The StreamRecording::getSampleRate()
method has been removed by the virtual float getSampleRate()
declaration has been left in StreamRecording.h
, which causes a compilation error.
- simplified structure - removed old/redundant functions - utilised audio-refactor APIs - implemented copy-mode recording (as yet untested) for smaller blocks. Known working with the following program: int main() { uBit.init(); uBit.audio.requestActivation(); SplitterChannel *channel = uBit.audio.splitter->createChannel(); StreamRecording *recording = new StreamRecording(*channel); MixerChannel * mix = uBit.audio.mixer.addChannel(*recording); recording->record(); mix->setSampleRate(11000); uBit.sleep(1000); while(1) { DMESG("PLAYING..."); recording->play(); DMESG("DONE."); uBit.sleep(10000); } }
void initialise(); | ||
uint32_t totalBufferLength; // Amount of data currently stored in this object. | ||
int state; // STOPPED/PLAYING/RECORDING. | ||
ManagedBuffer data[CODAL_STREAM_RECORDING_SIZE]; // Buffers of data, each CODAL_STREAM_RECORDING_BUFFER_SIZE in length. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to statically allocate an array of 200 items, so in the absolute best case scenario of an empty ManagedBuffer being only 4 bytes, that's 800 bytes consumed here (or a multiple of that if each instance is larger).
- remove excessive debug information - makeif statements positive, not negative
Not ready to merge. Raising this PR for review purposes only.