mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-13 00:04:19 +00:00
added a CD-eject method for the mac; fixed a small CoreAudio bug; sorted out some minor message loop problems on the mac and windows; added a PlatformUtilities method to add an item to the OSX dock.
This commit is contained in:
parent
ec0557e7b6
commit
da340b4d2f
12 changed files with 129 additions and 14 deletions
|
|
@ -431,4 +431,13 @@ const String AudioCDBurner::burn (JUCE_NAMESPACE::AudioCDBurner::BurnProgressLis
|
|||
return error;
|
||||
}
|
||||
|
||||
|
||||
//==============================================================================
|
||||
void AudioCDReader::ejectDisk()
|
||||
{
|
||||
const ScopedAutoReleasePool p;
|
||||
[[NSWorkspace sharedWorkspace] unmountAndEjectDeviceAtPath: juceStringToNS (volumeDir.getFullPathName())];
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -166,7 +166,6 @@ public:
|
|||
{
|
||||
if (activeInputChans[chanNum])
|
||||
{
|
||||
inputChannelInfo [activeChans].sourceChannelNum = chanNum;
|
||||
inputChannelInfo [activeChans].streamNum = i;
|
||||
inputChannelInfo [activeChans].dataOffsetSamples = j;
|
||||
inputChannelInfo [activeChans].dataStrideSamples = b.mNumberChannels;
|
||||
|
|
@ -180,7 +179,6 @@ public:
|
|||
{
|
||||
if (activeOutputChans[chanNum])
|
||||
{
|
||||
outputChannelInfo [activeChans].sourceChannelNum = chanNum;
|
||||
outputChannelInfo [activeChans].streamNum = i;
|
||||
outputChannelInfo [activeChans].dataOffsetSamples = j;
|
||||
outputChannelInfo [activeChans].dataStrideSamples = b.mNumberChannels;
|
||||
|
|
@ -583,7 +581,7 @@ public:
|
|||
for (i = numInputChans; --i >= 0;)
|
||||
{
|
||||
const CallbackDetailsForChannel& info = inputChannelInfo[i];
|
||||
float* dest = tempInputBuffers [info.sourceChannelNum];
|
||||
float* dest = tempInputBuffers [i];
|
||||
const float* src = ((const float*) inInputData->mBuffers[info.streamNum].mData)
|
||||
+ info.dataOffsetSamples;
|
||||
const int stride = info.dataStrideSamples;
|
||||
|
|
@ -755,7 +753,6 @@ private:
|
|||
|
||||
struct CallbackDetailsForChannel
|
||||
{
|
||||
int sourceChannelNum;
|
||||
int streamNum;
|
||||
int dataOffsetSamples;
|
||||
int dataStrideSamples;
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ bool MessageManager::runDispatchLoopUntil (int millisecondsToRunFor)
|
|||
uint32 endTime = Time::getMillisecondCounter() + millisecondsToRunFor;
|
||||
NSDate* endDate = [NSDate dateWithTimeIntervalSinceNow: millisecondsToRunFor * 0.001];
|
||||
|
||||
while (Time::getMillisecondCounter() < endTime)
|
||||
while (Time::getMillisecondCounter() < endTime && ! quitMessagePosted)
|
||||
{
|
||||
const ScopedAutoReleasePool pool;
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,21 @@ void PlatformUtilities::beep()
|
|||
NSBeep();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void PlatformUtilities::addItemToDock (const File& file)
|
||||
{
|
||||
// check that it's not already there...
|
||||
if (! juce_getOutputFromCommand ("defaults read com.apple.dock persistent-apps")
|
||||
.containsIgnoreCase (file.getFullPathName()))
|
||||
{
|
||||
juce_runSystemCommand ("defaults write com.apple.dock persistent-apps -array-add \"<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>"
|
||||
+ file.getFullPathName() + "</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>\"");
|
||||
|
||||
juce_runSystemCommand ("osascript -e \"tell application \\\"Dock\\\" to quit\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//==============================================================================
|
||||
#if ! JUCE_ONLY_BUILD_CORE_LIBRARY
|
||||
|
||||
|
|
@ -243,6 +258,7 @@ void juce_updateMultiMonitorInfo (Array <Rectangle>& monitorCoords, const bool c
|
|||
jassert (monitorCoords.size() > 0);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ BEGIN_JUCE_NAMESPACE
|
|||
#include "../../../src/juce_appframework/gui/components/special/juce_WebBrowserComponent.h"
|
||||
#include "../../../src/juce_appframework/gui/components/filebrowser/juce_FileChooser.h"
|
||||
#include "../../../src/juce_appframework/audio/audio_file_formats/juce_AudioCDBurner.h"
|
||||
#include "../../../src/juce_appframework/audio/audio_file_formats/juce_AudioCDReader.h"
|
||||
#include "../../../src/juce_appframework/audio/audio_sources/juce_AudioSource.h"
|
||||
#include "../../../src/juce_appframework/audio/dsp/juce_AudioDataConverters.h"
|
||||
#include "../../../src/juce_appframework/audio/devices/juce_AudioIODeviceType.h"
|
||||
|
|
|
|||
|
|
@ -390,6 +390,26 @@ const String juce_getVolumeLabel (const String& filenameOnVolume,
|
|||
return String::empty;
|
||||
}
|
||||
|
||||
|
||||
//==============================================================================
|
||||
void juce_runSystemCommand (const String& command)
|
||||
{
|
||||
system ((const char*) command.toUTF8());
|
||||
}
|
||||
|
||||
const String juce_getOutputFromCommand (const String& command)
|
||||
{
|
||||
// slight bodge here, as we just pipe the output into a temp file and read it...
|
||||
const File tempFile (File::getSpecialLocation (File::tempDirectory)
|
||||
.getNonexistentChildFile (String::toHexString (Random::getSystemRandom().nextInt()), ".tmp", false));
|
||||
|
||||
juce_runSystemCommand (command + " > " + tempFile.getFullPathName());
|
||||
|
||||
String result (tempFile.loadFileAsString());
|
||||
tempFile.deleteFile();
|
||||
return result;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
#if JUCE_64BIT
|
||||
#define filedesc ((long long) internal)
|
||||
|
|
|
|||
|
|
@ -36933,7 +36933,13 @@ bool MessageManager::runDispatchLoopUntil (int millisecondsToRunFor)
|
|||
{
|
||||
JUCE_TRY
|
||||
{
|
||||
juce_dispatchNextMessageOnSystemQueue (millisecondsToRunFor >= 0);
|
||||
if (! juce_dispatchNextMessageOnSystemQueue (millisecondsToRunFor >= 0))
|
||||
{
|
||||
const int msToWait = (int) (endTime - Time::currentTimeMillis());
|
||||
|
||||
if (msToWait > 0)
|
||||
Thread::sleep (jmin (5, msToWait));
|
||||
}
|
||||
}
|
||||
JUCE_CATCH_EXCEPTION
|
||||
}
|
||||
|
|
@ -43768,7 +43774,7 @@ void Label::showEditor()
|
|||
if (editor == 0)
|
||||
{
|
||||
addAndMakeVisible (editor = createEditorComponent());
|
||||
editor->setText (getText());
|
||||
editor->setText (getText(), false);
|
||||
editor->addListener (this);
|
||||
editor->grabKeyboardFocus();
|
||||
editor->setHighlightedRegion (0, text.length());
|
||||
|
|
@ -60972,8 +60978,10 @@ void LookAndFeel::drawPopupMenuBackground (Graphics& g, int width, int height)
|
|||
for (int i = 0; i < height; i += 3)
|
||||
g.fillRect (0, i, width, 1);
|
||||
|
||||
#if ! JUCE_MAC
|
||||
g.setColour (findColour (PopupMenu::textColourId).withAlpha (0.6f));
|
||||
g.drawRect (0, 0, width, height);
|
||||
#endif
|
||||
}
|
||||
|
||||
void LookAndFeel::drawPopupMenuUpDownArrow (Graphics& g,
|
||||
|
|
@ -255314,6 +255322,24 @@ const String juce_getVolumeLabel (const String& filenameOnVolume,
|
|||
return String::empty;
|
||||
}
|
||||
|
||||
void juce_runSystemCommand (const String& command)
|
||||
{
|
||||
system ((const char*) command.toUTF8());
|
||||
}
|
||||
|
||||
const String juce_getOutputFromCommand (const String& command)
|
||||
{
|
||||
// slight bodge here, as we just pipe the output into a temp file and read it...
|
||||
const File tempFile (File::getSpecialLocation (File::tempDirectory)
|
||||
.getNonexistentChildFile (String::toHexString (Random::getSystemRandom().nextInt()), ".tmp", false));
|
||||
|
||||
juce_runSystemCommand (command + " > " + tempFile.getFullPathName());
|
||||
|
||||
String result (tempFile.loadFileAsString());
|
||||
tempFile.deleteFile();
|
||||
return result;
|
||||
}
|
||||
|
||||
#if JUCE_64BIT
|
||||
#define filedesc ((long long) internal)
|
||||
#else
|
||||
|
|
@ -265350,6 +265376,24 @@ const String juce_getVolumeLabel (const String& filenameOnVolume,
|
|||
return String::empty;
|
||||
}
|
||||
|
||||
void juce_runSystemCommand (const String& command)
|
||||
{
|
||||
system ((const char*) command.toUTF8());
|
||||
}
|
||||
|
||||
const String juce_getOutputFromCommand (const String& command)
|
||||
{
|
||||
// slight bodge here, as we just pipe the output into a temp file and read it...
|
||||
const File tempFile (File::getSpecialLocation (File::tempDirectory)
|
||||
.getNonexistentChildFile (String::toHexString (Random::getSystemRandom().nextInt()), ".tmp", false));
|
||||
|
||||
juce_runSystemCommand (command + " > " + tempFile.getFullPathName());
|
||||
|
||||
String result (tempFile.loadFileAsString());
|
||||
tempFile.deleteFile();
|
||||
return result;
|
||||
}
|
||||
|
||||
#if JUCE_64BIT
|
||||
#define filedesc ((long long) internal)
|
||||
#else
|
||||
|
|
@ -266036,6 +266080,19 @@ void PlatformUtilities::beep()
|
|||
NSBeep();
|
||||
}
|
||||
|
||||
void PlatformUtilities::addItemToDock (const File& file)
|
||||
{
|
||||
// check that it's not already there...
|
||||
if (! juce_getOutputFromCommand ("defaults read com.apple.dock persistent-apps")
|
||||
.containsIgnoreCase (file.getFullPathName()))
|
||||
{
|
||||
juce_runSystemCommand ("defaults write com.apple.dock persistent-apps -array-add \"<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>"
|
||||
+ file.getFullPathName() + "</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>\"");
|
||||
|
||||
juce_runSystemCommand ("osascript -e \"tell application \\\"Dock\\\" to quit\"");
|
||||
}
|
||||
}
|
||||
|
||||
#if ! JUCE_ONLY_BUILD_CORE_LIBRARY
|
||||
|
||||
bool AlertWindow::showNativeDialogBox (const String& title,
|
||||
|
|
@ -269801,6 +269858,12 @@ const String AudioCDBurner::burn (JUCE_NAMESPACE::AudioCDBurner::BurnProgressLis
|
|||
return error;
|
||||
}
|
||||
|
||||
void AudioCDReader::ejectDisk()
|
||||
{
|
||||
const ScopedAutoReleasePool p;
|
||||
[[NSWorkspace sharedWorkspace] unmountAndEjectDeviceAtPath: juceStringToNS (volumeDir.getFullPathName())];
|
||||
}
|
||||
|
||||
#endif
|
||||
/********* End of inlined file: juce_mac_AudioCDBurner.mm *********/
|
||||
|
||||
|
|
@ -270378,7 +270441,7 @@ bool MessageManager::runDispatchLoopUntil (int millisecondsToRunFor)
|
|||
uint32 endTime = Time::getMillisecondCounter() + millisecondsToRunFor;
|
||||
NSDate* endDate = [NSDate dateWithTimeIntervalSinceNow: millisecondsToRunFor * 0.001];
|
||||
|
||||
while (Time::getMillisecondCounter() < endTime)
|
||||
while (Time::getMillisecondCounter() < endTime && ! quitMessagePosted)
|
||||
{
|
||||
const ScopedAutoReleasePool pool;
|
||||
|
||||
|
|
@ -270850,7 +270913,6 @@ public:
|
|||
{
|
||||
if (activeInputChans[chanNum])
|
||||
{
|
||||
inputChannelInfo [activeChans].sourceChannelNum = chanNum;
|
||||
inputChannelInfo [activeChans].streamNum = i;
|
||||
inputChannelInfo [activeChans].dataOffsetSamples = j;
|
||||
inputChannelInfo [activeChans].dataStrideSamples = b.mNumberChannels;
|
||||
|
|
@ -270864,7 +270926,6 @@ public:
|
|||
{
|
||||
if (activeOutputChans[chanNum])
|
||||
{
|
||||
outputChannelInfo [activeChans].sourceChannelNum = chanNum;
|
||||
outputChannelInfo [activeChans].streamNum = i;
|
||||
outputChannelInfo [activeChans].dataOffsetSamples = j;
|
||||
outputChannelInfo [activeChans].dataStrideSamples = b.mNumberChannels;
|
||||
|
|
@ -271265,7 +271326,7 @@ public:
|
|||
for (i = numInputChans; --i >= 0;)
|
||||
{
|
||||
const CallbackDetailsForChannel& info = inputChannelInfo[i];
|
||||
float* dest = tempInputBuffers [info.sourceChannelNum];
|
||||
float* dest = tempInputBuffers [i];
|
||||
const float* src = ((const float*) inInputData->mBuffers[info.streamNum].mData)
|
||||
+ info.dataOffsetSamples;
|
||||
const int stride = info.dataStrideSamples;
|
||||
|
|
@ -271436,7 +271497,6 @@ private:
|
|||
|
||||
struct CallbackDetailsForChannel
|
||||
{
|
||||
int sourceChannelNum;
|
||||
int streamNum;
|
||||
int dataOffsetSamples;
|
||||
int dataStrideSamples;
|
||||
|
|
|
|||
|
|
@ -13121,6 +13121,8 @@ public:
|
|||
/** MAC ONLY - Returns true if this file is actually a bundle. */
|
||||
static bool isBundle (const String& filename);
|
||||
|
||||
/** MAC ONLY - Adds an item to the dock */
|
||||
static void addItemToDock (const File& file);
|
||||
#endif
|
||||
|
||||
#if JUCE_WIN32 || DOXYGEN
|
||||
|
|
|
|||
|
|
@ -163,7 +163,13 @@ bool MessageManager::runDispatchLoopUntil (int millisecondsToRunFor)
|
|||
{
|
||||
JUCE_TRY
|
||||
{
|
||||
juce_dispatchNextMessageOnSystemQueue (millisecondsToRunFor >= 0);
|
||||
if (! juce_dispatchNextMessageOnSystemQueue (millisecondsToRunFor >= 0))
|
||||
{
|
||||
const int msToWait = (int) (endTime - Time::currentTimeMillis());
|
||||
|
||||
if (msToWait > 0)
|
||||
Thread::sleep (jmin (5, msToWait));
|
||||
}
|
||||
}
|
||||
JUCE_CATCH_EXCEPTION
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ void Label::showEditor()
|
|||
if (editor == 0)
|
||||
{
|
||||
addAndMakeVisible (editor = createEditorComponent());
|
||||
editor->setText (getText());
|
||||
editor->setText (getText(), false);
|
||||
editor->addListener (this);
|
||||
editor->grabKeyboardFocus();
|
||||
editor->setHighlightedRegion (0, text.length());
|
||||
|
|
|
|||
|
|
@ -961,8 +961,10 @@ void LookAndFeel::drawPopupMenuBackground (Graphics& g, int width, int height)
|
|||
for (int i = 0; i < height; i += 3)
|
||||
g.fillRect (0, i, width, 1);
|
||||
|
||||
#if ! JUCE_MAC
|
||||
g.setColour (findColour (PopupMenu::textColourId).withAlpha (0.6f));
|
||||
g.drawRect (0, 0, width, height);
|
||||
#endif
|
||||
}
|
||||
|
||||
void LookAndFeel::drawPopupMenuUpDownArrow (Graphics& g,
|
||||
|
|
|
|||
|
|
@ -77,6 +77,8 @@ public:
|
|||
/** MAC ONLY - Returns true if this file is actually a bundle. */
|
||||
static bool isBundle (const String& filename);
|
||||
|
||||
/** MAC ONLY - Adds an item to the dock */
|
||||
static void addItemToDock (const File& file);
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue