Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: rtp-MIDI / Apple-MIDI question…

Hybrid View

  1. #1
    Junior Member
    Join Date
    Feb 2016
    Location
    Los Angeles
    Posts
    10

    rtp-MIDI / Apple-MIDI question…

    Hello!

    My Arduino has finally run out of horsepower and a good friend suggested I turn my attention to the Teensy platform. Before I dive in, I wanted to make sure I was on the right path.

    My project aims to incorporate both Bonjour-style/Zeroconf networking as well as receiving MIDI over the local network via rtp-MIDI, (aka Apple-MIDI).

    Does anyone have any experience using this Arduino library on a Teensy, or if not, what are the probabilities of it working?

    https://github.com/lathoub/Arduino-AppleMidi-Library

    Thank you!

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,091
    This is the first I've heard of this AppleMIDI library.

    Looks like it ought to work. The EthernetShield_NoteOnOffEverySec example compiles for Teensy 3.2. Since this uses the Ethernet library for communication, it really ought to "just work".

  3. #3
    Junior Member
    Join Date
    Feb 2016
    Location
    Los Angeles
    Posts
    10
    Thanks for checking that out! I'm looking forward to migrating over to the Teensy platform.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,091
    Quote Originally Posted by lorenzofattori View Post
    do I need to care about this warnings?
    If using Teensy 3.x, you can probably just ignore these warnings.

    If using Teensy LC, these will be a serious problem. Cortex-M0+ requires 16 and 32 bit memory access to be properly aligned to 2 and 4 byte memory boundaries. When this code casts an arbitrary byte pointer to those types, unless other code aligns the memory properly, there's a 50-50 chance a 16 bit access with hard fault (crash your program), and a 3 in 4 chance a 32 bit access will fault.

    The Cortex-M4 processor used on all Teensy 3.x can handle unaligned memory access. It's slower since it has to access the memory twice, but that's still better than 4 accesses on an 8 bit processor for 32 bits.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,091
    To get rid of these warnings, the code can be changed to use void pointers instead of unsigned char. That still doesn't solve the unaligned access trouble, but it will quiet the compiler warnings.

    To actually deal with memory alignment, the variables need to be allocated as 32 bit types (as OctoWS2811 does) or an align attribute can be used. This issue recently came up with FastLED and Mark solved the problem that way. Here's the code:

    https://github.com/FastLED/FastLED/c...12a34e6c8ff5a7

Posting Permissions

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