From 8ac5efc90f03d5f4eb9cdd766b3a79da3943abd5 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Wed, 15 Apr 2009 16:08:31 +0000 Subject: added waveout plugin translation git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@906 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/Output/waveout/outputwaveout.cpp | 204 ++++++++++----------- src/plugins/Output/waveout/outputwaveout.h | 7 +- .../Output/waveout/outputwaveoutfactory.cpp | 5 +- src/plugins/Output/waveout/outputwaveoutfactory.h | 2 +- .../Output/waveout/translations/translations.qrc | 11 ++ .../waveout/translations/waveout_plugin_cs.ts | 32 ++++ .../waveout/translations/waveout_plugin_de.ts | 32 ++++ .../waveout/translations/waveout_plugin_pl.ts | 32 ++++ .../waveout/translations/waveout_plugin_ru.ts | 32 ++++ .../waveout/translations/waveout_plugin_uk_UA.ts | 32 ++++ .../waveout/translations/waveout_plugin_zh_CN.ts | 32 ++++ .../waveout/translations/waveout_plugin_zh_TW.ts | 32 ++++ src/plugins/Output/waveout/waveout.pro | 2 +- 13 files changed, 336 insertions(+), 119 deletions(-) create mode 100644 src/plugins/Output/waveout/translations/translations.qrc create mode 100644 src/plugins/Output/waveout/translations/waveout_plugin_cs.ts create mode 100644 src/plugins/Output/waveout/translations/waveout_plugin_de.ts create mode 100644 src/plugins/Output/waveout/translations/waveout_plugin_pl.ts create mode 100644 src/plugins/Output/waveout/translations/waveout_plugin_ru.ts create mode 100644 src/plugins/Output/waveout/translations/waveout_plugin_uk_UA.ts create mode 100644 src/plugins/Output/waveout/translations/waveout_plugin_zh_CN.ts create mode 100644 src/plugins/Output/waveout/translations/waveout_plugin_zh_TW.ts diff --git a/src/plugins/Output/waveout/outputwaveout.cpp b/src/plugins/Output/waveout/outputwaveout.cpp index f97e267f8..3b4c4609d 100644 --- a/src/plugins/Output/waveout/outputwaveout.cpp +++ b/src/plugins/Output/waveout/outputwaveout.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006-2008 by Ilya Kotov * + * Copyright (C) 2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -44,41 +44,41 @@ 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); - } + if ( uMsg == WOM_DONE ) + { + EnterCriticalSection (&cs); + PlayedWaveHeaders [PlayedWaveHeadersCount++] = (WAVEHDR*) dwParam1; + LeaveCriticalSection (&cs); + } } static void free_memory ( void ) { - WAVEHDR* wh; - HGLOBAL hg; + WAVEHDR* wh; + HGLOBAL hg; - EnterCriticalSection ( &cs ); - wh = PlayedWaveHeaders [--PlayedWaveHeadersCount]; - ScheduledBlocks--; // decrease the number of USED blocks - LeaveCriticalSection ( &cs ); + EnterCriticalSection ( &cs ); + wh = PlayedWaveHeaders [--PlayedWaveHeadersCount]; + ScheduledBlocks--; // decrease the number of USED blocks + LeaveCriticalSection ( &cs ); - waveOutUnprepareHeader ( dev, wh, sizeof (WAVEHDR) ); + waveOutUnprepareHeader ( dev, wh, sizeof (WAVEHDR) ); - hg = GlobalHandle ( wh -> lpData ); // Deallocate the buffer memory - GlobalUnlock (hg); - GlobalFree (hg); + hg = GlobalHandle ( wh -> lpData ); // Deallocate the buffer memory + GlobalUnlock (hg); + GlobalFree (hg); - hg = GlobalHandle ( wh ); // Deallocate the header 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; + //MessageBox ( NULL, ms"Error Message . . .", MB_OK | MB_ICONEXCLAMATION ); + return -1; } @@ -109,30 +109,37 @@ void OutputWaveOut::configure(quint32 freq, int chan, int prec) 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; + 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 ); + Output::configure(freq, chan, prec); + return; } bool OutputWaveOut::initialize() { if (!waveOutGetNumDevs ()) - { - qWarning("OutputWaveOut: no audio device found"); - return FALSE; - } + { + qWarning("OutputWaveOut: no audio device found"); + return FALSE; + } return TRUE; } @@ -140,105 +147,84 @@ bool OutputWaveOut::initialize() 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 (); + { + while ( PlayedWaveHeadersCount > 0 ) // free used blocks ... + free_memory (); - if ( ScheduledBlocks < sizeof(PlayedWaveHeaders)/sizeof(*PlayedWaveHeaders) ) // wait for a free block ... - break; - usleep (500); + if ( ScheduledBlocks < sizeof(PlayedWaveHeaders)/sizeof(*PlayedWaveHeaders) ) // wait for a free block ... + break; + usleep (500); - } while (1); + } + while (1); - if ( (hg2 = GlobalAlloc ( GMEM_MOVEABLE, len )) == NULL ) // allocate some memory for a copy of the buffer - return Box ( "GlobalAlloc failed." ); + 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.... + 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; + 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; + 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 ( 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; - } + if ( waveOutWrite ( dev, wh, sizeof (WAVEHDR)) != MMSYSERR_NOERROR ) + { + GlobalUnlock (hg); + GlobalFree (hg); + return -1; + } - EnterCriticalSection ( &cs ); - ScheduledBlocks++; - LeaveCriticalSection ( &cs ); + EnterCriticalSection ( &cs ); + ScheduledBlocks++; + LeaveCriticalSection ( &cs ); - return len; + return len; } void OutputWaveOut::flush() { - /*int error; - if (m_connection) - pa_simple_flush(m_connection, &error); */ } void OutputWaveOut::uninitialize() { - if (dev) + if (dev) + { + while ( ScheduledBlocks > 0 ) { - 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; + Sleep (ScheduledBlocks); + while ( PlayedWaveHeadersCount > 0 ) // free used blocks ... + free_memory (); } - DeleteCriticalSection ( &cs ); - ScheduledBlocks = 0; - return; + 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 index 065a140c6..a50e8a5e4 100644 --- a/src/plugins/Output/waveout/outputwaveout.h +++ b/src/plugins/Output/waveout/outputwaveout.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006-2008 by Ilya Kotov * + * Copyright (C) 2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -48,11 +48,6 @@ private: // helper functions void status(); void uninitialize(); - - //pa_simple *m_connection; - /*HWAVEOUT m_dev; - CRITICAL_SECTION m_cs; */ - }; diff --git a/src/plugins/Output/waveout/outputwaveoutfactory.cpp b/src/plugins/Output/waveout/outputwaveoutfactory.cpp index 04c22b447..72bc59b8f 100644 --- a/src/plugins/Output/waveout/outputwaveoutfactory.cpp +++ b/src/plugins/Output/waveout/outputwaveoutfactory.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2007-2008 by Ilya Kotov * + * Copyright (C) 2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -52,7 +52,8 @@ void OutputWaveOutFactory::showAbout(QWidget *parent) { QMessageBox::about (parent, tr("About WaveOut Output Plugin"), tr("Qmmp WaveOut Output Plugin")+"\n"+ - tr("Writen by: Ilya Kotov ")); + tr("Writen by: Ilya Kotov ") + "\n" + + tr("Based on aacDECdrop player")); } QTranslator *OutputWaveOutFactory::createTranslator(QObject *parent) diff --git a/src/plugins/Output/waveout/outputwaveoutfactory.h b/src/plugins/Output/waveout/outputwaveoutfactory.h index e8239cf00..6a59edbf4 100644 --- a/src/plugins/Output/waveout/outputwaveoutfactory.h +++ b/src/plugins/Output/waveout/outputwaveoutfactory.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2007-2008 by Ilya Kotov * + * Copyright (C) 2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/plugins/Output/waveout/translations/translations.qrc b/src/plugins/Output/waveout/translations/translations.qrc new file mode 100644 index 000000000..d60fabe2f --- /dev/null +++ b/src/plugins/Output/waveout/translations/translations.qrc @@ -0,0 +1,11 @@ + + + + waveout_plugin_cs.qm + waveout_plugin_de.qm + waveout_plugin_zh_CN.qm + waveout_plugin_zh_TW.qm + waveout_plugin_ru.qm + waveout_plugin_uk_UA.qm + + diff --git a/src/plugins/Output/waveout/translations/waveout_plugin_cs.ts b/src/plugins/Output/waveout/translations/waveout_plugin_cs.ts new file mode 100644 index 000000000..4318d3e79 --- /dev/null +++ b/src/plugins/Output/waveout/translations/waveout_plugin_cs.ts @@ -0,0 +1,32 @@ + + + + + OutputWaveOutFactory + + + WaveOut Plugin + + + + + About WaveOut Output Plugin + + + + + Qmmp WaveOut Output Plugin + + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + + + + + Based on aacDECdrop player + + + + diff --git a/src/plugins/Output/waveout/translations/waveout_plugin_de.ts b/src/plugins/Output/waveout/translations/waveout_plugin_de.ts new file mode 100644 index 000000000..4318d3e79 --- /dev/null +++ b/src/plugins/Output/waveout/translations/waveout_plugin_de.ts @@ -0,0 +1,32 @@ + + + + + OutputWaveOutFactory + + + WaveOut Plugin + + + + + About WaveOut Output Plugin + + + + + Qmmp WaveOut Output Plugin + + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + + + + + Based on aacDECdrop player + + + + diff --git a/src/plugins/Output/waveout/translations/waveout_plugin_pl.ts b/src/plugins/Output/waveout/translations/waveout_plugin_pl.ts new file mode 100644 index 000000000..4318d3e79 --- /dev/null +++ b/src/plugins/Output/waveout/translations/waveout_plugin_pl.ts @@ -0,0 +1,32 @@ + + + + + OutputWaveOutFactory + + + WaveOut Plugin + + + + + About WaveOut Output Plugin + + + + + Qmmp WaveOut Output Plugin + + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + + + + + Based on aacDECdrop player + + + + diff --git a/src/plugins/Output/waveout/translations/waveout_plugin_ru.ts b/src/plugins/Output/waveout/translations/waveout_plugin_ru.ts new file mode 100644 index 000000000..58f33207b --- /dev/null +++ b/src/plugins/Output/waveout/translations/waveout_plugin_ru.ts @@ -0,0 +1,32 @@ + + + + + OutputWaveOutFactory + + + WaveOut Plugin + Модуль WaveOut + + + + About WaveOut Output Plugin + О модуле вывода WaveOut + + + + Qmmp WaveOut Output Plugin + Модуль вывода WaveOut для Qmmp + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + Разработчик: Илья Котов <forkotov02@hotmail.ru> + + + + Based on aacDECdrop player + Основан на базе проигрывателя aacDECdrop + + + diff --git a/src/plugins/Output/waveout/translations/waveout_plugin_uk_UA.ts b/src/plugins/Output/waveout/translations/waveout_plugin_uk_UA.ts new file mode 100644 index 000000000..4318d3e79 --- /dev/null +++ b/src/plugins/Output/waveout/translations/waveout_plugin_uk_UA.ts @@ -0,0 +1,32 @@ + + + + + OutputWaveOutFactory + + + WaveOut Plugin + + + + + About WaveOut Output Plugin + + + + + Qmmp WaveOut Output Plugin + + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + + + + + Based on aacDECdrop player + + + + diff --git a/src/plugins/Output/waveout/translations/waveout_plugin_zh_CN.ts b/src/plugins/Output/waveout/translations/waveout_plugin_zh_CN.ts new file mode 100644 index 000000000..4318d3e79 --- /dev/null +++ b/src/plugins/Output/waveout/translations/waveout_plugin_zh_CN.ts @@ -0,0 +1,32 @@ + + + + + OutputWaveOutFactory + + + WaveOut Plugin + + + + + About WaveOut Output Plugin + + + + + Qmmp WaveOut Output Plugin + + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + + + + + Based on aacDECdrop player + + + + diff --git a/src/plugins/Output/waveout/translations/waveout_plugin_zh_TW.ts b/src/plugins/Output/waveout/translations/waveout_plugin_zh_TW.ts new file mode 100644 index 000000000..4318d3e79 --- /dev/null +++ b/src/plugins/Output/waveout/translations/waveout_plugin_zh_TW.ts @@ -0,0 +1,32 @@ + + + + + OutputWaveOutFactory + + + WaveOut Plugin + + + + + About WaveOut Output Plugin + + + + + Qmmp WaveOut Output Plugin + + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + + + + + Based on aacDECdrop player + + + + diff --git a/src/plugins/Output/waveout/waveout.pro b/src/plugins/Output/waveout/waveout.pro index e53e4fabb..86c92a997 100644 --- a/src/plugins/Output/waveout/waveout.pro +++ b/src/plugins/Output/waveout/waveout.pro @@ -29,7 +29,7 @@ TRANSLATIONS = translations/waveout_plugin_cs.ts \ translations/waveout_plugin_ru.ts \ translations/waveout_plugin_pl.ts \ translations/waveout_plugin_uk_UA.ts -#RESOURCES = translations/translations.qrc +RESOURCES = translations/translations.qrc isEmpty (LIB_DIR){ LIB_DIR = /lib -- cgit v1.2.3-13-gbd6f