Skip to content

Two input sources into single output #721

Answered by pschatzmann
Mukhin22 asked this question in Q&A
Discussion options

You must be logged in to vote

I tried to set up a POC on the AudioKit. Initially, I was stumbling a bit over the big array size that we need to process.
The following sketch works like a charm:

#include "BluetoothA2DPSink.h"
#include "AudioTools.h"
#include "AudioLibs/AudioKit.h"

AudioInfo info(44100, 2, 16);
BluetoothA2DPSink a2dp_sink;
AudioKitStream i2s;
OutputMixer<int16_t> mixer(i2s, 2);
const int buffer_size = 1024;  
uint8_t buffer[buffer_size];

// Write data to mixer in callback
void read_data_stream(const uint8_t *data, uint32_t length) {
  int open = length;
  int pos = 0;
  // limit write size
  while(open>0){
    int write_size = min(open, 1024);
    int bytes_read = i2s.readBytes(buffer, write_size);
    

Replies: 10 comments 22 replies

Comment options

You must be logged in to vote
5 replies
@Mukhin22
Comment options

@pschatzmann
Comment options

@Mukhin22
Comment options

@Mukhin22
Comment options

@pschatzmann
Comment options

Comment options

You must be logged in to vote
3 replies
@Mukhin22
Comment options

@pschatzmann
Comment options

@Mukhin22
Comment options

Comment options

You must be logged in to vote
6 replies
@pschatzmann
Comment options

@Mukhin22
Comment options

@pschatzmann
Comment options

@Mukhin22
Comment options

@Mukhin22
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@pschatzmann
Comment options

Comment options

You must be logged in to vote
2 replies
@Mukhin22
Comment options

@Mukhin22
Comment options

Comment options

You must be logged in to vote
4 replies
@Mukhin22
Comment options

@pschatzmann
Comment options

@pschatzmann
Comment options

@Mukhin22
Comment options

Comment options

You must be logged in to vote
1 reply
@Mukhin22
Comment options

Answer selected by pschatzmann
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #720 on March 26, 2023 20:55.