Moved wxMMedia to contrib/src/mmedia
Added contrib configure Made wxSocket sample compile Made OGL compile Modified main configure to pass some more parameter to children Changed the wxProcess doc according to the modification Still some win makefiles to come git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6461 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
10
contrib/samples/Makefile.in
Normal file
10
contrib/samples/Makefile.in
Normal file
@@ -0,0 +1,10 @@
|
||||
#
|
||||
# Makefile : Builds wxWindows utils for Unix.
|
||||
#
|
||||
|
||||
all:
|
||||
cd mmedia; make
|
||||
|
||||
clean:
|
||||
cd mmedia; make clean
|
||||
|
36
contrib/samples/mmedia/Makefile.in
Normal file
36
contrib/samples/mmedia/Makefile.in
Normal file
@@ -0,0 +1,36 @@
|
||||
#
|
||||
# File: makefile.unx
|
||||
# Author: Julian Smart
|
||||
# Created: 1998
|
||||
# Updated:
|
||||
# Copyright: (c) 1998 Julian Smart
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile for minimal example (UNIX).
|
||||
|
||||
top_srcdir = @top_srcdir@/..
|
||||
top_builddir = ../../..
|
||||
program_dir = contrib/samples/mmedia
|
||||
|
||||
PROGRAM=mmboard
|
||||
|
||||
OBJECTS=mmboard.o mmbman.o
|
||||
|
||||
EXTRA_LIBS= $(top_builddir)/lib/libwxmmedia2.a @ESD_LIBS@
|
||||
# the comment at the end of the next line is needed because otherwise autoconf
|
||||
# would remove this line completely - it contains a built-in hack to remove
|
||||
# any VPATH assignment not containing ':'
|
||||
VPATH = @PATH_IFS@$(top_srcdir)/contrib/samples/mmedia # ':' for autoconf
|
||||
|
||||
include ../../../src/make.env
|
||||
|
||||
.SUFFIXES: .o .cpp .c
|
||||
|
||||
.cpp.o:
|
||||
$(CC) -c $(CPPFLAGS) $(EXTRA_CPPFLAGS) -o $@ $<
|
||||
|
||||
all: $(PROGRAM)
|
||||
|
||||
mmboard: $(OBJECTS)
|
||||
$(CC) $(LDFLAGS) -o mmboard $(OBJECTS) $(EXTRA_LIBS) $(LDLIBS) $(top_builddir)/lib/@WX_TARGET_LIBRARY@
|
30
contrib/samples/mmedia/descrip.mms
Normal file
30
contrib/samples/mmedia/descrip.mms
Normal file
@@ -0,0 +1,30 @@
|
||||
#*****************************************************************************
|
||||
# *
|
||||
# Make file for VMS *
|
||||
# Author : J.Jansen (joukj@hrem.stm.tudelft.nl) *
|
||||
# Date : 10 November 1999 *
|
||||
# *
|
||||
#*****************************************************************************
|
||||
.first
|
||||
define wx [--.include.wx]
|
||||
|
||||
.ifdef __WXMOTIF__
|
||||
CXX_DEFINE = /define=(__WXMOTIF__=1)
|
||||
.else
|
||||
CXX_DEFINE =
|
||||
.endif
|
||||
|
||||
.suffixes : .cpp
|
||||
|
||||
.cpp.obj :
|
||||
cxx $(CXXFLAGS)$(CXX_DEFINE) $(MMS$TARGET_NAME).cpp
|
||||
|
||||
all :
|
||||
$(MMS)$(MMSQUALIFIERS) minimal.exe
|
||||
|
||||
minimal.exe : minimal.obj
|
||||
.ifdef __WXMOTIF__
|
||||
cxxlink minimal,[--.lib]vms/opt
|
||||
.endif
|
||||
|
||||
minimal.obj : minimal.cpp
|
24
contrib/samples/mmedia/eject.xpm
Normal file
24
contrib/samples/mmedia/eject.xpm
Normal file
@@ -0,0 +1,24 @@
|
||||
/* XPM */
|
||||
static char * eject_xpm[] = {
|
||||
"15 16 5 1",
|
||||
" c None",
|
||||
". c #949594",
|
||||
"+ c #000000",
|
||||
"@ c #FFFFFF",
|
||||
"# c #8E8E8E",
|
||||
" . ",
|
||||
" .+@ ",
|
||||
" .+++@ ",
|
||||
" .+++++@ ",
|
||||
" .+++++++@ ",
|
||||
" .+++++++++@ ",
|
||||
" .+++++++++++@ ",
|
||||
".+############@",
|
||||
".@@@@@@@@@@@@@@",
|
||||
" ",
|
||||
"...............",
|
||||
".++++++++++++#@",
|
||||
".++++++++++++#@",
|
||||
".++++++++++++#@",
|
||||
".+############@",
|
||||
".@@@@@@@@@@@@@@"};
|
512
contrib/samples/mmedia/mmbman.cpp
Normal file
512
contrib/samples/mmedia/mmbman.cpp
Normal file
@@ -0,0 +1,512 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: mmbman.cpp
|
||||
// Purpose: Multimedia Board manager
|
||||
// Author: Guilhem Lavaux, <guilhem.lavaux@libertysurf.fr>
|
||||
// Modified by:
|
||||
// Created: 13/02/2000
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000, Guilhem Lavaux
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "mmbman.cpp"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
// for all others, include the necessary headers (this file is usually all you
|
||||
// need because it includes almost all "standard" wxWindows headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
// Personal headers
|
||||
|
||||
#include "wx/stream.h"
|
||||
#include "wx/wfstream.h"
|
||||
|
||||
#include "wx/mmedia/sndbase.h"
|
||||
#include "wx/mmedia/sndfile.h"
|
||||
#include "wx/mmedia/sndwav.h"
|
||||
#include "wx/mmedia/sndaiff.h"
|
||||
#include "wx/mmedia/sndpcm.h"
|
||||
#include "wx/mmedia/sndulaw.h"
|
||||
|
||||
#ifdef __UNIX__
|
||||
#include "wx/mmedia/sndoss.h"
|
||||
#include "wx/mmedia/sndesd.h"
|
||||
#endif
|
||||
|
||||
#ifdef __WIN32__
|
||||
#include "wx/mmedia/sndwin.h"
|
||||
#endif
|
||||
|
||||
#include "wx/mmedia/vidbase.h"
|
||||
#ifdef __UNIX__
|
||||
#include "wx/mmedia/vidxanm.h"
|
||||
#endif
|
||||
|
||||
#ifdef __WIN32__
|
||||
#include "wx/mmedia/vidwin.h"
|
||||
#endif
|
||||
|
||||
#include "mmboard.h"
|
||||
#include "mmbman.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Private class definitions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class MMBoardSoundFile: public MMBoardFile {
|
||||
public:
|
||||
MMBoardSoundFile(const wxString& filename);
|
||||
~MMBoardSoundFile();
|
||||
|
||||
bool NeedWindow();
|
||||
|
||||
void SetWindow(wxWindow *window);
|
||||
|
||||
void Play();
|
||||
void Pause();
|
||||
void Resume();
|
||||
void Stop();
|
||||
|
||||
MMBoardTime GetPosition();
|
||||
MMBoardTime GetLength();
|
||||
void SetPosition(MMBoardTime btime);
|
||||
|
||||
bool IsStopped();
|
||||
bool IsPaused();
|
||||
|
||||
wxString GetStringType();
|
||||
wxString GetStringInformation();
|
||||
|
||||
protected:
|
||||
wxSoundFileStream *GetDecoder();
|
||||
|
||||
wxSoundStream *m_output_stream;
|
||||
wxInputStream *m_input_stream;
|
||||
wxSoundFileStream *m_file_stream;
|
||||
|
||||
MMBoardTime m_length;
|
||||
wxUint8 m_file_type;
|
||||
};
|
||||
|
||||
class MMBoardVideoFile: public MMBoardFile {
|
||||
public:
|
||||
MMBoardVideoFile(const wxString& filename);
|
||||
~MMBoardVideoFile();
|
||||
|
||||
bool NeedWindow();
|
||||
|
||||
void SetWindow(wxWindow *window);
|
||||
|
||||
void Play();
|
||||
void Pause();
|
||||
void Resume();
|
||||
void Stop();
|
||||
|
||||
MMBoardTime GetPosition();
|
||||
MMBoardTime GetLength();
|
||||
void SetPosition(MMBoardTime btime);
|
||||
|
||||
bool IsStopped();
|
||||
bool IsPaused();
|
||||
|
||||
wxString GetStringType();
|
||||
wxString GetStringInformation();
|
||||
|
||||
protected:
|
||||
wxWindow *m_output_window;
|
||||
wxVideoBaseDriver *m_video_driver;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define MMBoard_UNKNOWNTYPE 0
|
||||
#define MMBoard_WAVE 1
|
||||
#define MMBoard_AIFF 2
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MMBoardSoundFile
|
||||
|
||||
MMBoardSoundFile::MMBoardSoundFile(const wxString& filename)
|
||||
: MMBoardFile()
|
||||
{
|
||||
m_input_stream = new wxFileInputStream(filename);
|
||||
m_output_stream = MMBoardManager::OpenSoundStream();
|
||||
|
||||
m_file_stream = GetDecoder();
|
||||
|
||||
if (!m_file_stream) {
|
||||
SetError(MMBoard_UnknownFile);
|
||||
return;
|
||||
}
|
||||
|
||||
// Compute length
|
||||
wxUint32 length, seconds;
|
||||
|
||||
length = m_file_stream->GetLength();
|
||||
seconds = m_file_stream->GetSoundFormat().GetTimeFromBytes(length);
|
||||
m_length.seconds = seconds % 60;
|
||||
m_length.minutes = (seconds / 60) % 60;
|
||||
m_length.hours = seconds / 3600;
|
||||
}
|
||||
|
||||
MMBoardSoundFile::~MMBoardSoundFile()
|
||||
{
|
||||
if (m_file_stream)
|
||||
delete m_file_stream;
|
||||
MMBoardManager::UnrefSoundStream(m_output_stream);
|
||||
delete m_input_stream;
|
||||
}
|
||||
|
||||
wxSoundFileStream *MMBoardSoundFile::GetDecoder()
|
||||
{
|
||||
wxSoundFileStream *f_stream;
|
||||
|
||||
// First, we try a Wave decoder
|
||||
f_stream = new wxSoundWave(*m_input_stream, *m_output_stream);
|
||||
m_file_type = MMBoard_WAVE;
|
||||
if (f_stream->CanRead())
|
||||
return f_stream;
|
||||
delete f_stream;
|
||||
|
||||
// Then, a AIFF decoder
|
||||
f_stream = new wxSoundAiff(*m_input_stream, *m_output_stream);
|
||||
m_file_type = MMBoard_AIFF;
|
||||
if (f_stream->CanRead())
|
||||
return f_stream;
|
||||
delete f_stream;
|
||||
|
||||
m_file_type = MMBoard_UNKNOWNTYPE;
|
||||
|
||||
// TODO: automate
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MMBoardTime MMBoardSoundFile::GetLength()
|
||||
{
|
||||
return m_length;
|
||||
}
|
||||
|
||||
bool MMBoardSoundFile::IsStopped()
|
||||
{
|
||||
return m_file_stream->IsStopped();
|
||||
}
|
||||
|
||||
bool MMBoardSoundFile::IsPaused()
|
||||
{
|
||||
return m_file_stream->IsPaused();
|
||||
}
|
||||
|
||||
MMBoardTime MMBoardSoundFile::GetPosition()
|
||||
{
|
||||
wxUint32 length, seconds;
|
||||
MMBoardTime file_time;
|
||||
|
||||
file_time.seconds = file_time.minutes = file_time.hours = 0;
|
||||
if (m_file_stream->IsStopped())
|
||||
return file_time;
|
||||
|
||||
length = m_file_stream->GetPosition();
|
||||
seconds = m_file_stream->GetSoundFormat().GetTimeFromBytes(length);
|
||||
file_time.seconds = seconds % 60;
|
||||
file_time.minutes = (seconds / 60) % 60;
|
||||
file_time.hours = seconds / 3600;
|
||||
|
||||
return file_time;
|
||||
}
|
||||
|
||||
void MMBoardSoundFile::SetPosition(MMBoardTime btime)
|
||||
{
|
||||
wxUint32 itime;
|
||||
|
||||
itime = btime.seconds + btime.minutes * 60 + btime.hours;
|
||||
|
||||
m_file_stream->SetPosition(
|
||||
m_file_stream->GetSoundFormat().GetBytesFromTime(itime)
|
||||
);
|
||||
}
|
||||
|
||||
bool MMBoardSoundFile::NeedWindow()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void MMBoardSoundFile::SetWindow(wxWindow *window)
|
||||
{
|
||||
}
|
||||
|
||||
void MMBoardSoundFile::Play()
|
||||
{
|
||||
m_file_stream->Play();
|
||||
}
|
||||
|
||||
void MMBoardSoundFile::Pause()
|
||||
{
|
||||
m_file_stream->Pause();
|
||||
}
|
||||
|
||||
void MMBoardSoundFile::Resume()
|
||||
{
|
||||
m_file_stream->Resume();
|
||||
}
|
||||
|
||||
void MMBoardSoundFile::Stop()
|
||||
{
|
||||
m_file_stream->Stop();
|
||||
}
|
||||
|
||||
wxString MMBoardSoundFile::GetStringType()
|
||||
{
|
||||
switch (m_file_type) {
|
||||
case MMBoard_WAVE:
|
||||
return wxString(wxT("WAVE file"));
|
||||
break;
|
||||
case MMBoard_AIFF:
|
||||
return wxString(wxT("AIFF file"));
|
||||
break;
|
||||
default:
|
||||
return wxString(wxT("Unknown file"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
wxString MMBoardSoundFile::GetStringInformation()
|
||||
{
|
||||
wxString info;
|
||||
wxSoundFormatBase *format;
|
||||
|
||||
format = &(m_file_stream->GetSoundFormat());
|
||||
|
||||
info = wxT("Data encoding: ");
|
||||
switch (format->GetType()) {
|
||||
case wxSOUND_PCM: {
|
||||
wxSoundFormatPcm *pcm_format = (wxSoundFormatPcm *)format;
|
||||
|
||||
info += wxString::Format(wxT("PCM %s %s\n"),
|
||||
pcm_format->Signed() ? wxT("signed") : wxT("unsigned"),
|
||||
pcm_format->GetOrder() == wxLITTLE_ENDIAN ? wxT("little endian") : wxT("big endian"));
|
||||
info += wxString::Format(wxT("Sampling rate: %d\n")
|
||||
wxT("Bits per sample: %d\n")
|
||||
wxT("Number of channels: %d\n"),
|
||||
pcm_format->GetSampleRate(),
|
||||
pcm_format->GetBPS(),
|
||||
pcm_format->GetChannels());
|
||||
|
||||
break;
|
||||
}
|
||||
case wxSOUND_ULAW: {
|
||||
wxSoundFormatUlaw *ulaw_format = (wxSoundFormatUlaw *)format;
|
||||
info += wxT("ULAW\n");
|
||||
info += wxString::Format(wxT("Sampling rate: %d\n"), ulaw_format->GetSampleRate());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
info += wxT("Unknown");
|
||||
break;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MMBoardVideoFile
|
||||
|
||||
MMBoardVideoFile::MMBoardVideoFile(const wxString& filename)
|
||||
{
|
||||
m_output_window = NULL;
|
||||
|
||||
#if defined(__UNIX__)
|
||||
m_video_driver = new wxVideoXANIM(filename);
|
||||
#elif defined(__WIN32__)
|
||||
m_video_driver = new wxVideoWindows(filename);
|
||||
#else
|
||||
m_video_driver = NULL;
|
||||
SetError(MMBoard_UnknownFile);
|
||||
#endif
|
||||
}
|
||||
|
||||
MMBoardVideoFile::~MMBoardVideoFile()
|
||||
{
|
||||
if (m_video_driver)
|
||||
delete m_video_driver;
|
||||
}
|
||||
|
||||
bool MMBoardVideoFile::NeedWindow()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void MMBoardVideoFile::SetWindow(wxWindow *window)
|
||||
{
|
||||
m_output_window = window;
|
||||
m_video_driver->AttachOutput(*window);
|
||||
|
||||
wxSize size;
|
||||
m_video_driver->GetSize(size);
|
||||
window->SetSize(size);
|
||||
// BAD BAD
|
||||
// and we remove
|
||||
// window->GetParent()->GetSizer()->Fit(window->GetParent());
|
||||
}
|
||||
|
||||
void MMBoardVideoFile::Play()
|
||||
{
|
||||
m_video_driver->Play();
|
||||
}
|
||||
|
||||
void MMBoardVideoFile::Pause()
|
||||
{
|
||||
m_video_driver->Pause();
|
||||
}
|
||||
|
||||
void MMBoardVideoFile::Resume()
|
||||
{
|
||||
m_video_driver->Resume();
|
||||
}
|
||||
|
||||
void MMBoardVideoFile::Stop()
|
||||
{
|
||||
m_video_driver->Stop();
|
||||
}
|
||||
|
||||
MMBoardTime MMBoardVideoFile::GetPosition()
|
||||
{
|
||||
MMBoardTime btime;
|
||||
|
||||
btime.seconds = btime.minutes = btime.hours = 0;
|
||||
return btime;
|
||||
}
|
||||
|
||||
MMBoardTime MMBoardVideoFile::GetLength()
|
||||
{
|
||||
MMBoardTime btime;
|
||||
int frameTime;
|
||||
|
||||
frameTime = (int)( m_video_driver->GetNbFrames() / m_video_driver->GetFrameRate());
|
||||
|
||||
btime.seconds = frameTime % 60;
|
||||
btime.minutes = (frameTime / 60) % 60;
|
||||
btime.hours = frameTime / 3600;
|
||||
return btime;
|
||||
}
|
||||
|
||||
void MMBoardVideoFile::SetPosition(MMBoardTime btime)
|
||||
{
|
||||
}
|
||||
|
||||
bool MMBoardVideoFile::IsStopped()
|
||||
{
|
||||
return m_video_driver->IsStopped();
|
||||
}
|
||||
|
||||
bool MMBoardVideoFile::IsPaused()
|
||||
{
|
||||
return m_video_driver->IsPaused();
|
||||
}
|
||||
|
||||
wxString MMBoardVideoFile::GetStringType()
|
||||
{
|
||||
return wxString(wxT("Video XANIM"));
|
||||
}
|
||||
|
||||
wxString MMBoardVideoFile::GetStringInformation()
|
||||
{
|
||||
wxString info;
|
||||
|
||||
info = wxT("Video codec: ");
|
||||
info += m_video_driver->GetMovieCodec() + "\n";
|
||||
info += wxT("Audio codec: ");
|
||||
info += m_video_driver->GetAudioCodec();
|
||||
info += wxString::Format(" Sample rate: %d Channels: %d\n", m_video_driver->GetSampleRate(),
|
||||
m_video_driver->GetBPS());
|
||||
info += wxString::Format(" Frame rate: %.01f", m_video_driver->GetFrameRate());
|
||||
return info;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MMBoardFile
|
||||
|
||||
MMBoardFile::MMBoardFile()
|
||||
{
|
||||
m_error = 0;
|
||||
}
|
||||
|
||||
MMBoardFile::~MMBoardFile()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MMBoardManager
|
||||
|
||||
MMBoardFile *MMBoardManager::Open(const wxString& filename)
|
||||
{
|
||||
MMBoardFile *file;
|
||||
|
||||
// Test the audio codec
|
||||
file = new MMBoardSoundFile(filename);
|
||||
if (!file->GetError())
|
||||
return file;
|
||||
delete file;
|
||||
|
||||
// Test the video codec
|
||||
file = new MMBoardVideoFile(filename);
|
||||
if (!file->GetError())
|
||||
return file;
|
||||
delete file;
|
||||
|
||||
// Arrrgh, we just could not see what is that file ...
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DECLARE_APP(MMBoardApp)
|
||||
|
||||
wxSoundStream *MMBoardManager::OpenSoundStream()
|
||||
{
|
||||
#ifdef __UNIX__
|
||||
if ((wxGetApp().m_caps & MM_SOUND_ESD) != 0)
|
||||
return new wxSoundStreamESD();
|
||||
|
||||
if ((wxGetApp().m_caps & MM_SOUND_OSS) != 0)
|
||||
return new wxSoundStreamOSS();
|
||||
#endif
|
||||
|
||||
#ifdef __WIN32__
|
||||
if ((wxGetApp().m_caps & MM_SOUND_WIN) != 0)
|
||||
return new wxSoundStreamWin();
|
||||
#endif
|
||||
|
||||
wxMessageBox("You are trying to open a multimedia but you have not devices", "Error", wxOK | wxICON_ERROR, NULL);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void MMBoardManager::UnrefSoundStream(wxSoundStream *stream)
|
||||
{
|
||||
delete stream;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
84
contrib/samples/mmedia/mmbman.h
Normal file
84
contrib/samples/mmedia/mmbman.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: mmbman.h
|
||||
// Purpose: Multimedia Board manager
|
||||
// Author: Guilhem Lavaux, <guilhem.lavaux@libertysurf.fr>
|
||||
// Modified by:
|
||||
// Created: 13/02/2000
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000, Guilhem Lavaux
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _MMBMAN_APP_H_
|
||||
#define _MMBMAN_APP_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "mmbman.cpp"
|
||||
#endif
|
||||
|
||||
#include "wx/stream.h"
|
||||
#include "wx/mmedia/sndbase.h"
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Base structure definitions
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
typedef struct {
|
||||
wxUint8 seconds, minutes, hours;
|
||||
} MMBoardTime;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Constants
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
#define MMBoard_NoError 0
|
||||
#define MMBoard_UnknownFile 1
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Interface definition: MMBoardFile
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
class MMBoardFile {
|
||||
public:
|
||||
MMBoardFile();
|
||||
virtual ~MMBoardFile();
|
||||
|
||||
virtual bool NeedWindow() = 0;
|
||||
|
||||
virtual void SetWindow(wxWindow *window) = 0;
|
||||
|
||||
virtual void Play() = 0;
|
||||
virtual void Pause() = 0;
|
||||
virtual void Resume() = 0;
|
||||
virtual void Stop() = 0;
|
||||
|
||||
virtual MMBoardTime GetPosition() = 0;
|
||||
virtual MMBoardTime GetLength() = 0;
|
||||
virtual void SetPosition(MMBoardTime btime) = 0;
|
||||
|
||||
virtual bool IsStopped() = 0;
|
||||
virtual bool IsPaused() = 0;
|
||||
|
||||
virtual wxString GetStringType() = 0;
|
||||
virtual wxString GetStringInformation() = 0;
|
||||
|
||||
void SetError(wxUint8 error) { m_error = error; }
|
||||
wxUint8 GetError() const { return m_error; }
|
||||
|
||||
protected:
|
||||
wxUint8 m_error;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Main manager
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
class MMBoardManager {
|
||||
public:
|
||||
static MMBoardFile *Open(const wxString& filename);
|
||||
|
||||
static wxSoundStream *OpenSoundStream();
|
||||
static void UnrefSoundStream(wxSoundStream *stream);
|
||||
};
|
||||
|
||||
#endif
|
570
contrib/samples/mmedia/mmboard.cpp
Normal file
570
contrib/samples/mmedia/mmboard.cpp
Normal file
@@ -0,0 +1,570 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: mmboard.cpp
|
||||
// Purpose: Multimedia Library sample
|
||||
// Author: Guilhem Lavaux (created from minimal by J. Smart)
|
||||
// Modified by:
|
||||
// Created: 13/02/2000
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Guilhem Lavaux
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "mmboard.cpp"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
// for all others, include the necessary headers (this file is usually all you
|
||||
// need because it includes almost all "standard" wxWindows headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ressources
|
||||
// ----------------------------------------------------------------------------
|
||||
// the application icon
|
||||
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
||||
#include "mondrian.xpm"
|
||||
#endif
|
||||
|
||||
// include multimedia classes
|
||||
#include "wx/mmedia/sndbase.h"
|
||||
#ifdef __WIN32__
|
||||
#include "wx/mmedia/sndwin.h"
|
||||
#endif
|
||||
#ifdef __UNIX__
|
||||
#include "wx/mmedia/sndoss.h"
|
||||
#include "wx/mmedia/sndesd.h"
|
||||
#endif
|
||||
|
||||
#include "wx/statline.h"
|
||||
#include "wx/stattext.h"
|
||||
|
||||
// include personnal classes
|
||||
#include "mmboard.h"
|
||||
#include "mmbman.h"
|
||||
|
||||
#include "play.xpm"
|
||||
#include "stop.xpm"
|
||||
#include "eject.xpm"
|
||||
#include "pause.xpm"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// private classes
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Main Multimedia Board frame
|
||||
class MMBoardFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
// ctor(s)
|
||||
MMBoardFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
|
||||
// dtor
|
||||
~MMBoardFrame();
|
||||
|
||||
// event handlers
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
void OnOpen(wxCommandEvent& event);
|
||||
void OnPlay(wxCommandEvent& event);
|
||||
void OnStop(wxCommandEvent& event);
|
||||
void OnPause(wxCommandEvent& event);
|
||||
void OnEject(wxCommandEvent& event);
|
||||
void OnRefreshInfo(wxEvent& event);
|
||||
void OnSetPosition(wxCommandEvent& event);
|
||||
|
||||
void OpenVideoWindow();
|
||||
void CloseVideoWindow();
|
||||
|
||||
private:
|
||||
// any class wishing to process wxWindows events must use this macro
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
private:
|
||||
void UpdateMMedInfo();
|
||||
void UpdateInfoText();
|
||||
|
||||
MMBoardFile *m_opened_file;
|
||||
|
||||
wxSlider *m_positionSlider;
|
||||
wxBitmapButton *m_playButton, *m_pauseButton, *m_stopButton, *m_ejectButton;
|
||||
wxStaticText *m_fileType, *m_infoText;
|
||||
wxWindow *m_video_window;
|
||||
|
||||
wxPanel *m_panel;
|
||||
wxSizer *m_sizer;
|
||||
|
||||
wxTimer *m_refreshTimer;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// IDs for the controls and the menu commands
|
||||
enum
|
||||
{
|
||||
// menu items
|
||||
MMBoard_Quit = 1,
|
||||
MMBoard_Open,
|
||||
MMBoard_About,
|
||||
MMBoard_PositionSlider,
|
||||
MMBoard_PlayButton,
|
||||
MMBoard_PauseButton,
|
||||
MMBoard_ResumeButton,
|
||||
MMBoard_StopButton,
|
||||
MMBoard_EjectButton,
|
||||
MMBoard_RefreshInfo
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables and other macros for wxWindows
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(MMBoardFrame, wxFrame)
|
||||
EVT_MENU(MMBoard_Quit, MMBoardFrame::OnQuit)
|
||||
EVT_MENU(MMBoard_About, MMBoardFrame::OnAbout)
|
||||
EVT_MENU(MMBoard_Open, MMBoardFrame::OnOpen)
|
||||
EVT_BUTTON(MMBoard_PlayButton, MMBoardFrame::OnPlay)
|
||||
EVT_BUTTON(MMBoard_StopButton, MMBoardFrame::OnStop)
|
||||
EVT_BUTTON(MMBoard_PauseButton, MMBoardFrame::OnPause)
|
||||
EVT_BUTTON(MMBoard_EjectButton, MMBoardFrame::OnEject)
|
||||
EVT_SLIDER(MMBoard_PositionSlider, MMBoardFrame::OnSetPosition)
|
||||
EVT_CUSTOM(wxEVT_TIMER, MMBoard_RefreshInfo, MMBoardFrame::OnRefreshInfo)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Main board application launcher
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_APP(MMBoardApp)
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the application class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool MMBoardApp::OnInit()
|
||||
{
|
||||
// create the main application window
|
||||
MMBoardFrame *frame = new MMBoardFrame("Multimedia Board",
|
||||
wxPoint(50, 50), wxSize(450, 340));
|
||||
|
||||
// and show it (the frames, unlike simple controls, are not shown when
|
||||
// created initially)
|
||||
frame->Show(TRUE);
|
||||
|
||||
m_caps = TestMultimediaCaps();
|
||||
|
||||
if (!m_caps) {
|
||||
wxMessageBox("Your system has no multimedia capabilities. We are exiting now.", "Major error !", wxOK | wxICON_ERROR, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxString msg;
|
||||
msg.Printf("Detected : %s%s%s", (m_caps & MM_SOUND_OSS) ? "OSS " : "",
|
||||
(m_caps & MM_SOUND_ESD) ? "ESD " : "",
|
||||
(m_caps & MM_SOUND_WIN) ? "WIN" : "");
|
||||
|
||||
wxMessageBox(msg, "Good !", wxOK | wxICON_INFORMATION, NULL);
|
||||
|
||||
// success: wxApp::OnRun() will be called which will enter the main message
|
||||
// loop and the application will run. If we returned FALSE here, the
|
||||
// application would exit immediately.
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wxUint8 MMBoardApp::TestMultimediaCaps()
|
||||
{
|
||||
wxSoundStream *dev;
|
||||
wxUint8 caps;
|
||||
|
||||
caps = 0;
|
||||
|
||||
#ifdef __UNIX__
|
||||
// We now test the ESD support
|
||||
|
||||
dev = new wxSoundStreamESD();
|
||||
if (dev->GetError() == wxSOUND_NOERROR)
|
||||
caps |= MM_SOUND_ESD;
|
||||
delete dev;
|
||||
|
||||
// We test the OSS (Open Sound System) support.
|
||||
// WARNING: There is a conflict between ESD and ALSA
|
||||
|
||||
dev = new wxSoundStreamOSS();
|
||||
if (dev->GetError() == wxSOUND_NOERROR)
|
||||
caps |= MM_SOUND_OSS;
|
||||
delete dev;
|
||||
#endif
|
||||
|
||||
#ifdef __WIN32__
|
||||
// We test the Windows sound support.
|
||||
|
||||
dev = new wxSoundStreamWin();
|
||||
if (dev->GetError() == wxSOUND_NOERR)
|
||||
caps |= MM_SOUND_WIN;
|
||||
delete dev;
|
||||
#endif
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// main frame
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// frame constructor
|
||||
MMBoardFrame::MMBoardFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// we need this in order to allow the about menu relocation, since ABOUT is
|
||||
// not the default id of the about menu
|
||||
wxApp::s_macAboutMenuItemId = MMBoard_About;
|
||||
#endif
|
||||
|
||||
// set the frame icon
|
||||
SetIcon(wxICON(mondrian));
|
||||
|
||||
// create a menu bar
|
||||
wxMenu *menuFile = new wxMenu(wxT(""), wxMENU_TEAROFF);
|
||||
|
||||
// the "About" item should be in the help menu
|
||||
wxMenu *helpMenu = new wxMenu;
|
||||
helpMenu->Append(MMBoard_About, wxT("&About...\tCtrl-A"), wxT("Show about dialog"));
|
||||
|
||||
menuFile->Append(MMBoard_Open, wxT("&Open\tAlt-O"), wxT("Open file"));
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(MMBoard_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program"));
|
||||
|
||||
// now append the freshly created menu to the menu bar...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
// create a status bar just for fun (by default with 1 pane only)
|
||||
CreateStatusBar(3);
|
||||
SetStatusText(wxT("Welcome to wxWindows!"));
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
// Misc variables
|
||||
m_opened_file = NULL;
|
||||
|
||||
m_panel = new wxPanel(this, -1);
|
||||
|
||||
// Initialize main slider
|
||||
m_positionSlider = new wxSlider( m_panel, MMBoard_PositionSlider, 0, 0, 60,
|
||||
wxDefaultPosition, wxSize(300, -1),
|
||||
wxSL_HORIZONTAL | wxSL_AUTOTICKS);
|
||||
m_positionSlider->SetPageSize(60); // 60 secs
|
||||
m_positionSlider->Enable(FALSE);
|
||||
|
||||
// Initialize info panel
|
||||
wxPanel *infoPanel = new wxPanel( m_panel, -1);
|
||||
infoPanel->SetBackgroundColour(*wxBLACK);
|
||||
infoPanel->SetForegroundColour(*wxWHITE);
|
||||
|
||||
wxBoxSizer *infoSizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_fileType = new wxStaticText(infoPanel, -1, wxT(""));
|
||||
wxStaticLine *line = new wxStaticLine(infoPanel, -1);
|
||||
m_infoText = new wxStaticText(infoPanel, -1, "");
|
||||
|
||||
UpdateInfoText();
|
||||
|
||||
infoSizer->Add(m_fileType, 0, wxGROW | wxALL, 1);
|
||||
infoSizer->Add(line, 0, wxGROW | wxCENTRE, 20);
|
||||
infoSizer->Add(m_infoText, 0, wxGROW | wxALL, 1);
|
||||
|
||||
infoPanel->SetSizer(infoSizer);
|
||||
infoPanel->SetAutoLayout(TRUE);
|
||||
|
||||
// Bitmap button panel
|
||||
wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
wxBitmap *play_bmp = new wxBitmap(play_back_xpm);
|
||||
wxBitmap *stop_bmp = new wxBitmap(stop_back_xpm);
|
||||
wxBitmap *eject_bmp = new wxBitmap(eject_xpm);
|
||||
wxBitmap *pause_bmp = new wxBitmap(pause_xpm);
|
||||
|
||||
m_playButton = new wxBitmapButton(m_panel, MMBoard_PlayButton, *play_bmp);
|
||||
m_playButton->Enable(FALSE);
|
||||
m_pauseButton = new wxBitmapButton(m_panel, MMBoard_PauseButton, *pause_bmp);
|
||||
m_pauseButton->Enable(FALSE);
|
||||
m_stopButton = new wxBitmapButton(m_panel, MMBoard_StopButton, *stop_bmp);
|
||||
m_stopButton->Enable(FALSE);
|
||||
m_ejectButton = new wxBitmapButton(m_panel, MMBoard_EjectButton, *eject_bmp);
|
||||
m_ejectButton->Enable(FALSE);
|
||||
|
||||
buttonSizer->Add(m_playButton, 0, wxALL, 2);
|
||||
buttonSizer->Add(m_pauseButton, 0, wxALL, 2);
|
||||
buttonSizer->Add(m_stopButton, 0, wxALL, 2);
|
||||
buttonSizer->Add(m_ejectButton, 0, wxALL, 2);
|
||||
|
||||
// Top sizer
|
||||
m_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
m_sizer->Add(new wxStaticLine(m_panel, -1), 0, wxGROW | wxCENTRE, 0);
|
||||
m_sizer->Add(m_positionSlider, 0, wxCENTRE | wxGROW | wxALL, 2);
|
||||
m_sizer->Add(new wxStaticLine(m_panel, -1), 0, wxGROW | wxCENTRE, 0);
|
||||
m_sizer->Add(buttonSizer, 0, wxALL, 0);
|
||||
m_sizer->Add(new wxStaticLine(m_panel, -1), 0, wxGROW | wxCENTRE, 0);
|
||||
m_sizer->Add(infoPanel, 1, wxCENTRE | wxGROW, 0);
|
||||
|
||||
m_panel->SetSizer(m_sizer);
|
||||
m_panel->SetAutoLayout(TRUE);
|
||||
m_sizer->Fit(this);
|
||||
m_sizer->SetSizeHints(this);
|
||||
|
||||
// Timer
|
||||
m_refreshTimer = new wxTimer(this, MMBoard_RefreshInfo);
|
||||
|
||||
// Video window
|
||||
m_video_window = NULL;
|
||||
|
||||
// Multimedia file
|
||||
m_opened_file = NULL;
|
||||
}
|
||||
|
||||
MMBoardFrame::~MMBoardFrame()
|
||||
{
|
||||
if (m_opened_file)
|
||||
delete m_opened_file;
|
||||
|
||||
delete m_refreshTimer;
|
||||
}
|
||||
|
||||
void MMBoardFrame::OpenVideoWindow()
|
||||
{
|
||||
if (m_video_window)
|
||||
return;
|
||||
|
||||
m_video_window = new wxWindow(m_panel, -1, wxDefaultPosition, wxSize(200, 200));
|
||||
m_video_window->SetBackgroundColour(*wxBLACK);
|
||||
m_sizer->Prepend(m_video_window, 2, wxGROW | wxSHRINK | wxCENTRE, 1);
|
||||
|
||||
m_sizer->Fit(this);
|
||||
}
|
||||
|
||||
void MMBoardFrame::CloseVideoWindow()
|
||||
{
|
||||
if (!m_video_window)
|
||||
return;
|
||||
|
||||
m_sizer->Remove(m_video_window);
|
||||
delete m_video_window;
|
||||
m_video_window = NULL;
|
||||
|
||||
m_sizer->Fit(this);
|
||||
}
|
||||
|
||||
// event handlers
|
||||
|
||||
void MMBoardFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// TRUE is to force the frame to close
|
||||
Close(TRUE);
|
||||
}
|
||||
|
||||
void MMBoardFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT("wxWindows Multimedia board v1.0a, wxMMedia v2.0a:\n")
|
||||
wxT("an example of the capabilities of the wxWindows multimedia classes.\n")
|
||||
wxT("Copyright 1999, 2000, Guilhem Lavaux.\n"));
|
||||
|
||||
wxMessageBox(msg, "About MMBoard", wxOK | wxICON_INFORMATION, this);
|
||||
}
|
||||
|
||||
void MMBoardFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString selected_file;
|
||||
|
||||
if (m_opened_file) {
|
||||
if (!m_opened_file->IsStopped()) {
|
||||
wxCommandEvent event2;
|
||||
OnStop(event2);
|
||||
}
|
||||
delete m_opened_file;
|
||||
}
|
||||
|
||||
// select a file to be opened
|
||||
selected_file = wxLoadFileSelector("multimedia", "*", NULL, this);
|
||||
if (selected_file.IsNull())
|
||||
return;
|
||||
|
||||
m_opened_file = MMBoardManager::Open(selected_file);
|
||||
|
||||
// Change the range values of the slider.
|
||||
MMBoardTime length;
|
||||
|
||||
length = m_opened_file->GetLength();
|
||||
m_positionSlider->SetRange(0, length.hours * 3600 + length.minutes * 60 + length.seconds);
|
||||
|
||||
// Update misc info
|
||||
UpdateMMedInfo();
|
||||
|
||||
SetStatusText(selected_file, 2);
|
||||
|
||||
// Update info text
|
||||
UpdateInfoText();
|
||||
|
||||
// Enable a few buttons
|
||||
m_playButton->Enable(TRUE);
|
||||
m_ejectButton->Enable(TRUE);
|
||||
m_positionSlider->Enable(TRUE);
|
||||
|
||||
if (m_opened_file->NeedWindow()) {
|
||||
OpenVideoWindow();
|
||||
m_opened_file->SetWindow(m_video_window);
|
||||
} else
|
||||
CloseVideoWindow();
|
||||
}
|
||||
|
||||
void MMBoardFrame::UpdateInfoText()
|
||||
{
|
||||
wxString infotext1, infotext2;
|
||||
|
||||
if (m_opened_file) {
|
||||
infotext1 = wxT("File type:\n\t");
|
||||
infotext1 += m_opened_file->GetStringType() + wxT("\n");
|
||||
|
||||
infotext2 = wxT("File informations:\n\n");
|
||||
infotext2 += m_opened_file->GetStringInformation();
|
||||
} else {
|
||||
infotext1 = wxT("File type: \n\tNo file opened");
|
||||
infotext2 = wxT("File informations:\nNo information\n\n\n\n\n");
|
||||
}
|
||||
|
||||
m_fileType->SetLabel(infotext1);
|
||||
m_infoText->SetLabel(infotext2);
|
||||
}
|
||||
|
||||
void MMBoardFrame::UpdateMMedInfo()
|
||||
{
|
||||
wxString temp_string;
|
||||
MMBoardTime current, length;
|
||||
|
||||
if (m_opened_file) {
|
||||
current = m_opened_file->GetPosition();
|
||||
length = m_opened_file->GetLength();
|
||||
} else {
|
||||
current.hours = current.minutes = current.seconds = 0;
|
||||
length = current;
|
||||
}
|
||||
|
||||
// We refresh the status bar
|
||||
temp_string.Printf(wxT("%02d:%02d / %02d:%02d"), current.hours * 60 + current.minutes,
|
||||
current.seconds, length.hours * 60 + length.minutes, length.seconds);
|
||||
SetStatusText(temp_string, 1);
|
||||
|
||||
// We set the slider position
|
||||
m_positionSlider->SetValue(current.hours * 3600 + current.minutes * 60 + current.seconds);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Playing management, refreshers, ...
|
||||
|
||||
void MMBoardFrame::OnRefreshInfo(wxEvent& WXUNUSED(event))
|
||||
{
|
||||
UpdateMMedInfo();
|
||||
|
||||
if (m_opened_file->IsStopped()) {
|
||||
m_refreshTimer->Stop();
|
||||
m_playButton->Enable(TRUE);
|
||||
m_stopButton->Enable(FALSE);
|
||||
m_pauseButton->Enable(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void MMBoardFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_stopButton->Enable(TRUE);
|
||||
m_pauseButton->Enable(TRUE);
|
||||
m_playButton->Enable(FALSE);
|
||||
|
||||
if (m_opened_file->IsPaused()) {
|
||||
m_opened_file->Resume();
|
||||
return;
|
||||
}
|
||||
|
||||
m_refreshTimer->Start(1000, FALSE);
|
||||
|
||||
m_opened_file->Play();
|
||||
|
||||
m_stopButton->Enable(TRUE);
|
||||
m_pauseButton->Enable(TRUE);
|
||||
m_playButton->Enable(FALSE);
|
||||
}
|
||||
|
||||
void MMBoardFrame::OnStop(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_opened_file->Stop();
|
||||
m_refreshTimer->Stop();
|
||||
|
||||
m_stopButton->Enable(FALSE);
|
||||
m_playButton->Enable(TRUE);
|
||||
|
||||
UpdateMMedInfo();
|
||||
}
|
||||
|
||||
void MMBoardFrame::OnPause(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_opened_file->Pause();
|
||||
|
||||
m_playButton->Enable(TRUE);
|
||||
m_pauseButton->Enable(FALSE);
|
||||
}
|
||||
|
||||
void MMBoardFrame::OnEject(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_opened_file->Stop();
|
||||
|
||||
delete m_opened_file;
|
||||
m_opened_file = NULL;
|
||||
|
||||
m_playButton->Enable(FALSE);
|
||||
m_pauseButton->Enable(FALSE);
|
||||
m_stopButton->Enable(FALSE);
|
||||
m_ejectButton->Enable(FALSE);
|
||||
m_positionSlider->Enable(FALSE);
|
||||
|
||||
UpdateInfoText();
|
||||
UpdateMMedInfo();
|
||||
}
|
||||
|
||||
void MMBoardFrame::OnSetPosition(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxUint32 itime;
|
||||
MMBoardTime btime;
|
||||
|
||||
itime = m_positionSlider->GetValue();
|
||||
btime.seconds = itime % 60;
|
||||
btime.minutes = (itime / 60) % 60;
|
||||
btime.hours = itime / 3600;
|
||||
m_opened_file->SetPosition(btime);
|
||||
|
||||
UpdateMMedInfo();
|
||||
}
|
||||
|
7
contrib/samples/mmedia/mmboard.def
Normal file
7
contrib/samples/mmedia/mmboard.def
Normal file
@@ -0,0 +1,7 @@
|
||||
NAME Minimal
|
||||
DESCRIPTION 'Minimal wxWindows application'
|
||||
EXETYPE WINDOWS
|
||||
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE MULTIPLE
|
||||
HEAPSIZE 4048
|
||||
STACKSIZE 16000
|
57
contrib/samples/mmedia/mmboard.h
Normal file
57
contrib/samples/mmedia/mmboard.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: mmboard.h
|
||||
// Purpose: Multimedia Board header
|
||||
// Author: Guilhem Lavaux, <guilhem.lavaux@libertysurf.fr>
|
||||
// Modified by:
|
||||
// Created: 13/02/2000
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000, Guilhem Lavaux
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _MMBOARD_APP_H_
|
||||
#define _MMBOARD_APP_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "mmboard.cpp"
|
||||
#endif
|
||||
|
||||
// for compilers that support precompilation, includes "wx/wx.h"
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
// for all others, include the necessary headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// constants
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
#define MM_SOUND_OSS 0x01
|
||||
#define MM_SOUND_ESD 0x02
|
||||
#define MM_SOUND_WIN 0x04
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Class definitions
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// Define a new application type, each program should derive a class from wxApp
|
||||
class MMBoardApp : public wxApp
|
||||
{
|
||||
public:
|
||||
wxUint8 m_caps;
|
||||
|
||||
// override base class virtuals
|
||||
// ----------------------------
|
||||
|
||||
virtual bool OnInit();
|
||||
|
||||
wxUint8 TestMultimediaCaps();
|
||||
};
|
||||
|
||||
#endif
|
6
contrib/samples/mmedia/mmboard.rc
Normal file
6
contrib/samples/mmedia/mmboard.rc
Normal file
@@ -0,0 +1,6 @@
|
||||
mondrian ICON "mondrian.ico"
|
||||
#include "wx/msw/wx.rc"
|
||||
|
||||
#define MINIMAL_QUIT 1
|
||||
#define MINIMAL_ABOUT 102
|
||||
|
6
contrib/samples/mmedia/mmboard.rc0
Normal file
6
contrib/samples/mmedia/mmboard.rc0
Normal file
@@ -0,0 +1,6 @@
|
||||
ICON 1 PRELOAD "mondros2.ico"
|
||||
#include "H:\DEV\WX2\wxWindows\include\wx\os2\wx.rc"
|
||||
|
||||
#define MINIMAL_QUIT 1
|
||||
#define MINIMAL_ABOUT 102
|
||||
|
BIN
contrib/samples/mmedia/mondrian.ico
Normal file
BIN
contrib/samples/mmedia/mondrian.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
44
contrib/samples/mmedia/mondrian.xpm
Normal file
44
contrib/samples/mmedia/mondrian.xpm
Normal file
@@ -0,0 +1,44 @@
|
||||
/* XPM */
|
||||
static char *mondrian_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 6 1",
|
||||
" c Black",
|
||||
". c Blue",
|
||||
"X c #00bf00",
|
||||
"o c Red",
|
||||
"O c Yellow",
|
||||
"+ c Gray100",
|
||||
/* pixels */
|
||||
" ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" "
|
||||
};
|
BIN
contrib/samples/mmedia/mondros2.ico
Normal file
BIN
contrib/samples/mmedia/mondros2.ico
Normal file
Binary file not shown.
23
contrib/samples/mmedia/pause.xpm
Normal file
23
contrib/samples/mmedia/pause.xpm
Normal file
@@ -0,0 +1,23 @@
|
||||
/* XPM */
|
||||
static char * pause_xpm[] = {
|
||||
"13 15 5 1",
|
||||
" c None",
|
||||
". c #949594",
|
||||
"+ c #000000",
|
||||
"@ c #8E8E8E",
|
||||
"# c #FFFFFF",
|
||||
"...... ......",
|
||||
".+++@# .+++@#",
|
||||
".+++@# .+++@#",
|
||||
".+++@# .+++@#",
|
||||
".+++@# .+++@#",
|
||||
".+++@# .+++@#",
|
||||
".+++@# .+++@#",
|
||||
".+++@# .+++@#",
|
||||
".+++@# .+++@#",
|
||||
".+++@# .+++@#",
|
||||
".+++@# .+++@#",
|
||||
".+++@# .+++@#",
|
||||
".+++@# .+++@#",
|
||||
".+@@@# .+@@@#",
|
||||
".##### .#####"};
|
23
contrib/samples/mmedia/play.xpm
Normal file
23
contrib/samples/mmedia/play.xpm
Normal file
@@ -0,0 +1,23 @@
|
||||
/* XPM */
|
||||
static char * play_back_xpm[] = {
|
||||
"13 15 5 1",
|
||||
" c None",
|
||||
". c #949594",
|
||||
"+ c #000000",
|
||||
"@ c #8E8E8E",
|
||||
"# c #FFFFFF",
|
||||
"...... ",
|
||||
".+++++. ",
|
||||
".++++++. ",
|
||||
".+++++++. ",
|
||||
".++++++++. ",
|
||||
".+++++++++. ",
|
||||
".++++++++++. ",
|
||||
".++++++++++@#",
|
||||
".+++++++++@# ",
|
||||
".++++++++@# ",
|
||||
".+++++++@# ",
|
||||
".++++++@# ",
|
||||
".+++++@# ",
|
||||
".+@@@@# ",
|
||||
".##### "};
|
23
contrib/samples/mmedia/stop.xpm
Normal file
23
contrib/samples/mmedia/stop.xpm
Normal file
@@ -0,0 +1,23 @@
|
||||
/* XPM */
|
||||
static char * stop_back_xpm[] = {
|
||||
"13 15 5 1",
|
||||
" c None",
|
||||
". c #949594",
|
||||
"+ c #000000",
|
||||
"@ c #8E8E8E",
|
||||
"# c #FFFFFF",
|
||||
".............",
|
||||
".++++++++++@#",
|
||||
".++++++++++@#",
|
||||
".++++++++++@#",
|
||||
".++++++++++@#",
|
||||
".++++++++++@#",
|
||||
".++++++++++@#",
|
||||
".++++++++++@#",
|
||||
".++++++++++@#",
|
||||
".++++++++++@#",
|
||||
".++++++++++@#",
|
||||
".++++++++++@#",
|
||||
".++++++++++@#",
|
||||
".+@@@@@@@@@@#",
|
||||
".############"};
|
Reference in New Issue
Block a user