Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 30 of 30

Thread: Teensy Audio Adapter and Audio Library - Stream mic to serial USB interface

  1. #26
    Quote Originally Posted by PaulStoffregen View Post
    The descriptor data in usb_desc.c tells the USB host what to expect in the endpoint data.
    Hi Paul,
    I am trying to understand the usb libs implementation by reading them with the Universal Serial Bus Device Class Definition for Audio Devices

    Starting with the descriptor, I found the descriptor section that I should changed first to let the USB Host knows that the interface has 4 channels.
    Code:
    bNrChannels = 2 --> 4
    
    wChannelConfig, 0x0003 = Left & Right Front --> 0x0107 = 4 channels
    I tried this and indeed the ASIO4ALL driver recognize the teensy as 4 channels (4 in, 4 out)

    I believe that my big mission is to create a new AudioOutputQuadUSB object, quite same as the AudioOutputQuadUSB.
    Code:
    static void copy_from_buffers(uint32_t *dst, int16_t *left, int16_t *right, unsigned int len)
    {
    	// TODO: optimize...
    	while (len > 0) {
    		*dst++ = (*right++ << 16) | (*left++ & 0xFFFF);
    		len--;
    	}
    }
    Here I can see that the dst buffer is 32 bit, and of course the left and right channels are 16 bit each... so this is a challenge. how can I create the same function to get 4 channels if the dst buffer is 32bit type?

    If you think I'm wrong or my way of thinking is wrong please tell me..
    of course any suggestion is blessed.
    Thanks

  2. #27
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,792
    Quote Originally Posted by alonper View Post
    Is there a Teensy simulator with debugger that I can work with?
    Or any idea how can I understand the flow of the program?
    There is no simulator available as far as I know. You will understand the flow of the program by going through it line by line and only going to the next after you are sure that you have fully understood what the previous does. Having the processor's reference manual nearby is very helpful.

  3. #28
    Quote Originally Posted by Theremingenieur View Post
    There is no simulator available as far as I know. You will understand the flow of the program by going through it line by line and only going to the next after you are sure that you have fully understood what the previous does. Having the processor's reference manual nearby is very helpful.
    Sure. Thanks for reply.
    Are you familiar with the usb code?
    Please, Can you look at my #26 reply?

    thanks again.

  4. #29
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,203
    I haven't actually tried 4 channels over USB, but my impression is you'll need to change the USB descriptors so the PC expects 4 channels. Looks like you've already done that.

    Then edit all the code which actually processes the data, to send & receive packets twice the size. For for first attempt, perhaps just write zeros into every other 32 bits, so channels 3 & 4 are silent. Or write a fixed number and see if that comes through correctly, together with the first 2 channels as they should be. After that's working, the last part would involve actually moving audio lib data into those bytes.

  5. #30
    Hi Paul,
    I tried to get deep into your code but I still didnt figure it out,
    changing the usb_desc params changed the behaviour of the teensy as recording device to react as 4 channels audio card, but unfortunately, I couldn't handle with writing a new AudioOutputQuadUSB Object.
    I know that I asked this question already but maybe something changed in the past 6 month..
    Do you know if anyone else managed with patching 4 channels to AudioOutputUSB?
    or if you can help me and give me some clues where and how to start?

    Thanks a lot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •