summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen2015-06-09 20:09:26 +0800
committerAllen2015-06-09 20:09:26 +0800
commit770bc478dff932022349fc4a3d262e1182581f76 (patch)
treed5f192044c77f2cb36b062f3e0b7f74954c3aa6d
downloadaur-770bc478dff932022349fc4a3d262e1182581f76.tar.gz
Initial import
-rw-r--r--.SRCINFO29
-rw-r--r--DeviceFrame.cpp362
-rwxr-xr-xMIDIDeviceDialog.h31
-rw-r--r--PKGBUILD34
-rw-r--r--TagsDialog.h24
-rw-r--r--gcc-4.4.patch34
-rw-r--r--speexfile.cpp.patch11
7 files changed, 525 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..d9aa5ed2b805
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,29 @@
+pkgbase = audiere
+ pkgdesc = High-level audio API. It can play Ogg Vorbis, MP3, FLAC, uncompressed WAV, AIFF, MOD, S3M, XM, and IT files
+ pkgver = 1.9.4
+ pkgrel = 10
+ url = http://audiere.sourceforge.net/
+ arch = i686
+ arch = x86_64
+ license = LGPL
+ depends = speex
+ depends = wxgtk
+ depends = libvorbis
+ depends = libcdaudio
+ optdepends = flac: for flac format
+ options = !libtool
+ source = http://downloads.sourceforge.net/sourceforge/audiere/audiere-1.9.4.tar.gz
+ source = gcc-4.4.patch
+ source = TagsDialog.h
+ source = DeviceFrame.cpp
+ source = MIDIDeviceDialog.h
+ source = speexfile.cpp.patch
+ md5sums = b95dfe6f1e69cfd12371747f22772766
+ md5sums = bd082fa9a258ef6598eefe88a71a4279
+ md5sums = 55c31ad9a68304f49f30ac8ca9fa3288
+ md5sums = 0fe69aeb84a6860ef7a36f75887f4f07
+ md5sums = a80de799a3b833f0331cf83f7f6a27ab
+ md5sums = 8dd3fd42cb0ff4961ec050fc859bcf63
+
+pkgname = audiere
+
diff --git a/DeviceFrame.cpp b/DeviceFrame.cpp
new file mode 100644
index 000000000000..33a1559f5942
--- /dev/null
+++ b/DeviceFrame.cpp
@@ -0,0 +1,362 @@
+#ifdef _MSC_VER
+#pragma warning(disable : 4786)
+#endif
+
+
+#include <set>
+#include <string>
+#include <vector>
+#include "Commands.h"
+#include "DeviceFrame.h"
+#include "SoundEffectFrame.h"
+#include "StreamFrame.h"
+#include "wxPlayer.h"
+
+#if wxCHECK_VERSION(2,5,3)
+#include "wx/generic/numdlgg.h"
+#endif
+
+template<typename T>
+std::string Join(
+ T cont,
+ const std::string& joiner,
+ const std::string& prefix = "")
+{
+ std::string result;
+
+ typename T::iterator i = cont.begin();
+ for (;;) {
+ result += prefix + *i++;
+ if (i == cont.end()) {
+ break;
+ } else {
+ result += joiner;
+ }
+ }
+
+ return result;
+}
+
+
+BEGIN_EVENT_TABLE(DeviceFrame, wxMDIParentFrame)
+ EVT_MENU(DEVICE_NEW_DEVICE, DeviceFrame::OnDeviceNewDevice)
+ EVT_MENU(DEVICE_NEW_CDDEVICE, DeviceFrame::OnDeviceNewCDDevice)
+ EVT_MENU(DEVICE_NEW_MIDIDEVICE, DeviceFrame::OnDeviceNewMIDIDevice)
+ EVT_MENU(DEVICE_OPEN_STREAM, DeviceFrame::OnDeviceOpenStream)
+ EVT_MENU(DEVICE_OPEN_SOUND, DeviceFrame::OnDeviceOpenSound)
+ EVT_MENU(DEVICE_CREATE_TONE, DeviceFrame::OnDeviceCreateTone)
+ EVT_MENU(DEVICE_CREATE_SQUARE_WAVE, DeviceFrame::OnDeviceCreateSquareWave)
+ EVT_MENU(DEVICE_CREATE_WHITE_NOISE, DeviceFrame::OnDeviceCreateWhiteNoise)
+ EVT_MENU(DEVICE_CREATE_PINK_NOISE, DeviceFrame::OnDeviceCreatePinkNoise)
+ EVT_MENU(DEVICE_OPEN_SINGLE_EFFECT, DeviceFrame::OnDeviceOpenSingleEffect)
+ EVT_MENU(DEVICE_OPEN_MULTIPLE_EFFECT, DeviceFrame::OnDeviceOpenMultipleEffect)
+ EVT_MENU(DEVICE_CLOSE_WINDOW, DeviceFrame::OnDeviceCloseCurrentWindow)
+ EVT_MENU(DEVICE_CLOSE, DeviceFrame::OnDeviceClose)
+ EVT_MENU(HELP_ABOUT, DeviceFrame::OnHelpAbout)
+END_EVENT_TABLE()
+
+
+DeviceFrame::DeviceFrame(audiere::AudioDevicePtr device)
+: wxMDIParentFrame(0, -1, wxT("Audio Device - " + CStr2wxString( device->getName() )),
+ wxDefaultPosition, wxSize(400, 500))
+{
+ m_device = device;
+
+ wxMenu* deviceMenu = new wxMenu();
+ deviceMenu->Append(DEVICE_NEW_DEVICE, wxT("&New Device..."));
+ deviceMenu->Append(DEVICE_NEW_CDDEVICE, wxT("New C&D Device..."));
+ deviceMenu->Append(DEVICE_NEW_MIDIDEVICE, wxT("New &MIDI Device..."));
+ deviceMenu->AppendSeparator();
+ deviceMenu->Append(DEVICE_OPEN_STREAM, wxT("&Open Stream..."));
+ deviceMenu->Append(DEVICE_OPEN_SOUND, wxT("Open &Sound..."));
+ deviceMenu->AppendSeparator();
+ deviceMenu->Append(DEVICE_CREATE_TONE, wxT("Create &Tone..."));
+ deviceMenu->Append(DEVICE_CREATE_SQUARE_WAVE, wxT("Create S&quare Wave..."));
+ deviceMenu->Append(DEVICE_CREATE_WHITE_NOISE, wxT("Create &White Noise"));
+ deviceMenu->Append(DEVICE_CREATE_PINK_NOISE, wxT("Create &Pink Noise"));
+ deviceMenu->AppendSeparator();
+ deviceMenu->Append(DEVICE_OPEN_SINGLE_EFFECT, wxT("Open &Effect (Single)..."));
+ deviceMenu->Append(DEVICE_OPEN_MULTIPLE_EFFECT, wxT("Open Effect (&Multiple)..."));
+ deviceMenu->AppendSeparator();
+ deviceMenu->Append(DEVICE_CLOSE_WINDOW, wxT("Close C&urrent Window"));
+ deviceMenu->Append(DEVICE_CLOSE, wxT("&Close Device"));
+
+ wxMenu* helpMenu = new wxMenu();
+ helpMenu->Append(HELP_ABOUT, wxT("&About..."));
+
+ wxMenuBar* menuBar = new wxMenuBar();
+ menuBar->Append(deviceMenu, wxT("&Device"));
+ menuBar->Append(helpMenu, wxT("&Help"));
+ SetMenuBar(menuBar);
+
+ SetFocus();
+}
+
+
+void DeviceFrame::OnDeviceNewDevice(wxCommandEvent&) {
+ wxGetApp().OnNewDevice(this);
+}
+
+
+void DeviceFrame::OnDeviceNewCDDevice(wxCommandEvent&) {
+ wxGetApp().OnNewCDDevice(this);
+}
+
+
+void DeviceFrame::OnDeviceNewMIDIDevice(wxCommandEvent&) {
+ wxGetApp().OnNewMIDIDevice(this);
+}
+
+
+wxString DeviceFrame::GetSoundFile() {
+ std::vector<audiere::FileFormatDesc> formats;
+ audiere::GetSupportedFileFormats(formats);
+
+ // combine all of the supported extensions into one collection
+ std::set<std::string> all_extensions;
+ {
+ for (unsigned i = 0; i < formats.size(); ++i) {
+ for (unsigned j = 0; j < formats[i].extensions.size(); ++j) {
+ all_extensions.insert("*." + formats[i].extensions[j]);
+ }
+ }
+ }
+
+ // build a string of wildcards for wxWindows
+ std::string wildcards;
+ wildcards = "Sound Files (" + Join(all_extensions, ",") + ")|";
+ wildcards += Join(all_extensions, ";") + "|";
+
+ {
+ for (unsigned i = 0; i < formats.size(); ++i) {
+ audiere::FileFormatDesc& ffd = formats[i];
+ wildcards += ffd.description + " ";
+ wildcards += "(" + Join(ffd.extensions, ",", "*.") + ")|";
+ wildcards += Join(ffd.extensions, ";", "*.") + "|";
+ }
+ }
+
+ wildcards += "All Files (*.*)|*.*";
+
+ return wxFileSelector(
+ wxT("Select a sound file"), wxT(""), wxT(""), wxT(""),
+ CStr2wxString(wildcards.c_str()), wxOPEN, this);
+}
+
+
+void DeviceFrame::OnDeviceOpenStream(wxCommandEvent &) {
+ wxString filename(GetSoundFile());
+ if (filename.empty()) {
+ return;
+ }
+
+#if wxUSE_UNICODE
+ wxCharBuffer buffFilename = filename.mb_str(wxConvUTF8);
+ audiere::SampleSourcePtr source = audiere::OpenSampleSource(buffFilename.data());
+#else
+ audiere::SampleSourcePtr source = audiere::OpenSampleSource(filename);
+#endif
+ if (!source) {
+ wxMessageBox(
+ wxT("Could not open sample source: ") + filename,
+ wxT("Open Stream"), wxOK | wxCENTRE, this);
+ return;
+ }
+
+ audiere::LoopPointSourcePtr loop_source =
+ audiere::CreateLoopPointSource(source);
+ if (loop_source) {
+ source = loop_source.get();
+ }
+
+ audiere::OutputStreamPtr stream = audiere::OpenSound(
+ m_device,
+ source,
+ true);
+ if (!stream) {
+ wxMessageBox(
+ wxT("Could not open output stream: ") + filename,
+ wxT("Open Stream"), wxOK | wxCENTRE, this);
+ return;
+ }
+
+ // get the basename of the path for the window title
+ wxString basename = wxFileNameFromPath(filename);
+ new StreamFrame(this, wxT("Stream: ") + basename, stream.get(), source.get(), loop_source.get());
+}
+
+
+void DeviceFrame::OnDeviceOpenSound(wxCommandEvent &) {
+ wxString filename(GetSoundFile());
+ if (filename.empty()) {
+ return;
+ }
+
+ audiere::SampleSourcePtr source = audiere::OpenSampleSource(wxString2CStr(filename));
+ if (!source) {
+ wxMessageBox(
+ wxT("Could not open source: ") + filename,
+ wxT("Open Sound"), wxOK | wxCENTRE, this);
+ return;
+ }
+
+ audiere::OutputStreamPtr stream = audiere::OpenSound(m_device, source);
+ if (!stream) {
+ wxMessageBox(
+ wxT("Could not open sound: ") + filename,
+ wxT("Open Sound"), wxOK | wxCENTRE, this);
+ return;
+ }
+
+ // get the basename of the path for the window title
+ wxString basename = wxFileNameFromPath(filename);
+ new StreamFrame(this, wxT("Sound: ") + basename, stream.get(), source.get());
+}
+
+
+void DeviceFrame::OnDeviceCreateTone(wxCommandEvent &) {
+ int frequency = ::wxGetNumberFromUser(
+ wxT("Value must be between 1 and 30000."), wxT("Enter frequency in Hz"),
+ wxT("Create Tone"), 256, 1, 30000, this);
+ if (frequency != -1) {
+ audiere::SampleSourcePtr source = audiere::CreateTone(frequency);
+ if (!source) {
+ wxMessageBox(
+ wxT("Could not create tone"),
+ wxT("Create Tone"), wxOK | wxCENTRE, this);
+ return;
+ }
+
+ audiere::OutputStreamPtr stream = m_device->openStream(source.get());
+ if (!stream) {
+ wxMessageBox(
+ wxT("Could not open output stream"),
+ wxT("Create Tone"), wxOK | wxCENTRE, this);
+ return;
+
+ }
+
+ wxString title;
+ title.sprintf(wxT("Tone: %d Hz"), frequency);
+ new StreamFrame(this, title, stream.get(), source.get());
+ }
+}
+
+
+void DeviceFrame::OnDeviceCreateSquareWave(wxCommandEvent &) {
+ int frequency = ::wxGetNumberFromUser(
+ wxT("Value must be between 1 and 30000."), wxT("Enter frequency in Hz"),
+ wxT("Create Square Wave"), 256, 1, 30000, this);
+ if (frequency != -1) {
+ audiere::SampleSourcePtr source = audiere::CreateSquareWave(frequency);
+ if (!source) {
+ wxMessageBox(
+ wxT("Could not create square wave"),
+ wxT("Create Square Wave"), wxOK | wxCENTRE, this);
+ return;
+ }
+
+ audiere::OutputStreamPtr stream = m_device->openStream(source.get());
+ if (!stream) {
+ wxMessageBox(
+ wxT("Could not open output stream"),
+ wxT("Create Square Wave"), wxOK | wxCENTRE, this);
+ return;
+ }
+
+ wxString title;
+ title.sprintf(wxT("Square Wave: %d Hz"), frequency);
+ new StreamFrame(this, title, stream.get(), source.get());
+ }
+}
+
+
+void DeviceFrame::OnDeviceCreateWhiteNoise(wxCommandEvent &) {
+ audiere::SampleSourcePtr source = audiere::CreateWhiteNoise();
+ if (!source) {
+ wxMessageBox(
+ wxT("Could not create white noise"),
+ wxT("Create White Noise"), wxOK | wxCENTRE, this);
+ return;
+ }
+
+ audiere::OutputStreamPtr stream = m_device->openStream(source.get());
+ if (!stream) {
+ wxMessageBox(
+ wxT("Could not open output stream"),
+ wxT("Create White Noise"), wxOK | wxCENTRE, this);
+ return;
+ }
+
+ new StreamFrame(this, wxT("White Noise"), stream.get(), source.get());
+}
+
+
+void DeviceFrame::OnDeviceCreatePinkNoise(wxCommandEvent &) {
+ audiere::SampleSourcePtr source = audiere::CreatePinkNoise();
+ if (!source) {
+ wxMessageBox(
+ wxT("Could not create white noise"),
+ wxT("Create Pink Noise"), wxOK | wxCENTRE, this);
+ return;
+ }
+
+ audiere::OutputStreamPtr stream = m_device->openStream(source.get());
+ if (!stream) {
+ wxMessageBox(
+ wxT("Could not open output stream"),
+ wxT("Create Pink Noise"), wxOK | wxCENTRE, this);
+ return;
+ }
+
+ new StreamFrame(this, wxT("Pink Noise"), stream.get(), source.get());
+}
+
+
+void DeviceFrame::OnDeviceOpenSingleEffect(wxCommandEvent &) {
+ DoOpenEffect(audiere::SINGLE, wxT("Single"));
+}
+
+
+void DeviceFrame::OnDeviceOpenMultipleEffect(wxCommandEvent &) {
+ DoOpenEffect(audiere::MULTIPLE, wxT("Multiple"));
+}
+
+
+void DeviceFrame::DoOpenEffect(audiere::SoundEffectType type, wxString typestring) {
+ wxString filename(GetSoundFile());
+ if (filename.empty()) {
+ return;
+ }
+
+ audiere::SoundEffectPtr effect = audiere::OpenSoundEffect(m_device, wxString2CStr(filename), type);
+ if (effect) {
+ wxString basename = wxFileNameFromPath(filename);
+ wxString title;
+ title.sprintf(wxT("Sound Effect (%s): %s"),
+ typestring.c_str(), basename.c_str());
+ new SoundEffectFrame(this, title, effect);
+ } else {
+ wxMessageBox(
+ wxT("Could not open sound effect: ") + filename,
+ wxT("Open Sound Effect"), wxOK | wxCENTRE, this);
+ }
+}
+
+
+void DeviceFrame::OnDeviceCloseCurrentWindow(wxCommandEvent&) {
+ wxMDIChildFrame* frame = GetActiveChild();
+ if (frame) {
+ frame->Close();
+ }
+}
+
+
+void DeviceFrame::OnDeviceClose(wxCommandEvent &) {
+ Close();
+}
+
+
+void DeviceFrame::OnHelpAbout(wxCommandEvent &) {
+ wxGetApp().ShowAboutDialog(this);
+}
diff --git a/MIDIDeviceDialog.h b/MIDIDeviceDialog.h
new file mode 100755
index 000000000000..64e23070b55d
--- /dev/null
+++ b/MIDIDeviceDialog.h
@@ -0,0 +1,31 @@
+#ifndef ADR_MIDI_DEVICE_DIALOG_H
+#define ADR_MIDI_DEVICE_DIALOG_H
+
+
+#include <string>
+#include "wx.h"
+
+
+class MIDIDeviceDialog : public wxDialog {
+public:
+ MIDIDeviceDialog(wxWindow* parent);
+
+ const std::string& getName() const {
+ return m_name_str;
+ }
+
+private:
+ void OnButton(wxCommandEvent& event);
+
+ wxTextCtrl* m_name;
+
+ wxButton* m_ok;
+ wxButton* m_cancel;
+
+ std::string m_name_str;
+
+ DECLARE_EVENT_TABLE()
+};
+
+
+#endif
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..55c3b6d505bd
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,34 @@
+# Contributor: Sebastian Vandekerckhove <ptitfox@scarlet.be>
+# Maintainer: Stefan Husmann <stefan-husmann@t-online.de>
+pkgname=audiere
+pkgver=1.9.4
+pkgrel=10
+pkgdesc="High-level audio API. It can play Ogg Vorbis, MP3, FLAC, uncompressed WAV, AIFF, MOD, S3M, XM, and IT files"
+arch=('i686' 'x86_64')
+url="http://audiere.sourceforge.net/"
+license=('LGPL')
+depends=('speex' 'wxgtk' 'libvorbis' 'libcdaudio')
+optdepends=('flac: for flac format')
+source=(http://downloads.sourceforge.net/sourceforge/audiere/audiere-1.9.4.tar.gz gcc-4.4.patch TagsDialog.h DeviceFrame.cpp MIDIDeviceDialog.h speexfile.cpp.patch)
+md5sums=('b95dfe6f1e69cfd12371747f22772766' 'bd082fa9a258ef6598eefe88a71a4279'\
+ '55c31ad9a68304f49f30ac8ca9fa3288' '0fe69aeb84a6860ef7a36f75887f4f07'\
+ 'a80de799a3b833f0331cf83f7f6a27ab' '8dd3fd42cb0ff4961ec050fc859bcf63')
+options=('!libtool')
+
+build() {
+ cd $srcdir/$pkgname-$pkgver
+ msg "Apply patch ..."
+ patch -Np1 < $srcdir/gcc-4.4.patch || return 1
+ patch -Np1 < $srcdir/speexfile.cpp.patch || return 1
+ for _i in TagsDialog.h DeviceFrame.cpp MIDIDeviceDialog.h
+ do
+ cp $srcdir/${_i} examples/wxPlayer || return 1
+ done
+ ./configure --prefix=/usr --with-pic --without-dumb || return 1
+ sed -ie 's/wxOPEN/wxFD_OPEN/g' examples/wxPlayer/{MIDIDeviceFrame,DeviceFrame}.cpp
+ make || return 1
+}
+package() {
+ cd $srcdir/$pkgname-$pkgver
+ make DESTDIR=$pkgdir install || return 1
+}
diff --git a/TagsDialog.h b/TagsDialog.h
new file mode 100644
index 000000000000..ec23401b9700
--- /dev/null
+++ b/TagsDialog.h
@@ -0,0 +1,24 @@
+#ifndef TAGS_DIALOG_H
+#define TAGS_DIALOG_H
+
+
+#include <audiere.h>
+#include "wx.h"
+
+
+class TagsDialog : public wxDialog {
+public:
+ TagsDialog(
+ wxWindow* parent,
+ audiere::SampleSourcePtr source);
+
+private:
+ void OnButton(wxCommandEvent& event);
+ void OnClose(wxCloseEvent& event);
+
+ wxListBox* m_tags;
+ wxButton* m_close;
+
+ DECLARE_EVENT_TABLE()
+};
+#endif
diff --git a/gcc-4.4.patch b/gcc-4.4.patch
new file mode 100644
index 000000000000..528e1ba9e17f
--- /dev/null
+++ b/gcc-4.4.patch
@@ -0,0 +1,34 @@
+diff -Naur audiere-1.9.4.orig//src/audiere.h audiere-1.9.4.new//src/audiere.h
+--- audiere-1.9.4.orig//src/audiere.h 2010-04-02 15:58:56.000000000 +0200
++++ audiere-1.9.4.new//src/audiere.h 2010-04-02 16:00:52.000000000 +0200
+@@ -28,6 +28,7 @@
+
+ #include <vector>
+ #include <string>
++#include <cstring>
+
+ #ifdef _MSC_VER
+ #pragma warning(disable : 4786)
+diff -Naur audiere-1.9.4.orig//src/debug.h audiere-1.9.4.new//src/debug.h
+--- audiere-1.9.4.orig//src/debug.h 2010-04-02 15:58:56.000000000 +0200
++++ audiere-1.9.4.new//src/debug.h 2010-04-02 16:01:39.000000000 +0200
+@@ -5,7 +5,7 @@
+ #include <assert.h>
+ #include <stdio.h>
+ #include <string>
+-
++#include <cstdlib>
+
+ namespace audiere {
+
+diff -Naur audiere-1.9.4.orig//src/utility.cpp audiere-1.9.4.new//src/utility.cpp
+--- audiere-1.9.4.orig//src/utility.cpp 2010-04-02 15:58:56.000000000 +0200
++++ audiere-1.9.4.new//src/utility.cpp 2010-04-02 16:00:52.000000000 +0200
+@@ -4,6 +4,7 @@
+
+
+ #include <ctype.h>
++#include <cstdio>
+ #include "utility.h"
+ #include "internal.h"
+
diff --git a/speexfile.cpp.patch b/speexfile.cpp.patch
new file mode 100644
index 000000000000..f7b1ea24d102
--- /dev/null
+++ b/speexfile.cpp.patch
@@ -0,0 +1,11 @@
+--- audiere-1.9.4/src/speexfile/speexfile.cpp 2006-02-14 05:57:01.000000000 +0100
++++ audiere-1.9.4/src/speexfile/speexfile.cpp.new 2007-10-04 14:51:32.000000000 +0200
+@@ -889,7 +889,7 @@
+ modeID = header->mode;
+ if ( forceMode != -1 )
+ modeID = forceMode;
+- mode = speex_mode_list[modeID];
++ mode = const_cast<SpeexMode*>(speex_mode_list[modeID]);
+
+ if ( mode->bitstream_version < header->mode_bitstream_version ) {
+ strcpy ( speex_last_error, "The file was encoded with a newer version of Speex.\nYou need to upgrade in order to play it." );