Send the received command to Audacity and build an array of response lines. The response lines can be retrieved by calling DoSrvMore repeatedly.
| 64 | // Send the received command to Audacity and build an array of response lines. |
| 65 | // The response lines can be retrieved by calling DoSrvMore repeatedly. |
| 66 | int DoSrv(char *pIn) |
| 67 | { |
| 68 | // Interpret string as unicode. |
| 69 | // wxWidgets (now) uses unicode internally. |
| 70 | // Scripts must send unicode strings (if going beyond 7-bit ASCII). |
| 71 | // Important for filenames in commands. |
| 72 | wxString Str1(pIn, wxConvUTF8); |
| 73 | Str1.Replace( wxT("\r"), wxT("")); |
| 74 | Str1.Replace( wxT("\n"), wxT("")); |
| 75 | Str2 = wxEmptyString; |
| 76 | (*pScriptServerFn)( &Str1 , &Str2); |
| 77 | |
| 78 | Str2 += wxT('\n'); |
| 79 | size_t outputLength = Str2.Length(); |
| 80 | aStr.Clear(); |
| 81 | size_t iStart = 0; |
| 82 | size_t i; |
| 83 | for(i = 0; i < outputLength; ++i) |
| 84 | { |
| 85 | if( Str2[i] == wxT('\n') ) |
| 86 | { |
| 87 | aStr.Add( Str2.Mid( iStart, i-iStart) + wxT("\n") ); |
| 88 | iStart = i+1; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | currentLine = 0; |
| 93 | currentPosition = 0; |
| 94 | |
| 95 | return 1; |
| 96 | } |
| 97 | |
| 98 | size_t smin(size_t a, size_t b) { return a < b ? a : b; } |
| 99 |
no test coverage detected