Subversion Repositories svn.mios32

Rev

Rev 1041 | Rev 2053 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1041 Rev 1724
Line 1... Line 1...
1
/* -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- */
1
/* -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- */
2
// $Id: OscHelper.cpp 1041 2010-05-28 18:57:42Z tk $
2
// $Id: OscHelper.cpp 1724 2013-03-28 20:23:40Z tk $
3
/*
3
/*
4
 * OSC Help Routines
4
 * OSC Help Routines
5
 * (taken from MIOS32_OSC)
5
 * (taken from MIOS32_OSC)
6
 * Documentation: see there
6
 * Documentation: see there
7
 *
7
 *
Line 240... Line 240...
240
    unsigned char *buffer = new unsigned char(str.length() + 4);
240
    unsigned char *buffer = new unsigned char(str.length() + 4);
241
    unsigned char *endPtr = buffer;
241
    unsigned char *endPtr = buffer;
242
#if JUCE_MAJOR_VERSION == 1 && JUCE_MINOR_VERSION < 51
242
#if JUCE_MAJOR_VERSION == 1 && JUCE_MINOR_VERSION < 51
243
    endPtr = putString(buffer, (const char *)str);
243
    endPtr = putString(buffer, (const char *)str);
244
#else
244
#else
245
    endPtr = putString(buffer, str.toCString());
245
    endPtr = putString(buffer, str.toUTF8().getAddress());
246
#endif
246
#endif
247
    Array<uint8> tmp = Array<uint8>(buffer, endPtr-buffer);
247
    Array<uint8> tmp = Array<uint8>(buffer, endPtr-buffer);
248
    delete buffer;
248
    delete buffer;
249
    return tmp;
249
    return tmp;
250
}
250
}
Line 922... Line 922...
922
                unsigned seconds;
922
                unsigned seconds;
923
                unsigned fraction;
923
                unsigned fraction;
924
#if JUCE_MAJOR_VERSION == 1 && JUCE_MINOR_VERSION < 51
924
#if JUCE_MAJOR_VERSION == 1 && JUCE_MINOR_VERSION < 51
925
                if( sscanf((const char*)word, "@%u.%u", &seconds, &fraction) != 2 ) {
925
                if( sscanf((const char*)word, "@%u.%u", &seconds, &fraction) != 2 ) {
926
#else
926
#else
927
                if( sscanf((const char*)word.toCString(), "@%u.%u", &seconds, &fraction) != 2 ) {
927
                if( sscanf((const char*)word.toUTF8().getAddress(), "@%u.%u", &seconds, &fraction) != 2 ) {
928
#endif
928
#endif
929
                    statusMessage = T("syntax: <seconds>.<fraction>");
929
                    statusMessage = T("syntax: <seconds>.<fraction>");
930
                    return Array<uint8>();
930
                    return Array<uint8>();
931
                } else {
931
                } else {
932
                    timetag.seconds = seconds;
932
                    timetag.seconds = seconds;
Line 982... Line 982...
982
            int len;
982
            int len;
983
            unsigned value;
983
            unsigned value;
984
#if JUCE_MAJOR_VERSION == 1 && JUCE_MINOR_VERSION < 51
984
#if JUCE_MAJOR_VERSION == 1 && JUCE_MINOR_VERSION < 51
985
            if( sscanf((const char*)word.substring(1), "%d:%x", &len, &value) != 2 ) {
985
            if( sscanf((const char*)word.substring(1), "%d:%x", &len, &value) != 2 ) {
986
#else
986
#else
987
            if( sscanf((const char*)word.substring(1).toCString(), "%d:%x", &len, &value) != 2 ) {
987
            if( sscanf((const char*)word.substring(1).toUTF8().getAddress(), "%d:%x", &len, &value) != 2 ) {
988
#endif
988
#endif
989
                statusMessage = T("please enter blob length and hex value (syntax: <len>:<data>)");
989
                statusMessage = T("please enter blob length and hex value (syntax: <len>:<data>)");
990
                return Array<uint8>();
990
                return Array<uint8>();
991
            } else if( len != 4 ) {
991
            } else if( len != 4 ) {
992
                statusMessage = T(":-/ only 4 byte blobs supported yet! :-/");
992
                statusMessage = T(":-/ only 4 byte blobs supported yet! :-/");
Line 1017... Line 1017...
1017
                unsigned seconds;
1017
                unsigned seconds;
1018
                unsigned fraction;
1018
                unsigned fraction;
1019
#if JUCE_MAJOR_VERSION == 1 && JUCE_MINOR_VERSION < 51
1019
#if JUCE_MAJOR_VERSION == 1 && JUCE_MINOR_VERSION < 51
1020
                if( sscanf((const char*)word.substring(1), "%u.%u", &seconds, &fraction) != 2 ) {
1020
                if( sscanf((const char*)word.substring(1), "%u.%u", &seconds, &fraction) != 2 ) {
1021
#else
1021
#else
1022
                if( sscanf((const char*)word.substring(1).toCString(), "%u.%u", &seconds, &fraction) != 2 ) {
1022
                if( sscanf((const char*)word.substring(1).toUTF8().getAddress(), "%u.%u", &seconds, &fraction) != 2 ) {
1023
#endif
1023
#endif
1024
                    statusMessage = T("syntax: <seconds>.<fraction>");
1024
                    statusMessage = T("syntax: <seconds>.<fraction>");
1025
                    return Array<uint8>();
1025
                    return Array<uint8>();
1026
                } else {
1026
                } else {
1027
                    oscArgsString += arg;
1027
                    oscArgsString += arg;
Line 1063... Line 1063...
1063
            } else {
1063
            } else {
1064
                unsigned value;
1064
                unsigned value;
1065
#if JUCE_MAJOR_VERSION == 1 && JUCE_MINOR_VERSION < 51
1065
#if JUCE_MAJOR_VERSION == 1 && JUCE_MINOR_VERSION < 51
1066
                if( sscanf((const char*)word.substring(1), "%x", &value) != 1 ) {
1066
                if( sscanf((const char*)word.substring(1), "%x", &value) != 1 ) {
1067
#else
1067
#else
1068
                if( sscanf((const char*)word.substring(1).toCString(), "%x", &value) != 1 ) {
1068
                if( sscanf((const char*)word.substring(1).toUTF8().getAddress(), "%x", &value) != 1 ) {
1069
#endif
1069
#endif
1070
                    statusMessage = String(T("ERROR: expecting hex value for '") + arg + T("' argument!"));
1070
                    statusMessage = String(T("ERROR: expecting hex value for '") + arg + T("' argument!"));
1071
                    return Array<uint8>();
1071
                    return Array<uint8>();
1072
                } else {
1072
                } else {
1073
                    oscArgsString += arg;
1073
                    oscArgsString += arg;