Browse Source

Fixed a win32 mouse position problem. Added quality option to FLAC writer. Added support for non-opaque menus.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
9a1fde0470
4 changed files with 21 additions and 30 deletions
  1. +11
    -23
      src/audio/audio_file_formats/juce_FlacAudioFormat.cpp
  2. +5
    -5
      src/containers/juce_Array.h
  3. +4
    -2
      src/gui/components/menus/juce_PopupMenu.cpp
  4. +1
    -0
      src/native/windows/juce_win32_Windowing.cpp

+ 11
- 23
src/audio/audio_file_formats/juce_FlacAudioFormat.cpp View File

@@ -315,18 +315,17 @@ class FlacWriter : public AudioFormatWriter
{
public:
//==============================================================================
FlacWriter (OutputStream* const out,
const double sampleRate_,
const int numChannels_,
const int bitsPerSample_)
FlacWriter (OutputStream* const out, double sampleRate_,
int numChannels_, int bitsPerSample_, int qualityOptionIndex)
: AudioFormatWriter (out, TRANS (flacFormatName),
sampleRate_,
numChannels_,
bitsPerSample_)
sampleRate_, numChannels_, bitsPerSample_)
{
using namespace FlacNamespace;
encoder = FLAC__stream_encoder_new();
if (qualityOptionIndex > 0)
FLAC__stream_encoder_set_compression_level (encoder, jmin (8, qualityOptionIndex));
FLAC__stream_encoder_set_do_mid_side_stereo (encoder, numChannels == 2);
FLAC__stream_encoder_set_loose_mid_side_stereo (encoder, numChannels == 2);
FLAC__stream_encoder_set_channels (encoder, numChannels);
@@ -510,20 +509,9 @@ const Array <int> FlacAudioFormat::getPossibleBitDepths()
return Array <int> (depths);
}
bool FlacAudioFormat::canDoStereo()
{
return true;
}
bool FlacAudioFormat::canDoMono()
{
return true;
}
bool FlacAudioFormat::isCompressed()
{
return true;
}
bool FlacAudioFormat::canDoStereo() { return true; }
bool FlacAudioFormat::canDoMono() { return true; }
bool FlacAudioFormat::isCompressed() { return true; }
AudioFormatReader* FlacAudioFormat::createReaderFor (InputStream* in,
const bool deleteStreamIfOpeningFails)
@@ -544,11 +532,11 @@ AudioFormatWriter* FlacAudioFormat::createWriterFor (OutputStream* out,
unsigned int numberOfChannels,
int bitsPerSample,
const StringPairArray& /*metadataValues*/,
int /*qualityOptionIndex*/)
int qualityOptionIndex)
{
if (getPossibleBitDepths().contains (bitsPerSample))
{
ScopedPointer<FlacWriter> w (new FlacWriter (out, sampleRate, numberOfChannels, bitsPerSample));
ScopedPointer<FlacWriter> w (new FlacWriter (out, sampleRate, numberOfChannels, bitsPerSample, qualityOptionIndex));
if (w->ok)
return w.release();


+ 5
- 5
src/containers/juce_Array.h View File

@@ -33,15 +33,15 @@
//==============================================================================
/**
Holds a list of simple objects, such as ints, doubles, or pointers.
Holds a resizable array of primitive or copy-by-value objects.
Examples of arrays are: Array<int>, Array<Rectangle> or Array<MyClass*>
The array can be used to hold simple, non-polymorphic objects as well as primitive types - to
The Array class can be used to hold simple, non-polymorphic objects as well as primitive types - to
do so, the class must fulfil these requirements:
- it must have a copy constructor and operator=
- it must be able to be relocated in memory by a memcpy without this causing a problem - so no
objects whose functionality relies on pointers or references to themselves can be used.
- it must have a copy constructor and assignment operator
- it must be able to be relocated in memory by a memcpy without this causing any problems - so
objects whose functionality relies on external pointers or references to themselves can be used.
You can of course have an array of pointers to any kind of object, e.g. Array <MyClass*>, but if
you do this, the array doesn't take any ownership of the objects - see the OwnedArray class or the


+ 4
- 2
src/gui/components/menus/juce_PopupMenu.cpp View File

@@ -283,8 +283,6 @@ public:
menuCreationTime = lastFocused = lastScroll = Time::getMillisecondCounter();
setWantsKeyboardFocus (true);
setMouseClickGrabsKeyboardFocus (false);
setOpaque (true);
setAlwaysOnTop (true);
Desktop::getInstance().addGlobalMouseListener (this);
@@ -324,6 +322,7 @@ public:
ScopedPointer <Window> mw (new Window());
mw->setLookAndFeel (menu.lookAndFeel);
mw->setWantsKeyboardFocus (false);
mw->setOpaque (mw->getLookAndFeel().findColour (PopupMenu::backgroundColourId).isOpaque() || ! Desktop::canUseSemiTransparentWindows());
mw->minimumWidth = minimumWidth;
mw->maximumNumColumns = maximumNumColumns;
mw->standardItemHeight = standardItemHeight;
@@ -370,6 +369,9 @@ public:
//==============================================================================
void paint (Graphics& g)
{
if (isOpaque())
g.fillAll (Colours::white);
getLookAndFeel().drawPopupMenuBackground (g, getWidth(), getHeight());
}


+ 1
- 0
src/native/windows/juce_win32_Windowing.cpp View File

@@ -1861,6 +1861,7 @@ private:
return 0;
case WM_WINDOWPOSCHANGED:
doMouseEvent (getCurrentMousePos());
handleMovedOrResized();
if (dontRepaint)


Loading…
Cancel
Save