sdl audio fix
small gui fixes
This commit is contained in:
@@ -31,80 +31,6 @@
|
|||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="1" column="1" >
|
|
||||||
<widget class="QLineEdit" name="lineEdit_profileName" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>myServerProfile1</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" >
|
|
||||||
<widget class="QLabel" name="label_4" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>Profile Name:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" >
|
|
||||||
<widget class="QLabel" name="label" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>IP Address / Domain Name:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="3" >
|
|
||||||
<widget class="QLabel" name="label_2" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>Port:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="4" >
|
|
||||||
<widget class="QSpinBox" name="spinBox_port" >
|
|
||||||
<property name="maximum" >
|
|
||||||
<number>65535</number>
|
|
||||||
</property>
|
|
||||||
<property name="minimum" >
|
|
||||||
<number>80</number>
|
|
||||||
</property>
|
|
||||||
<property name="value" >
|
|
||||||
<number>7234</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="3" >
|
|
||||||
<widget class="QLabel" name="label_3" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>Password (optional):</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="4" >
|
|
||||||
<widget class="QLineEdit" name="lineEdit_password" >
|
|
||||||
<property name="echoMode" >
|
|
||||||
<enum>QLineEdit::Password</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1" >
|
|
||||||
<widget class="QLineEdit" name="lineEdit_ipAddress" />
|
|
||||||
</item>
|
|
||||||
<item rowspan="2" row="0" column="2" >
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType" >
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" >
|
|
||||||
<size>
|
|
||||||
<width>16</width>
|
|
||||||
<height>57</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0" colspan="5" >
|
<item row="3" column="0" colspan="5" >
|
||||||
<widget class="QGroupBox" name="groupBox_2" >
|
<widget class="QGroupBox" name="groupBox_2" >
|
||||||
<property name="title" >
|
<property name="title" >
|
||||||
@@ -123,7 +49,7 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="indentation" >
|
<property name="indentation" >
|
||||||
<number>3</number>
|
<number>15</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rootIsDecorated" >
|
<property name="rootIsDecorated" >
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@@ -191,40 +117,166 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" >
|
<item row="2" column="3" colspan="2" >
|
||||||
<widget class="QCheckBox" name="checkBox_ipv6" >
|
<layout class="QHBoxLayout" >
|
||||||
<property name="text" >
|
<property name="margin" >
|
||||||
<string>Use IPv6</string>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="spacing" >
|
||||||
</item>
|
<number>6</number>
|
||||||
<item row="2" column="1" >
|
|
||||||
<widget class="QLabel" name="label_5" >
|
|
||||||
<property name="text" >
|
|
||||||
<string><a href="http://en.wikipedia.org/wiki/Ipv6">What is this?</a></string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="openExternalLinks" >
|
<item>
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="3" >
|
|
||||||
<widget class="QCheckBox" name="checkBox_sctp" >
|
<widget class="QCheckBox" name="checkBox_sctp" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Use SCTP</string>
|
<string>Use SCTP</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="4" >
|
<item>
|
||||||
<widget class="QLabel" name="label_6" >
|
<widget class="QLabel" name="label_6" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string><a href="http://en.wikipedia.org/wiki/Stream_Control_Transmission_Protocol">What is this?</a></string>
|
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
|
p, li { white-space: pre-wrap; }
|
||||||
|
</style></head><body style=" font-family:'Nimbus Sans L'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
|
||||||
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> <a href="http://en.wikipedia.org/wiki/Stream_Control_Transmission_Protocol"><span style=" text-decoration: underline; color:#0000ff;">What is this?</span></a></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="openExternalLinks" >
|
<property name="openExternalLinks" >
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2" >
|
||||||
|
<layout class="QHBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing" >
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_ipv6" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Use IPv6</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5" >
|
||||||
|
<property name="text" >
|
||||||
|
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
|
p, li { white-space: pre-wrap; }
|
||||||
|
</style></head><body style=" font-family:'Nimbus Sans L'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
|
||||||
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> <a href="http://en.wikipedia.org/wiki/Ipv6"><span style=" text-decoration: underline; color:#0000ff;">What is this?</span></a></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="openExternalLinks" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>131</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item rowspan="2" row="0" column="2" >
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType" >
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>16</width>
|
||||||
|
<height>57</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" >
|
||||||
|
<widget class="QLineEdit" name="lineEdit_ipAddress" />
|
||||||
|
</item>
|
||||||
|
<item row="0" column="4" >
|
||||||
|
<widget class="QLineEdit" name="lineEdit_password" >
|
||||||
|
<property name="echoMode" >
|
||||||
|
<enum>QLineEdit::Password</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3" >
|
||||||
|
<widget class="QLabel" name="label_3" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Password (optional):</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="4" >
|
||||||
|
<widget class="QSpinBox" name="spinBox_port" >
|
||||||
|
<property name="maximum" >
|
||||||
|
<number>65535</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimum" >
|
||||||
|
<number>80</number>
|
||||||
|
</property>
|
||||||
|
<property name="value" >
|
||||||
|
<number>7234</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3" >
|
||||||
|
<widget class="QLabel" name="label_2" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Port:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" >
|
||||||
|
<widget class="QLabel" name="label" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>IP Address / Domain Name:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" >
|
||||||
|
<widget class="QLabel" name="label_4" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Profile Name:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" >
|
||||||
|
<widget class="QLineEdit" name="lineEdit_profileName" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>myServerProfile1</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
SDLPlayer::SDLPlayer()
|
SDLPlayer::SDLPlayer()
|
||||||
: soundData(NULL), currentChannel(0)
|
: soundData(NULL), currentChannel(0) , audioEnabled(0)
|
||||||
{
|
{
|
||||||
initAudio();
|
initAudio();
|
||||||
}
|
}
|
||||||
@@ -37,12 +37,16 @@ void SDLPlayer::initAudio() {
|
|||||||
|
|
||||||
SDL_Init(SDL_INIT_AUDIO);
|
SDL_Init(SDL_INIT_AUDIO);
|
||||||
|
|
||||||
if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) == 0)
|
if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) == 0) {
|
||||||
Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
|
Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
|
||||||
|
audioEnabled = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLPlayer::playSound(string audioString) {
|
void SDLPlayer::playSound(string audioString) {
|
||||||
|
|
||||||
|
if(audioEnabled) {
|
||||||
|
|
||||||
QFile myFile(":sounds/resources/sounds/"+QString::fromStdString(audioString)+".wav");
|
QFile myFile(":sounds/resources/sounds/"+QString::fromStdString(audioString)+".wav");
|
||||||
|
|
||||||
if(myFile.open(QIODevice::ReadOnly)) {
|
if(myFile.open(QIODevice::ReadOnly)) {
|
||||||
@@ -65,19 +69,24 @@ void SDLPlayer::playSound(string audioString) {
|
|||||||
// currentChannel = Mix_PlayChannel(-1, sound,0);
|
// currentChannel = Mix_PlayChannel(-1, sound,0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SDLPlayer::audioDone() {
|
void SDLPlayer::audioDone() {
|
||||||
|
|
||||||
|
if(audioEnabled) {
|
||||||
Mix_HaltChannel(currentChannel);
|
Mix_HaltChannel(currentChannel);
|
||||||
Mix_FreeChunk(sound);
|
Mix_FreeChunk(sound);
|
||||||
sound = NULL;
|
sound = NULL;
|
||||||
delete[] soundData;
|
delete[] soundData;
|
||||||
soundData = NULL;
|
soundData = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SDLPlayer::closeAudio() {
|
void SDLPlayer::closeAudio() {
|
||||||
|
|
||||||
|
if(audioEnabled) {
|
||||||
audioDone();
|
audioDone();
|
||||||
Mix_CloseAudio();
|
Mix_CloseAudio();
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ private:
|
|||||||
Uint8 *soundData;
|
Uint8 *soundData;
|
||||||
int currentChannel;
|
int currentChannel;
|
||||||
|
|
||||||
|
bool audioEnabled;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user