From 1acbed1f7f76427c28de5b4416f93a360ccc3c4b Mon Sep 17 00:00:00 2001
From: John Preston <johnprestonmail@gmail.com>
Date: Fri, 5 Sep 2014 14:40:22 +0400
Subject: [PATCH] up to 1mb voice messages autoload, fixed voice messages in
 app playing, version 0.5.19

---
 Telegram/PrepareLinux.sh                    |   4 ++--
 Telegram/PrepareLinux32.sh                  |   4 ++--
 Telegram/PrepareMac.sh                      |   4 ++--
 Telegram/Setup.iss                          |   6 +++---
 Telegram/SourceFiles/audio.cpp              |   2 +-
 Telegram/SourceFiles/config.h               |   6 +++---
 Telegram/Telegram.plist                     |   2 +-
 Telegram/Telegram.rc                        | Bin 5566 -> 5566 bytes
 Telegram/Telegram.xcodeproj/project.pbxproj |  12 ++++++------
 9 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/Telegram/PrepareLinux.sh b/Telegram/PrepareLinux.sh
index 9bb4554e1..0de6f1e22 100755
--- a/Telegram/PrepareLinux.sh
+++ b/Telegram/PrepareLinux.sh
@@ -1,5 +1,5 @@
-AppVersionStr=0.5.18
-AppVersion=5018
+AppVersionStr=0.5.19
+AppVersion=5019
 
 if [ -d "./../Linux/Release/deploy/$AppVersionStr" ]; then
   echo "Deploy folder for version $AppVersionStr already exists!"
diff --git a/Telegram/PrepareLinux32.sh b/Telegram/PrepareLinux32.sh
index d5b14377d..d0ec281ba 100755
--- a/Telegram/PrepareLinux32.sh
+++ b/Telegram/PrepareLinux32.sh
@@ -1,5 +1,5 @@
-AppVersionStr=0.5.18
-AppVersion=5018
+AppVersionStr=0.5.19
+AppVersion=5019
 
 if [ -d "./../Linux/Release/deploy/$AppVersionStr" ]; then
   echo "Deploy folder for version $AppVersionStr already exists!"
diff --git a/Telegram/PrepareMac.sh b/Telegram/PrepareMac.sh
index 1af2df784..3a7b71d69 100755
--- a/Telegram/PrepareMac.sh
+++ b/Telegram/PrepareMac.sh
@@ -1,5 +1,5 @@
-AppVersionStr=0.5.18
-AppVersion=5018
+AppVersionStr=0.5.19
+AppVersion=5019
 
 if [ -d "./../Mac/Release/deploy/$AppVersionStr" ]; then
   echo "Deploy folder for version $AppVersionStr already exists!"
diff --git a/Telegram/Setup.iss b/Telegram/Setup.iss
index f916d6ceb..fd5ddde46 100644
--- a/Telegram/Setup.iss
+++ b/Telegram/Setup.iss
@@ -3,9 +3,9 @@
 
 #define MyAppShortName "Telegram"
 #define MyAppName "Telegram Win (Unofficial)"
-#define MyAppVersion "0.5.18"
-#define MyAppVersionZero "0.5.18"
-#define MyAppFullVersion "0.5.18.0"
+#define MyAppVersion "0.5.19"
+#define MyAppVersionZero "0.5.19"
+#define MyAppFullVersion "0.5.19.0"
 #define MyAppPublisher "Telegram (Unofficial)"
 #define MyAppURL "https://tdesktop.com"
 #define MyAppExeName "Telegram.exe"
diff --git a/Telegram/SourceFiles/audio.cpp b/Telegram/SourceFiles/audio.cpp
index cd6f06eda..623d33c4c 100644
--- a/Telegram/SourceFiles/audio.cpp
+++ b/Telegram/SourceFiles/audio.cpp
@@ -663,7 +663,7 @@ void VoiceMessagesLoader::onLoad(AudioData *audio) {
 		alSourceQueueBuffers(m.source, 1, m.buffers + m.nextBuffer);
 		m.skipEnd -= samplesAdded;
 
-		m.nextBuffer = (m.nextBuffer + 1) & 3;
+		m.nextBuffer = (m.nextBuffer + 1) % 3;
 
 		if (!_checkALError()) {
 			m.state = VoiceMessageStopped;
diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h
index b246e705d..fd8a7782a 100644
--- a/Telegram/SourceFiles/config.h
+++ b/Telegram/SourceFiles/config.h
@@ -17,8 +17,8 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 */
 #pragma once
 
-static const int32 AppVersion = 5018;
-static const wchar_t *AppVersionStr = L"0.5.18";
+static const int32 AppVersion = 5019;
+static const wchar_t *AppVersionStr = L"0.5.19";
 #ifdef Q_OS_WIN
 static const wchar_t *AppName = L"Telegram Win (Unofficial)";
 #else
@@ -79,7 +79,7 @@ enum {
 	AudioVoiceMsgFrequency = 48000, // 48 kHz
 	AudioVoiceMsgChannels = 2, // stereo
 	AudioVoiceMsgBufferSize = 1024 * 1024, // 1 Mb buffers
-	AudioVoiceMsgInMemory = 256 * 1024, // 256 kb audio is hold in memory and auto loaded
+	AudioVoiceMsgInMemory = 1024 * 1024, // 1 Mb audio is hold in memory and auto loaded
 };
 
 #ifdef Q_OS_WIN
diff --git a/Telegram/Telegram.plist b/Telegram/Telegram.plist
index 8d91ac639..b5cc81cb0 100644
--- a/Telegram/Telegram.plist
+++ b/Telegram/Telegram.plist
@@ -11,7 +11,7 @@
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>0.5.18</string>
+	<string>0.5.19</string>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>NOTE</key>
diff --git a/Telegram/Telegram.rc b/Telegram/Telegram.rc
index 5ec5cae2290d1b0821b8ee5c83556701c10cb9b6..3d58a51157d71c239b891a466a37eb53d76c5929 100644
GIT binary patch
delta 58
zcmdm|y-$0C9yg=qWPNU9R!asQ27}2Pxg|F@a2GKFxq3kETwdMHDtvN`aIW~~IQ|4S
E0J-N5DgXcg

delta 58
zcmdm|y-$0C9yg=KWPNU9Rtp9l27}2Pxg|F@a2GKFxq3kETwdMHDtvN`aIW~~IQ|4S
E0J&ZcCIA2c

diff --git a/Telegram/Telegram.xcodeproj/project.pbxproj b/Telegram/Telegram.xcodeproj/project.pbxproj
index ce6dc1e05..cb67df8ad 100644
--- a/Telegram/Telegram.xcodeproj/project.pbxproj
+++ b/Telegram/Telegram.xcodeproj/project.pbxproj
@@ -1488,7 +1488,7 @@
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 0.5.18;
+				CURRENT_PROJECT_VERSION = 0.5.19;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
 				GCC_OPTIMIZATION_LEVEL = 0;
@@ -1506,7 +1506,7 @@
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 0.5.18;
+				CURRENT_PROJECT_VERSION = 0.5.19;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
 				GCC_OPTIMIZATION_LEVEL = fast;
 				GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
@@ -1531,10 +1531,10 @@
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				CODE_SIGN_IDENTITY = "";
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 0.5.18;
+				CURRENT_PROJECT_VERSION = 0.5.19;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DYLIB_COMPATIBILITY_VERSION = 0.5;
-				DYLIB_CURRENT_VERSION = 0.5.18;
+				DYLIB_CURRENT_VERSION = 0.5.19;
 				FRAMEWORK_SEARCH_PATHS = "";
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
 				GCC_LINK_WITH_DYNAMIC_LIBRARIES = NO;
@@ -1668,10 +1668,10 @@
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				CODE_SIGN_IDENTITY = "";
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 0.5.18;
+				CURRENT_PROJECT_VERSION = 0.5.19;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DYLIB_COMPATIBILITY_VERSION = 0.5;
-				DYLIB_CURRENT_VERSION = 0.5.18;
+				DYLIB_CURRENT_VERSION = 0.5.19;
 				FRAMEWORK_SEARCH_PATHS = "";
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
 				GCC_LINK_WITH_DYNAMIC_LIBRARIES = NO;