--- a/hedgewars/uMobile.pas Sat Feb 19 01:01:03 2011 +0100
+++ b/hedgewars/uMobile.pas Sat Feb 19 01:38:40 2011 +0100
@@ -31,11 +31,9 @@
procedure setGameRunning(arg: boolean); cdecl; external;
procedure updateVisualsNewTurn; cdecl; external;
function isApplePhone: Boolean; cdecl; external;
-function isAppleDeviceMuted: Boolean; cdecl; external;
procedure AudioServicesPlaySystemSound(num: LongInt); cdecl; external;
{$ENDIF}
function isPhone: Boolean; inline;
-function isDeviceMute: Boolean; inline;
procedure performRumble; inline;
procedure perfExt_AddProgress; inline;
procedure perfExt_FinishProgress; inline;
@@ -47,6 +45,8 @@
implementation
uses uVariables;
+const kSystemSoundID_Vibrate = $00000FFF;
+
function isPhone: Boolean; inline;
begin
{$IFDEF IPHONEOS}
@@ -55,19 +55,10 @@
exit(false);
end;
-function isDeviceMute: Boolean; inline;
-begin
-{$IFDEF IPHONEOS}
-// exit(isAppleDeviceMuted());
-{$ENDIF}
- exit(false);
-end;
-
procedure performRumble; inline;
begin
{$IFDEF IPHONEOS}
- // kSystemSoundID_Vibrate = $00000FFF
- AudioServicesPlaySystemSound($00000FFF);
+ AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
{$ENDIF}
end;
--- a/hedgewars/uSound.pas Sat Feb 19 01:01:03 2011 +0100
+++ b/hedgewars/uSound.pas Sat Feb 19 01:38:40 2011 +0100
@@ -47,7 +47,7 @@
implementation
-uses uVariables, uConsole, uUtils, uCommands, uDebug, uMobile;
+uses uVariables, uConsole, uUtils, uCommands, uDebug;
const chanTPU = 32;
var Volume: LongInt;
@@ -180,7 +180,7 @@
procedure PlaySound(snd: TSound; voicepack: PVoicepack; keepPlaying: boolean);
var s:shortstring;
begin
- if (not isSoundEnabled) or fastUntilLag or isDeviceMute() then
+ if (not isSoundEnabled) or fastUntilLag then
exit;
if keepPlaying and (lastChan[snd] <> -1) and (Mix_Playing(lastChan[snd]) <> 0) then
@@ -222,7 +222,7 @@
function LoopSound(snd: TSound; voicepack: PVoicepack): LongInt;
var s: shortstring;
begin
- if (not isSoundEnabled) or fastUntilLag or isDeviceMute() then
+ if (not isSoundEnabled) or fastUntilLag then
begin
LoopSound:= -1;
exit
--- a/project_files/HedgewarsMobile/Classes/ObjcExports.m Sat Feb 19 01:01:03 2011 +0100
+++ b/project_files/HedgewarsMobile/Classes/ObjcExports.m Sat Feb 19 01:38:40 2011 +0100
@@ -154,38 +154,3 @@
void updateVisualsNewTurn(void) {
[amvc_instance updateAmmoVisuals];
}
-
-/*
-// http://stackoverflow.com/questions/287543/how-to-programatically-sense-the-iphone-mute-switch
-BOOL isAppleDeviceMuted(void) {
- if (!gAudioSessionInited) {
- AudioSessionInterruptionListener inInterruptionListener = NULL;
- OSStatus error;
- if ((error = AudioSessionInitialize(NULL, NULL, inInterruptionListener, NULL)))
- DLog(@"*** Error *** error in AudioSessionInitialize: %d", error);
- else
- gAudioSessionInited = YES;
- }
- UInt32 propertySize = sizeof(CFStringRef);
- BOOL muteResult = NO;
-
- // this checks if there is volume
- Float32 volume;
- OSStatus n = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareOutputVolume, &propertySize, &volume);
- if (n != 0)
- DLog( @"AudioSessionGetProperty 'volume': %d", n );
- BOOL volumeResult = (volume == 0.0f);
-
- // this checks if the device is muted
- CFStringRef state;
- n = AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &propertySize, &state);
- if (n != 0)
- DLog( @"AudioSessionGetProperty 'audioRoute': %d", n );
- else {
- NSString *result = (NSString *)state;
- muteResult = ([result length] == 0);
- releaseAndNil(result);
- }
- return volumeResult || muteResult;
-}
-*/