Moved all sound effects into Qt-style resources. Sound files can be played back directly from program memory by passing a pointer to the WAVE data into PlaySound as the first argument (and using the SND_MEMORY flag), it's just not documented very well.

This commit is contained in:
LoRd_MuldeR 2013-12-03 22:19:11 +01:00
parent 6800711b6a
commit b05a7ac3ef
20 changed files with 1262 additions and 1188 deletions

View File

@ -102,25 +102,6 @@ END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// WAVE
//
IDR_WAVE_ABOUT WAVE "res\\sounds\\uuaarrgh.wav"
IDR_WAVE_SUCCESS WAVE "res\\sounds\\success.wav"
IDR_WAVE_ERROR WAVE "res\\sounds\\error.wav"
IDR_WAVE_ABORTED WAVE "res\\sounds\\aborted.wav"
IDR_WAVE_WHAMMY WAVE "res\\sounds\\whammy.wav"
IDR_WAVE_WOOHOO WAVE "res\\sounds\\woohoo.wav"
IDR_WAVE_SHUTDOWN WAVE "res\\sounds\\shutdown.wav"
IDR_WAVE_BEEP WAVE "res\\sounds\\beep.wav"
IDR_WAVE_BEEP_LONG WAVE "res\\sounds\\beep2.wav"
IDR_WAVE_WAITING WAVE "res\\sounds\\waiting.wav"
IDR_WAVE_BLAST WAVE "res\\sounds\\blast.wav"
IDR_WAVE_TICK WAVE "res\\sounds\\tick.wav"
IDR_WAVE_DROP WAVE "res\\sounds\\drop.wav"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Icon // Icon
@ -134,7 +115,6 @@ IDI_ICON2 ICON "res\\FolderIcon.ico"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED #ifndef APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
@ -144,4 +124,3 @@ IDI_ICON2 ICON "res\\FolderIcon.ico"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED #endif // not APSTUDIO_INVOKED

View File

@ -412,6 +412,7 @@ del "$(TargetDir)imageformats\q???d4.dll"
<ClCompile Include="tmp\QRC_Icons.cpp" /> <ClCompile Include="tmp\QRC_Icons.cpp" />
<ClCompile Include="tmp\QRC_Images.cpp" /> <ClCompile Include="tmp\QRC_Images.cpp" />
<ClCompile Include="tmp\QRC_Localization.cpp" /> <ClCompile Include="tmp\QRC_Localization.cpp" />
<ClCompile Include="tmp\QRC_Sounds.cpp" />
<ClCompile Include="tmp\QRC_Tools_Decd.cpp" /> <ClCompile Include="tmp\QRC_Tools_Decd.cpp" />
<ClCompile Include="tmp\QRC_Tools_Encd_A.cpp" /> <ClCompile Include="tmp\QRC_Tools_Encd_A.cpp" />
<ClCompile Include="tmp\QRC_Tools_Encd_B.cpp" /> <ClCompile Include="tmp\QRC_Tools_Encd_B.cpp" />
@ -1326,6 +1327,18 @@ del "$(TargetDir)imageformats\q???d4.dll"
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\QRC_%(Filename).cpp;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\QRC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">$(SolutionDir)tmp\QRC_%(Filename).cpp;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">$(SolutionDir)tmp\QRC_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild> </CustomBuild>
<CustomBuild Include="res\Sounds.qrc">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\QRC_%(Filename).cpp" -name "%(Filename)" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\QRC_%(Filename).cpp" -name "%(Filename)" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\QRC_%(Filename).cpp" -name "%(Filename)" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">RCC "$(SolutionDir)tmp\QRC_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">RCC "$(SolutionDir)tmp\QRC_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">RCC "$(SolutionDir)tmp\QRC_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\QRC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\QRC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">$(SolutionDir)tmp\QRC_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="LameXP.rc"> <ResourceCompile Include="LameXP.rc">

View File

@ -421,6 +421,9 @@
<ClCompile Include="src\Global_Zero.cpp"> <ClCompile Include="src\Global_Zero.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="tmp\QRC_Sounds.cpp">
<Filter>Generated Files\QRC</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="src\Config.h"> <ClInclude Include="src\Config.h">
@ -758,7 +761,12 @@
<CustomBuild Include="res\Tools_Misc_C.qrc"> <CustomBuild Include="res\Tools_Misc_C.qrc">
<Filter>Resources</Filter> <Filter>Resources</Filter>
</CustomBuild> </CustomBuild>
<CustomBuild Include="src\Thread_CheckUpdate.h" /> <CustomBuild Include="res\Sounds.qrc">
<Filter>Resources</Filter>
</CustomBuild>
<CustomBuild Include="src\Thread_CheckUpdate.h">
<Filter>Header Files</Filter>
</CustomBuild>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="ReadMe.txt" /> <None Include="ReadMe.txt" />

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@
<context> <context>
<name>MainWindow</name> <name>MainWindow</name>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="773"/> <location filename="../../src/Dialog_MainWindow.cpp" line="778"/>
<source>%n file(s) have been rejected, because read access was not granted!</source> <source>%n file(s) have been rejected, because read access was not granted!</source>
<translation> <translation>
<numerusform>%n file have been rejected, because read access was not granted!</numerusform> <numerusform>%n file have been rejected, because read access was not granted!</numerusform>
@ -39,7 +39,7 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="777"/> <location filename="../../src/Dialog_MainWindow.cpp" line="782"/>
<source>%n file(s) have been rejected, because they are dummy CDDA files!</source> <source>%n file(s) have been rejected, because they are dummy CDDA files!</source>
<translation> <translation>
<numerusform>%n file have been rejected, because they are dummy CDDA files!</numerusform> <numerusform>%n file have been rejected, because they are dummy CDDA files!</numerusform>
@ -47,7 +47,7 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="781"/> <location filename="../../src/Dialog_MainWindow.cpp" line="786"/>
<source>%n file(s) have been rejected, because they appear to be Cue Sheet images!</source> <source>%n file(s) have been rejected, because they appear to be Cue Sheet images!</source>
<translation> <translation>
<numerusform>%n file have been rejected, because they appear to be Cue Sheet images!</numerusform> <numerusform>%n file have been rejected, because they appear to be Cue Sheet images!</numerusform>
@ -55,7 +55,7 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="785"/> <location filename="../../src/Dialog_MainWindow.cpp" line="790"/>
<source>%n file(s) have been rejected, because the file format could not be recognized!</source> <source>%n file(s) have been rejected, because the file format could not be recognized!</source>
<translation> <translation>
<numerusform>%n file have been rejected, because the file format could not be recognized!</numerusform> <numerusform>%n file have been rejected, because the file format could not be recognized!</numerusform>
@ -63,7 +63,7 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_MainWindow.cpp" line="3845"/> <location filename="../../src/Dialog_MainWindow.cpp" line="3846"/>
<source>%n Instance(s)</source> <source>%n Instance(s)</source>
<translation> <translation>
<numerusform>%n Instance</numerusform> <numerusform>%n Instance</numerusform>
@ -74,7 +74,7 @@
<context> <context>
<name>ProcessingDialog</name> <name>ProcessingDialog</name>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="668"/> <location filename="../../src/Dialog_Processing.cpp" line="673"/>
<source>Encoding: %n file(s) of %1 completed so far, please wait...</source> <source>Encoding: %n file(s) of %1 completed so far, please wait...</source>
<translation> <translation>
<numerusform>Encoding: %n file of %1 completed so far, please wait...</numerusform> <numerusform>Encoding: %n file of %1 completed so far, please wait...</numerusform>
@ -82,7 +82,7 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="700"/> <location filename="../../src/Dialog_Processing.cpp" line="705"/>
<source>Process was aborted by the user after %n file(s)!</source> <source>Process was aborted by the user after %n file(s)!</source>
<translation> <translation>
<numerusform>Process was aborted by the user after %n file!</numerusform> <numerusform>Process was aborted by the user after %n file!</numerusform>
@ -90,7 +90,7 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="729"/> <location filename="../../src/Dialog_Processing.cpp" line="731"/>
<source>Error: %1 of %n file(s) failed (%2). Double-click failed items for detailed information!</source> <source>Error: %1 of %n file(s) failed (%2). Double-click failed items for detailed information!</source>
<translation> <translation>
<numerusform>Error: %1 of %n file failed (%2). Double-click failed items for detailed information!</numerusform> <numerusform>Error: %1 of %n file failed (%2). Double-click failed items for detailed information!</numerusform>
@ -98,7 +98,7 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="729"/> <location filename="../../src/Dialog_Processing.cpp" line="731"/>
<source>%n file(s) skipped</source> <source>%n file(s) skipped</source>
<translation> <translation>
<numerusform>%n file skipped</numerusform> <numerusform>%n file skipped</numerusform>
@ -106,7 +106,7 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="733"/> <location filename="../../src/Dialog_Processing.cpp" line="735"/>
<source>Error: %1 of %n file(s) failed. Double-click failed items for detailed information!</source> <source>Error: %1 of %n file(s) failed. Double-click failed items for detailed information!</source>
<translation> <translation>
<numerusform>Error: %1 of %n file failed. Double-click failed items for detailed information!</numerusform> <numerusform>Error: %1 of %n file failed. Double-click failed items for detailed information!</numerusform>
@ -114,7 +114,7 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="747"/> <location filename="../../src/Dialog_Processing.cpp" line="749"/>
<source>All files completed successfully. Skipped %n file(s).</source> <source>All files completed successfully. Skipped %n file(s).</source>
<translation> <translation>
<numerusform>All files completed successfully. Skipped %n file.</numerusform> <numerusform>All files completed successfully. Skipped %n file.</numerusform>
@ -122,7 +122,7 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="1171"/> <location filename="../../src/Dialog_Processing.cpp" line="1170"/>
<source>%n hour(s)</source> <source>%n hour(s)</source>
<translation> <translation>
<numerusform>%n hour</numerusform> <numerusform>%n hour</numerusform>
@ -130,8 +130,8 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="1172"/> <location filename="../../src/Dialog_Processing.cpp" line="1171"/>
<location filename="../../src/Dialog_Processing.cpp" line="1176"/> <location filename="../../src/Dialog_Processing.cpp" line="1175"/>
<source>%n minute(s)</source> <source>%n minute(s)</source>
<translation> <translation>
<numerusform>%n minute</numerusform> <numerusform>%n minute</numerusform>
@ -139,8 +139,8 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="1177"/> <location filename="../../src/Dialog_Processing.cpp" line="1176"/>
<location filename="../../src/Dialog_Processing.cpp" line="1181"/> <location filename="../../src/Dialog_Processing.cpp" line="1180"/>
<source>%n second(s)</source> <source>%n second(s)</source>
<translation> <translation>
<numerusform>%n second</numerusform> <numerusform>%n second</numerusform>
@ -148,7 +148,7 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="../../src/Dialog_Processing.cpp" line="1182"/> <location filename="../../src/Dialog_Processing.cpp" line="1181"/>
<source>%n millisecond(s)</source> <source>%n millisecond(s)</source>
<translation> <translation>
<numerusform>%n millisecond</numerusform> <numerusform>%n millisecond</numerusform>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -143,13 +143,13 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>48</width> <width>48</width>
<height>45</height> <height>48</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>48</width> <width>48</width>
<height>45</height> <height>48</height>
</size> </size>
</property> </property>
<property name="text"> <property name="text">

18
res/Sounds.qrc Normal file
View File

@ -0,0 +1,18 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource>
<file>sounds/aborted.wav</file>
<file>sounds/beep.wav</file>
<file>sounds/beep2.wav</file>
<file>sounds/blast.wav</file>
<file>sounds/drop.wav</file>
<file>sounds/error.wav</file>
<file>sounds/shutdown.wav</file>
<file>sounds/success.wav</file>
<file>sounds/tick.wav</file>
<file>sounds/uuaarrgh.wav</file>
<file>sounds/waiting.wav</file>
<file>sounds/whammy.wav</file>
<file>sounds/woohoo.wav</file>
</qresource>
</RCC>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -35,7 +35,7 @@
#define VER_LAMEXP_MINOR_LO 9 #define VER_LAMEXP_MINOR_LO 9
#define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 9 #define VER_LAMEXP_PATCH 9
#define VER_LAMEXP_BUILD 1495 #define VER_LAMEXP_BUILD 1499
#define VER_LAMEXP_CONFG 1348 #define VER_LAMEXP_CONFG 1348
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -25,7 +25,6 @@
#include "../tmp/UIC_AboutDialog.h" #include "../tmp/UIC_AboutDialog.h"
#include "Global.h" #include "Global.h"
#include "Resource.h"
#include "Model_Settings.h" #include "Model_Settings.h"
#include <math.h> #include <math.h>
@ -214,12 +213,12 @@ int AboutDialog::exec()
{ {
if(!lamexp_play_sound_file("imageres.dll", 5080, true)) if(!lamexp_play_sound_file("imageres.dll", 5080, true))
{ {
lamexp_play_sound(0, true, L"SystemStart"); lamexp_play_sound_alias("SystemStart", true);
} }
} }
else else
{ {
lamexp_play_sound(IDR_WAVE_ABOUT, true); lamexp_play_sound("uuaarrgh", true);
} }
} }
@ -291,7 +290,7 @@ void AboutDialog::tabChanged(int index, const bool silent)
//Play tick sound //Play tick sound
if(m_settings->soundsEnabled() && (!silent)) if(m_settings->soundsEnabled() && (!silent))
{ {
lamexp_play_sound(IDR_WAVE_TICK, true); lamexp_play_sound("tick", true);
} }
//Scroll to the top //Scroll to the top

View File

@ -27,7 +27,6 @@
//LameXP includes //LameXP includes
#include "Global.h" #include "Global.h"
#include "Resource.h"
#include "Dialog_WorkingBanner.h" #include "Dialog_WorkingBanner.h"
#include "Dialog_MetaInfo.h" #include "Dialog_MetaInfo.h"
#include "Dialog_About.h" #include "Dialog_About.h"
@ -193,6 +192,12 @@ while(0)
} \ } \
while(0) while(0)
#define PLAY_SOUND_OPTIONAL(NAME, ASYNC) do \
{ \
if(m_settings->soundsEnabled()) lamexp_play_sound((NAME), (ASYNC)); \
} \
while(0)
#define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(QString(URL).replace("-", "&minus;")) #define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(QString(URL).replace("-", "&minus;"))
#define FSLINK(PATH) QString("<a href=\"file:///%1\">%2</a>").arg(PATH).arg(QString(PATH).replace("-", "&minus;")) #define FSLINK(PATH) QString("<a href=\"file:///%1\">%2</a>").arg(PATH).arg(QString(PATH).replace("-", "&minus;"))
#define CENTER_CURRENT_OUTPUT_FOLDER_DELAYED QTimer::singleShot(125, this, SLOT(centerOutputFolderModel())) #define CENTER_CURRENT_OUTPUT_FOLDER_DELAYED QTimer::singleShot(125, this, SLOT(centerOutputFolderModel()))
@ -1095,7 +1100,7 @@ void MainWindow::dropEvent(QDropEvent *event)
(*m_droppedFileList) << event->mimeData()->urls(); (*m_droppedFileList) << event->mimeData()->urls();
if(!m_droppedFileList->isEmpty()) if(!m_droppedFileList->isEmpty())
{ {
if(m_settings->soundsEnabled()) lamexp_play_sound(IDR_WAVE_DROP, true); PLAY_SOUND_OPTIONAL("drop", true);
QTimer::singleShot(0, this, SLOT(handleDroppedFiles())); QTimer::singleShot(0, this, SLOT(handleDroppedFiles()));
} }
} }
@ -1270,7 +1275,7 @@ void MainWindow::windowShown(void)
m_settings->licenseAccepted(++iAccepted); m_settings->licenseAccepted(++iAccepted);
m_settings->syncNow(); m_settings->syncNow();
QApplication::processEvents(); QApplication::processEvents();
lamexp_play_sound(IDR_WAVE_WHAMMY, false); lamexp_play_sound("whammy", false);
QMessageBox::critical(this, tr("License Declined"), tr("You have declined the license. Consequently the application will exit now!"), tr("Goodbye!")); QMessageBox::critical(this, tr("License Declined"), tr("You have declined the license. Consequently the application will exit now!"), tr("Goodbye!"));
QFileInfo uninstallerInfo = QFileInfo(QString("%1/Uninstall.exe").arg(QApplication::applicationDirPath())); QFileInfo uninstallerInfo = QFileInfo(QString("%1/Uninstall.exe").arg(QApplication::applicationDirPath()));
if(uninstallerInfo.exists()) if(uninstallerInfo.exists())
@ -1286,7 +1291,7 @@ void MainWindow::windowShown(void)
return; return;
} }
lamexp_play_sound(IDR_WAVE_WOOHOO, false); lamexp_play_sound("woohoo", false);
m_settings->licenseAccepted(1); m_settings->licenseAccepted(1);
m_settings->syncNow(); m_settings->syncNow();
if(lamexp_version_demo()) showAnnounceBox(); if(lamexp_version_demo()) showAnnounceBox();
@ -1298,7 +1303,7 @@ void MainWindow::windowShown(void)
if(lamexp_current_date_safe() >= lamexp_version_expires()) if(lamexp_current_date_safe() >= lamexp_version_expires())
{ {
qWarning("Binary has expired !!!"); qWarning("Binary has expired !!!");
lamexp_play_sound(IDR_WAVE_WHAMMY, false); lamexp_play_sound("whammy", false);
if(QMessageBox::warning(this, tr("LameXP - Expired"), QString("%1<br>%2").arg(NOBR(tr("This demo (pre-release) version of LameXP has expired at %1.").arg(lamexp_version_expires().toString(Qt::ISODate))), NOBR(tr("LameXP is free software and release versions won't expire."))), tr("Check for Updates"), tr("Exit Program")) == 0) if(QMessageBox::warning(this, tr("LameXP - Expired"), QString("%1<br>%2").arg(NOBR(tr("This demo (pre-release) version of LameXP has expired at %1.").arg(lamexp_version_expires().toString(Qt::ISODate))), NOBR(tr("LameXP is free software and release versions won't expire."))), tr("Check for Updates"), tr("Exit Program")) == 0)
{ {
checkForUpdates(); checkForUpdates();
@ -1340,7 +1345,7 @@ void MainWindow::windowShown(void)
return; return;
default: default:
QEventLoop loop; QTimer::singleShot(7000, &loop, SLOT(quit())); QEventLoop loop; QTimer::singleShot(7000, &loop, SLOT(quit()));
lamexp_play_sound(IDR_WAVE_WAITING, true); lamexp_play_sound("waiting", true);
SHOW_BANNER_ARG(tr("Skipping update check this time, please be patient..."), &loop); SHOW_BANNER_ARG(tr("Skipping update check this time, please be patient..."), &loop);
break; break;
} }
@ -1543,7 +1548,7 @@ void MainWindow::encodeButtonClicked(void)
{ {
QStringList tempFolderParts = tempFolder.split("/", QString::SkipEmptyParts, Qt::CaseInsensitive); QStringList tempFolderParts = tempFolder.split("/", QString::SkipEmptyParts, Qt::CaseInsensitive);
tempFolderParts.takeLast(); tempFolderParts.takeLast();
if(m_settings->soundsEnabled()) lamexp_play_sound(IDR_WAVE_WHAMMY, false); PLAY_SOUND_OPTIONAL("whammy", false);
QString lowDiskspaceMsg = QString("%1<br>%2<br><br>%3<br>%4<br>").arg QString lowDiskspaceMsg = QString("%1<br>%2<br><br>%3<br>%4<br>").arg
( (
NOBR(tr("There are less than %1 GB of free diskspace available on your system's TEMP folder.").arg(QString::number(minimumFreeDiskspaceMultiplier))), NOBR(tr("There are less than %1 GB of free diskspace available on your system's TEMP folder.").arg(QString::number(minimumFreeDiskspaceMultiplier))),
@ -1649,9 +1654,9 @@ void MainWindow::tabPageChanged(int idx, const bool silent)
} }
//Play tick sound //Play tick sound
if(m_settings->soundsEnabled() && (!silent)) if(!silent)
{ {
lamexp_play_sound(IDR_WAVE_TICK, true); PLAY_SOUND_OPTIONAL("tick", true);
} }
int initialWidth = this->width(); int initialWidth = this->width();
@ -3496,11 +3501,7 @@ void MainWindow::compressionTabEventOccurred(QWidget *sender, QEvent *event)
} }
else if((sender == ui->labelResetEncoders) && (event->type() == QEvent::MouseButtonPress)) else if((sender == ui->labelResetEncoders) && (event->type() == QEvent::MouseButtonPress))
{ {
if(m_settings->soundsEnabled()) PLAY_SOUND_OPTIONAL("blast", true);
{
lamexp_play_sound(IDR_WAVE_BLAST, true);
}
EncoderRegistry::resetAllEncoders(m_settings); EncoderRegistry::resetAllEncoders(m_settings);
m_settings->compressionEncoder(SettingsModel::MP3Encoder); m_settings->compressionEncoder(SettingsModel::MP3Encoder);
ui->radioButtonEncoderMP3->setChecked(true); ui->radioButtonEncoderMP3->setChecked(true);
@ -4024,10 +4025,7 @@ void MainWindow::overwriteModeChanged(int id)
*/ */
void MainWindow::resetAdvancedOptionsButtonClicked(void) void MainWindow::resetAdvancedOptionsButtonClicked(void)
{ {
if(m_settings->soundsEnabled()) PLAY_SOUND_OPTIONAL("blast", true);
{
lamexp_play_sound(IDR_WAVE_BLAST, true);
}
ui->sliderLameAlgoQuality->setValue(m_settings->lameAlgoQualityDefault()); ui->sliderLameAlgoQuality->setValue(m_settings->lameAlgoQualityDefault());
ui->spinBoxBitrateManagementMin->setValue(m_settings->bitrateManagementMinRateDefault()); ui->spinBoxBitrateManagementMin->setValue(m_settings->bitrateManagementMinRateDefault());

View File

@ -26,7 +26,6 @@
#include "../tmp/UIC_ProcessingDialog.h" #include "../tmp/UIC_ProcessingDialog.h"
#include "Global.h" #include "Global.h"
#include "Resource.h"
#include "Model_FileList.h" #include "Model_FileList.h"
#include "Model_Progress.h" #include "Model_Progress.h"
#include "Model_Settings.h" #include "Model_Settings.h"
@ -113,6 +112,12 @@ while(0)
} \ } \
while(0) while(0)
#define PLAY_SOUND_OPTIONAL(NAME, ASYNC) do \
{ \
if(m_settings->soundsEnabled()) lamexp_play_sound((NAME), (ASYNC)); \
} \
while(0)
#define IS_VBR(RC_MODE) ((RC_MODE) == SettingsModel::VBRMode) #define IS_VBR(RC_MODE) ((RC_MODE) == SettingsModel::VBRMode)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -694,17 +699,14 @@ void ProcessingDialog::doneEncoding(void)
if(m_userAborted) if(m_userAborted)
{ {
CHANGE_BACKGROUND_COLOR(ui->frame_header, QColor("#FFF3BA")); CHANGE_BACKGROUND_COLOR(ui->frame_header, QColor("#FFFFE0"));
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarErrorState); WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarErrorState);
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/error.png")); WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/error.png"));
SET_PROGRESS_TEXT((m_succeededJobs.count() > 0) ? tr("Process was aborted by the user after %n file(s)!", "", m_succeededJobs.count()) : tr("Process was aborted prematurely by the user!")); SET_PROGRESS_TEXT((m_succeededJobs.count() > 0) ? tr("Process was aborted by the user after %n file(s)!", "", m_succeededJobs.count()) : tr("Process was aborted prematurely by the user!"));
m_systemTray->showMessage(tr("LameXP - Aborted"), tr("Process was aborted by the user."), QSystemTrayIcon::Warning); m_systemTray->showMessage(tr("LameXP - Aborted"), tr("Process was aborted by the user."), QSystemTrayIcon::Warning);
m_systemTray->setIcon(QIcon(":/icons/cd_delete.png")); m_systemTray->setIcon(QIcon(":/icons/cd_delete.png"));
qApp->processEvents(QEventLoop::ExcludeUserInputEvents); qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
if(m_settings->soundsEnabled() && (!m_forcedAbort)) if(!m_forcedAbort) PLAY_SOUND_OPTIONAL("aborted", false);
{
lamexp_play_sound(IDR_WAVE_ABORTED, false);
}
} }
else else
{ {
@ -721,7 +723,7 @@ void ProcessingDialog::doneEncoding(void)
if(m_failedJobs.count() > 0) if(m_failedJobs.count() > 0)
{ {
CHANGE_BACKGROUND_COLOR(ui->frame_header, QColor("#FFBABA")); CHANGE_BACKGROUND_COLOR(ui->frame_header, QColor("#FFF0F0"));
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarErrorState); WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarErrorState);
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/exclamation.png")); WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/exclamation.png"));
if(m_skippedJobs.count() > 0) if(m_skippedJobs.count() > 0)
@ -735,11 +737,11 @@ void ProcessingDialog::doneEncoding(void)
m_systemTray->showMessage(tr("LameXP - Error"), tr("At least one file has failed!"), QSystemTrayIcon::Critical); m_systemTray->showMessage(tr("LameXP - Error"), tr("At least one file has failed!"), QSystemTrayIcon::Critical);
m_systemTray->setIcon(QIcon(":/icons/cd_delete.png")); m_systemTray->setIcon(QIcon(":/icons/cd_delete.png"));
qApp->processEvents(QEventLoop::ExcludeUserInputEvents); qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
if(m_settings->soundsEnabled()) lamexp_play_sound(IDR_WAVE_ERROR, false); PLAY_SOUND_OPTIONAL("error", false);
} }
else else
{ {
CHANGE_BACKGROUND_COLOR(ui->frame_header, QColor("#E0FFE2")); CHANGE_BACKGROUND_COLOR(ui->frame_header, QColor("#F0FFF0"));
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNormalState); WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNormalState);
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/accept.png")); WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/accept.png"));
if(m_skippedJobs.count() > 0) if(m_skippedJobs.count() > 0)
@ -753,7 +755,7 @@ void ProcessingDialog::doneEncoding(void)
m_systemTray->showMessage(tr("LameXP - Done"), tr("All files completed successfully."), QSystemTrayIcon::Information); m_systemTray->showMessage(tr("LameXP - Done"), tr("All files completed successfully."), QSystemTrayIcon::Information);
m_systemTray->setIcon(QIcon(":/icons/cd_add.png")); m_systemTray->setIcon(QIcon(":/icons/cd_add.png"));
qApp->processEvents(QEventLoop::ExcludeUserInputEvents); qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
if(m_settings->soundsEnabled()) lamexp_play_sound(IDR_WAVE_SUCCESS, false); PLAY_SOUND_OPTIONAL("success", false);
} }
} }
@ -1123,12 +1125,9 @@ bool ProcessingDialog::shutdownComputer(void)
qApp->processEvents(QEventLoop::ExcludeUserInputEvents); qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
if(m_settings->soundsEnabled()) QApplication::setOverrideCursor(Qt::WaitCursor);
{ PLAY_SOUND_OPTIONAL("shutdown", false);
QApplication::setOverrideCursor(Qt::WaitCursor); QApplication::restoreOverrideCursor();
lamexp_play_sound(IDR_WAVE_SHUTDOWN, false);
QApplication::restoreOverrideCursor();
}
QTimer timer; QTimer timer;
timer.setInterval(1000); timer.setInterval(1000);
@ -1150,7 +1149,7 @@ bool ProcessingDialog::shutdownComputer(void)
progressDialog.setLabelText(text.arg(iTimeout-i)); progressDialog.setLabelText(text.arg(iTimeout-i));
if(iTimeout-i == 3) progressDialog.setCancelButton(NULL); if(iTimeout-i == 3) progressDialog.setCancelButton(NULL);
qApp->processEvents(QEventLoop::ExcludeUserInputEvents); qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
lamexp_play_sound(((i < iTimeout) ? IDR_WAVE_BEEP : IDR_WAVE_BEEP_LONG), false); PLAY_SOUND_OPTIONAL(((i < iTimeout) ? "beep" : "beep2"), false);
} }
progressDialog.close(); progressDialog.close();

View File

@ -27,7 +27,6 @@
//LameXP includes //LameXP includes
#include "Global.h" #include "Global.h"
#include "Resource.h"
#include "Thread_CheckUpdate.h" #include "Thread_CheckUpdate.h"
#include "Dialog_LogView.h" #include "Dialog_LogView.h"
#include "Model_Settings.h" #include "Model_Settings.h"
@ -338,7 +337,7 @@ void UpdateDialog::threadFinished(void)
if(!bSuccess) if(!bSuccess)
{ {
if(m_settings->soundsEnabled()) lamexp_play_sound(IDR_WAVE_ERROR, true); if(m_settings->soundsEnabled()) lamexp_play_sound("error", true);
} }
else else
{ {

View File

@ -89,9 +89,9 @@ WorkingBanner::WorkingBanner(QWidget *parent)
{ {
m_style = new QWindowsVistaStyle(); m_style = new QWindowsVistaStyle();
this->setStyle(m_style); this->setStyle(m_style);
ui->labelStatus->setStyle(m_style);
ui->progressBar->setStyle(m_style); ui->progressBar->setStyle(m_style);
ui->labelStatus->setStyleSheet("background-color: rgb(255, 255, 255);"); ui->labelStatus->setStyle(m_style);
ui->labelStatus->setStyleSheet("background-color: #FFFFFF;");
} }
else else
{ {
@ -99,7 +99,6 @@ WorkingBanner::WorkingBanner(QWidget *parent)
m_working = new QMovie(":/images/Busy.gif"); m_working = new QMovie(":/images/Busy.gif");
m_working->setCacheMode(QMovie::CacheAll); m_working->setCacheMode(QMovie::CacheAll);
ui->labelWorking->setMovie(m_working); ui->labelWorking->setMovie(m_working);
m_working->start();
} }
//Set Opacity //Set Opacity
@ -256,9 +255,29 @@ bool WorkingBanner::winEvent(MSG *message, long *result)
void WorkingBanner::showEvent(QShowEvent *event) void WorkingBanner::showEvent(QShowEvent *event)
{ {
QDialog::showEvent(event);
if(!event->spontaneous())
{
if(m_working)
{
m_working->start();
}
}
QTimer::singleShot(25, this, SLOT(windowShown())); QTimer::singleShot(25, this, SLOT(windowShown()));
} }
void WorkingBanner::hideEvent(QHideEvent *event)
{
QDialog::hideEvent(event);
if(!event->spontaneous())
{
if(m_working)
{
m_working->stop();
}
}
}
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// SLOTS // SLOTS
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -69,6 +69,7 @@ protected:
virtual void closeEvent(QCloseEvent *event); virtual void closeEvent(QCloseEvent *event);
virtual bool winEvent(MSG *message, long *result); virtual bool winEvent(MSG *message, long *result);
virtual void showEvent(QShowEvent *event); virtual void showEvent(QShowEvent *event);
virtual void hideEvent(QHideEvent *event);
QFontMetrics *m_metrics; QFontMetrics *m_metrics;
QStyle *m_style; QStyle *m_style;

View File

@ -197,8 +197,9 @@ bool lamexp_open_media_file(const QString &mediaFilePath);
QString lamexp_path_to_short(const QString &longPath); QString lamexp_path_to_short(const QString &longPath);
__int64 lamexp_perfcounter_frequ(void); __int64 lamexp_perfcounter_frequ(void);
__int64 lamexp_perfcounter_value(void); __int64 lamexp_perfcounter_value(void);
bool lamexp_play_sound(const unsigned short uiSoundIdx, const bool bAsync, const wchar_t *alias = NULL); bool lamexp_play_sound(const QString &name, const bool bAsync);
bool lamexp_play_sound_file(const QString &library, const unsigned short uiSoundIdx, const bool bAsync); bool lamexp_play_sound_file(const QString &library, const unsigned short uiSoundIdx, const bool bAsync);
bool lamexp_play_sound_alias(const QString &alias, const bool bAsync);
bool lamexp_portable_mode(void); bool lamexp_portable_mode(void);
unsigned long lamexp_process_id(const QProcess *proc); unsigned long lamexp_process_id(const QProcess *proc);
QStringList lamexp_query_translations(void); QStringList lamexp_query_translations(void);

View File

@ -61,6 +61,7 @@
#include <QTimer> #include <QTimer>
#include <QTranslator> #include <QTranslator>
#include <QUuid> #include <QUuid>
#include <QResource>
//LameXP includes //LameXP includes
#define LAMEXP_INC_CONFIG #define LAMEXP_INC_CONFIG
@ -190,6 +191,14 @@ static struct
} }
g_lamexp_dwmapi; g_lamexp_dwmapi;
//Sound file cache
static struct
{
QHash<const QString, const unsigned char*> *sound_db;
QReadWriteLock lock;
}
g_lamexp_sounds;
//Image formats //Image formats
static const char *g_lamexp_imageformats[] = {"bmp", "png", "jpg", "gif", "ico", "xpm", NULL}; //"svg" static const char *g_lamexp_imageformats[] = {"bmp", "png", "jpg", "gif", "ico", "xpm", NULL}; //"svg"
@ -1537,44 +1546,84 @@ bool lamexp_beep(int beepType)
/* /*
* Play a sound (from resources) * Play a sound (from resources)
*/ */
bool lamexp_play_sound(const unsigned short uiSoundIdx, const bool bAsync, const wchar_t *alias) bool lamexp_play_sound(const QString &name, const bool bAsync)
{ {
if(alias) const unsigned char *data = NULL;
//Try to look-up the sound in the cache first
if(!name.isEmpty())
{ {
return PlaySound(alias, GetModuleHandle(NULL), (SND_ALIAS | (bAsync ? SND_ASYNC : SND_SYNC))) == TRUE; QReadLocker readLock(&g_lamexp_sounds.lock);
if(g_lamexp_sounds.sound_db && g_lamexp_sounds.sound_db->contains(name))
{
data = g_lamexp_sounds.sound_db->value(name);
}
} }
else
//If data not found in cache, try to load from resource!
if((!data) && (!name.isEmpty()))
{ {
return PlaySound(MAKEINTRESOURCE(uiSoundIdx), GetModuleHandle(NULL), (SND_RESOURCE | (bAsync ? SND_ASYNC : SND_SYNC))) == TRUE; QResource resource(QString(":/sounds/%1.wav").arg(name));
if(resource.isValid() && (data = resource.data()))
{
QWriteLocker writeLock(&g_lamexp_sounds.lock);
if(!g_lamexp_sounds.sound_db)
{
g_lamexp_sounds.sound_db = new QHash<const QString, const unsigned char*>();
}
g_lamexp_sounds.sound_db->insert(name, data);
}
else
{
qWarning("Sound effect \"%s\" not found!", QUTF8(name));
}
} }
//Play the sound, if availbale
if(data)
{
return PlaySound(LPCWSTR(data), NULL, (SND_MEMORY | (bAsync ? SND_ASYNC : SND_SYNC))) != FALSE;
}
return false;
} }
/* /*
* Play a sound (from resources) * Play a sound (system alias)
*/
bool lamexp_play_sound_alias(const QString &alias, const bool bAsync)
{
return PlaySound(QWCHAR(alias), GetModuleHandle(NULL), (SND_ALIAS | (bAsync ? SND_ASYNC : SND_SYNC))) != FALSE;
}
/*
* Play a sound (from external DLL)
*/ */
bool lamexp_play_sound_file(const QString &library, const unsigned short uiSoundIdx, const bool bAsync) bool lamexp_play_sound_file(const QString &library, const unsigned short uiSoundIdx, const bool bAsync)
{ {
bool result = false; bool result = false;
HMODULE module = NULL;
QFileInfo libraryFile(library); QFileInfo libraryFile(library);
if(!libraryFile.isAbsolute()) if(!libraryFile.isAbsolute())
{ {
unsigned int buffSize = GetSystemDirectoryW(NULL, NULL) + 1; const QString &systemDir = lamexp_known_folder(lamexp_folder_systemfolder);
wchar_t *buffer = (wchar_t*) _malloca(buffSize * sizeof(wchar_t)); if(!systemDir.isEmpty())
unsigned int result = GetSystemDirectory(buffer, buffSize);
if(result > 0 && result < buffSize)
{ {
libraryFile.setFile(QString("%1/%2").arg(QDir::fromNativeSeparators(QString::fromUtf16(reinterpret_cast<const unsigned short*>(buffer))), library)); libraryFile.setFile(QDir(systemDir), libraryFile.fileName());
} }
_freea(buffer);
} }
module = LoadLibraryW(QWCHAR(QDir::toNativeSeparators(libraryFile.absoluteFilePath()))); if(libraryFile.exists() && libraryFile.isFile())
if(module)
{ {
result = (PlaySound(MAKEINTRESOURCE(uiSoundIdx), module, (SND_RESOURCE | (bAsync ? SND_ASYNC : SND_SYNC))) == TRUE); if(HMODULE module = LoadLibraryW(QWCHAR(QDir::toNativeSeparators(libraryFile.canonicalFilePath()))))
FreeLibrary(module); {
result = (PlaySound(MAKEINTRESOURCE(uiSoundIdx), module, (SND_RESOURCE | (bAsync ? SND_ASYNC : SND_SYNC))) != FALSE);
FreeLibrary(module);
}
}
else
{
qWarning("PlaySound: File \"%s\" could not be found!", QUTF8(libraryFile.absoluteFilePath()));
} }
return result; return result;
@ -2202,6 +2251,7 @@ extern "C" void _lamexp_global_init_win32(void)
LAMEXP_ZERO_MEMORY(g_lamexp_wine); LAMEXP_ZERO_MEMORY(g_lamexp_wine);
LAMEXP_ZERO_MEMORY(g_lamexp_themes_enabled); LAMEXP_ZERO_MEMORY(g_lamexp_themes_enabled);
LAMEXP_ZERO_MEMORY(g_lamexp_dwmapi); LAMEXP_ZERO_MEMORY(g_lamexp_dwmapi);
LAMEXP_ZERO_MEMORY(g_lamexp_sounds);
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -2245,6 +2295,9 @@ extern "C" void _lamexp_global_free_win32(void)
g_lamexp_log_file = NULL; g_lamexp_log_file = NULL;
} }
//Clear sound cache
LAMEXP_DELETE(g_lamexp_sounds.sound_db);
//Free CLI Arguments //Free CLI Arguments
LAMEXP_DELETE(g_lamexp_argv.list); LAMEXP_DELETE(g_lamexp_argv.list);
} }

View File

@ -25,19 +25,6 @@
*/ */
#define IDI_ICON1 106 #define IDI_ICON1 106
#define IDI_ICON2 107 #define IDI_ICON2 107
#define IDR_WAVE_ABOUT 666
#define IDR_WAVE_SUCCESS 667
#define IDR_WAVE_ERROR 668
#define IDR_WAVE_ABORTED 669
#define IDR_WAVE_WHAMMY 670
#define IDR_WAVE_WOOHOO 671
#define IDR_WAVE_SHUTDOWN 672
#define IDR_WAVE_BEEP 673
#define IDR_WAVE_BEEP_LONG 674
#define IDR_WAVE_WAITING 675
#define IDR_WAVE_BLAST 676
#define IDR_WAVE_TICK 677
#define IDR_WAVE_DROP 678
/* /*
* Next default values for new objects * Next default values for new objects