The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

629 lines
22KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 5 End-User License
  8. Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
  9. 27th April 2017).
  10. End User License Agreement: www.juce.com/juce-5-licence
  11. Privacy Policy: www.juce.com/juce-5-privacy-policy
  12. Or: You may also use this code under the terms of the GPL v3 (see
  13. www.gnu.org/licenses).
  14. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  15. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  16. DISCLAIMED.
  17. ==============================================================================
  18. */
  19. namespace juce
  20. {
  21. #if JUCE_USE_FLAC
  22. }
  23. #if defined _WIN32 && !defined __CYGWIN__
  24. #include <io.h>
  25. #else
  26. #include <unistd.h>
  27. #endif
  28. #if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__
  29. #include <sys/types.h> /* for off_t */
  30. #endif
  31. #if HAVE_INTTYPES_H
  32. #define __STDC_FORMAT_MACROS
  33. #include <inttypes.h>
  34. #endif
  35. #if defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ || defined __EMX__
  36. #include <io.h> /* for _setmode(), chmod() */
  37. #include <fcntl.h> /* for _O_BINARY */
  38. #else
  39. #include <unistd.h> /* for chown(), unlink() */
  40. #endif
  41. #if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__
  42. #if defined __BORLANDC__
  43. #include <utime.h> /* for utime() */
  44. #else
  45. #include <sys/utime.h> /* for utime() */
  46. #endif
  47. #else
  48. #include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */
  49. #include <utime.h> /* for utime() */
  50. #endif
  51. #if defined _MSC_VER
  52. #if _MSC_VER >= 1600
  53. #include <stdint.h>
  54. #else
  55. #include <limits.h>
  56. #endif
  57. #endif
  58. #ifdef _WIN32
  59. #include <stdio.h>
  60. #include <sys/stat.h>
  61. #include <stdarg.h>
  62. #include <windows.h>
  63. #endif
  64. #ifdef DEBUG
  65. #include <assert.h>
  66. #endif
  67. #include <stdlib.h>
  68. #include <stdio.h>
  69. namespace juce
  70. {
  71. namespace FlacNamespace
  72. {
  73. #if JUCE_INCLUDE_FLAC_CODE || ! defined (JUCE_INCLUDE_FLAC_CODE)
  74. #undef VERSION
  75. #define VERSION "1.3.1"
  76. #define FLAC__NO_DLL 1
  77. #if JUCE_MSVC
  78. #pragma warning (disable: 4267 4127 4244 4996 4100 4701 4702 4013 4133 4206 4312 4505 4365 4005 4334 181 111)
  79. #else
  80. #define HAVE_LROUND 1
  81. #endif
  82. #if JUCE_MAC
  83. #define FLAC__SYS_DARWIN 1
  84. #endif
  85. #ifndef SIZE_MAX
  86. #define SIZE_MAX 0xffffffff
  87. #endif
  88. #if JUCE_CLANG
  89. #pragma clang diagnostic push
  90. #pragma clang diagnostic ignored "-Wconversion"
  91. #pragma clang diagnostic ignored "-Wshadow"
  92. #pragma clang diagnostic ignored "-Wdeprecated-register"
  93. #endif
  94. #if JUCE_INTEL
  95. #if JUCE_32BIT
  96. #define FLAC__CPU_IA32 1
  97. #endif
  98. #if JUCE_64BIT
  99. #define FLAC__CPU_X86_64 1
  100. #endif
  101. #define FLAC__HAS_X86INTRIN 1
  102. #endif
  103. #undef __STDC_LIMIT_MACROS
  104. #define __STDC_LIMIT_MACROS 1
  105. #define flac_max jmax
  106. #define flac_min jmin
  107. #undef DEBUG // (some flac code dumps debug trace if the app defines this macro)
  108. #include "flac/all.h"
  109. #include "flac/libFLAC/bitmath.c"
  110. #include "flac/libFLAC/bitreader.c"
  111. #include "flac/libFLAC/bitwriter.c"
  112. #include "flac/libFLAC/cpu.c"
  113. #include "flac/libFLAC/crc.c"
  114. #include "flac/libFLAC/fixed.c"
  115. #include "flac/libFLAC/float.c"
  116. #include "flac/libFLAC/format.c"
  117. #include "flac/libFLAC/lpc_flac.c"
  118. #include "flac/libFLAC/md5.c"
  119. #include "flac/libFLAC/memory.c"
  120. #include "flac/libFLAC/stream_decoder.c"
  121. #include "flac/libFLAC/stream_encoder.c"
  122. #include "flac/libFLAC/stream_encoder_framing.c"
  123. #include "flac/libFLAC/window_flac.c"
  124. #undef VERSION
  125. #else
  126. #include <FLAC/all.h>
  127. #endif
  128. #if JUCE_CLANG
  129. #pragma clang diagnostic pop
  130. #endif
  131. }
  132. #undef max
  133. #undef min
  134. //==============================================================================
  135. static const char* const flacFormatName = "FLAC file";
  136. //==============================================================================
  137. class FlacReader : public AudioFormatReader
  138. {
  139. public:
  140. FlacReader (InputStream* const in)
  141. : AudioFormatReader (in, flacFormatName),
  142. reservoirStart (0),
  143. samplesInReservoir (0),
  144. scanningForLength (false)
  145. {
  146. using namespace FlacNamespace;
  147. lengthInSamples = 0;
  148. decoder = FLAC__stream_decoder_new();
  149. ok = FLAC__stream_decoder_init_stream (decoder,
  150. readCallback_, seekCallback_, tellCallback_, lengthCallback_,
  151. eofCallback_, writeCallback_, metadataCallback_, errorCallback_,
  152. this) == FLAC__STREAM_DECODER_INIT_STATUS_OK;
  153. if (ok)
  154. {
  155. FLAC__stream_decoder_process_until_end_of_metadata (decoder);
  156. if (lengthInSamples == 0 && sampleRate > 0)
  157. {
  158. // the length hasn't been stored in the metadata, so we'll need to
  159. // work it out the length the hard way, by scanning the whole file..
  160. scanningForLength = true;
  161. FLAC__stream_decoder_process_until_end_of_stream (decoder);
  162. scanningForLength = false;
  163. const int64 tempLength = lengthInSamples;
  164. FLAC__stream_decoder_reset (decoder);
  165. FLAC__stream_decoder_process_until_end_of_metadata (decoder);
  166. lengthInSamples = tempLength;
  167. }
  168. }
  169. }
  170. ~FlacReader()
  171. {
  172. FlacNamespace::FLAC__stream_decoder_delete (decoder);
  173. }
  174. void useMetadata (const FlacNamespace::FLAC__StreamMetadata_StreamInfo& info)
  175. {
  176. sampleRate = info.sample_rate;
  177. bitsPerSample = info.bits_per_sample;
  178. lengthInSamples = (unsigned int) info.total_samples;
  179. numChannels = info.channels;
  180. reservoir.setSize ((int) numChannels, 2 * (int) info.max_blocksize, false, false, true);
  181. }
  182. // returns the number of samples read
  183. bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
  184. int64 startSampleInFile, int numSamples) override
  185. {
  186. using namespace FlacNamespace;
  187. if (! ok)
  188. return false;
  189. while (numSamples > 0)
  190. {
  191. if (startSampleInFile >= reservoirStart
  192. && startSampleInFile < reservoirStart + samplesInReservoir)
  193. {
  194. const int num = (int) jmin ((int64) numSamples,
  195. reservoirStart + samplesInReservoir - startSampleInFile);
  196. jassert (num > 0);
  197. for (int i = jmin (numDestChannels, reservoir.getNumChannels()); --i >= 0;)
  198. if (destSamples[i] != nullptr)
  199. memcpy (destSamples[i] + startOffsetInDestBuffer,
  200. reservoir.getReadPointer (i, (int) (startSampleInFile - reservoirStart)),
  201. sizeof (int) * (size_t) num);
  202. startOffsetInDestBuffer += num;
  203. startSampleInFile += num;
  204. numSamples -= num;
  205. }
  206. else
  207. {
  208. if (startSampleInFile >= (int) lengthInSamples)
  209. {
  210. samplesInReservoir = 0;
  211. }
  212. else if (startSampleInFile < reservoirStart
  213. || startSampleInFile > reservoirStart + jmax (samplesInReservoir, 511))
  214. {
  215. // had some problems with flac crashing if the read pos is aligned more
  216. // accurately than this. Probably fixed in newer versions of the library, though.
  217. reservoirStart = (int) (startSampleInFile & ~511);
  218. samplesInReservoir = 0;
  219. FLAC__stream_decoder_seek_absolute (decoder, (FLAC__uint64) reservoirStart);
  220. }
  221. else
  222. {
  223. reservoirStart += samplesInReservoir;
  224. samplesInReservoir = 0;
  225. FLAC__stream_decoder_process_single (decoder);
  226. }
  227. if (samplesInReservoir == 0)
  228. break;
  229. }
  230. }
  231. if (numSamples > 0)
  232. {
  233. for (int i = numDestChannels; --i >= 0;)
  234. if (destSamples[i] != nullptr)
  235. zeromem (destSamples[i] + startOffsetInDestBuffer, sizeof (int) * (size_t) numSamples);
  236. }
  237. return true;
  238. }
  239. void useSamples (const FlacNamespace::FLAC__int32* const buffer[], int numSamples)
  240. {
  241. if (scanningForLength)
  242. {
  243. lengthInSamples += numSamples;
  244. }
  245. else
  246. {
  247. if (numSamples > reservoir.getNumSamples())
  248. reservoir.setSize ((int) numChannels, numSamples, false, false, true);
  249. const unsigned int bitsToShift = 32 - bitsPerSample;
  250. for (int i = 0; i < (int) numChannels; ++i)
  251. {
  252. const FlacNamespace::FLAC__int32* src = buffer[i];
  253. int n = i;
  254. while (src == 0 && n > 0)
  255. src = buffer [--n];
  256. if (src != nullptr)
  257. {
  258. int* const dest = reinterpret_cast<int*> (reservoir.getWritePointer(i));
  259. for (int j = 0; j < numSamples; ++j)
  260. dest[j] = src[j] << bitsToShift;
  261. }
  262. }
  263. samplesInReservoir = numSamples;
  264. }
  265. }
  266. //==============================================================================
  267. static FlacNamespace::FLAC__StreamDecoderReadStatus readCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__byte buffer[], size_t* bytes, void* client_data)
  268. {
  269. using namespace FlacNamespace;
  270. *bytes = (size_t) static_cast<const FlacReader*> (client_data)->input->read (buffer, (int) *bytes);
  271. return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
  272. }
  273. static FlacNamespace::FLAC__StreamDecoderSeekStatus seekCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__uint64 absolute_byte_offset, void* client_data)
  274. {
  275. using namespace FlacNamespace;
  276. static_cast<const FlacReader*> (client_data)->input->setPosition ((int) absolute_byte_offset);
  277. return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
  278. }
  279. static FlacNamespace::FLAC__StreamDecoderTellStatus tellCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__uint64* absolute_byte_offset, void* client_data)
  280. {
  281. using namespace FlacNamespace;
  282. *absolute_byte_offset = (uint64) static_cast<const FlacReader*> (client_data)->input->getPosition();
  283. return FLAC__STREAM_DECODER_TELL_STATUS_OK;
  284. }
  285. static FlacNamespace::FLAC__StreamDecoderLengthStatus lengthCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__uint64* stream_length, void* client_data)
  286. {
  287. using namespace FlacNamespace;
  288. *stream_length = (uint64) static_cast<const FlacReader*> (client_data)->input->getTotalLength();
  289. return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
  290. }
  291. static FlacNamespace::FLAC__bool eofCallback_ (const FlacNamespace::FLAC__StreamDecoder*, void* client_data)
  292. {
  293. return static_cast<const FlacReader*> (client_data)->input->isExhausted();
  294. }
  295. static FlacNamespace::FLAC__StreamDecoderWriteStatus writeCallback_ (const FlacNamespace::FLAC__StreamDecoder*,
  296. const FlacNamespace::FLAC__Frame* frame,
  297. const FlacNamespace::FLAC__int32* const buffer[],
  298. void* client_data)
  299. {
  300. using namespace FlacNamespace;
  301. static_cast<FlacReader*> (client_data)->useSamples (buffer, (int) frame->header.blocksize);
  302. return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
  303. }
  304. static void metadataCallback_ (const FlacNamespace::FLAC__StreamDecoder*,
  305. const FlacNamespace::FLAC__StreamMetadata* metadata,
  306. void* client_data)
  307. {
  308. static_cast<FlacReader*> (client_data)->useMetadata (metadata->data.stream_info);
  309. }
  310. static void errorCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__StreamDecoderErrorStatus, void*)
  311. {
  312. }
  313. private:
  314. FlacNamespace::FLAC__StreamDecoder* decoder;
  315. AudioSampleBuffer reservoir;
  316. int reservoirStart, samplesInReservoir;
  317. bool ok, scanningForLength;
  318. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FlacReader)
  319. };
  320. //==============================================================================
  321. class FlacWriter : public AudioFormatWriter
  322. {
  323. public:
  324. FlacWriter (OutputStream* const out, double rate, uint32 numChans, uint32 bits, int qualityOptionIndex)
  325. : AudioFormatWriter (out, flacFormatName, rate, numChans, bits),
  326. streamStartPos (output != nullptr ? jmax (output->getPosition(), 0ll) : 0ll)
  327. {
  328. using namespace FlacNamespace;
  329. encoder = FLAC__stream_encoder_new();
  330. if (qualityOptionIndex > 0)
  331. FLAC__stream_encoder_set_compression_level (encoder, (uint32) jmin (8, qualityOptionIndex));
  332. FLAC__stream_encoder_set_do_mid_side_stereo (encoder, numChannels == 2);
  333. FLAC__stream_encoder_set_loose_mid_side_stereo (encoder, numChannels == 2);
  334. FLAC__stream_encoder_set_channels (encoder, numChannels);
  335. FLAC__stream_encoder_set_bits_per_sample (encoder, jmin ((unsigned int) 24, bitsPerSample));
  336. FLAC__stream_encoder_set_sample_rate (encoder, (unsigned int) sampleRate);
  337. FLAC__stream_encoder_set_blocksize (encoder, 0);
  338. FLAC__stream_encoder_set_do_escape_coding (encoder, true);
  339. ok = FLAC__stream_encoder_init_stream (encoder,
  340. encodeWriteCallback, encodeSeekCallback,
  341. encodeTellCallback, encodeMetadataCallback,
  342. this) == FLAC__STREAM_ENCODER_INIT_STATUS_OK;
  343. }
  344. ~FlacWriter()
  345. {
  346. if (ok)
  347. {
  348. FlacNamespace::FLAC__stream_encoder_finish (encoder);
  349. output->flush();
  350. }
  351. else
  352. {
  353. output = nullptr; // to stop the base class deleting this, as it needs to be returned
  354. // to the caller of createWriter()
  355. }
  356. FlacNamespace::FLAC__stream_encoder_delete (encoder);
  357. }
  358. //==============================================================================
  359. bool write (const int** samplesToWrite, int numSamples) override
  360. {
  361. using namespace FlacNamespace;
  362. if (! ok)
  363. return false;
  364. HeapBlock<int*> channels;
  365. HeapBlock<int> temp;
  366. const int bitsToShift = 32 - (int) bitsPerSample;
  367. if (bitsToShift > 0)
  368. {
  369. temp.malloc (numChannels * (size_t) numSamples);
  370. channels.calloc (numChannels + 1);
  371. for (unsigned int i = 0; i < numChannels; ++i)
  372. {
  373. if (samplesToWrite[i] == nullptr)
  374. break;
  375. int* const destData = temp.get() + i * (size_t) numSamples;
  376. channels[i] = destData;
  377. for (int j = 0; j < numSamples; ++j)
  378. destData[j] = (samplesToWrite[i][j] >> bitsToShift);
  379. }
  380. samplesToWrite = const_cast<const int**> (channels.get());
  381. }
  382. return FLAC__stream_encoder_process (encoder, (const FLAC__int32**) samplesToWrite, (unsigned) numSamples) != 0;
  383. }
  384. bool writeData (const void* const data, const int size) const
  385. {
  386. return output->write (data, (size_t) size);
  387. }
  388. static void packUint32 (FlacNamespace::FLAC__uint32 val, FlacNamespace::FLAC__byte* b, const int bytes)
  389. {
  390. b += bytes;
  391. for (int i = 0; i < bytes; ++i)
  392. {
  393. *(--b) = (FlacNamespace::FLAC__byte) (val & 0xff);
  394. val >>= 8;
  395. }
  396. }
  397. void writeMetaData (const FlacNamespace::FLAC__StreamMetadata* metadata)
  398. {
  399. using namespace FlacNamespace;
  400. const FLAC__StreamMetadata_StreamInfo& info = metadata->data.stream_info;
  401. unsigned char buffer [FLAC__STREAM_METADATA_STREAMINFO_LENGTH];
  402. const unsigned int channelsMinus1 = info.channels - 1;
  403. const unsigned int bitsMinus1 = info.bits_per_sample - 1;
  404. packUint32 (info.min_blocksize, buffer, 2);
  405. packUint32 (info.max_blocksize, buffer + 2, 2);
  406. packUint32 (info.min_framesize, buffer + 4, 3);
  407. packUint32 (info.max_framesize, buffer + 7, 3);
  408. buffer[10] = (uint8) ((info.sample_rate >> 12) & 0xff);
  409. buffer[11] = (uint8) ((info.sample_rate >> 4) & 0xff);
  410. buffer[12] = (uint8) (((info.sample_rate & 0x0f) << 4) | (channelsMinus1 << 1) | (bitsMinus1 >> 4));
  411. buffer[13] = (FLAC__byte) (((bitsMinus1 & 0x0f) << 4) | (unsigned int) ((info.total_samples >> 32) & 0x0f));
  412. packUint32 ((FLAC__uint32) info.total_samples, buffer + 14, 4);
  413. memcpy (buffer + 18, info.md5sum, 16);
  414. const bool seekOk = output->setPosition (streamStartPos + 4);
  415. ignoreUnused (seekOk);
  416. // if this fails, you've given it an output stream that can't seek! It needs
  417. // to be able to seek back to write the header
  418. jassert (seekOk);
  419. output->writeIntBigEndian (FLAC__STREAM_METADATA_STREAMINFO_LENGTH);
  420. output->write (buffer, FLAC__STREAM_METADATA_STREAMINFO_LENGTH);
  421. }
  422. //==============================================================================
  423. static FlacNamespace::FLAC__StreamEncoderWriteStatus encodeWriteCallback (const FlacNamespace::FLAC__StreamEncoder*,
  424. const FlacNamespace::FLAC__byte buffer[],
  425. size_t bytes,
  426. unsigned int /*samples*/,
  427. unsigned int /*current_frame*/,
  428. void* client_data)
  429. {
  430. using namespace FlacNamespace;
  431. return static_cast<FlacWriter*> (client_data)->writeData (buffer, (int) bytes)
  432. ? FLAC__STREAM_ENCODER_WRITE_STATUS_OK
  433. : FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
  434. }
  435. static FlacNamespace::FLAC__StreamEncoderSeekStatus encodeSeekCallback (const FlacNamespace::FLAC__StreamEncoder*, FlacNamespace::FLAC__uint64, void*)
  436. {
  437. using namespace FlacNamespace;
  438. return FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED;
  439. }
  440. static FlacNamespace::FLAC__StreamEncoderTellStatus encodeTellCallback (const FlacNamespace::FLAC__StreamEncoder*, FlacNamespace::FLAC__uint64* absolute_byte_offset, void* client_data)
  441. {
  442. using namespace FlacNamespace;
  443. if (client_data == nullptr)
  444. return FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED;
  445. *absolute_byte_offset = (FLAC__uint64) static_cast<FlacWriter*> (client_data)->output->getPosition();
  446. return FLAC__STREAM_ENCODER_TELL_STATUS_OK;
  447. }
  448. static void encodeMetadataCallback (const FlacNamespace::FLAC__StreamEncoder*, const FlacNamespace::FLAC__StreamMetadata* metadata, void* client_data)
  449. {
  450. static_cast<FlacWriter*> (client_data)->writeMetaData (metadata);
  451. }
  452. bool ok;
  453. private:
  454. FlacNamespace::FLAC__StreamEncoder* encoder;
  455. int64 streamStartPos;
  456. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FlacWriter)
  457. };
  458. //==============================================================================
  459. FlacAudioFormat::FlacAudioFormat()
  460. : AudioFormat (flacFormatName, ".flac")
  461. {
  462. }
  463. FlacAudioFormat::~FlacAudioFormat()
  464. {
  465. }
  466. Array<int> FlacAudioFormat::getPossibleSampleRates()
  467. {
  468. const int rates[] = { 8000, 11025, 12000, 16000, 22050, 32000, 44100, 48000,
  469. 88200, 96000, 176400, 192000, 352800, 384000 };
  470. return Array<int> (rates, numElementsInArray (rates));
  471. }
  472. Array<int> FlacAudioFormat::getPossibleBitDepths()
  473. {
  474. const int depths[] = { 16, 24 };
  475. return Array<int> (depths, numElementsInArray (depths));
  476. }
  477. bool FlacAudioFormat::canDoStereo() { return true; }
  478. bool FlacAudioFormat::canDoMono() { return true; }
  479. bool FlacAudioFormat::isCompressed() { return true; }
  480. AudioFormatReader* FlacAudioFormat::createReaderFor (InputStream* in, const bool deleteStreamIfOpeningFails)
  481. {
  482. ScopedPointer<FlacReader> r (new FlacReader (in));
  483. if (r->sampleRate > 0)
  484. return r.release();
  485. if (! deleteStreamIfOpeningFails)
  486. r->input = nullptr;
  487. return nullptr;
  488. }
  489. AudioFormatWriter* FlacAudioFormat::createWriterFor (OutputStream* out,
  490. double sampleRate,
  491. unsigned int numberOfChannels,
  492. int bitsPerSample,
  493. const StringPairArray& /*metadataValues*/,
  494. int qualityOptionIndex)
  495. {
  496. if (out != nullptr && getPossibleBitDepths().contains (bitsPerSample))
  497. {
  498. ScopedPointer<FlacWriter> w (new FlacWriter (out, sampleRate, numberOfChannels,
  499. (uint32) bitsPerSample, qualityOptionIndex));
  500. if (w->ok)
  501. return w.release();
  502. }
  503. return nullptr;
  504. }
  505. StringArray FlacAudioFormat::getQualityOptions()
  506. {
  507. static const char* options[] = { "0 (Fastest)", "1", "2", "3", "4", "5 (Default)","6", "7", "8 (Highest quality)", 0 };
  508. return StringArray (options);
  509. }
  510. #endif
  511. } // namespace juce