diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-04-12 19:31:02 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-04-12 19:31:02 +0000 |
| commit | 5b126a92737bba6264065c8ff437056c908204f5 (patch) | |
| tree | 51459d8295dc1159628765c185dbd72b8bd66473 /src | |
| parent | 5096951200ec362b995a00b4d6ecb3e3a622950a (diff) | |
| download | qmmp-5b126a92737bba6264065c8ff437056c908204f5.tar.gz qmmp-5b126a92737bba6264065c8ff437056c908204f5.tar.bz2 qmmp-5b126a92737bba6264065c8ff437056c908204f5.zip | |
added wave output plugin
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@901 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src')
24 files changed, 583 insertions, 60 deletions
diff --git a/src/plugins/General/General.pro b/src/plugins/General/General.pro index e19fe4b5f..c7db7aa8e 100644 --- a/src/plugins/General/General.pro +++ b/src/plugins/General/General.pro @@ -1,8 +1,8 @@ SUBDIRS += statusicon \ - scrobbler \ - mpris \ notifier \ - hal \ lyrics \ - hotkey + scrobbler +unix:SUBDIRS += mpris \ + hal \ + hotkey TEMPLATE = subdirs diff --git a/src/plugins/General/lyrics/lyrics.pro b/src/plugins/General/lyrics/lyrics.pro index 8f4985481..ac6c8bb01 100644 --- a/src/plugins/General/lyrics/lyrics.pro +++ b/src/plugins/General/lyrics/lyrics.pro @@ -6,12 +6,15 @@ warn_on \ plugin TARGET =$$PLUGINS_PREFIX/General/lyrics -QMAKE_CLEAN = $$PLUGINS_PREFIX/General/liblyrics.so +unix:QMAKE_CLEAN = $$PLUGINS_PREFIX/General/liblyrics.so TEMPLATE = lib -QMAKE_LIBDIR += ../../../../lib -LIBS += -lqmmpui -lqmmp +unix:QMAKE_LIBDIR += ../../../../lib +unix:LIBS += -lqmmpui -lqmmp + +win32:QMAKE_LIBDIR += ../../../../bin +win32:LIBS += -lqmmpui0 -lqmmp0 TRANSLATIONS = translations/lyrics_plugin_cs.ts \ translations/lyrics_plugin_de.ts \ @@ -21,16 +24,17 @@ TRANSLATIONS = translations/lyrics_plugin_cs.ts \ translations/lyrics_plugin_pl.ts \ translations/lyrics_plugin_uk_UA.ts RESOURCES = translations/translations.qrc - +wnix{ isEmpty(LIB_DIR){ LIB_DIR = /lib } target.path = $$LIB_DIR/qmmp/General INSTALLS += target - +} HEADERS += lyricsfactory.h \ lyrics.h \ lyricswindow.h +win32:HEADERS += ../../../../src/qmmpui/general.h SOURCES += lyricsfactory.cpp \ lyrics.cpp \ lyricswindow.cpp diff --git a/src/plugins/General/notifier/notifier.pro b/src/plugins/General/notifier/notifier.pro index 9c80b2215..ed6da6813 100644 --- a/src/plugins/General/notifier/notifier.pro +++ b/src/plugins/General/notifier/notifier.pro @@ -6,12 +6,14 @@ warn_on \ plugin TARGET =$$PLUGINS_PREFIX/General/notifier -QMAKE_CLEAN =$$PLUGINS_PREFIX/General/libnotifier.so +unix:QMAKE_CLEAN =$$PLUGINS_PREFIX/General/libnotifier.so TEMPLATE = lib -QMAKE_LIBDIR += ../../../../lib -LIBS += -lqmmpui -lqmmp +unix:QMAKE_LIBDIR += ../../../../lib +unix:LIBS += -lqmmpui -lqmmp +win32:QMAKE_LIBDIR += ../../../../bin +win32:LIBS += -lqmmpui0 -lqmmp0 TRANSLATIONS = translations/notifier_plugin_cs.ts \ translations/notifier_plugin_de.ts \ @@ -23,17 +25,19 @@ TRANSLATIONS = translations/notifier_plugin_cs.ts \ RESOURCES = notifier_images.qrc \ translations/translations.qrc +win32 { isEmpty(LIB_DIR){ LIB_DIR = /lib } target.path = $$LIB_DIR/qmmp/General INSTALLS += target -#FORMS += settingsdialog.ui +} HEADERS += notifierfactory.h \ notifier.h \ popupwidget.h \ settingsdialog.h +win32:HEADERS += ../../../../src/qmmpui/general.h SOURCES += notifierfactory.cpp \ notifier.cpp \ popupwidget.cpp \ diff --git a/src/plugins/General/notifier/popupwidget.cpp b/src/plugins/General/notifier/popupwidget.cpp index a83508a3a..26712a93b 100644 --- a/src/plugins/General/notifier/popupwidget.cpp +++ b/src/plugins/General/notifier/popupwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008 by Ilya Kotov * + * Copyright (C) 2008-2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -35,7 +35,7 @@ PopupWidget::PopupWidget(QWidget *parent) : QFrame(parent) { setWindowFlags(Qt::X11BypassWindowManagerHint | - Qt::WindowStaysOnTopHint | Qt::Window); + Qt::WindowStaysOnTopHint | Qt::Dialog | Qt::FramelessWindowHint); setFrameStyle(QFrame::Box | QFrame::Plain); QHBoxLayout *hlayout = new QHBoxLayout(this); diff --git a/src/plugins/General/scrobbler/scrobbler.pro b/src/plugins/General/scrobbler/scrobbler.pro index 98f55d53e..75af38213 100644 --- a/src/plugins/General/scrobbler/scrobbler.pro +++ b/src/plugins/General/scrobbler/scrobbler.pro @@ -5,10 +5,11 @@ CONFIG += release \ plugin TEMPLATE = lib -QMAKE_LIBDIR += ../../../../lib +unix:QMAKE_LIBDIR += ../../../../lib +win32:QMAKE_LIBDIR += ../../../../bin TARGET=$$PLUGINS_PREFIX/General/scrobbler -QMAKE_CLEAN =$$PLUGINS_PREFIX/General/libscrobbler.so +unix:QMAKE_CLEAN =$$PLUGINS_PREFIX/General/libscrobbler.so TRANSLATIONS = translations/scrobbler_plugin_cs.ts \ @@ -20,28 +21,28 @@ TRANSLATIONS = translations/scrobbler_plugin_cs.ts \ translations/scrobbler_plugin_uk_UA.ts RESOURCES = translations/translations.qrc +unix{ isEmpty(LIB_DIR){ LIB_DIR = /lib } target.path = $$LIB_DIR/qmmp/General INSTALLS += target -#FORMS += settingsdialog.ui - -#RESOURCES += images/images.qrc - +} HEADERS += scrobblerfactory.h \ scrobbler.h \ - settingsdialog.h + settingsdialog.h +win32:HEADERS += ../../../../src/qmmpui/general.h SOURCES += scrobblerfactory.cpp \ scrobbler.cpp \ - settingsdialog.cpp + settingsdialog.cpp QT += network INCLUDEPATH += ../../../ -LIBS += -lqmmpui -lqmmp +unix:LIBS += -lqmmpui -lqmmp +win32:LIBS += -lqmmpui0 -lqmmp0 FORMS += settingsdialog.ui diff --git a/src/plugins/General/statusicon/statusicon.pro b/src/plugins/General/statusicon/statusicon.pro index b9bd03e21..66c72773c 100644 --- a/src/plugins/General/statusicon/statusicon.pro +++ b/src/plugins/General/statusicon/statusicon.pro @@ -5,13 +5,21 @@ CONFIG += release \ warn_on \ plugin -TARGET =$$PLUGINS_PREFIX/General/statusicon -QMAKE_CLEAN =$$PLUGINS_PREFIX/General/libstatusicon.so +unix:TARGET =$$PLUGINS_PREFIX/General/statusicon +unix:QMAKE_CLEAN =$$PLUGINS_PREFIX/General/libstatusicon.so +win32:TARGET = $$PLUGINS_PREFIX/General/statusicon TEMPLATE = lib + +unix{ QMAKE_LIBDIR += ../../../../lib LIBS += -lqmmpui -lqmmp +} +win32{ +QMAKE_LIBDIR += ../../../../bin +LIBS += -lqmmpui0 -lqmmp0 +} TRANSLATIONS = translations/statusicon_plugin_cs.ts \ translations/statusicon_plugin_de.ts \ @@ -22,12 +30,13 @@ TRANSLATIONS = translations/statusicon_plugin_cs.ts \ translations/statusicon_plugin_uk_UA.ts RESOURCES = translations/translations.qrc +unix{ isEmpty(LIB_DIR){ LIB_DIR = /lib } target.path = $$LIB_DIR/qmmp/General INSTALLS += target - +} RESOURCES += images/tray_images.qrc @@ -41,3 +50,5 @@ SOURCES += statusiconfactory.cpp \ qmmptrayicon.cpp FORMS += settingsdialog.ui +win32:HEADERS += ../../../../src/qmmpui/general.h + diff --git a/src/plugins/Input/Input.pro b/src/plugins/Input/Input.pro index 8235306ea..520d9060b 100644 --- a/src/plugins/Input/Input.pro +++ b/src/plugins/Input/Input.pro @@ -1,8 +1,10 @@ include(../../../qmmp.pri) -SUBDIRS += mad vorbis cue sndfile wavpack +SUBDIRS += mad cue TEMPLATE = subdirs +unix{ +SUBDIRS += vorbis sndfile wavpack contains(CONFIG, MODPLUG_PLUGIN){ SUBDIRS += modplug message(***************************) @@ -51,3 +53,4 @@ contains(CONFIG, CDAUDIO_PLUGIN){ message(* CD Audio plugin enabled *) message(***************************) } +} diff --git a/src/plugins/Input/cue/cue.pro b/src/plugins/Input/cue/cue.pro index d725fec40..932c2a3dd 100644 --- a/src/plugins/Input/cue/cue.pro +++ b/src/plugins/Input/cue/cue.pro @@ -1,6 +1,6 @@ include(../../plugins.pri) -#FORMS += detailsdialog.ui +FORMS += settingsdialog.ui HEADERS += decodercuefactory.h \ cueparser.h \ decoder_cue.h \ @@ -10,8 +10,11 @@ SOURCES += decoder_cue.cpp \ cueparser.cpp \ settingsdialog.cpp +win32:HEADERS += ../../../../src/qmmp/decoder.h \ + ../../../../src/qmmp/statehandler.h + TARGET =$$PLUGINS_PREFIX/Input/cue -QMAKE_CLEAN =$$PLUGINS_PREFIX/Input/libcue.so +unix:QMAKE_CLEAN =$$PLUGINS_PREFIX/Input/libcue.so INCLUDEPATH += ../../../ CONFIG += release \ @@ -20,8 +23,10 @@ plugin TEMPLATE = lib -QMAKE_LIBDIR += ../../../../lib -LIBS += -lqmmp -L/usr/lib +unix:QMAKE_LIBDIR += ../../../../lib +win32:QMAKE_LIBDIR += ../../../../bin +unix:LIBS += -lqmmp -L/usr/lib +win32:LIBS += -lqmmp0 TRANSLATIONS = translations/cue_plugin_ru.ts \ translations/cue_plugin_uk_UA.ts \ @@ -32,14 +37,14 @@ TRANSLATIONS = translations/cue_plugin_ru.ts \ translations/cue_plugin_de.ts RESOURCES = translations/translations.qrc +unix{ isEmpty(LIB_DIR){ LIB_DIR = /lib } target.path = $$LIB_DIR/qmmp/Input -FORMS += settingsdialog.ui - desktop.files = qmmp_cue.desktop desktop.path = /share/applications INSTALLS += target desktop +} diff --git a/src/plugins/Input/mad/decodermadfactory.cpp b/src/plugins/Input/mad/decodermadfactory.cpp index fa3f1d12b..b0efdc1d6 100644 --- a/src/plugins/Input/mad/decodermadfactory.cpp +++ b/src/plugins/Input/mad/decodermadfactory.cpp @@ -104,7 +104,7 @@ QList<FileInfo *> DecoderMADFactory::createPlayList(const QString &fileName, boo { FileInfo *info = new FileInfo(fileName); TagLib::Tag *tag = 0; - TagLib::MPEG::File fileRef(fileName.toLocal8Bit ()); + TagLib::MPEG::File fileRef(fileName.toLocal8Bit ().constData()); if (useMetaData) { diff --git a/src/plugins/Input/mad/detailsdialog.cpp b/src/plugins/Input/mad/detailsdialog.cpp index 885ff6e5e..7ab678ed5 100644 --- a/src/plugins/Input/mad/detailsdialog.cpp +++ b/src/plugins/Input/mad/detailsdialog.cpp @@ -93,7 +93,7 @@ DetailsDialog::~DetailsDialog() void DetailsDialog::loadMPEGInfo() { - TagLib::MPEG::File f (m_path.toLocal8Bit()); + TagLib::MPEG::File f (m_path.toLocal8Bit().constData()); //l.label //ui. f.audioProperties()->level(); QString text; @@ -136,7 +136,7 @@ void DetailsDialog::loadMPEGInfo() void DetailsDialog::loadTag() { - TagLib::MPEG::File f (m_path.toLocal8Bit()); + TagLib::MPEG::File f (m_path.toLocal8Bit().constData()); QTextCodec *codec = QTextCodec::codecForName ("UTF-8"); TagLib::Tag *tag = 0; @@ -199,7 +199,7 @@ void DetailsDialog::loadTag() void DetailsDialog::save() { - TagLib::MPEG::File* f = new TagLib::MPEG::File(m_path.toLocal8Bit()); + TagLib::MPEG::File* f = new TagLib::MPEG::File(m_path.toLocal8Bit().constData()); TagLib::String::Type type = TagLib::String::Latin1; QTextCodec *codec = 0; @@ -259,7 +259,7 @@ void DetailsDialog::save() void DetailsDialog::create() { - TagLib::MPEG::File *f = new TagLib::MPEG::File (m_path.toLocal8Bit()); + TagLib::MPEG::File *f = new TagLib::MPEG::File (m_path.toLocal8Bit().constData()); TagLib::Tag *tag = 0; if (selectedTag() == TagLib::MPEG::File::ID3v1) tag = f->ID3v1Tag(TRUE); @@ -277,7 +277,7 @@ void DetailsDialog::create() void DetailsDialog::deleteTag() { - TagLib::MPEG::File *f = new TagLib::MPEG::File (m_path.toLocal8Bit()); + TagLib::MPEG::File *f = new TagLib::MPEG::File (m_path.toLocal8Bit().constData()); f->strip(selectedTag()); delete f; loadTag(); diff --git a/src/plugins/Input/mad/mad.pro b/src/plugins/Input/mad/mad.pro index 1e872fe2a..2c8787675 100644 --- a/src/plugins/Input/mad/mad.pro +++ b/src/plugins/Input/mad/mad.pro @@ -15,17 +15,23 @@ SOURCES += decoder_mad.cpp \ tagextractor.cpp TARGET =$$PLUGINS_PREFIX/Input/mad -QMAKE_CLEAN =$$PLUGINS_PREFIX/Input/libmad.so +unix:QMAKE_CLEAN =$$PLUGINS_PREFIX/Input/libmad.so -INCLUDEPATH += ../../../ + +INCLUDEPATH += ../../../ +win32:INCLUDEPATH += D:\MINGW\include\taglib CONFIG += release \ warn_on \ plugin \ link_pkgconfig TEMPLATE = lib -QMAKE_LIBDIR += ../../../../lib -LIBS += -lqmmp -lmad -PKGCONFIG += taglib mad +unix:QMAKE_LIBDIR += ../../../../lib +win32:QMAKE_LIBDIR += ../../../../bin +unix:LIBS += -lqmmp -lmad +unix:PKGCONFIG += taglib mad + +win32:LIBS += -lqmmp0 -lmad -ltag.dll -ltag_c.dll + TRANSLATIONS = translations/mad_plugin_ru.ts \ translations/mad_plugin_uk_UA.ts \ translations/mad_plugin_zh_CN.ts \ @@ -35,8 +41,10 @@ TRANSLATIONS = translations/mad_plugin_ru.ts \ translations/mad_plugin_de.ts RESOURCES = translations/translations.qrc +unix{ isEmpty(LIB_DIR){ LIB_DIR = /lib } target.path = $$LIB_DIR/qmmp/Input INSTALLS += target +} diff --git a/src/plugins/Output/Output.pro b/src/plugins/Output/Output.pro index a4d2114eb..d60a6e64c 100644 --- a/src/plugins/Output/Output.pro +++ b/src/plugins/Output/Output.pro @@ -2,7 +2,8 @@ include(../../../qmmp.pri) CONFIG += release warn_on TEMPLATE = subdirs - +win32:SUBDIRS += waveout +unix{ contains(CONFIG, JACK_PLUGIN){ # SUBDIRS += jack message(***********************) @@ -30,3 +31,4 @@ contains(CONFIG, ALSA_PLUGIN){ message(* ALSA plugin enabled *) message(***********************) } +}
\ No newline at end of file diff --git a/src/plugins/Output/waveout/outputwaveout.cpp b/src/plugins/Output/waveout/outputwaveout.cpp new file mode 100644 index 000000000..f97e267f8 --- /dev/null +++ b/src/plugins/Output/waveout/outputwaveout.cpp @@ -0,0 +1,244 @@ +/***************************************************************************
+ * Copyright (C) 2006-2008 by Ilya Kotov *
+ * forkotov02@hotmail.ru *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it 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. *
+ * *
+ * This program 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 this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+
+#include <QObject>
+#include <QApplication>
+#include <QtGlobal>
+
+#include <stdio.h>
+#include <string.h>
+#include <iostream>
+
+#include <qmmp/constants.h>
+#include <qmmp/buffer.h>
+#include <qmmp/visual.h>
+#include "outputwaveout.h"
+
+#define MAX_WAVEBLOCKS 32
+
+static CRITICAL_SECTION cs;
+static HWAVEOUT dev = NULL;
+static int ScheduledBlocks = 0;
+static int PlayedWaveHeadersCount = 0; // free index
+static WAVEHDR* PlayedWaveHeaders [MAX_WAVEBLOCKS];
+
+
+
+static void CALLBACK wave_callback (HWAVE hWave, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 )
+{
+ if ( uMsg == WOM_DONE )
+ {
+ EnterCriticalSection (&cs);
+ PlayedWaveHeaders [PlayedWaveHeadersCount++] = (WAVEHDR*) dwParam1;
+ LeaveCriticalSection (&cs);
+ }
+}
+
+static void
+free_memory ( void )
+{
+ WAVEHDR* wh;
+ HGLOBAL hg;
+
+ EnterCriticalSection ( &cs );
+ wh = PlayedWaveHeaders [--PlayedWaveHeadersCount];
+ ScheduledBlocks--; // decrease the number of USED blocks
+ LeaveCriticalSection ( &cs );
+
+ waveOutUnprepareHeader ( dev, wh, sizeof (WAVEHDR) );
+
+ hg = GlobalHandle ( wh -> lpData ); // Deallocate the buffer memory
+ GlobalUnlock (hg);
+ GlobalFree (hg);
+
+ hg = GlobalHandle ( wh ); // Deallocate the header memory
+ GlobalUnlock (hg);
+ GlobalFree (hg);
+}
+
+static int
+Box ( const char* msg )
+{
+ //MessageBox ( NULL, ms"Error Message . . .", MB_OK | MB_ICONEXCLAMATION );
+ return -1;
+}
+
+
+
+OutputWaveOut::OutputWaveOut(QObject * parent)
+ : Output(parent)
+{
+ //m_connection = 0;
+ //m_dev = 0;
+}
+
+OutputWaveOut::~OutputWaveOut()
+{
+ uninitialize();
+}
+
+void OutputWaveOut::configure(quint32 freq, int chan, int prec)
+{
+ WAVEFORMATEX fmt;
+ UINT deviceID = WAVE_MAPPER;
+
+ fmt.wFormatTag = WAVE_FORMAT_PCM;
+ fmt.wBitsPerSample = prec;
+ fmt.nChannels = chan;
+ fmt.nSamplesPerSec = (unsigned long)(freq);
+ fmt.nBlockAlign = fmt.nChannels * fmt.wBitsPerSample/8;
+ fmt.nAvgBytesPerSec = fmt.nSamplesPerSec * fmt.nChannels * fmt.wBitsPerSample/8;
+
+ switch (waveOutOpen (&dev, deviceID, &fmt, (DWORD)wave_callback, 0, CALLBACK_FUNCTION))
+ {
+ case MMSYSERR_ALLOCATED: return qWarning("OutputWaveOut: Device is already open.");
+ case MMSYSERR_BADDEVICEID: return qWarning("OutputWaveOut: The specified device is out of range.");
+ case MMSYSERR_NODRIVER: return qWarning("OutputWaveOut: There is no audio driver in this system.");
+ case MMSYSERR_NOMEM: return qWarning("OutputWaveOut: Unable to allocate sound memory.");
+ case WAVERR_BADFORMAT: return qWarning("OutputWaveOut: This audio format is not supported.");
+ case WAVERR_SYNC: return qWarning("OutputWaveOut: The device is synchronous.");
+ default: return qWarning("OutputWaveOut: Unknown media error.");
+ case MMSYSERR_NOERROR: break;
+ }
+
+ waveOutReset (dev);
+ InitializeCriticalSection ( &cs );
+ //SetPriorityClass ( GetCurrentProcess (), HIGH_PRIORITY_CLASS );
+ Output::configure(freq, chan, prec);
+ return;
+}
+
+bool OutputWaveOut::initialize()
+{
+ if (!waveOutGetNumDevs ())
+ {
+ qWarning("OutputWaveOut: no audio device found");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+qint64 OutputWaveOut::latency()
+{
+ /*if (!m_connection)
+ return 0;
+ int error = 0;
+ qint64 delay = pa_simple_get_latency(m_connection, &error)/1000;
+ if (error)
+ {
+ qWarning("OutputWaveOut: %s", pa_strerror (error));
+ delay = 0;
+ }*/
+ return 0;
+}
+
+qint64 OutputWaveOut::writeAudio(unsigned char *data, qint64 len)
+{
+ /*int error;
+ if (!m_connection)
+ return -1;
+ if (pa_simple_write(m_connection, data, maxSize, &error) < 0)
+ {
+ mutex()->unlock();
+ qWarning("OutputWaveOut: pa_simple_write() failed: %s", pa_strerror(error));
+ return -1;
+ }*/
+ //return maxSize;
+ HGLOBAL hg;
+ HGLOBAL hg2;
+ LPWAVEHDR wh;
+ void* allocptr;
+
+ do
+ {
+ while ( PlayedWaveHeadersCount > 0 ) // free used blocks ...
+ free_memory ();
+
+ if ( ScheduledBlocks < sizeof(PlayedWaveHeaders)/sizeof(*PlayedWaveHeaders) ) // wait for a free block ...
+ break;
+ usleep (500);
+
+ } while (1);
+
+ if ( (hg2 = GlobalAlloc ( GMEM_MOVEABLE, len )) == NULL ) // allocate some memory for a copy of the buffer
+ return Box ( "GlobalAlloc failed." );
+
+ allocptr = GlobalLock (hg2);
+ CopyMemory ( allocptr, data, len ); // Here we can call any modification output functions we want....
+
+ if ( (hg = GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof (WAVEHDR))) == NULL ) // now make a header and WRITE IT!
+ return -1;
+
+ wh = (wavehdr_tag*)GlobalLock (hg);
+ wh->dwBufferLength = len;
+ wh->lpData = (CHAR *)allocptr;
+
+ if ( waveOutPrepareHeader ( dev, wh, sizeof (WAVEHDR)) != MMSYSERR_NOERROR )
+ {
+ GlobalUnlock (hg);
+ GlobalFree (hg);
+ return -1;
+ }
+
+ if ( waveOutWrite ( dev, wh, sizeof (WAVEHDR)) != MMSYSERR_NOERROR )
+ {
+ GlobalUnlock (hg);
+ GlobalFree (hg);
+ return -1;
+ }
+
+ EnterCriticalSection ( &cs );
+ ScheduledBlocks++;
+ LeaveCriticalSection ( &cs );
+
+ return len;
+}
+
+void OutputWaveOut::flush()
+{
+ /*int error;
+ if (m_connection)
+ pa_simple_flush(m_connection, &error); */
+}
+
+void OutputWaveOut::uninitialize()
+{
+ if (dev)
+ {
+ while ( ScheduledBlocks > 0 )
+ {
+ Sleep (ScheduledBlocks);
+ while ( PlayedWaveHeadersCount > 0 ) // free used blocks ...
+ free_memory ();
+ }
+
+ waveOutReset (dev); // reset the device
+ waveOutClose (dev); // close the device
+ dev = 0;
+ }
+
+ DeleteCriticalSection ( &cs );
+ ScheduledBlocks = 0;
+ return;
+}
+
diff --git a/src/plugins/Output/waveout/outputwaveout.h b/src/plugins/Output/waveout/outputwaveout.h new file mode 100644 index 000000000..065a140c6 --- /dev/null +++ b/src/plugins/Output/waveout/outputwaveout.h @@ -0,0 +1,59 @@ +/***************************************************************************
+ * Copyright (C) 2006-2008 by Ilya Kotov *
+ * forkotov02@hotmail.ru *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it 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. *
+ * *
+ * This program 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 this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef OUTPUTWAVEOUT_H
+#define OUTPUTWAVEOUT_H
+
+#include <QObject>
+#include <stdio.h>
+#include <windows.h>
+#include <qmmp/output.h>
+
+/**
+ @author Ilya Kotov <forkotov02@hotmail.ru>
+*/
+class OutputWaveOut : public Output
+{
+ Q_OBJECT
+public:
+ OutputWaveOut(QObject * parent = 0);
+ ~OutputWaveOut();
+
+ bool initialize();
+ void configure(quint32, int, int);
+ qint64 latency();
+
+private:
+ //output api
+ qint64 writeAudio(unsigned char *data, qint64 maxSize);
+ void flush();
+
+ // helper functions
+ void status();
+ void uninitialize();
+
+ //pa_simple *m_connection;
+ /*HWAVEOUT m_dev;
+ CRITICAL_SECTION m_cs; */
+
+};
+
+
+#endif // OUTPUTWAVEOUT_H
diff --git a/src/plugins/Output/waveout/outputwaveoutfactory.cpp b/src/plugins/Output/waveout/outputwaveoutfactory.cpp new file mode 100644 index 000000000..04c22b447 --- /dev/null +++ b/src/plugins/Output/waveout/outputwaveoutfactory.cpp @@ -0,0 +1,66 @@ +/***************************************************************************
+ * Copyright (C) 2007-2008 by Ilya Kotov *
+ * forkotov02@hotmail.ru *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it 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. *
+ * *
+ * This program 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 this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include <QtGui>
+
+#include "outputwaveout.h"
+#include "outputwaveoutfactory.h"
+
+
+const OutputProperties OutputWaveOutFactory::properties() const
+{
+ OutputProperties properties;
+ properties.name = tr("WaveOut Plugin");
+ properties.hasAbout = TRUE;
+ properties.hasSettings = FALSE;
+ return properties;
+}
+
+Output* OutputWaveOutFactory::create(QObject* parent)
+{
+ return new OutputWaveOut(parent);
+}
+
+VolumeControl *OutputWaveOutFactory::createVolumeControl(QObject *)
+{
+ return 0;
+}
+
+void OutputWaveOutFactory::showSettings(QWidget* parent)
+{
+ Q_UNUSED(parent);
+}
+
+void OutputWaveOutFactory::showAbout(QWidget *parent)
+{
+ QMessageBox::about (parent, tr("About WaveOut Output Plugin"),
+ tr("Qmmp WaveOut Output Plugin")+"\n"+
+ tr("Writen by: Ilya Kotov <forkotov02@hotmail.ru>"));
+}
+
+QTranslator *OutputWaveOutFactory::createTranslator(QObject *parent)
+{
+ QTranslator *translator = new QTranslator(parent);
+ QString locale = QLocale::system().name();
+ translator->load(QString(":/waveout_plugin_") + locale);
+ return translator;
+}
+
+Q_EXPORT_PLUGIN(OutputWaveOutFactory)
diff --git a/src/plugins/Output/waveout/outputwaveoutfactory.h b/src/plugins/Output/waveout/outputwaveoutfactory.h new file mode 100644 index 000000000..e8239cf00 --- /dev/null +++ b/src/plugins/Output/waveout/outputwaveoutfactory.h @@ -0,0 +1,49 @@ +/***************************************************************************
+ * Copyright (C) 2007-2008 by Ilya Kotov *
+ * forkotov02@hotmail.ru *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it 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. *
+ * *
+ * This program 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 this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef OUTPUTPULSEAUDIOFACTORY_H
+#define OUTPUTPULSEAUDIOFACTORY_H
+
+
+#include <QObject>
+#include <QString>
+#include <QIODevice>
+#include <QWidget>
+
+#include <qmmp/output.h>
+#include <qmmp/outputfactory.h>
+
+
+class OutputWaveOutFactory : public QObject,
+ OutputFactory
+{
+Q_OBJECT
+Q_INTERFACES(OutputFactory);
+
+public:
+ const OutputProperties properties() const;
+ Output* create(QObject* parent);
+ VolumeControl *createVolumeControl(QObject *parent);
+ void showSettings(QWidget* parent);
+ void showAbout(QWidget *parent);
+ QTranslator *createTranslator(QObject *parent);
+
+};
+
+#endif
diff --git a/src/plugins/Output/waveout/waveout.pro b/src/plugins/Output/waveout/waveout.pro new file mode 100644 index 000000000..e53e4fabb --- /dev/null +++ b/src/plugins/Output/waveout/waveout.pro @@ -0,0 +1,39 @@ +include(../../plugins.pri) + +HEADERS += outputwaveoutfactory.h \ + outputwaveout.h + +SOURCES += outputwaveoutfactory.cpp \ + outputwaveout.cpp + +HEADERS += ../../../../src/qmmp/output.h + + +TARGET=$$PLUGINS_PREFIX/Output/waveout + +INCLUDEPATH += ../../../ +QMAKE_LIBDIR += ../../../../bin + +CONFIG += release \ +warn_on \ +thread \ +plugin + +TEMPLATE = lib +LIBS += -lqmmp0 -lwinmm + +TRANSLATIONS = translations/waveout_plugin_cs.ts \ + translations/waveout_plugin_de.ts \ + translations/waveout_plugin_zh_CN.ts \ + translations/waveout_plugin_zh_TW.ts \ + translations/waveout_plugin_ru.ts \ + translations/waveout_plugin_pl.ts \ + translations/waveout_plugin_uk_UA.ts +#RESOURCES = translations/translations.qrc + +isEmpty (LIB_DIR){ +LIB_DIR = /lib +} + +target.path = $$LIB_DIR/qmmp/Output +INSTALLS += target diff --git a/src/plugins/Visual/Visual.pro b/src/plugins/Visual/Visual.pro index 527a03997..c2cde3f8f 100644 --- a/src/plugins/Visual/Visual.pro +++ b/src/plugins/Visual/Visual.pro @@ -2,10 +2,11 @@ include(../../../qmmp.pri) TEMPLATE = subdirs SUBDIRS += analyzer - +unix{ contains(CONFIG, PROJECTM_PLUGIN){ SUBDIRS += projectm message(***************************) message(* projectM plugin enabled *) message(***************************) } +}
\ No newline at end of file diff --git a/src/plugins/Visual/analyzer/analyzer.pro b/src/plugins/Visual/analyzer/analyzer.pro index 04af40804..9cdbbb98c 100644 --- a/src/plugins/Visual/analyzer/analyzer.pro +++ b/src/plugins/Visual/analyzer/analyzer.pro @@ -11,18 +11,23 @@ HEADERS += analyzer.h \ inlines.h \ colorwidget.h \ settingsdialog.h - SOURCES += analyzer.cpp \ +SOURCES += analyzer.cpp \ fft.c \ visualanalyzerfactory.cpp \ colorwidget.cpp \ settingsdialog.cpp +win32:HEADERS += ../../../../src/qmmp/visual.h +win32:INCLUDEPATH += ./ INCLUDEPATH += ../../../ CONFIG += release \ warn_on \ plugin TEMPLATE = lib -QMAKE_LIBDIR += ../../../../lib -LIBS += -lqmmp -L/usr/lib -I/usr/include +unix:QMAKE_LIBDIR += ../../../../lib +unix:LIBS += -lqmmp -L/usr/lib -I/usr/include +win32:QMAKE_LIBDIR += ../../../../bin +win32:LIBS += -lqmmp0 + TRANSLATIONS = translations/analyzer_plugin_cs.ts \ translations/analyzer_plugin_de.ts \ translations/analyzer_plugin_zh_CN.ts \ @@ -31,11 +36,10 @@ TRANSLATIONS = translations/analyzer_plugin_cs.ts \ translations/analyzer_plugin_pl.ts \ translations/analyzer_plugin_uk_UA.ts RESOURCES = translations/translations.qrc - +unix{ isEmpty(LIB_DIR){ LIB_DIR = /lib } target.path = $$LIB_DIR/qmmp/Visual INSTALLS += target - - +} diff --git a/src/plugins/plugins.pri b/src/plugins/plugins.pri index 623825dcf..5c7a674a0 100644 --- a/src/plugins/plugins.pri +++ b/src/plugins/plugins.pri @@ -1,2 +1,3 @@ include(../../qmmp.pri) -PLUGINS_PREFIX=../../../../lib/qmmp +unix:PLUGINS_PREFIX=../../../../lib/qmmp +win32:PLUGINS_PREFIX=../../../../../bin/plugins diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 6f2a3b66b..ea3c6fc19 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -1,9 +1,10 @@ SUBDIRS += Input \ Output \ - Visual \ - Effect \ General \ - PlaylistFormats \ - CommandLineOptions \ - FileDialogs + Visual + +unix:SUBDIRS += Effect \ + PlaylistFormats \ + CommandLineOptions \ + FileDialogs TEMPLATE = subdirs diff --git a/src/qmmp/qmmp.cpp b/src/qmmp/qmmp.cpp index 28b5dd0f8..d80d050ec 100644 --- a/src/qmmp/qmmp.cpp +++ b/src/qmmp/qmmp.cpp @@ -95,7 +95,11 @@ const QString Qmmp::pluginsPath() QDir dir(QMMP_INSTALL_PREFIX"/"LIB_DIR"/qmmp"); //qDebug(QMMP_INSTALL_PREFIX"/"LIB_DIR"/qmmp"); #else +#ifndef Q_OS_WIN32 QDir dir(qApp->applicationDirPath() + "/../"LIB_DIR"/qmmp"); +#else + QDir dir(qApp->applicationDirPath() + "/plugins"); +#endif #endif return dir.canonicalPath(); } diff --git a/src/ui/configdialog.cpp b/src/ui/configdialog.cpp index 229fa14c6..e86651a60 100644 --- a/src/ui/configdialog.cpp +++ b/src/ui/configdialog.cpp @@ -169,7 +169,11 @@ void ConfigDialog::loadSkins() m_skinList << fileInfo; findSkins(QDir::homePath() +"/.qmmp/skins"); +#ifdef Q_OS_WIN32 + findSkins(qApp->applicationDirPath()+"skins"); +#else findSkins(qApp->applicationDirPath()+"/../share/qmmp/skins"); +#endif foreach(QString path, m_reader->skins()) { QListWidgetItem *item = new QListWidgetItem (path.section('/', -1)); diff --git a/src/ui/playlist.cpp b/src/ui/playlist.cpp index a3c9e576e..dd454df38 100644 --- a/src/ui/playlist.cpp +++ b/src/ui/playlist.cpp @@ -368,8 +368,21 @@ void PlayList::mouseMoveEvent (QMouseEvent *e) { if (m_resize) { +#ifdef Q_OS_WIN32 + int sx = (width()-275) /25; + int sy = (height()-116) /29; + if(width() < e->x() - 14) + sx++; + else if(width() > e->x() + 14) + sx--; + if(height() < e->y() - 14) + sy++; + else if(height() > e->y() + 14) + sy--; + resize (275+25*sx,116+29*sy); +#else resize (e->x() +25, e->y() +25); - //usleep(32000); +#endif } } void PlayList::mouseReleaseEvent (QMouseEvent *) |
