mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-01 03:10:06 +00:00
Fix for AU bundle paths; added column width access to TableHeaderComponent, made FileBasedDocument do extra checking about file overwriting
This commit is contained in:
parent
1c01e897d9
commit
7e56a7514c
7 changed files with 345 additions and 352 deletions
|
|
@ -191,6 +191,12 @@ void TableHeaderComponent::moveColumn (const int columnId, int newIndex)
|
|||
}
|
||||
}
|
||||
|
||||
int TableHeaderComponent::getColumnWidth (const int columnId) const throw()
|
||||
{
|
||||
const ColumnInfo* const ci = getInfoForId (columnId);
|
||||
return ci != 0 ? ci->width : 0;
|
||||
}
|
||||
|
||||
void TableHeaderComponent::setColumnWidth (const int columnId, const int newWidth)
|
||||
{
|
||||
ColumnInfo* const ci = getInfoForId (columnId);
|
||||
|
|
|
|||
|
|
@ -193,6 +193,10 @@ public:
|
|||
*/
|
||||
void moveColumn (const int columnId, int newVisibleIndex);
|
||||
|
||||
/** Returns the width of one of the columns.
|
||||
*/
|
||||
int getColumnWidth (const int columnId) const throw();
|
||||
|
||||
/** Changes the width of a column.
|
||||
|
||||
This will cause an asynchronous callback to the tableColumnsResized() method of any registered listeners.
|
||||
|
|
|
|||
|
|
@ -29,4 +29,293 @@
|
|||
|
||||
|
||||
|
||||
|
||||
class IPhoneAudioIODevice : public AudioIODeviceType
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
IPhoneAudioIODevice (const String& deviceName, const bool isInput_)
|
||||
: AudioIODevice (deviceName, T("Audio")),
|
||||
isInput (isInput_),
|
||||
isOpen_ (false),
|
||||
isStarted (false)
|
||||
{
|
||||
}
|
||||
|
||||
~IPhoneAudioIODeviceType()
|
||||
{
|
||||
}
|
||||
|
||||
const StringArray getOutputChannelNames()
|
||||
{
|
||||
StringArray s;
|
||||
if (! isInput)
|
||||
{
|
||||
s.add ("Left");
|
||||
s.add ("Right");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
const StringArray getInputChannelNames()
|
||||
{
|
||||
StringArray s;
|
||||
if (isInput)
|
||||
{
|
||||
s.add ("Left");
|
||||
s.add ("Right");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
int getNumSampleRates()
|
||||
{
|
||||
return sampleRates.size();
|
||||
}
|
||||
|
||||
double getSampleRate (int index)
|
||||
{
|
||||
return sampleRates [index];
|
||||
}
|
||||
|
||||
int getNumBufferSizesAvailable()
|
||||
{
|
||||
return bufferSizes.size();
|
||||
}
|
||||
|
||||
int getBufferSizeSamples (int index)
|
||||
{
|
||||
return bufferSizes [index];
|
||||
}
|
||||
|
||||
int getDefaultBufferSize()
|
||||
{
|
||||
for (int i = 0; i < getNumBufferSizesAvailable(); ++i)
|
||||
if (getBufferSizeSamples(i) >= 512)
|
||||
return getBufferSizeSamples(i);
|
||||
|
||||
return 512;
|
||||
}
|
||||
|
||||
const String open (const BitArray& inputChannels,
|
||||
const BitArray& outputChannels,
|
||||
double sampleRate,
|
||||
int bufferSizeSamples)
|
||||
{
|
||||
isOpen_ = true;
|
||||
|
||||
if (bufferSizeSamples <= 0)
|
||||
bufferSizeSamples = getDefaultBufferSize();
|
||||
|
||||
lastError = String::empty;
|
||||
|
||||
|
||||
|
||||
isOpen_ = lastError.isEmpty();
|
||||
return lastError;
|
||||
}
|
||||
|
||||
void close()
|
||||
{
|
||||
isOpen_ = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool isOpen()
|
||||
{
|
||||
return isOpen_;
|
||||
}
|
||||
|
||||
int getCurrentBufferSizeSamples()
|
||||
{
|
||||
return internal != 0 ? internal->getBufferSize() : 512;
|
||||
}
|
||||
|
||||
double getCurrentSampleRate()
|
||||
{
|
||||
return internal != 0 ? internal->getSampleRate() : 0;
|
||||
}
|
||||
|
||||
int getCurrentBitDepth()
|
||||
{
|
||||
return 32; // no way to find out, so just assume it's high..
|
||||
}
|
||||
|
||||
const BitArray getActiveOutputChannels() const
|
||||
{
|
||||
return internal != 0 ? internal->activeOutputChans : BitArray();
|
||||
}
|
||||
|
||||
const BitArray getActiveInputChannels() const
|
||||
{
|
||||
BitArray chans;
|
||||
|
||||
if (internal != 0)
|
||||
{
|
||||
chans = internal->activeInputChans;
|
||||
|
||||
if (internal->inputDevice != 0)
|
||||
chans.orWith (internal->inputDevice->activeInputChans);
|
||||
}
|
||||
|
||||
return chans;
|
||||
}
|
||||
|
||||
int getOutputLatencyInSamples()
|
||||
{
|
||||
if (internal == 0)
|
||||
return 0;
|
||||
|
||||
// this seems like a good guess at getting the latency right - comparing
|
||||
// this with a round-trip measurement, it gets it to within a few millisecs
|
||||
// for the built-in mac soundcard
|
||||
return internal->outputLatency + internal->getBufferSize() * 2;
|
||||
}
|
||||
|
||||
int getInputLatencyInSamples()
|
||||
{
|
||||
if (internal == 0)
|
||||
return 0;
|
||||
|
||||
return internal->inputLatency + internal->getBufferSize() * 2;
|
||||
}
|
||||
|
||||
void start (AudioIODeviceCallback* callback)
|
||||
{
|
||||
if (internal != 0 && ! isStarted)
|
||||
{
|
||||
if (callback != 0)
|
||||
callback->audioDeviceAboutToStart (this);
|
||||
|
||||
isStarted = true;
|
||||
internal->start (callback);
|
||||
}
|
||||
}
|
||||
|
||||
void stop()
|
||||
{
|
||||
if (isStarted && internal != 0)
|
||||
{
|
||||
AudioIODeviceCallback* const lastCallback = internal->callback;
|
||||
|
||||
isStarted = false;
|
||||
internal->stop (true);
|
||||
|
||||
if (lastCallback != 0)
|
||||
lastCallback->audioDeviceStopped();
|
||||
}
|
||||
}
|
||||
|
||||
bool isPlaying()
|
||||
{
|
||||
if (internal->callback == 0)
|
||||
isStarted = false;
|
||||
|
||||
return isStarted;
|
||||
}
|
||||
|
||||
const String getLastError()
|
||||
{
|
||||
return lastError;
|
||||
}
|
||||
|
||||
int inputIndex, outputIndex;
|
||||
|
||||
juce_UseDebuggingNewOperator
|
||||
|
||||
private:
|
||||
CoreAudioInternal* internal;
|
||||
bool isOpen_, isStarted;
|
||||
String lastError;
|
||||
|
||||
static OSStatus hardwareListenerProc (AudioDeviceID /*inDevice*/, UInt32 /*inLine*/, const AudioObjectPropertyAddress* pa, void* inClientData)
|
||||
{
|
||||
CoreAudioInternal* const intern = (CoreAudioInternal*) inClientData;
|
||||
|
||||
switch (pa->mSelector)
|
||||
{
|
||||
case kAudioHardwarePropertyDevices:
|
||||
intern->deviceDetailsChanged();
|
||||
break;
|
||||
|
||||
case kAudioHardwarePropertyDefaultOutputDevice:
|
||||
case kAudioHardwarePropertyDefaultInputDevice:
|
||||
case kAudioHardwarePropertyDefaultSystemOutputDevice:
|
||||
break;
|
||||
}
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
CoreAudioIODevice (const CoreAudioIODevice&);
|
||||
const CoreAudioIODevice& operator= (const CoreAudioIODevice&);
|
||||
};
|
||||
|
||||
|
||||
//==============================================================================
|
||||
class IPhoneAudioIODeviceType : public AudioIODeviceType
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
IPhoneAudioIODeviceType()
|
||||
: AudioIODeviceType (T("iPhone Audio")),
|
||||
hasScanned (false)
|
||||
{
|
||||
}
|
||||
|
||||
~IPhoneAudioIODeviceType()
|
||||
{
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void scanForDevices()
|
||||
{
|
||||
}
|
||||
|
||||
const StringArray getDeviceNames (const bool wantInputNames) const
|
||||
{
|
||||
StringArray s;
|
||||
return s;
|
||||
}
|
||||
|
||||
int getDefaultDeviceIndex (const bool forInput) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getIndexOfDevice (AudioIODevice* device, const bool asInput) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool hasSeparateInputsAndOutputs() const { return true; }
|
||||
|
||||
AudioIODevice* createDevice (const String& outputDeviceName,
|
||||
const String& inputDeviceName)
|
||||
{
|
||||
if (outputDeviceName.isNotEmpty() && inputDeviceName.isNotEmpty())
|
||||
return new CoreAudioIODevice (deviceName,
|
||||
inputIds [inputIndex],
|
||||
inputIndex,
|
||||
outputIds [outputIndex],
|
||||
outputIndex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
juce_UseDebuggingNewOperator
|
||||
|
||||
private:
|
||||
IPhoneAudioIODeviceType (const IPhoneAudioIODeviceType&);
|
||||
const IPhoneAudioIODeviceType& operator= (const IPhoneAudioIODeviceType&);
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
AudioIODeviceType* juce_createAudioIODeviceType_iPhoneAudio()
|
||||
{
|
||||
return new IPhoneAudioIODeviceType();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -263,8 +263,24 @@ FileBasedDocument::SaveResult FileBasedDocument::saveAsInteractive (const bool w
|
|||
|
||||
File chosen (fc.getResult());
|
||||
if (chosen.getFileExtension().isEmpty())
|
||||
{
|
||||
chosen = chosen.withFileExtension (fileExtension);
|
||||
|
||||
if (chosen.exists())
|
||||
{
|
||||
if (! AlertWindow::showOkCancelBox (AlertWindow::WarningIcon,
|
||||
TRANS("File already exists"),
|
||||
TRANS("There's already a file called:\n\n")
|
||||
+ chosen.getFullPathName()
|
||||
+ T("\n\nAre you sure you want to overwrite it?"),
|
||||
TRANS("overwrite"),
|
||||
TRANS("cancel")))
|
||||
{
|
||||
return userCancelledSave;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return saveAs (chosen, false, false, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue