Posts relating to software development.
Cross-compiling on Malus Sylvestris

Posted by cwright on 2007.04.06 @ 14:42

Filed under:

After working my way through most of the migration to Mac, I came across a common problem for multi-platform developers like myself. The problem is the creation and use of applications targeted for another platform. For example, using a Linux compiler to develop Windows applications, or using an OS X compiler to develop Linux applications.

This is a fairly common problem, and also fairly simple to solve. The resultant tool kit is referred to as a Cross-Compiler, because is crosses platforms, and it compiles source code into target code. For Linux, my cross-compiler of choice was created and maintained by SDL, and can be found here. This allowed me to write Windows programs without needing to actually run Windows. Since both Linux and Windows were my complete set of frequented platforms, that sufficed. Now, however, one more platform has entered the mix. [more...]

Nord Modular Tempo Format Nord Modular Tempo Format

Posted by smokris on 2002.08.06 @ 16:01

Filed under:

When the Nord Modular Editor writes patch files, the sequencer tempo is stored in an odd format, which packs the entire tempo range into a 7bit value. In beats per minute, the tempo ranges from 24 to 214. For values toward the ends of the spectrum, it skips by two.

  • 24bpm to 88bpm = by 2
  • 89bpm to 151bpm = by 1
  • 152bpm to 214bpm = by 2

The following C snippet should translate from BPM to nord-patch-file format and reverse.

unsigned char bpmToNordTempo(int b)
{
    if(b<24)
        return 0;
    else if(b<88)
        return (b-24)/2;
    else if(b<152)
        return b-88+32;
    else if(b<214)
        return (b-152)/2+96;
    else
        return 127;
}
 
int nordTempoToBpm(unsigned char t)
{
    if(t<32)
        return t*2+24;
    else if(t<96)
        return t-32+88;
    else if(t<128)
        return (t-96)*2+152;
    else
        return 214;
}
The Sentinel

Posted by cwright on 1999.11.18 @ 16:24

Filed under:

Today in Barton’s compsci class we went over simple user-controlled looping.  This allows us to collect variable amounts of input from user, without asking them explicitly for the number of fields in advance.

We used Barton’s Constant (-999) as a sentinel value to trigger the end of the data set.  In many ways this is a lame solution, since -999 may be a valid data point for some data sets, and it also requires additional instructions at each prompt to let the user know how to exit the loop.  In the future, we’ll hopefully learn how to trap Ctrl-C or Ctrl-D to make this simpler, or maybe we can simply detect a null input to indicate list completion.

Of course, all of the above is moot once we get into Graphical User Interfaces.  But for command-line stuff, I guess there aren’t really any better solutions…