From d5e52e74f20b65e6fae26ac8ec6c3281ceb4ad16 Mon Sep 17 00:00:00 2001
From: atraczyk <andreastraczyk@gmail.com>
Date: Fri, 20 Jan 2017 12:47:53 -0500
Subject: [PATCH] audio: remove use of libsndfile for UWP build

- remove the referencing of sndfile objects, as UWP implements
  the playing of ringtone files client-side.

Change-Id: I88e12b31c2fd66d3e171d971960eb66bdf8875a4
Tuleap: #790
---
 src/media/audio/audiorecord.cpp     | 8 ++++++++
 src/media/audio/sound/audiofile.cpp | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/src/media/audio/audiorecord.cpp b/src/media/audio/audiorecord.cpp
index 2f3b8bb849..12768b048f 100644
--- a/src/media/audio/audiorecord.cpp
+++ b/src/media/audio/audiorecord.cpp
@@ -28,7 +28,9 @@
 #include "fileutils.h"
 #include "manager.h"
 
+#ifndef RING_UWP
 #include <sndfile.hh>
+#endif
 
 #include <algorithm>
 #include <sstream> // for stringstream
@@ -147,6 +149,7 @@ std::string AudioRecord::getFilename() const
 bool
 AudioRecord::openFile()
 {
+#ifndef RING_UWP
     fileHandle_.reset(); // do it before calling fileExists()
 
     const bool doAppend = fileExists();
@@ -170,6 +173,9 @@ AudioRecord::openFile()
         RING_WARN("Couldn't seek to the end of the file ");
 
     return true;
+#else
+    return false;
+#endif
 }
 
 void
@@ -218,6 +224,7 @@ AudioRecord::stopRecording() const noexcept
 void
 AudioRecord::recData(AudioBuffer& buffer)
 {
+#ifndef RING_UWP
     if (not recordingEnabled_)
         return;
 
@@ -228,6 +235,7 @@ AudioRecord::recData(AudioBuffer& buffer)
     } else {
         fileHandle_->writeSync();
     }
+#endif
 }
 
 } // namespace ring
diff --git a/src/media/audio/sound/audiofile.cpp b/src/media/audio/sound/audiofile.cpp
index e8a299658d..5fa03ea00c 100644
--- a/src/media/audio/sound/audiofile.cpp
+++ b/src/media/audio/sound/audiofile.cpp
@@ -26,7 +26,10 @@
 #include <cstring>
 #include <vector>
 #include <climits>
+
+#ifndef RING_UWP
 #include <sndfile.hh>
+#endif
 
 #include "audiofile.h"
 #include "audio/resampler.h"
@@ -59,6 +62,7 @@ AudioFile::onBufferFinish()
 AudioFile::AudioFile(const std::string &fileName, unsigned int sampleRate) :
     AudioLoop(sampleRate), filepath_(fileName), updatePlaybackScale_(0)
 {
+#ifndef RING_UWP
     int format;
     bool hasHeader = true;
 
@@ -127,6 +131,7 @@ AudioFile::AudioFile(const std::string &fileName, unsigned int sampleRate) :
         delete buffer_;
         buffer_ = buffer;
     }
+#endif
 }
 
 } // namespace ring
-- 
GitLab