From: Guilhem Lavaux Date: Sun, 15 Aug 1999 10:28:21 +0000 (+0000) Subject: Commited very sort samples X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/354616b0464a97f8956a4dd68f60eab31c585df5?ds=inline Commited very sort samples git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3386 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/utils/wxMMedia2/sample/Makefile.in b/utils/wxMMedia2/sample/Makefile.in new file mode 100644 index 0000000000..f4d5cec63e --- /dev/null +++ b/utils/wxMMedia2/sample/Makefile.in @@ -0,0 +1,20 @@ +# +# File: makefile.unx +# Author: Julian Smart +# Created: 1998 +# Updated: +# Copyright: (c) 1998 Julian Smart +# +# "%W% %G%" +# +# Makefile for thread example (UNIX). + +top_srcdir = @top_srcdir@ +top_builddir = ../../.. +program_dir = utils/wxMMedia2/sample + +PROGRAM=test_med + +OBJECTS=$(PROGRAM).o ../lib/libwxmmedia2.a + +include $(top_builddir)/src/makeprog.env diff --git a/utils/wxMMedia2/sample/test_med.cpp b/utils/wxMMedia2/sample/test_med.cpp new file mode 100644 index 0000000000..bfaef8ccc2 --- /dev/null +++ b/utils/wxMMedia2/sample/test_med.cpp @@ -0,0 +1,66 @@ +// -------------------------------------------------------------------------- +// Name: test_med.cpp +// Purpose: +// Date: 08/11/1999 +// Author: Guilhem Lavaux (C) 1999 +// CVSID: $Id$ +// -------------------------------------------------------------------------- +#include +#include +#include +#include "../lib/sndoss.h" +#include "../lib/sndwav.h" +#include "../lib/sndaiff.h" +#include "../lib/sndulaw.h" + +wxSoundStreamOSS *oss_dev; +wxInputStream *f_input; +wxSoundStreamUlaw *ulaw_codec; + +class MySoundStream: public wxSoundStream { + public: + wxSoundStream& Read(void *buffer, size_t len) { return *this; } + wxSoundStream& Write(const void *buffer, size_t len) { return *this; } + + bool StartProduction(int evt) { return FALSE; } + bool StopProduction() { return FALSE; } + + void SetDuplexMode(bool on) {} + + void OnSoundEvent(int evt) { + char buffer[2048]; + + f_input->Read(buffer, sizeof(buffer)); + ulaw_codec->Write(buffer, sizeof(buffer)); + } +}; + +class MyApp: public wxApp { + bool OnInit() { + wxSoundFormatUlaw ulaw; + MySoundStream strm; + + oss_dev = new wxSoundStreamOSS(); + f_input = new wxFileInputStream(argv[1]); + + if (oss_dev->GetError() != wxSOUND_NOERR) { + wxPrintf("No device\n"); + return FALSE; + } + + ulaw.SetSampleRate(8000); + ulaw_codec = new wxSoundStreamUlaw(*oss_dev); + ulaw_codec->SetSoundFormat(ulaw); + + oss_dev->SetEventHandler(&strm); + oss_dev->StartProduction(wxSOUND_OUTPUT); + + while (1) { +// wxYield(); + strm.OnSoundEvent(0); + } + return TRUE; + } +}; + +IMPLEMENT_APP(MyApp) diff --git a/utils/wxMMedia2/sample/test_med2.cpp b/utils/wxMMedia2/sample/test_med2.cpp new file mode 100644 index 0000000000..22d240a36f --- /dev/null +++ b/utils/wxMMedia2/sample/test_med2.cpp @@ -0,0 +1,34 @@ +// -------------------------------------------------------------------------- +// Name: test_med.cpp +// Purpose: +// Date: 08/11/1999 +// Author: Guilhem Lavaux (C) 1999 +// CVSID: $Id$ +// -------------------------------------------------------------------------- +#include +#include +#include +#include "../lib/sndoss.h" +#include "../lib/sndwav.h" +#include "../lib/sndaiff.h" + +class MyApp: public wxApp { + bool OnInit() { + wxSoundStreamOSS *oss_dev = new wxSoundStreamOSS(); + wxFileInputStream *f_input = new wxFileInputStream(argv[1]); + wxSoundWave *wav_file = new wxSoundWave(*f_input, *oss_dev); + wxFrame *frame = new wxFrame(NULL, -1, "My Frame"); + wxSoundFormatPcm pcm; + + if (oss_dev->GetError() != wxSOUND_NOERR) { + wxPrintf("No device\n"); + return FALSE; + } + + wav_file->Play(); + frame->Show(TRUE); + return TRUE; + } +}; + +IMPLEMENT_APP(MyApp)