Browse Source

tags/2021-05-28
jules 17 years ago
parent
commit
6f74e96862
7 changed files with 167 additions and 137 deletions
  1. +2
    -2
      build/win32/platform_specific_code/juce_win32_Network.cpp
  2. +129
    -129
      extras/juce demo/src/binarydata/QuickTimeDemo.cpp
  3. +7
    -5
      src/juce_appframework/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp
  4. +13
    -1
      src/juce_appframework/audio/audio_sources/juce_AudioSourcePlayer.cpp
  5. +3
    -0
      src/juce_appframework/audio/audio_sources/juce_AudioSourcePlayer.h
  6. +4
    -0
      src/juce_appframework/gui/components/menus/juce_PopupMenu.h
  7. +9
    -0
      src/juce_core/text/juce_String.h

+ 2
- 2
build/win32/platform_specific_code/juce_win32_Network.cpp View File

@@ -100,7 +100,7 @@ void* juce_openInternetFile (const String& url,
uc.lpszUrlPath = file;
uc.lpszHostName = server;
if (InternetCrackUrl (url, 0, ICU_ESCAPE | ICU_DECODE, &uc))
if (InternetCrackUrl (url, 0, 0, &uc))
{
const bool isFtp = url.startsWithIgnoreCase (T("ftp:"));
@@ -129,7 +129,7 @@ void* juce_openInternetFile (const String& url,
}
else
{
const TCHAR* mimeTypes[] = { _T("*"), 0 };
const TCHAR* mimeTypes[] = { _T("*/*"), 0 };
HINTERNET request = HttpOpenRequest (connection,
isPost ? _T("POST")


+ 129
- 129
extras/juce demo/src/binarydata/QuickTimeDemo.cpp View File

@@ -1,129 +1,129 @@
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-7 by Raw Material Software ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the
GNU General Public License, as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
JUCE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with JUCE; if not, visit www.gnu.org/licenses or write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
------------------------------------------------------------------------------
If you'd like to release a closed-source product which uses JUCE, commercial
licenses are also available: visit www.rawmaterialsoftware.com/juce for
more information.
==============================================================================
*/
#include "../jucedemo_headers.h"
#if JUCE_QUICKTIME && ! JUCE_LINUX
//==============================================================================
// so that we can easily have two QT windows each with a file browser, wrap this up as a class..
class QuickTimeWindowWithFileBrowser : public Component,
public FilenameComponentListener
{
public:
QuickTimeWindowWithFileBrowser()
{
addAndMakeVisible (qtComp = new QuickTimeMovieComponent());
// and a file-chooser..
addAndMakeVisible (fileChooser = new FilenameComponent (T("movie"),
File::nonexistent,
true, false, false,
T("*.*"),
String::empty,
T("(choose a video file to play)")));
fileChooser->addListener (this);
fileChooser->setBrowseButtonText (T("browse"));
}
~QuickTimeWindowWithFileBrowser()
{
deleteAllChildren();
}
void resized()
{
qtComp->setBounds (0, 0, getWidth(), getHeight() - 30);
fileChooser->setBounds (0, getHeight() - 24, getWidth(), 24);
}
void filenameComponentChanged (FilenameComponent*)
{
// this is called when the user changes the filename in the file chooser box
if (qtComp->loadMovie (fileChooser->getCurrentFile(), true))
{
// loaded the file ok, so let's start it playing..
qtComp->play();
}
else
{
AlertWindow::showMessageBox (AlertWindow::WarningIcon,
T("Couldn't load the file!"),
T("Sorry, QuickTime didn't manage to load that file!"));
}
}
private:
QuickTimeMovieComponent* qtComp;
FilenameComponent* fileChooser;
};
//==============================================================================
class QuickTimeDemo : public Component
{
public:
//==============================================================================
QuickTimeDemo()
{
setName (T("QuickTime"));
// add a movie component..
addAndMakeVisible (qtComp1 = new QuickTimeWindowWithFileBrowser());
addAndMakeVisible (qtComp2 = new QuickTimeWindowWithFileBrowser());
}
~QuickTimeDemo()
{
deleteAllChildren();
}
void resized()
{
qtComp1->setBoundsRelative (0.05f, 0.05f, 0.425f, 0.9f);
qtComp2->setBoundsRelative (0.525f, 0.05f, 0.425f, 0.9f);
}
private:
//==============================================================================
QuickTimeWindowWithFileBrowser* qtComp1;
QuickTimeWindowWithFileBrowser* qtComp2;
};
//==============================================================================
Component* createQuickTimeDemo()
{
return new QuickTimeDemo();
}
#endif
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-7 by Raw Material Software ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the
GNU General Public License, as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
JUCE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with JUCE; if not, visit www.gnu.org/licenses or write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
------------------------------------------------------------------------------
If you'd like to release a closed-source product which uses JUCE, commercial
licenses are also available: visit www.rawmaterialsoftware.com/juce for
more information.
==============================================================================
*/
#include "../jucedemo_headers.h"
#if JUCE_QUICKTIME && ! JUCE_LINUX
//==============================================================================
// so that we can easily have two QT windows each with a file browser, wrap this up as a class..
class QuickTimeWindowWithFileBrowser : public Component,
public FilenameComponentListener
{
public:
QuickTimeWindowWithFileBrowser()
{
addAndMakeVisible (qtComp = new QuickTimeMovieComponent());
// and a file-chooser..
addAndMakeVisible (fileChooser = new FilenameComponent (T("movie"),
File::nonexistent,
true, false, false,
T("*.*"),
String::empty,
T("(choose a video file to play)")));
fileChooser->addListener (this);
fileChooser->setBrowseButtonText (T("browse"));
}
~QuickTimeWindowWithFileBrowser()
{
deleteAllChildren();
}
void resized()
{
qtComp->setBounds (0, 0, getWidth(), getHeight() - 30);
fileChooser->setBounds (0, getHeight() - 24, getWidth(), 24);
}
void filenameComponentChanged (FilenameComponent*)
{
// this is called when the user changes the filename in the file chooser box
if (qtComp->loadMovie (fileChooser->getCurrentFile(), true))
{
// loaded the file ok, so let's start it playing..
qtComp->play();
}
else
{
AlertWindow::showMessageBox (AlertWindow::WarningIcon,
T("Couldn't load the file!"),
T("Sorry, QuickTime didn't manage to load that file!"));
}
}
private:
QuickTimeMovieComponent* qtComp;
FilenameComponent* fileChooser;
};
//==============================================================================
class QuickTimeDemo : public Component
{
public:
//==============================================================================
QuickTimeDemo()
{
setName (T("QuickTime"));
// add a movie component..
addAndMakeVisible (qtComp1 = new QuickTimeWindowWithFileBrowser());
addAndMakeVisible (qtComp2 = new QuickTimeWindowWithFileBrowser());
}
~QuickTimeDemo()
{
deleteAllChildren();
}
void resized()
{
qtComp1->setBoundsRelative (0.05f, 0.05f, 0.425f, 0.9f);
qtComp2->setBoundsRelative (0.525f, 0.05f, 0.425f, 0.9f);
}
private:
//==============================================================================
QuickTimeWindowWithFileBrowser* qtComp1;
QuickTimeWindowWithFileBrowser* qtComp2;
};
//==============================================================================
Component* createQuickTimeDemo()
{
return new QuickTimeDemo();
}
#endif

+ 7
- 5
src/juce_appframework/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp View File

@@ -95,14 +95,12 @@ public:
#ifdef WIN32
if (InitializeQTML (0) != noErr)
return;
#endif
#elif JUCE_MAC
EnterMoviesOnThread (0);
#endif
if (EnterMovies() != noErr)
return;
#if JUCE_MAC
EnterMoviesOnThread (0);
#endif
bool opened = juce_OpenQuickTimeMovieFromStream (input_, movie, dataHandle);
if (! opened)
@@ -233,6 +231,10 @@ public:
juce_free (bufferList->mBuffers[0].mData);
juce_free (bufferList);
#if JUCE_MAC
ExitMoviesOnThread ();
#endif
}
bool read (int** destSamples,


+ 13
- 1
src/juce_appframework/audio/audio_sources/juce_AudioSourcePlayer.cpp View File

@@ -42,7 +42,9 @@ AudioSourcePlayer::AudioSourcePlayer()
: source (0),
sampleRate (0),
bufferSize (0),
tempBuffer (2, 8)
tempBuffer (2, 8),
lastGain (1.0f),
gain (1.0f)
{
}
@@ -70,6 +72,11 @@ void AudioSourcePlayer::setSource (AudioSource* newSource)
}
}
void AudioSourcePlayer::setGain (const float newGain) throw()
{
gain = newGain;
}
void AudioSourcePlayer::audioDeviceIOCallback (const float** inputChannelData,
int totalNumInputChannels,
float** outputChannelData,
@@ -154,6 +161,11 @@ void AudioSourcePlayer::audioDeviceIOCallback (const float** inputChannelData,
info.numSamples = numSamples;
source->getNextAudioBlock (info);
for (int i = info.buffer->getNumChannels(); --i >= 0;)
info.buffer->applyGainRamp (i, info.startSample, info.numSamples, lastGain, gain);
lastGain = gain;
}
else
{


+ 3
- 0
src/juce_appframework/audio/audio_sources/juce_AudioSourcePlayer.h View File

@@ -80,6 +80,8 @@ public:
*/
AudioSource* getCurrentSource() const throw() { return source; }
/** Sets a gain to apply to the audio data. */
void setGain (const float newGain) throw();
//==============================================================================
/** Implementation of the AudioIODeviceCallback method. */
@@ -108,6 +110,7 @@ private:
float* outputChans [128];
const float* inputChans [128];
AudioSampleBuffer tempBuffer;
float lastGain, gain;
AudioSourcePlayer (const AudioSourcePlayer&);
const AudioSourcePlayer& operator= (const AudioSourcePlayer&);


+ 4
- 0
src/juce_appframework/gui/components/menus/juce_PopupMenu.h View File

@@ -259,6 +259,10 @@ public:
This is the same as show(), but uses a specific location (in global screen
co-ordinates) rather than the current mouse position.
Note that the co-ordinates don't specify the top-left of the menu - they
indicate a point of interest, and the menu will position itself nearby to
this point, trying to keep it fully on-screen.
@see show()
*/
int showAt (const int screenX,


+ 9
- 0
src/juce_core/text/juce_String.h View File

@@ -728,6 +728,9 @@ public:
This will replace the contents of the string with the output of this
formatted printf.
Note that using the %s token with a juce string is probably a bad idea, as
this may expect differect encodings on different platforms.
@see formatted
*/
void printf (const tchar* const format, ...) throw();
@@ -737,6 +740,9 @@ public:
This will return a string which is the result of a sprintf using the
arguments passed-in.
Note that using the %s token with a juce string is probably a bad idea, as
this may expect differect encodings on different platforms.
@see printf, vprintf
*/
static const String formatted (const tchar* const format, ...) throw();
@@ -747,6 +753,9 @@ public:
formatted printf. Used by other methods, this is public in case it's
useful for other purposes where you want to pass a va_list through directly.
Note that using the %s token with a juce string is probably a bad idea, as
this may expect differect encodings on different platforms.
@see printf, formatted
*/
void vprintf (const tchar* const format, va_list& args) throw();


Loading…
Cancel
Save