|
|
|
|
|
|
|
|
AudioConnection(AudioStream &source, AudioStream &destination) : |
|
|
AudioConnection(AudioStream &source, AudioStream &destination) : |
|
|
src(source), dst(destination), src_index(0), dest_index(0), |
|
|
src(source), dst(destination), src_index(0), dest_index(0), |
|
|
next_dest(NULL) |
|
|
next_dest(NULL) |
|
|
{ connect(); } |
|
|
|
|
|
|
|
|
{ isConnected = false; |
|
|
|
|
|
connect(); } |
|
|
AudioConnection(AudioStream &source, unsigned char sourceOutput, |
|
|
AudioConnection(AudioStream &source, unsigned char sourceOutput, |
|
|
AudioStream &destination, unsigned char destinationInput) : |
|
|
AudioStream &destination, unsigned char destinationInput) : |
|
|
src(source), dst(destination), |
|
|
src(source), dst(destination), |
|
|
src_index(sourceOutput), dest_index(destinationInput), |
|
|
src_index(sourceOutput), dest_index(destinationInput), |
|
|
next_dest(NULL) |
|
|
next_dest(NULL) |
|
|
{ connect(); } |
|
|
|
|
|
|
|
|
{ isConnected = false; |
|
|
|
|
|
connect(); } |
|
|
friend class AudioStream; |
|
|
friend class AudioStream; |
|
|
protected: |
|
|
|
|
|
|
|
|
~AudioConnection() { |
|
|
|
|
|
disconnect(); |
|
|
|
|
|
} |
|
|
|
|
|
void disconnect(void); |
|
|
void connect(void); |
|
|
void connect(void); |
|
|
|
|
|
protected: |
|
|
AudioStream &src; |
|
|
AudioStream &src; |
|
|
AudioStream &dst; |
|
|
AudioStream &dst; |
|
|
unsigned char src_index; |
|
|
unsigned char src_index; |
|
|
unsigned char dest_index; |
|
|
unsigned char dest_index; |
|
|
AudioConnection *next_dest; |
|
|
AudioConnection *next_dest; |
|
|
|
|
|
bool isConnected; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
next_update = NULL; |
|
|
next_update = NULL; |
|
|
cpu_cycles = 0; |
|
|
cpu_cycles = 0; |
|
|
cpu_cycles_max = 0; |
|
|
cpu_cycles_max = 0; |
|
|
|
|
|
numConnections = 0; |
|
|
} |
|
|
} |
|
|
static void initialize_memory(audio_block_t *data, unsigned int num); |
|
|
static void initialize_memory(audio_block_t *data, unsigned int num); |
|
|
int processorUsage(void) { return CYCLE_COUNTER_APPROX_PERCENT(cpu_cycles); } |
|
|
int processorUsage(void) { return CYCLE_COUNTER_APPROX_PERCENT(cpu_cycles); } |
|
|
int processorUsageMax(void) { return CYCLE_COUNTER_APPROX_PERCENT(cpu_cycles_max); } |
|
|
int processorUsageMax(void) { return CYCLE_COUNTER_APPROX_PERCENT(cpu_cycles_max); } |
|
|
void processorUsageMaxReset(void) { cpu_cycles_max = cpu_cycles; } |
|
|
void processorUsageMaxReset(void) { cpu_cycles_max = cpu_cycles; } |
|
|
|
|
|
bool isActive(void) { return active; } |
|
|
uint16_t cpu_cycles; |
|
|
uint16_t cpu_cycles; |
|
|
uint16_t cpu_cycles_max; |
|
|
uint16_t cpu_cycles_max; |
|
|
static uint16_t cpu_cycles_total; |
|
|
static uint16_t cpu_cycles_total; |
|
|
|
|
|
|
|
|
static void update_all(void) { NVIC_SET_PENDING(IRQ_SOFTWARE); } |
|
|
static void update_all(void) { NVIC_SET_PENDING(IRQ_SOFTWARE); } |
|
|
friend void software_isr(void); |
|
|
friend void software_isr(void); |
|
|
friend class AudioConnection; |
|
|
friend class AudioConnection; |
|
|
|
|
|
uint8_t numConnections; |
|
|
private: |
|
|
private: |
|
|
AudioConnection *destination_list; |
|
|
AudioConnection *destination_list; |
|
|
audio_block_t **inputQueue; |
|
|
audio_block_t **inputQueue; |