Browse Source

Initial check-in of a new WASAPI audio device wrapper (not properly tested yet!), and tidied up all the audio device type creation functions to make it easier to cope with all these different device types. Added a couple of config entries to enable WASAPI and DSound, so a windows build can use any combination of device APIs. Also replaced the string-to-double conversion code with a custom function to avoid localisation problems with commas and full-stops.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
7dfc764bf0
19 changed files with 5618 additions and 3155 deletions
  1. +5
    -0
      .gitignore
  2. +2877
    -2873
      build/win32/vc8/JUCE.vcproj
  3. +1
    -3
      extras/browser plugins/demo/test.html
  4. +12
    -0
      juce_Config.h
  5. +1242
    -42
      juce_amalgamated.cpp
  6. +195
    -182
      juce_amalgamated.h
  7. +1
    -1
      src/audio/audio_file_formats/juce_AudioFormat.cpp
  8. +24
    -18
      src/audio/devices/juce_AudioDeviceManager.cpp
  9. +1
    -0
      src/core/juce_SystemStats.h
  10. +9
    -9
      src/juce_app_includes.h
  11. +1
    -0
      src/native/juce_win32_NativeCode.cpp
  12. +2
    -13
      src/native/linux/juce_linux_Audio.cpp
  13. +2
    -2
      src/native/mac/juce_mac_CoreAudio.cpp
  14. +1
    -1
      src/native/windows/juce_win32_ASIO.cpp
  15. +7
    -7
      src/native/windows/juce_win32_DirectSound.cpp
  16. +8
    -0
      src/native/windows/juce_win32_NativeIncludes.h
  17. +1
    -1
      src/native/windows/juce_win32_SystemStats.cpp
  18. +1080
    -0
      src/native/windows/juce_win32_WASAPI.cpp
  19. +149
    -3
      src/text/juce_CharacterFunctions.cpp

+ 5
- 0
.gitignore View File

@@ -6,6 +6,11 @@
*.ncb
*.suo
*.obj
*.ilk
*.pch
*.pdb
*.dep
*.idb
extras/juce demo/build/macosx/build
extras/juce demo/build/win32_vc8/Debug
extras/juce demo/build/win32_vc8/Release


+ 2877
- 2873
build/win32/vc8/JUCE.vcproj
File diff suppressed because it is too large
View File


+ 1
- 3
extras/browser plugins/demo/test.html View File

@@ -41,15 +41,13 @@ function sendCallbackObjectToPlugin()

</script>

<!-- This tag works in IE - for Netscape plugins, remove or rename the classid tag
and it should use the npapi plugin instead -->
<object id="plugin"
type="application/npjucedemo-plugin"
classid="CLSID:F683B990-3ADF-11DE-BDFE-F9CB55D89593"
width="80%" height="400">
<embed src="" type="application/npjucedemo-plugin" width="80%" height="400"></embed>
</object>


<br>
<form name="formname">
<input type=button value="Tell the plugin to show a message" onclick='showAMessage()'>


+ 12
- 0
juce_Config.h View File

@@ -73,6 +73,18 @@
#define JUCE_ASIO 1
#endif
/** Comment out this macro to disable the Windows WASAPI audio device type.
*/
#ifndef JUCE_WASAPI
// #define JUCE_WASAPI 1
#endif
/** Comment out this macro to disable the Windows WASAPI audio device type.
*/
#ifndef JUCE_DIRECTSOUND
#define JUCE_DIRECTSOUND 1
#endif
/** Comment out this macro to disable building of ALSA device support on Linux.
*/
#ifndef JUCE_ALSA


+ 1242
- 42
juce_amalgamated.cpp
File diff suppressed because it is too large
View File


+ 195
- 182
juce_amalgamated.h View File

@@ -118,6 +118,18 @@
#define JUCE_ASIO 1
#endif

/** Comment out this macro to disable the Windows WASAPI audio device type.
*/
#ifndef JUCE_WASAPI
// #define JUCE_WASAPI 1
#endif

/** Comment out this macro to disable the Windows WASAPI audio device type.
*/
#ifndef JUCE_DIRECTSOUND
#define JUCE_DIRECTSOUND 1
#endif

/** Comment out this macro to disable building of ALSA device support on Linux.
*/
#ifndef JUCE_ALSA
@@ -8206,6 +8218,7 @@ public:
Win2000 = 0x4105,
WinXP = 0x4106,
WinVista = 0x4107,
Windows7 = 0x4108,

Windows = 0x4000, /**< To test whether any version of Windows is running,
you can use the expression ((getOperatingSystemType() & Windows) != 0). */
@@ -37167,72 +37180,6 @@ private:
#endif
#ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__

#endif
#ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__

/********* Start of inlined file: juce_AudioSubsectionReader.h *********/
#ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
#define __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__

/**
This class is used to wrap an AudioFormatReader and only read from a
subsection of the file.

So if you have a reader which can read a 1000 sample file, you could wrap it
in one of these to only access, e.g. samples 100 to 200, and any samples
outside that will come back as 0. Accessing sample 0 from this reader will
actually read the first sample from the other's subsection, which might
be at a non-zero position.

@see AudioFormatReader
*/
class JUCE_API AudioSubsectionReader : public AudioFormatReader
{
public:

/** Creates a AudioSubsectionReader for a given data source.

@param sourceReader the source reader from which we'll be taking data
@param subsectionStartSample the sample within the source reader which will be
mapped onto sample 0 for this reader.
@param subsectionLength the number of samples from the source that will
make up the subsection. If this reader is asked for
any samples beyond this region, it will return zero.
@param deleteSourceWhenDeleted if true, the sourceReader object will be deleted when
this object is deleted.
*/
AudioSubsectionReader (AudioFormatReader* const sourceReader,
const int64 subsectionStartSample,
const int64 subsectionLength,
const bool deleteSourceWhenDeleted);

/** Destructor. */
~AudioSubsectionReader();

bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
int64 startSampleInFile, int numSamples);

void readMaxLevels (int64 startSample,
int64 numSamples,
float& lowestLeft,
float& highestLeft,
float& lowestRight,
float& highestRight);

juce_UseDebuggingNewOperator

private:
AudioFormatReader* const source;
int64 startSample, length;
const bool deleteSourceWhenDeleted;

AudioSubsectionReader (const AudioSubsectionReader&);
const AudioSubsectionReader& operator= (const AudioSubsectionReader&);
};

#endif // __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
/********* End of inlined file: juce_AudioSubsectionReader.h *********/

#endif
#ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__

@@ -37387,6 +37334,72 @@ private:
#endif // __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
/********* End of inlined file: juce_AudioThumbnail.h *********/

#endif
#ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__

/********* Start of inlined file: juce_AudioSubsectionReader.h *********/
#ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
#define __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__

/**
This class is used to wrap an AudioFormatReader and only read from a
subsection of the file.

So if you have a reader which can read a 1000 sample file, you could wrap it
in one of these to only access, e.g. samples 100 to 200, and any samples
outside that will come back as 0. Accessing sample 0 from this reader will
actually read the first sample from the other's subsection, which might
be at a non-zero position.

@see AudioFormatReader
*/
class JUCE_API AudioSubsectionReader : public AudioFormatReader
{
public:

/** Creates a AudioSubsectionReader for a given data source.

@param sourceReader the source reader from which we'll be taking data
@param subsectionStartSample the sample within the source reader which will be
mapped onto sample 0 for this reader.
@param subsectionLength the number of samples from the source that will
make up the subsection. If this reader is asked for
any samples beyond this region, it will return zero.
@param deleteSourceWhenDeleted if true, the sourceReader object will be deleted when
this object is deleted.
*/
AudioSubsectionReader (AudioFormatReader* const sourceReader,
const int64 subsectionStartSample,
const int64 subsectionLength,
const bool deleteSourceWhenDeleted);

/** Destructor. */
~AudioSubsectionReader();

bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
int64 startSampleInFile, int numSamples);

void readMaxLevels (int64 startSample,
int64 numSamples,
float& lowestLeft,
float& highestLeft,
float& lowestRight,
float& highestRight);

juce_UseDebuggingNewOperator

private:
AudioFormatReader* const source;
int64 startSample, length;
const bool deleteSourceWhenDeleted;

AudioSubsectionReader (const AudioSubsectionReader&);
const AudioSubsectionReader& operator= (const AudioSubsectionReader&);
};

#endif // __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
/********* End of inlined file: juce_AudioSubsectionReader.h *********/

#endif
#ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__

@@ -37501,114 +37514,6 @@ public:
#endif // __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
/********* End of inlined file: juce_FlacAudioFormat.h *********/

#endif
#ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__

/********* Start of inlined file: juce_OggVorbisAudioFormat.h *********/
#ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
#define __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__

#if JUCE_USE_OGGVORBIS || defined (DOXYGEN)

/**
Reads and writes the Ogg-Vorbis audio format.

To compile this, you'll need to set the JUCE_USE_OGGVORBIS flag in juce_Config.h,
and make sure your include search path and library search path are set up to find
the Vorbis and Ogg header files and static libraries.

@see AudioFormat,
*/
class JUCE_API OggVorbisAudioFormat : public AudioFormat
{
public:

OggVorbisAudioFormat();
~OggVorbisAudioFormat();

const Array <int> getPossibleSampleRates();
const Array <int> getPossibleBitDepths();
bool canDoStereo();
bool canDoMono();
bool isCompressed();
const StringArray getQualityOptions();

/** Tries to estimate the quality level of an ogg file based on its size.

If it can't read the file for some reason, this will just return 1 (medium quality),
otherwise it will return the approximate quality setting that would have been used
to create the file.

@see getQualityOptions
*/
int estimateOggFileQuality (const File& source);

AudioFormatReader* createReaderFor (InputStream* sourceStream,
const bool deleteStreamIfOpeningFails);

AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
double sampleRateToUse,
unsigned int numberOfChannels,
int bitsPerSample,
const StringPairArray& metadataValues,
int qualityOptionIndex);

juce_UseDebuggingNewOperator
};

#endif
#endif // __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
/********* End of inlined file: juce_OggVorbisAudioFormat.h *********/

#endif
#ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__

/********* Start of inlined file: juce_QuickTimeAudioFormat.h *********/
#ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
#define __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__

#if JUCE_QUICKTIME

/**
Uses QuickTime to read the audio track a movie or media file.

As well as QuickTime movies, this should also manage to open other audio
files that quicktime can understand, like mp3, m4a, etc.

@see AudioFormat
*/
class JUCE_API QuickTimeAudioFormat : public AudioFormat
{
public:

/** Creates a format object. */
QuickTimeAudioFormat();

/** Destructor. */
~QuickTimeAudioFormat();

const Array <int> getPossibleSampleRates();
const Array <int> getPossibleBitDepths();
bool canDoStereo();
bool canDoMono();

AudioFormatReader* createReaderFor (InputStream* sourceStream,
const bool deleteStreamIfOpeningFails);

AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
double sampleRateToUse,
unsigned int numberOfChannels,
int bitsPerSample,
const StringPairArray& metadataValues,
int qualityOptionIndex);

juce_UseDebuggingNewOperator
};

#endif
#endif // __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
/********* End of inlined file: juce_QuickTimeAudioFormat.h *********/

#endif
#ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__

@@ -37731,6 +37636,114 @@ public:
#endif // __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
/********* End of inlined file: juce_WavAudioFormat.h *********/

#endif
#ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__

/********* Start of inlined file: juce_OggVorbisAudioFormat.h *********/
#ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
#define __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__

#if JUCE_USE_OGGVORBIS || defined (DOXYGEN)

/**
Reads and writes the Ogg-Vorbis audio format.

To compile this, you'll need to set the JUCE_USE_OGGVORBIS flag in juce_Config.h,
and make sure your include search path and library search path are set up to find
the Vorbis and Ogg header files and static libraries.

@see AudioFormat,
*/
class JUCE_API OggVorbisAudioFormat : public AudioFormat
{
public:

OggVorbisAudioFormat();
~OggVorbisAudioFormat();

const Array <int> getPossibleSampleRates();
const Array <int> getPossibleBitDepths();
bool canDoStereo();
bool canDoMono();
bool isCompressed();
const StringArray getQualityOptions();

/** Tries to estimate the quality level of an ogg file based on its size.

If it can't read the file for some reason, this will just return 1 (medium quality),
otherwise it will return the approximate quality setting that would have been used
to create the file.

@see getQualityOptions
*/
int estimateOggFileQuality (const File& source);

AudioFormatReader* createReaderFor (InputStream* sourceStream,
const bool deleteStreamIfOpeningFails);

AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
double sampleRateToUse,
unsigned int numberOfChannels,
int bitsPerSample,
const StringPairArray& metadataValues,
int qualityOptionIndex);

juce_UseDebuggingNewOperator
};

#endif
#endif // __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
/********* End of inlined file: juce_OggVorbisAudioFormat.h *********/

#endif
#ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__

/********* Start of inlined file: juce_QuickTimeAudioFormat.h *********/
#ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
#define __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__

#if JUCE_QUICKTIME

/**
Uses QuickTime to read the audio track a movie or media file.

As well as QuickTime movies, this should also manage to open other audio
files that quicktime can understand, like mp3, m4a, etc.

@see AudioFormat
*/
class JUCE_API QuickTimeAudioFormat : public AudioFormat
{
public:

/** Creates a format object. */
QuickTimeAudioFormat();

/** Destructor. */
~QuickTimeAudioFormat();

const Array <int> getPossibleSampleRates();
const Array <int> getPossibleBitDepths();
bool canDoStereo();
bool canDoMono();

AudioFormatReader* createReaderFor (InputStream* sourceStream,
const bool deleteStreamIfOpeningFails);

AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
double sampleRateToUse,
unsigned int numberOfChannels,
int bitsPerSample,
const StringPairArray& metadataValues,
int qualityOptionIndex);

juce_UseDebuggingNewOperator
};

#endif
#endif // __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
/********* End of inlined file: juce_QuickTimeAudioFormat.h *********/

#endif
#ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__

@@ -41118,7 +41131,11 @@ private:
/********* End of inlined file: juce_ImageFileFormat.h *********/

#endif
#ifndef __JUCE_DRAWABLE_JUCEHEADER__
#ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__

/********* Start of inlined file: juce_DrawableComposite.h *********/
#ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
#define __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__

/********* Start of inlined file: juce_Drawable.h *********/
#ifndef __JUCE_DRAWABLE_JUCEHEADER__
@@ -41274,13 +41291,6 @@ private:
#endif // __JUCE_DRAWABLE_JUCEHEADER__
/********* End of inlined file: juce_Drawable.h *********/

#endif
#ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__

/********* Start of inlined file: juce_DrawableComposite.h *********/
#ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
#define __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__

/**
A drawable object which acts as a container for a set of other Drawables.

@@ -41399,6 +41409,9 @@ private:
#endif // __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
/********* End of inlined file: juce_DrawableComposite.h *********/

#endif
#ifndef __JUCE_DRAWABLE_JUCEHEADER__

#endif
#ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__



+ 1
- 1
src/audio/audio_file_formats/juce_AudioFormat.cpp View File

@@ -204,7 +204,7 @@ void AudioFormatReader::readMaxLevels (int64 startSampleInFile,
numSamples -= numToDo;
startSampleInFile += numToDo;
for (int j = numChannels; --j >= 0;)
{
int bufMax = INT_MIN;


+ 24
- 18
src/audio/devices/juce_AudioDeviceManager.cpp View File

@@ -107,30 +107,36 @@ const OwnedArray <AudioIODeviceType>& AudioDeviceManager::getAvailableDeviceType
}
//==============================================================================
extern AudioIODeviceType* juce_createDefaultAudioIODeviceType();
#if JUCE_WIN32 && JUCE_ASIO
extern AudioIODeviceType* juce_createASIOAudioIODeviceType();
#endif
#if JUCE_WIN32 && JUCE_WDM_AUDIO
extern AudioIODeviceType* juce_createWDMAudioIODeviceType();
#endif
AudioIODeviceType* juce_createAudioIODeviceType_CoreAudio();
AudioIODeviceType* juce_createAudioIODeviceType_WASAPI();
AudioIODeviceType* juce_createAudioIODeviceType_DirectSound();
AudioIODeviceType* juce_createAudioIODeviceType_ASIO();
AudioIODeviceType* juce_createAudioIODeviceType_ALSA();
void AudioDeviceManager::createAudioDeviceTypes (OwnedArray <AudioIODeviceType>& list)
{
AudioIODeviceType* const defaultDeviceType = juce_createDefaultAudioIODeviceType();
#if JUCE_WIN32
#if JUCE_WASAPI
if (SystemStats::getOperatingSystemType() >= SystemStats::WinVista)
list.add (juce_createAudioIODeviceType_WASAPI());
#endif
#if JUCE_DIRECTSOUND
list.add (juce_createAudioIODeviceType_DirectSound());
#endif
if (defaultDeviceType != 0)
list.add (defaultDeviceType);
#if JUCE_ASIO
list.add (juce_createAudioIODeviceType_ASIO());
#endif
#endif
#if JUCE_WIN32 && JUCE_ASIO
list.add (juce_createASIOAudioIODeviceType());
#endif
#if JUCE_MAC
list.add (juce_createAudioIODeviceType_CoreAudio());
#endif
#if JUCE_WIN32 && JUCE_WDM_AUDIO
list.add (juce_createWDMAudioIODeviceType());
#endif
#if JUCE_LINUX && JUCE_ALSA
list.add (juce_createAudioIODeviceType_ALSA());
#endif
}
//==============================================================================


+ 1
- 0
src/core/juce_SystemStats.h View File

@@ -60,6 +60,7 @@ public:
Win2000 = 0x4105,
WinXP = 0x4106,
WinVista = 0x4107,
Windows7 = 0x4108,
Windows = 0x4000, /**< To test whether any version of Windows is running,
you can use the expression ((getOperatingSystemType() & Windows) != 0). */


+ 9
- 9
src/juce_app_includes.h View File

@@ -203,27 +203,27 @@
#ifndef __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
#include "audio/audio_file_formats/juce_AudioFormatWriter.h"
#endif
#ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
#include "audio/audio_file_formats/juce_AudioSubsectionReader.h"
#endif
#ifndef __JUCE_AUDIOTHUMBNAIL_JUCEHEADER__
#include "audio/audio_file_formats/juce_AudioThumbnail.h"
#endif
#ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
#include "audio/audio_file_formats/juce_AudioSubsectionReader.h"
#endif
#ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
#include "audio/audio_file_formats/juce_AudioThumbnailCache.h"
#endif
#ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
#include "audio/audio_file_formats/juce_FlacAudioFormat.h"
#endif
#ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
#include "audio/audio_file_formats/juce_WavAudioFormat.h"
#endif
#ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
#include "audio/audio_file_formats/juce_OggVorbisAudioFormat.h"
#endif
#ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
#include "audio/audio_file_formats/juce_QuickTimeAudioFormat.h"
#endif
#ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
#include "audio/audio_file_formats/juce_WavAudioFormat.h"
#endif
#ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
#include "events/juce_ActionBroadcaster.h"
#endif
@@ -371,12 +371,12 @@
#ifndef __JUCE_IMAGEFILEFORMAT_JUCEHEADER__
#include "gui/graphics/imaging/juce_ImageFileFormat.h"
#endif
#ifndef __JUCE_DRAWABLE_JUCEHEADER__
#include "gui/graphics/drawables/juce_Drawable.h"
#endif
#ifndef __JUCE_DRAWABLECOMPOSITE_JUCEHEADER__
#include "gui/graphics/drawables/juce_DrawableComposite.h"
#endif
#ifndef __JUCE_DRAWABLE_JUCEHEADER__
#include "gui/graphics/drawables/juce_Drawable.h"
#endif
#ifndef __JUCE_DRAWABLEIMAGE_JUCEHEADER__
#include "gui/graphics/drawables/juce_DrawableImage.h"
#endif


+ 1
- 0
src/native/juce_win32_NativeCode.cpp View File

@@ -105,6 +105,7 @@ BEGIN_JUCE_NAMESPACE
#include "windows/juce_win32_Midi.cpp"
#include "windows/juce_win32_ASIO.cpp"
#include "windows/juce_win32_DirectSound.cpp"
#include "windows/juce_win32_WASAPI.cpp"
#include "windows/juce_win32_CameraDevice.cpp"
#endif


+ 2
- 13
src/native/linux/juce_linux_Audio.cpp View File

@@ -25,9 +25,7 @@
// (This file gets included by juce_linux_NativeCode.cpp, rather than being
// compiled on its own).
#ifdef JUCE_INCLUDED_FILE
#if JUCE_ALSA
#ifdef JUCE_INCLUDED_FILE && JUCE_ALSA
//==============================================================================
static const int maxNumChans = 64;
@@ -992,18 +990,9 @@ private:
};
//==============================================================================
AudioIODeviceType* juce_createDefaultAudioIODeviceType()
AudioIODeviceType* juce_createAudioIODeviceType_ALSA()
{
return new ALSAAudioIODeviceType();
}
//==============================================================================
#else // if ALSA is turned off..
AudioIODeviceType* juce_createDefaultAudioIODeviceType()
{
return 0;
}
#endif
#endif

+ 2
- 2
src/native/mac/juce_mac_CoreAudio.cpp View File

@@ -169,7 +169,7 @@ public:
zerostruct (channelName);
UInt32 nameSize = sizeof (channelName);
if (AudioDeviceGetProperty (deviceID, chanNum + 1, input, kAudioDevicePropertyChannelName,
if (AudioDeviceGetProperty (deviceID, chanNum + 1, input, kAudioDevicePropertyChannelName,
&nameSize, &channelName) == noErr)
name = String::fromUTF8 (channelName, nameSize);
}
@@ -1310,7 +1310,7 @@ private:
};
//==============================================================================
AudioIODeviceType* juce_createDefaultAudioIODeviceType()
AudioIODeviceType* juce_createAudioIODeviceType_CoreAudio()
{
return new CoreAudioIODeviceType();
}


+ 1
- 1
src/native/windows/juce_win32_ASIO.cpp View File

@@ -1949,7 +1949,7 @@ private:
const ASIOAudioIODeviceType& operator= (const ASIOAudioIODeviceType&);
};
AudioIODeviceType* juce_createASIOAudioIODeviceType()
AudioIODeviceType* juce_createAudioIODeviceType_ASIO()
{
return new ASIOAudioIODeviceType();
}


+ 7
- 7
src/native/windows/juce_win32_DirectSound.cpp View File

@@ -25,7 +25,7 @@
// (This file gets included by juce_win32_NativeCode.cpp, rather than being
// compiled on its own).
#if JUCE_INCLUDED_FILE
#if JUCE_INCLUDED_FILE && JUCE_DIRECTSOUND
//==============================================================================
END_JUCE_NAMESPACE
@@ -1491,12 +1491,6 @@ private:
const DSoundAudioIODeviceType& operator= (const DSoundAudioIODeviceType&);
};
//==============================================================================
AudioIODeviceType* juce_createDefaultAudioIODeviceType()
{
return new DSoundAudioIODeviceType();
}
//==============================================================================
const String DSoundAudioIODevice::openDevice (const BitArray& inputChannels,
const BitArray& outputChannels,
@@ -1633,6 +1627,12 @@ const String DSoundAudioIODevice::openDevice (const BitArray& inputChannels,
return error;
}
//==============================================================================
AudioIODeviceType* juce_createAudioIODeviceType_DirectSound()
{
return new DSoundAudioIODeviceType();
}
#undef log


+ 8
- 0
src/native/windows/juce_win32_NativeIncludes.h View File

@@ -133,6 +133,14 @@
#include <qedit.h>
#endif
//==============================================================================
#if JUCE_WASAPI
#include <MMReg.h>
#include <mmdeviceapi.h>
#include <Audioclient.h>
#include <functiondiscoverykeys.h>
#endif
//==============================================================================
#if JUCE_QUICKTIME


+ 1
- 1
src/native/windows/juce_win32_SystemStats.cpp View File

@@ -258,7 +258,7 @@ SystemStats::OperatingSystemType SystemStats::getOperatingSystemType() throw()
return (info.dwMinorVersion == 0) ? Win2000 : WinXP;
case 6:
return WinVista;
return (info.dwMinorVersion == 0) ? WinVista : Windows7;
default:
jassertfalse // !! not a supported OS!


+ 1080
- 0
src/native/windows/juce_win32_WASAPI.cpp
File diff suppressed because it is too large
View File


+ 149
- 3
src/text/juce_CharacterFunctions.cpp View File

@@ -431,15 +431,161 @@ int64 CharacterFunctions::getInt64Value (const juce_wchar* s) throw()
#endif
}
//==============================================================================
static double juce_mulexp10 (const double value, int exponent) throw()
{
if (exponent == 0)
return value;
if (value == 0)
return 0;
const bool negative = (exponent < 0);
if (negative)
exponent = -exponent;
double result = 1.0, power = 10.0;
for (int bit = 1; exponent != 0; bit <<= 1)
{
if ((exponent & bit) != 0)
{
exponent ^= bit;
result *= power;
if (exponent == 0)
break;
}
power *= power;
}
return negative ? (value / result) : (value * result);
}
template <class CharType>
double juce_atof (const CharType* const original) throw()
{
double result[3] = { 0, 0, 0 }, accumulator[2] = { 0, 0 };
int exponentAdjustment[2] = { 0, 0 }, exponentAccumulator[2] = { -1, -1 };
int exponent = 0, decPointIndex = 0, digit = 0;
int lastDigit = 0, numSignificantDigits = 0;
bool isNegative = false, digitsFound = false;
const int maxSignificantDigits = 15 + 2;
const CharType* s = original;
while (CharacterFunctions::isWhitespace (*s))
++s;
switch (*s)
{
case '-': isNegative = true; // fall-through..
case '+': ++s;
}
if (*s == 'n' || *s == 'N' || *s == 'i' || *s == 'I')
return atof (String (original)); // Let the c library deal with NAN and INF
for (;;)
{
if (CharacterFunctions::isDigit (*s))
{
lastDigit = digit;
digit = *s++ - '0';
digitsFound = true;
if (decPointIndex != 0)
exponentAdjustment[1]++;
if (numSignificantDigits == 0 && digit == 0)
continue;
if (++numSignificantDigits > maxSignificantDigits)
{
if (digit > 5)
++accumulator [decPointIndex];
else if (digit == 5 && (lastDigit & 1) != 0)
++accumulator [decPointIndex];
if (decPointIndex > 0)
exponentAdjustment[1]--;
else
exponentAdjustment[0]++;
while (CharacterFunctions::isDigit (*s))
{
++s;
if (decPointIndex == 0)
exponentAdjustment[0]++;
}
}
else
{
const double maxAccumulatorValue = (double) ((UINT_MAX - 9) / 10);
if (accumulator [decPointIndex] > maxAccumulatorValue)
{
result [decPointIndex] = juce_mulexp10 (result [decPointIndex], exponentAccumulator [decPointIndex])
+ accumulator [decPointIndex];
accumulator [decPointIndex] = 0;
exponentAccumulator [decPointIndex] = 0;
}
accumulator [decPointIndex] = accumulator[decPointIndex] * 10 + digit;
exponentAccumulator [decPointIndex]++;
}
}
else if (decPointIndex == 0 && *s == '.')
{
++s;
decPointIndex = 1;
if (numSignificantDigits > maxSignificantDigits)
{
while (CharacterFunctions::isDigit (*s))
++s;
break;
}
}
else
{
break;
}
}
result[0] = juce_mulexp10 (result[0], exponentAccumulator[0]) + accumulator[0];
if (decPointIndex != 0)
result[1] = juce_mulexp10 (result[1], exponentAccumulator[1]) + accumulator[1];
if ((*s == 'e' || *s == 'E') && digitsFound)
{
bool negativeExponent = false;
switch (*++s)
{
case '-': negativeExponent = true; // fall-through..
case '+': ++s;
}
while (CharacterFunctions::isDigit (*s))
exponent = (exponent * 10) + (*s++ - '0');
if (negativeExponent)
exponent = -exponent;
}
double r = juce_mulexp10 (result[0], exponent + exponentAdjustment[0]);
if (decPointIndex != 0)
r += juce_mulexp10 (result[1], exponent - exponentAdjustment[1]);
return isNegative ? -r : r;
}
double CharacterFunctions::getDoubleValue (const char* const s) throw()
{
return atof (s);
return juce_atof <char> (s);
}
double CharacterFunctions::getDoubleValue (const juce_wchar* const s) throw()
{
wchar_t* endChar;
return wcstod (s, &endChar);
return juce_atof <juce_wchar> (s);
}
//==============================================================================


Loading…
Cancel
Save