Skip to content

Commit

Permalink
usb-mic: quick test with sending only 1ms worth of samples for 48kHz …
Browse files Browse the repository at this point in the history
…and 8kHz
  • Loading branch information
jackun committed Feb 18, 2021
1 parent bb5a333 commit bc5c83a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/usb-mic/usb-mic-singstar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,11 @@ static void singstar_mic_handle_data(USBDevice *dev, USBPacket *p)
int16_t *dst = nullptr;
std::vector<int16_t> dst_alloc(0); //TODO
size_t len = p->iov.size;

// send only 1ms (bInterval) of samples
if (s->f.srate[0] == 48000 || s->f.srate[0] == 8000) // TODO others don't divide so nicely
len = std::min(p->iov.size, outChns * sizeof(int16_t) * s->f.srate[0] / 1000);

//Divide 'len' bytes between 2 channels of 16 bits
uint32_t max_frames = len / (outChns * sizeof(uint16_t));

Expand Down

0 comments on commit bc5c83a

Please sign in to comment.