- more changes to unify development across different projects (callers / server / hasq / softphone)
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
/* Copyright(C) 2007-2014 VoIP objects (voipobjects.com)
|
||||
/* Copyright(C) 2007-2018 VoIP objects (voipobjects.com)
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <assert.h>
|
||||
#include "Audio_DataWindow.h"
|
||||
|
||||
using namespace Audio;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#define NOMINMAX
|
||||
#include "Audio_DevicePair.h"
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
|
||||
#define LOG_SUBSYSTEM "Audio"
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
# include <WinSock2.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include "Audio_Helper.h"
|
||||
#include "../helper/HL_Exception.h"
|
||||
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
/* Copyright(C) 2007-2014 VoIP objects (voipobjects.com)
|
||||
/* Copyright(C) 2007-2018 VoIP objects (voipobjects.com)
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "../config.h"
|
||||
#include "../helper/HL_Exception.h"
|
||||
#include "Audio_Mixer.h"
|
||||
#include <algorithm>
|
||||
#include "../helper/HL_Log.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
|
||||
#include "Audio_Mixer.h"
|
||||
|
||||
#define LOG_SUBSYSTEM "Mixer"
|
||||
using namespace Audio;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "Audio_Null.h"
|
||||
#include "helper/HL_Log.h"
|
||||
#include <assert.h>
|
||||
#define LOG_SUBSYSTEM "NULL audio"
|
||||
|
||||
using namespace Audio;
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
# include "signal_processing_library/signal_processing_library.h"
|
||||
#endif
|
||||
|
||||
#include "../helper/HL_Pointer.h"
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <map>
|
||||
|
||||
namespace Audio
|
||||
{
|
||||
|
||||
@@ -31,6 +31,8 @@ typedef struct {
|
||||
|
||||
#define LOG_SUBSYSTEM "WavFileReader"
|
||||
|
||||
#define LOCK std::unique_lock<std::mutex> lock(mFileMtx);
|
||||
|
||||
using namespace Audio;
|
||||
|
||||
// ---------------------- WavFileReader -------------------------
|
||||
@@ -71,7 +73,7 @@ std::string WavFileReader::readChunk()
|
||||
|
||||
bool WavFileReader::open(const std::tstring& filename)
|
||||
{
|
||||
Lock lock(mFileMtx);
|
||||
LOCK;
|
||||
try
|
||||
{
|
||||
#ifdef WIN32
|
||||
@@ -160,7 +162,7 @@ bool WavFileReader::open(const std::tstring& filename)
|
||||
|
||||
void WavFileReader::close()
|
||||
{
|
||||
Lock lock(mFileMtx);
|
||||
LOCK;
|
||||
|
||||
if (NULL != mHandle)
|
||||
fclose(mHandle);
|
||||
@@ -179,7 +181,7 @@ unsigned WavFileReader::read(void* buffer, unsigned bytes)
|
||||
|
||||
unsigned WavFileReader::read(short* buffer, unsigned samples)
|
||||
{
|
||||
Lock lock(mFileMtx);
|
||||
LOCK;
|
||||
|
||||
if (!mHandle)
|
||||
return 0;
|
||||
@@ -208,14 +210,14 @@ unsigned WavFileReader::read(short* buffer, unsigned samples)
|
||||
|
||||
bool WavFileReader::isOpened()
|
||||
{
|
||||
Lock lock(mFileMtx);
|
||||
LOCK;
|
||||
|
||||
return (mHandle != 0);
|
||||
}
|
||||
|
||||
void WavFileReader::rewind()
|
||||
{
|
||||
Lock l(mFileMtx);
|
||||
LOCK;
|
||||
|
||||
if (mHandle)
|
||||
fseek(mHandle, mDataOffset, SEEK_SET);
|
||||
@@ -223,14 +225,14 @@ void WavFileReader::rewind()
|
||||
|
||||
std::tstring WavFileReader::filename() const
|
||||
{
|
||||
Lock lock(mFileMtx);
|
||||
LOCK;
|
||||
|
||||
return mFileName;
|
||||
}
|
||||
|
||||
unsigned WavFileReader::size() const
|
||||
{
|
||||
Lock l(mFileMtx);
|
||||
LOCK;
|
||||
|
||||
return mDataLength;
|
||||
}
|
||||
@@ -258,7 +260,7 @@ void WavFileWriter::checkWriteResult(int result)
|
||||
|
||||
bool WavFileWriter::open(const std::tstring& filename, int rate, int channels)
|
||||
{
|
||||
Lock lock(mFileMtx);
|
||||
LOCK;
|
||||
|
||||
close();
|
||||
|
||||
@@ -324,7 +326,7 @@ bool WavFileWriter::open(const std::tstring& filename, int rate, int channels)
|
||||
|
||||
void WavFileWriter::close()
|
||||
{
|
||||
Lock lock(mFileMtx);
|
||||
LOCK;
|
||||
|
||||
if (mHandle)
|
||||
{
|
||||
@@ -335,7 +337,7 @@ void WavFileWriter::close()
|
||||
|
||||
unsigned WavFileWriter::write(const void* buffer, unsigned bytes)
|
||||
{
|
||||
Lock l(mFileMtx);
|
||||
LOCK;
|
||||
|
||||
if (!mHandle)
|
||||
return 0;
|
||||
@@ -361,14 +363,15 @@ unsigned WavFileWriter::write(const void* buffer, unsigned bytes)
|
||||
|
||||
bool WavFileWriter::isOpened()
|
||||
{
|
||||
Lock lock(mFileMtx);
|
||||
LOCK;
|
||||
|
||||
return (mHandle != 0);
|
||||
}
|
||||
|
||||
std::tstring WavFileWriter::filename()
|
||||
{
|
||||
Lock lock(mFileMtx);
|
||||
LOCK;
|
||||
|
||||
return mFileName;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright(C) 2007-2017 VoIPobjects (voipobjects.com)
|
||||
/* Copyright(C) 2007-2018 VoIPobjects (voipobjects.com)
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
@@ -7,13 +7,15 @@
|
||||
#ifndef __AUDIO_WAVFILE_H
|
||||
#define __AUDIO_WAVFILE_H
|
||||
|
||||
#include "helper/HL_Sync.h"
|
||||
#include "helper/HL_Types.h"
|
||||
//#include "helper/HL_Types.h"
|
||||
#include "Audio_Resampler.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
#include "helper/HL_Types.h"
|
||||
|
||||
namespace Audio
|
||||
{
|
||||
@@ -26,7 +28,7 @@ namespace Audio
|
||||
short mBits;
|
||||
int mRate;
|
||||
std::tstring mFileName;
|
||||
mutable Mutex mFileMtx;
|
||||
mutable std::mutex mFileMtx;
|
||||
unsigned mDataOffset;
|
||||
unsigned mDataLength;
|
||||
Resampler mResampler;
|
||||
@@ -57,7 +59,7 @@ namespace Audio
|
||||
protected:
|
||||
FILE* mHandle; /// Handle of audio file.
|
||||
std::tstring mFileName; /// Path to requested audio file.
|
||||
Mutex mFileMtx; /// Mutex to protect this instance.
|
||||
std::mutex mFileMtx; /// Mutex to protect this instance.
|
||||
int mWritten; /// Amount of written data (in bytes)
|
||||
int mLengthOffset; /// Position of length field.
|
||||
int mRate, mChannels;
|
||||
|
||||
@@ -20,3 +20,4 @@ set (AUDIOLIB_SOURCES
|
||||
)
|
||||
|
||||
add_library(audio_lib ${AUDIOLIB_SOURCES})
|
||||
target_include_directories(audio_lib PRIVATE ../../libs/speex/include ../../libs ../)
|
||||
|
||||
Reference in New Issue
Block a user