Browse Source

Fixed some documentation and minor GCC warnings. Fixed a JACK bug that would have mixed up the input/output channels.

tags/2021-05-28
jules 13 years ago
parent
commit
c16c3a7c28
17 changed files with 90 additions and 116 deletions
  1. +1
    -1
      modules/juce_audio_devices/native/juce_linux_ALSA.cpp
  2. +51
    -76
      modules/juce_audio_devices/native/juce_linux_JackAudio.cpp
  3. +1
    -1
      modules/juce_audio_formats/codecs/flac/libFLAC/stream_encoder.c
  4. +1
    -1
      modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.2/lib/floor0.c
  5. +1
    -1
      modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.2/lib/floor1.c
  6. +2
    -2
      modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.2/lib/os.h
  7. +3
    -3
      modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.2/lib/res0.c
  8. +1
    -1
      modules/juce_core/maths/juce_Range.h
  9. +4
    -4
      modules/juce_core/native/juce_linux_Network.cpp
  10. +2
    -2
      modules/juce_events/native/juce_linux_Messaging.cpp
  11. +2
    -2
      modules/juce_graphics/image_formats/pnglib/pngconf.h
  12. +2
    -2
      modules/juce_gui_basics/mouse/juce_MouseCursor.h
  13. +3
    -4
      modules/juce_gui_basics/native/juce_linux_Clipboard.cpp
  14. +4
    -4
      modules/juce_gui_basics/native/juce_linux_FileChooser.cpp
  15. +10
    -10
      modules/juce_gui_basics/native/juce_linux_Windowing.cpp
  16. +1
    -1
      modules/juce_gui_basics/widgets/juce_TextEditor.h
  17. +1
    -1
      modules/juce_gui_extra/native/juce_linux_SystemTrayIcon.cpp

+ 1
- 1
modules/juce_audio_devices/native/juce_linux_ALSA.cpp View File

@@ -930,7 +930,7 @@ public:
return wantInputNames ? inputNames : outputNames;
}
int getDefaultDeviceIndex (bool forInput) const
int getDefaultDeviceIndex (bool /* forInput */) const
{
jassert (hasScanned); // need to call scanForDevices() before doing this
return 0;


+ 51
- 76
modules/juce_audio_devices/native/juce_linux_JackAudio.cpp View File

@@ -101,19 +101,25 @@ namespace
//==============================================================================
#ifndef JUCE_JACK_CLIENT_NAME
#define JUCE_JACK_CLIENT_NAME "JuceJack"
#define JUCE_JACK_CLIENT_NAME "JUCEJack"
#endif
static const char** getJackPorts (jack_client_t* const client, const bool forInput)
{
return juce::jack_get_ports (client, nullptr, nullptr,
forInput ? JackPortIsInput : JackPortIsOutput);
}
//==============================================================================
class JackAudioIODevice : public AudioIODevice
{
public:
JackAudioIODevice (const String& deviceName,
const String& inputId_,
const String& outputId_)
const String& inId,
const String& outId)
: AudioIODevice (deviceName, "JACK"),
inputId (inputId_),
outputId (outputId_),
inputId (inId),
outputId (outId),
isOpen_ (false),
callback (nullptr),
totalNumberOfInputChannels (0),
@@ -134,7 +140,7 @@ public:
// open input ports
const StringArray inputChannels (getInputChannelNames());
for (int i = 0; i < inputChannels.size(); i++)
for (int i = 0; i < inputChannels.size(); ++i)
{
String inputName;
inputName << "in_" << ++totalNumberOfInputChannels;
@@ -145,7 +151,7 @@ public:
// open output ports
const StringArray outputChannels (getOutputChannelNames());
for (int i = 0; i < outputChannels.size (); i++)
for (int i = 0; i < outputChannels.size (); ++i)
{
String outputName;
outputName << "out_" << ++totalNumberOfOutputChannels;
@@ -172,15 +178,11 @@ public:
StringArray getChannelNames (bool forInput) const
{
StringArray names;
const char** const ports = juce::jack_get_ports (client, 0, 0, /* JackPortIsPhysical | */
forInput ? JackPortIsInput : JackPortIsOutput);
if (ports != 0)
if (const char** const ports = getJackPorts (client, forInput))
{
int j = 0;
while (ports[j] != 0)
for (int j = 0; ports[j] != nullptr; ++j)
{
const String portName (ports [j++]);
const String portName (ports [j]);
if (portName.upToFirstOccurrenceOf (":", false, false) == getName())
names.add (portName.fromFirstOccurrenceOf (":", false, false));
@@ -195,13 +197,13 @@ public:
StringArray getOutputChannelNames() { return getChannelNames (false); }
StringArray getInputChannelNames() { return getChannelNames (true); }
int getNumSampleRates() { return client != nullptr ? 1 : 0; }
double getSampleRate (int index) { return client != nullptr ? juce::jack_get_sample_rate (client) : 0; }
double getSampleRate (int /*index*/) { return client != nullptr ? juce::jack_get_sample_rate (client) : 0; }
int getNumBufferSizesAvailable() { return client != nullptr ? 1 : 0; }
int getBufferSizeSamples (int index) { return getDefaultBufferSize(); }
int getBufferSizeSamples (int /*index*/) { return getDefaultBufferSize(); }
int getDefaultBufferSize() { return client != nullptr ? juce::jack_get_buffer_size (client) : 0; }
String open (const BigInteger& inputChannels, const BigInteger& outputChannels,
double sampleRate, int bufferSizeSamples)
double /* sampleRate */, int /* bufferSizeSamples */)
{
if (client == nullptr)
{
@@ -219,9 +221,7 @@ public:
if (! inputChannels.isZero())
{
const char** const ports = juce::jack_get_ports (client, 0, 0, /* JackPortIsPhysical | */ JackPortIsOutput);
if (ports != 0)
if (const char** const ports = getJackPorts (client, true))
{
const int numInputChannels = inputChannels.getHighestBit() + 1;
@@ -243,9 +243,7 @@ public:
if (! outputChannels.isZero())
{
const char** const ports = juce::jack_get_ports (client, 0, 0, /* JackPortIsPhysical | */ JackPortIsInput);
if (ports != 0)
if (const char** const ports = getJackPorts (client, false))
{
const int numOutputChannels = outputChannels.getHighestBit() + 1;
@@ -275,8 +273,8 @@ public:
if (client != nullptr)
{
juce::jack_deactivate (client);
juce::jack_set_process_callback (client, processCallback, 0);
juce::jack_on_shutdown (client, shutdownCallback, 0);
juce::jack_set_process_callback (client, processCallback, nullptr);
juce::jack_on_shutdown (client, shutdownCallback, nullptr);
}
isOpen_ = false;
@@ -360,23 +358,19 @@ public:
private:
void process (const int numSamples)
{
int i, numActiveInChans = 0, numActiveOutChans = 0;
int numActiveInChans = 0, numActiveOutChans = 0;
for (i = 0; i < totalNumberOfInputChannels; ++i)
for (int i = 0; i < totalNumberOfInputChannels; ++i)
{
jack_default_audio_sample_t* in
= (jack_default_audio_sample_t*) juce::jack_port_get_buffer ((jack_port_t*) inputPorts.getUnchecked(i), numSamples);
if (in != nullptr)
if (jack_default_audio_sample_t* in
= (jack_default_audio_sample_t*) juce::jack_port_get_buffer ((jack_port_t*) inputPorts.getUnchecked(i), numSamples))
inChans [numActiveInChans++] = (float*) in;
}
for (i = 0; i < totalNumberOfOutputChannels; ++i)
for (int i = 0; i < totalNumberOfOutputChannels; ++i)
{
jack_default_audio_sample_t* out
= (jack_default_audio_sample_t*) juce::jack_port_get_buffer ((jack_port_t*) outputPorts.getUnchecked(i), numSamples);
if (out != nullptr)
if (jack_default_audio_sample_t* out
= (jack_default_audio_sample_t*) juce::jack_port_get_buffer ((jack_port_t*) outputPorts.getUnchecked(i), numSamples))
outChans [numActiveOutChans++] = (float*) out;
}
@@ -389,20 +383,20 @@ private:
}
else
{
for (i = 0; i < numActiveOutChans; ++i)
for (int i = 0; i < numActiveOutChans; ++i)
zeromem (outChans[i], sizeof (float) * numSamples);
}
}
static int processCallback (jack_nframes_t nframes, void* callbackArgument)
{
if (callbackArgument != 0)
if (callbackArgument != nullptr)
((JackAudioIODevice*) callbackArgument)->process (nframes);
return 0;
}
static void threadInitCallback (void* callbackArgument)
static void threadInitCallback (void* /* callbackArgument */)
{
jack_Log ("JackAudioIODevice::initialise");
}
@@ -411,9 +405,7 @@ private:
{
jack_Log ("JackAudioIODevice::shutdown");
JackAudioIODevice* device = (JackAudioIODevice*) callbackArgument;
if (device != nullptr)
if (JackAudioIODevice* device = (JackAudioIODevice*) callbackArgument)
{
device->client = nullptr;
device->close();
@@ -442,14 +434,12 @@ private:
class JackAudioIODeviceType : public AudioIODeviceType
{
public:
//==============================================================================
JackAudioIODeviceType()
: AudioIODeviceType ("JACK"),
hasScanned (false)
{
}
//==============================================================================
void scanForDevices()
{
hasScanned = true;
@@ -466,59 +456,42 @@ public:
return;
}
// open a dummy client
jack_status_t status;
jack_client_t* client = juce::jack_client_open ("JuceJackDummy", JackNoStartServer, &status);
if (client == nullptr)
{
dumpJackErrorMessage (status);
}
else
// open a dummy client
if (jack_client_t* const client = juce::jack_client_open ("JuceJackDummy", JackNoStartServer, &status))
{
// scan for output devices
const char** ports = juce::jack_get_ports (client, 0, 0, /* JackPortIsPhysical | */ JackPortIsOutput);
if (ports != nullptr)
if (const char** const ports = getJackPorts (client, false))
{
int j = 0;
while (ports[j] != 0)
for (int j = 0; ports[j] != nullptr; ++j)
{
String clientName (ports[j]);
clientName = clientName.upToFirstOccurrenceOf (":", false, false);
if (clientName != String (JUCE_JACK_CLIENT_NAME)
&& ! inputNames.contains (clientName))
if (clientName != (JUCE_JACK_CLIENT_NAME) && ! inputNames.contains (clientName))
{
inputNames.add (clientName);
inputIds.add (ports [j]);
}
++j;
}
free (ports);
}
// scan for input devices
ports = juce::jack_get_ports (client, 0, 0, /* JackPortIsPhysical | */ JackPortIsInput);
if (ports != nullptr)
if (const char** const ports = getJackPorts (client, true))
{
int j = 0;
while (ports[j] != 0)
for (int j = 0; ports[j] != nullptr; ++j)
{
String clientName (ports[j]);
clientName = clientName.upToFirstOccurrenceOf (":", false, false);
if (clientName != String (JUCE_JACK_CLIENT_NAME)
&& ! outputNames.contains (clientName))
if (clientName != (JUCE_JACK_CLIENT_NAME) && ! outputNames.contains (clientName))
{
outputNames.add (clientName);
outputIds.add (ports [j]);
}
++j;
}
free (ports);
@@ -526,6 +499,10 @@ public:
juce::jack_client_close (client);
}
else
{
dumpJackErrorMessage (status);
}
}
StringArray getDeviceNames (bool wantInputNames) const
@@ -534,7 +511,7 @@ public:
return wantInputNames ? inputNames : outputNames;
}
int getDefaultDeviceIndex (bool forInput) const
int getDefaultDeviceIndex (bool /* forInput */) const
{
jassert (hasScanned); // need to call scanForDevices() before doing this
return 0;
@@ -546,12 +523,11 @@ public:
{
jassert (hasScanned); // need to call scanForDevices() before doing this
JackAudioIODevice* d = dynamic_cast <JackAudioIODevice*> (device);
if (d == nullptr)
return -1;
if (JackAudioIODevice* d = dynamic_cast <JackAudioIODevice*> (device))
return asInput ? inputIds.indexOf (d->inputId)
: outputIds.indexOf (d->outputId);
return asInput ? inputIds.indexOf (d->inputId)
: outputIds.indexOf (d->outputId);
return -1;
}
AudioIODevice* createDevice (const String& outputDeviceName,
@@ -571,7 +547,6 @@ public:
return nullptr;
}
//==============================================================================
private:
StringArray inputNames, outputNames, inputIds, outputIds;
bool hasScanned;


+ 1
- 1
modules/juce_audio_formats/codecs/flac/libFLAC/stream_encoder.c View File

@@ -2437,7 +2437,7 @@ FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, unsigned samples, FLAC
return true;
}
FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, FLAC__bool is_last_block)
FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, FLAC__bool /* is_last_block */)
{
FLAC__StreamEncoderWriteStatus status;
FLAC__uint64 output_position = 0;


+ 1
- 1
modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.2/lib/floor0.c View File

@@ -144,7 +144,7 @@ static void floor0_map_lazy_init(vorbis_block *vb,
}
}
static vorbis_look_floor *floor0_look(vorbis_dsp_state *vd,
static vorbis_look_floor *floor0_look(vorbis_dsp_state* /* vd */,
vorbis_info_floor *i){
vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
vorbis_look_floor0 *look=(vorbis_look_floor0*)_ogg_calloc(1,sizeof(*look));


+ 1
- 1
modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.2/lib/floor1.c View File

@@ -175,7 +175,7 @@ static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){
return(NULL);
}
static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd,
static vorbis_look_floor *floor1_look(vorbis_dsp_state* /* vd */,
vorbis_info_floor *in){
int *sortpointer[VIF_POSIT+2];


+ 2
- 2
modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.2/lib/os.h View File

@@ -155,10 +155,10 @@ static __inline int vorbis_ftoi(double f){
return _mm_cvtsd_si32(_mm_load_sd(&f));
}
static __inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
static __inline void vorbis_fpu_setround(vorbis_fpu_control*){
}
static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu){
static __inline void vorbis_fpu_restore(vorbis_fpu_control){
}
#endif /* Special MSVC x64 implementation */


+ 3
- 3
modules/juce_audio_formats/codecs/oggvorbis/libvorbis-1.3.2/lib/res0.c View File

@@ -393,7 +393,7 @@ static int local_book_besterror(codebook *book,int *a){
}
static int _encodepart(oggpack_buffer *opb,int *vec, int n,
codebook *book,long *acc){
codebook *book,long* /* acc */){
int i,bits=0;
int dim=book->dim;
int step=n/dim;
@@ -536,12 +536,12 @@ static long **_2class(vorbis_block *vb,vorbis_look_residue *vl,int **in,
}
static int _01forward(oggpack_buffer *opb,
vorbis_block *vb,vorbis_look_residue *vl,
vorbis_block*, vorbis_look_residue *vl,
int **in,int ch,
long **partword,
int (*encode)(oggpack_buffer *,int *,int,
codebook *,long *),
int submap){
int /* submap */){
long i,j,k,s;
vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
vorbis_info_residue0 *info=look->info;


+ 1
- 1
modules/juce_core/maths/juce_Range.h View File

@@ -143,7 +143,7 @@ public:
return Range (jmin (start, newEnd), newEnd);
}
/** Returns a range with the same length as this one, but moved to have the given start position. */
/** Returns a range with the same length as this one, but moved to have the given end position. */
Range movedToEndAt (const ValueType newEnd) const noexcept
{
return Range (start + (newEnd - end), newEnd);


+ 4
- 4
modules/juce_core/native/juce_linux_Network.cpp View File

@@ -52,10 +52,10 @@ void MACAddress::findAllAddresses (Array<MACAddress>& result)
}
bool Process::openEmailWithAttachments (const String& targetEmailAddress,
const String& emailSubject,
const String& bodyText,
const StringArray& filesToAttach)
bool Process::openEmailWithAttachments (const String& /* targetEmailAddress */,
const String& /* emailSubject */,
const String& /* bodyText */,
const StringArray& /* filesToAttach */)
{
jassertfalse; // xxx todo


+ 2
- 2
modules/juce_events/native/juce_linux_Messaging.cpp View File

@@ -224,7 +224,7 @@ namespace LinuxErrorHandling
//==============================================================================
// Usually happens when client-server connection is broken
int ioErrorHandler (Display* display)
int ioErrorHandler (Display*)
{
DBG ("ERROR: connection to X server broken.. terminating.");
@@ -364,7 +364,7 @@ bool MessageManager::postMessageToSystemQueue (MessageManager::MessageBase* cons
return true;
}
void MessageManager::broadcastMessage (const String& value)
void MessageManager::broadcastMessage (const String& /* value */)
{
/* TODO */
}


+ 2
- 2
modules/juce_graphics/image_formats/pnglib/pngconf.h View File

@@ -36,9 +36,9 @@
#define PNG_NO_READ_sPLT 1
#define png_error(a, b) png_err(a)
#define png_warning(a, b)
#define png_warning(a, b) (void)0
#define png_chunk_error(a, b) png_err(a)
#define png_chunk_warning(a, b)
#define png_chunk_warning(a, b) png_warning(a, b)
//==============================================================================


+ 2
- 2
modules/juce_gui_basics/mouse/juce_MouseCursor.h View File

@@ -101,8 +101,8 @@ public:
cursors.
@param hotSpotX the x position of the cursor's hotspot within the image
@param hotSpotY the y position of the cursor's hotspot within the image
@param dpiFactor the factor by which this image is larger than the target
screen size of the cursor.
@param scaleFactor the factor by which this image is larger than the target
screen size of the cursor.
*/
MouseCursor (const Image& image, int hotSpotX, int hotSpotY, float scaleFactor);


+ 3
- 4
modules/juce_gui_basics/native/juce_linux_Clipboard.cpp View File

@@ -48,12 +48,12 @@ namespace ClipboardHelpers
//==============================================================================
// Read the content of a window property as either a locale-dependent string or an utf8 string
// works only for strings shorter than 1000000 bytes
static String readWindowProperty (Window window, Atom prop, Atom fmt)
static String readWindowProperty (Window window, Atom prop)
{
String returnData;
char* clipData;
Atom actualType;
int actualFormat;
int actualFormat;
unsigned long numItems, bytesLeft;
if (XGetWindowProperty (display, window, prop,
@@ -100,8 +100,7 @@ namespace ClipboardHelpers
jassert (event.xselection.requestor == juce_messageWindowHandle);
selectionContent = readWindowProperty (event.xselection.requestor,
event.xselection.property,
requestedFormat);
event.xselection.property);
return true;
}
else


+ 4
- 4
modules/juce_gui_basics/native/juce_linux_FileChooser.cpp View File

@@ -41,13 +41,13 @@ bool FileChooser::isPlatformDialogAvailable()
void FileChooser::showPlatformDialog (Array<File>& results,
const String& title,
const File& file,
const String& filters,
const String& /* filters */,
bool isDirectory,
bool selectsFiles,
bool /* selectsFiles */,
bool isSave,
bool warnAboutOverwritingExistingFiles,
bool /* warnAboutOverwritingExistingFiles */,
bool selectMultipleFiles,
FilePreviewComponent* previewComponent)
FilePreviewComponent* /* previewComponent */)
{
String separator;
StringArray args;


+ 10
- 10
modules/juce_gui_basics/native/juce_linux_Windowing.cpp View File

@@ -963,7 +963,7 @@ public:
return screenPosition - getScreenPosition();
}
void setAlpha (float newAlpha)
void setAlpha (float /* newAlpha */)
{
//xxx todo!
}
@@ -1109,7 +1109,7 @@ public:
return BorderSize<int>();
}
bool setAlwaysOnTop (bool alwaysOnTop)
bool setAlwaysOnTop (bool /* alwaysOnTop */)
{
return false;
}
@@ -1507,7 +1507,7 @@ public:
}
if (dragState.dragging)
handleExternalDragButtonReleaseEvent (buttonRelEvent);
handleExternalDragButtonReleaseEvent();
handleMouseEvent (0, getMousePos (buttonRelEvent), currentModifiers, getEventTime (buttonRelEvent));
@@ -2551,7 +2551,7 @@ private:
}
}
void handleExternalDragButtonReleaseEvent (const XButtonReleasedEvent& buttonRelEvent)
void handleExternalDragButtonReleaseEvent()
{
if (dragState.dragging)
XUngrabPointer (display, CurrentTime);
@@ -2952,7 +2952,7 @@ ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept
//==============================================================================
void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool allowMenusAndBars)
void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDisable, bool /* allowMenusAndBars */)
{
if (enableOrDisable)
kioskModeComponent->setBounds (Desktop::getInstance().getDisplays().getMainDisplay().totalArea);
@@ -3334,7 +3334,7 @@ void MouseCursor::showInAllWindows() const
}
//==============================================================================
Image juce_createIconForFile (const File& file)
Image juce_createIconForFile (const File& /* file */)
{
return Image::null;
}
@@ -3380,16 +3380,16 @@ void LookAndFeel::playAlertSound()
//==============================================================================
void JUCE_CALLTYPE NativeMessageBox::showMessageBox (AlertWindow::AlertIconType iconType,
const String& title, const String& message,
Component* associatedComponent)
Component* /* associatedComponent */)
{
AlertWindow::showMessageBox (AlertWindow::NoIcon, title, message);
AlertWindow::showMessageBox (iconType, title, message);
}
void JUCE_CALLTYPE NativeMessageBox::showMessageBoxAsync (AlertWindow::AlertIconType iconType,
const String& title, const String& message,
Component* associatedComponent)
Component* /* associatedComponent */)
{
AlertWindow::showMessageBoxAsync (AlertWindow::NoIcon, title, message);
AlertWindow::showMessageBoxAsync (iconType, title, message);
}
bool JUCE_CALLTYPE NativeMessageBox::showOkCancelBox (AlertWindow::AlertIconType iconType,


+ 1
- 1
modules/juce_gui_basics/widgets/juce_TextEditor.h View File

@@ -552,7 +552,7 @@ public:
{
public:
/** Creates a filter that limits the length of text, and/or the characters that it can contain.
@param maxTextLength if this is > 0, it sets a maximum length limit; if <= 0, no
@param maxNumChars if this is > 0, it sets a maximum length limit; if <= 0, no
limit is set
@param allowedCharacters if this is non-empty, then only characters that occur in
this string are allowed to be entered into the editor.


+ 1
- 1
modules/juce_gui_extra/native/juce_linux_SystemTrayIcon.cpp View File

@@ -118,7 +118,7 @@ void SystemTrayIconComponent::paint (Graphics& g)
RectanglePlacement::xLeft | RectanglePlacement::yTop | RectanglePlacement::onlyReduceInSize, false);
}
void SystemTrayIconComponent::setIconTooltip (const String& tooltip)
void SystemTrayIconComponent::setIconTooltip (const String& /* tooltip */)
{
// xxx not yet implemented!
}

Loading…
Cancel
Save