//uma is for wxMacFSSpec
#include "wx/mac/uma.h"
#include "wx/timer.h"
+#ifndef __DARWIN__
#include <Movies.h>
#include <Gestalt.h>
#include <QuickTimeComponents.h> //Standard QT stuff
+#else
+#include <QuickTime/QuickTimeComponents.h>
+#endif
//Determines whether version 4 of QT is installed (Pretty much for classic only)
Boolean _wxIsQuickTime4Installed (void)
virtual double GetPlaybackRate();
virtual bool SetPlaybackRate(double dRate);
+ virtual double GetVolume();
+ virtual bool SetVolume(double);
+
void Cleanup();
void FinishLoad();
if ( !
#if wxUSE_CREATEMOVIECONTROL
- ctrl->wxWindow::Create(parent, id, pos, size,
- wxWindow::MacRemoveBordersFromStyle(style),
- name)
+ ctrl->wxWindow::Create(parent, id, pos, size,
+ wxWindow::MacRemoveBordersFromStyle(style),
+ name)
#else
- ctrl->wxControl::Create(parent, id, pos, size,
- wxWindow::MacRemoveBordersFromStyle(style),
- validator, name)
+ ctrl->wxControl::Create(parent, id, pos, size,
+ wxWindow::MacRemoveBordersFromStyle(style),
+ validator, name)
#endif
)
return false;
#if wxUSE_VALIDATORS
- ctrl->SetValidator(validator);
+ ctrl->SetValidator(validator);
#endif
m_ctrl = ctrl;
movieTrackEnabledOnly) != NULL)
{
#if wxUSE_CREATEMOVIECONTROL
- //
- //Native CreateMovieControl QT control (Thanks to Kevin Olliver's
- //wxQTMovie for some of this).
- //
- #define GetControlPeer(whatever) ctrl->m_peer
- wxMediaCtrl* ctrl = (wxMediaCtrl*) m_ctrl;
- Rect bounds = wxMacGetBoundsForControl(m_ctrl,
- m_ctrl->GetPosition(),
- m_ctrl->GetSize());
-
- //Dispose of old control for new one
- if (GetControlPeer(m_ctrl) && GetControlPeer(m_ctrl)->Ok() )
- GetControlPeer(m_ctrl)->Dispose();
-
- //Options-
- //kMovieControlOptionXXX
- //HideController - hide the movie controller
- //LocateTopLeft - movie is pinned to top left rather than centered in the control
- //EnableEditing - Allows programmatic editing and dragn'drop
- //HandleEditingHI- Installs event stuff for edit menu - forces EnableEditing also
- //SetKeysEnabled - Allows keyboard input
- //ManuallyIdled - app handles movie idling rather than internal timer event loop
+ //
+ //Native CreateMovieControl QT control (Thanks to Kevin Olliver's
+ //wxQTMovie for some of this).
+ //
+ #define GetControlPeer(whatever) ctrl->m_peer
+ wxMediaCtrl* ctrl = (wxMediaCtrl*) m_ctrl;
+ Rect bounds = wxMacGetBoundsForControl(m_ctrl,
+ m_ctrl->GetPosition(),
+ m_ctrl->GetSize());
+
+ //Dispose of old control for new one
+ if (GetControlPeer(m_ctrl) && GetControlPeer(m_ctrl)->Ok() )
+ GetControlPeer(m_ctrl)->Dispose();
+
+ //Options-
+ //kMovieControlOptionXXX
+ //HideController - hide the movie controller
+ //LocateTopLeft - movie is pinned to top left rather than centered in the control
+ //EnableEditing - Allows programmatic editing and dragn'drop
+ //HandleEditingHI- Installs event stuff for edit menu - forces EnableEditing also
+ //SetKeysEnabled - Allows keyboard input
+ //ManuallyIdled - app handles movie idling rather than internal timer event loop
::CreateMovieControl(
(WindowRef)
ctrl->MacGetTopLevelWindowRef(), //parent
::EmbedControl(ctrl->m_peer->GetControlRef(), (ControlRef)ctrl->GetParent()->GetHandle());
#else
- //
- //"Emulation"
- //
+ //
+ //"Emulation"
+ //
SetMovieGWorld(m_movie,
(CGrafPtr)
GetWindowPort(
m_ctrl->GetParent()->Layout();
m_ctrl->GetParent()->Refresh();
m_ctrl->GetParent()->Update();
+
+ //send loaded event
+ wxMediaEvent theEvent(wxEVT_MEDIA_LOADED,
+ m_ctrl->GetId());
+ m_ctrl->AddPendingEvent(theEvent);
}
//---------------------------------------------------------------------------
}
//---------------------------------------------------------------------------
+// wxQTMediaBackend::GetVolume
+//
+// Gets the volume through GetMovieVolume - which returns a 16 bit short -
+//
+// +--------+--------+
+// + (1) + (2) +
+// +--------+--------+
+//
+// (1) first 8 bits are value before decimal
+// (2) second 8 bits are value after decimal
+//
+// Volume ranges from -1.0 (gain but no sound), 0 (no sound and no gain) to
+// 1 (full gain and sound)
+//---------------------------------------------------------------------------
+double wxQTMediaBackend::GetVolume()
+{
+ short sVolume = GetMovieVolume(m_movie);
+
+ if(sVolume & (128 << 8)) //negative - no sound
+ return 0.0;
+
+ return (sVolume & (127 << 8)) ? 1.0 : ((double)(sVolume & 255)) / 255.0;
+}
+
+//---------------------------------------------------------------------------
+// wxQTMediaBackend::SetVolume
+//
+// Sets the volume through SetMovieVolume - which takes a 16 bit short -
+//
+// +--------+--------+
+// + (1) + (2) +
+// +--------+--------+
+//
+// (1) first 8 bits are value before decimal
+// (2) second 8 bits are value after decimal
+//
+// Volume ranges from -1.0 (gain but no sound), 0 (no sound and no gain) to
+// 1 (full gain and sound)
+//---------------------------------------------------------------------------
+bool wxQTMediaBackend::SetVolume(double dVolume)
+{
+ short sVolume = (short) (dVolume >= .9999 ? 1 << 8 : (dVolume * 255) );
+ SetMovieVolume(m_movie, sVolume);
+ return true;
+}
+
+ //---------------------------------------------------------------------------
// wxQTMediaBackend::GetDuration
//
// Calls GetMovieDuration
FORCE_LINK_ME(basewxmediabackends);
#endif //wxUSE_MEDIACTRL
-
-
-
-
-