mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-21 22:26:29 +01:00
globally remove all trailing whitespace from .cpp and .hpp files missed by previous commit
This commit is contained in:
parent
4dc63966f0
commit
4178db5f63
56 changed files with 50764 additions and 50764 deletions
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "UMicroseconds.h"
|
||||
|
||||
namespace wvNS {
|
||||
namespace wvNS {
|
||||
UMicroseconds& UMicroseconds::ReadTime()
|
||||
{
|
||||
// Note: g_get_monotonic_time() may be a viable alternative
|
||||
|
|
@ -39,7 +39,7 @@ UMicroseconds& UMicroseconds::ReadTime()
|
|||
return *this;
|
||||
}
|
||||
/*
|
||||
Removed in favor of the posix implementation.
|
||||
Removed in favor of the posix implementation.
|
||||
#ifdef __APPLE__
|
||||
uint32_t UMicroseconds::hi() {return reinterpret_cast<UnsignedWide*>(&theTime)->hi;}
|
||||
uint32_t UMicroseconds::lo() {return reinterpret_cast<UnsignedWide*>(&theTime)->lo;}
|
||||
|
|
@ -74,4 +74,4 @@ UMicrosecondsAccumulator& UMicrosecondsAccumulator::operator+=(const UMicrosecon
|
|||
return *this;
|
||||
}
|
||||
|
||||
} // namespace wvNS {
|
||||
} // namespace wvNS {
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace wvThread
|
|||
//--------------------- begin measurement code
|
||||
// poll to align to a tick of gettimeofday
|
||||
::gettimeofday(&tvtmp,0);
|
||||
do {
|
||||
do {
|
||||
::gettimeofday(&tvstart,0);
|
||||
__asm__ __volatile__ (".byte 0x0f, 0x31" : "=A" (Tstart)); // RDTSC
|
||||
} while (tvtmp.tv_usec!=tvstart.tv_usec);
|
||||
|
|
@ -74,7 +74,7 @@ namespace wvThread
|
|||
::usleep(sktd_TSC_MeasurementPeriod);
|
||||
//
|
||||
::gettimeofday(&tvtmp,0);
|
||||
do {
|
||||
do {
|
||||
::gettimeofday(&tvend,0);
|
||||
__asm__ __volatile__ (".byte 0x0f, 0x31" : "=A" (Tend)); // RDTSC
|
||||
} while (tvtmp.tv_usec!=tvend.tv_usec);
|
||||
|
|
@ -86,10 +86,10 @@ namespace wvThread
|
|||
#endif
|
||||
return nTicksPerMicrosecond;
|
||||
}
|
||||
|
||||
|
||||
#if defined(__APPLE__) //&& !defined(__MACH__)
|
||||
|
||||
|
||||
|
||||
bool FindNetInterfaceByIPAddress(const char *sIP, char *sInterface) // sIP and sInterface are both char[16]
|
||||
{
|
||||
FILE *fProcess , *pSubcall;
|
||||
|
|
@ -106,7 +106,7 @@ namespace wvThread
|
|||
while (pToken)
|
||||
{
|
||||
sprintf(sCommand, "ifconfig %s | grep \"inet %s \"", pToken, sIP);
|
||||
|
||||
|
||||
pSubcall = popen(sCommand, "r");
|
||||
if (pSubcall)
|
||||
{
|
||||
|
|
@ -121,12 +121,12 @@ namespace wvThread
|
|||
}
|
||||
}
|
||||
pclose(pSubcall);
|
||||
pToken = strtok(NULL, " ");
|
||||
pToken = strtok(NULL, " ");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
pclose(fProcess);
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
#endif // MACOS
|
||||
|
|
@ -198,7 +198,7 @@ namespace wvThread
|
|||
#elif XPLATFORMTHREADS_POSIX
|
||||
void yield() { ::sched_yield(); }
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -214,14 +214,14 @@ namespace wvThread
|
|||
inline void obtain() { EnsureThreadingInitialized(); ::EnterCriticalSection (&m_critsec); }
|
||||
inline void release() { EnsureThreadingInitialized(); ::LeaveCriticalSection (&m_critsec); }
|
||||
inline bool tryobtain() { EnsureThreadingInitialized(); return TryEnterCriticalSection(&m_critsec)!=FALSE; }
|
||||
|
||||
|
||||
#elif defined (XPLATFORMTHREADS_POSIX)
|
||||
protected:
|
||||
pthread_mutex_t m_ptmutex;
|
||||
public:
|
||||
inline OSDependentMutex()
|
||||
{
|
||||
EnsureThreadingInitialized();
|
||||
inline OSDependentMutex()
|
||||
{
|
||||
EnsureThreadingInitialized();
|
||||
pthread_mutexattr_t attr;
|
||||
pthread_mutexattr_init(&attr);
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
|
|
@ -237,7 +237,7 @@ namespace wvThread
|
|||
|
||||
ThreadMutexInited::ThreadMutexInited() :
|
||||
m_osdmutex(0) {}
|
||||
|
||||
|
||||
void ThreadMutexInited::init()
|
||||
{
|
||||
if (! is_init())
|
||||
|
|
@ -245,7 +245,7 @@ namespace wvThread
|
|||
m_osdmutex = new OSDependentMutex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ThreadMutexInited::uninit()
|
||||
{
|
||||
if (is_init())
|
||||
|
|
@ -254,38 +254,38 @@ namespace wvThread
|
|||
m_osdmutex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ThreadMutexInited::~ThreadMutexInited()
|
||||
{
|
||||
uninit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ThreadMutexInited::obtain()
|
||||
{
|
||||
if (is_init())
|
||||
{
|
||||
m_osdmutex->obtain();
|
||||
m_osdmutex->obtain();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ThreadMutexInited::release()
|
||||
{
|
||||
if (is_init())
|
||||
{
|
||||
m_osdmutex->release();
|
||||
m_osdmutex->release();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool ThreadMutexInited::tryobtain()
|
||||
{
|
||||
bool retVal = true;
|
||||
if (is_init())
|
||||
{
|
||||
retVal = m_osdmutex->tryobtain();
|
||||
retVal = m_osdmutex->tryobtain();
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ThreadConditionSignal::OSDependentObject : public noncopyableobject
|
||||
{
|
||||
#if defined (XPLATFORMTHREADS_POSIX)
|
||||
|
|
@ -294,17 +294,17 @@ namespace wvThread
|
|||
pthread_cond_t m_ptcond;
|
||||
pthread_mutex_t m_ptmutex;
|
||||
public:
|
||||
inline OSDependentObject()
|
||||
inline OSDependentObject()
|
||||
{
|
||||
EnsureThreadingInitialized();
|
||||
EnsureThreadingInitialized();
|
||||
::pthread_mutex_init(&m_ptmutex,0);
|
||||
::pthread_cond_init(&m_ptcond, 0);
|
||||
::pthread_cond_init(&m_ptcond, 0);
|
||||
}
|
||||
inline ~OSDependentObject() { ::pthread_cond_destroy(&m_ptcond), ::pthread_mutex_destroy(&m_ptmutex); }
|
||||
inline void signal_unicast() { ::pthread_cond_signal(&m_ptcond); }
|
||||
inline void signal_broadcast() { ::pthread_cond_broadcast(&m_ptcond); }
|
||||
inline void await_signal() { ::pthread_cond_wait(&m_ptcond, &m_ptmutex); }
|
||||
inline bool await_signal(timediff td)
|
||||
inline bool await_signal(timediff td)
|
||||
{
|
||||
timespec tspecDeadline;
|
||||
timeval tvNow;
|
||||
|
|
@ -423,14 +423,14 @@ namespace wvThread
|
|||
#endif // OS switch
|
||||
};
|
||||
|
||||
void ThreadConditionSignal::obtain_mutex()
|
||||
{
|
||||
m_osdepobj.obtain_mutex();
|
||||
void ThreadConditionSignal::obtain_mutex()
|
||||
{
|
||||
m_osdepobj.obtain_mutex();
|
||||
}
|
||||
bool ThreadConditionSignal::tryobtain_mutex() { return m_osdepobj.tryobtain_mutex(); }
|
||||
void ThreadConditionSignal::release_mutex()
|
||||
{
|
||||
m_osdepobj.release_mutex();
|
||||
void ThreadConditionSignal::release_mutex()
|
||||
{
|
||||
m_osdepobj.release_mutex();
|
||||
}
|
||||
|
||||
void ThreadConditionSignal::await_condition() { m_osdepobj.await_signal(); }
|
||||
|
|
@ -587,7 +587,7 @@ namespace wvThread
|
|||
0 // where to store thread ID
|
||||
);
|
||||
|
||||
if (h)
|
||||
if (h)
|
||||
{
|
||||
th.m_oshandle = h;
|
||||
if (pri!=ThreadPriority::Normal)
|
||||
|
|
@ -620,8 +620,8 @@ namespace wvThread
|
|||
ThunkedThreadWrapper,
|
||||
ptwdata
|
||||
);
|
||||
|
||||
if (anyerr)
|
||||
|
||||
if (anyerr)
|
||||
th=Invalid;
|
||||
else
|
||||
th.m_oshandle = OSDependent::from_oshandle(pt);
|
||||
|
|
@ -676,7 +676,7 @@ namespace wvThread
|
|||
class WCThreadRef::OSDependent
|
||||
{
|
||||
public:
|
||||
static void GetCurrentThreadRef(WCThreadRef& tid);
|
||||
static void GetCurrentThreadRef(WCThreadRef& tid);
|
||||
#if XPLATFORMTHREADS_WINDOWS
|
||||
static inline uintptr_t from_os(DWORD thread_id) { return (uintptr_t)(thread_id); }
|
||||
static inline DWORD to_os(uintptr_t thread_id) { return (DWORD)(thread_id); }
|
||||
|
|
@ -735,7 +735,7 @@ namespace wvThread
|
|||
|
||||
WCThreadRef GetCurrentThreadRef()
|
||||
{
|
||||
EnsureThreadingInitialized(); // Is it necessary?
|
||||
EnsureThreadingInitialized(); // Is it necessary?
|
||||
WCThreadRef tRefToReturn;
|
||||
WCThreadRef::OSDependent::GetCurrentThreadRef(tRefToReturn);
|
||||
return tRefToReturn;
|
||||
|
|
@ -794,7 +794,7 @@ namespace wvThread
|
|||
bool WCAtomicLock::obtain(const uint32_t in_num_trys)
|
||||
{
|
||||
bool retVal = false;
|
||||
|
||||
|
||||
uint32_t timeOut = in_num_trys;
|
||||
while (true)
|
||||
{
|
||||
|
|
@ -812,7 +812,7 @@ namespace wvThread
|
|||
sleep_milliseconds(1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Akupara
|
|||
{
|
||||
// The ultimate nothingness
|
||||
// This is useful for writing constructors that nullify their object, and for testing nullness
|
||||
struct null_type
|
||||
struct null_type
|
||||
{
|
||||
null_type() {}
|
||||
null_type(const null_type *) {} // this allows 0 to be implicitly converted to null_type
|
||||
|
|
|
|||
|
|
@ -18,22 +18,22 @@ namespace Akupara
|
|||
|
||||
// Integer log2 functions
|
||||
//------------------------------------------------------------------------
|
||||
template<unsigned int n>
|
||||
template<unsigned int n>
|
||||
struct compiletime_bit_count_to_represent { static const unsigned int value = 1+compiletime_bit_count_to_represent<(n>>1)>::value; };
|
||||
|
||||
template<>
|
||||
template<>
|
||||
struct compiletime_bit_count_to_represent<0> { static const unsigned int value = 0; };
|
||||
//------------------------------------------------------------------------
|
||||
template<unsigned int n>
|
||||
template<unsigned int n>
|
||||
struct compiletime_log2_ceiling { static const unsigned int value=compiletime_bit_count_to_represent<n-1>::value; };
|
||||
|
||||
template<>
|
||||
template<>
|
||||
struct compiletime_log2_ceiling<0> {}; // no value for 0 argument
|
||||
//------------------------------------------------------------------------
|
||||
template<unsigned int n>
|
||||
template<unsigned int n>
|
||||
struct compiletime_log2_floor { static const unsigned int value=compiletime_bit_count_to_represent<n>::value-1; };
|
||||
|
||||
template<>
|
||||
template<>
|
||||
struct compiletime_log2_floor<0> {}; // no value for 0 argument
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -41,13 +41,13 @@ namespace Akupara
|
|||
|
||||
// Assertion - accessing 'value' will generate a compile-time error if the argument evaluates to false
|
||||
//------------------------------------------------------------------------
|
||||
template<bool>
|
||||
template<bool>
|
||||
struct compiletime_assert;
|
||||
|
||||
template<>
|
||||
struct compiletime_assert<true> { static const bool value=true; };
|
||||
|
||||
template<>
|
||||
template<>
|
||||
struct compiletime_assert<false> {}; // no value member for false assertion -> compile time error
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ namespace Akupara
|
|||
template<typename _true_type, typename _false_type>
|
||||
struct compiletime_select_type<true, _true_type, _false_type> { typedef _true_type type; };
|
||||
|
||||
template<typename _true_type, typename _false_type>
|
||||
template<typename _true_type, typename _false_type>
|
||||
struct compiletime_select_type<false, _true_type, _false_type> { typedef _false_type type; };
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ namespace Akupara
|
|||
//------------------------------------------------------------------------
|
||||
namespace detail
|
||||
{
|
||||
template<unsigned int _size, bool _signed>
|
||||
template<unsigned int _size, bool _signed>
|
||||
struct integer_with_byte_count_base;
|
||||
|
||||
template<>
|
||||
|
|
@ -149,15 +149,15 @@ namespace Akupara
|
|||
AKUPARA_SIGNED_UNSIGNED_INTEGER_PAIR(3, int )
|
||||
|
||||
//AKUPARA_SIGNED_UNSIGNED_INTEGER_PAIR(4, int32_t )// 64BitConversion
|
||||
template<>
|
||||
struct
|
||||
signed_unsigned_pair<4>
|
||||
{
|
||||
typedef int32_t signed_type;
|
||||
typedef uint32_t unsigned_type;
|
||||
template<>
|
||||
struct
|
||||
signed_unsigned_pair<4>
|
||||
{
|
||||
typedef int32_t signed_type;
|
||||
typedef uint32_t unsigned_type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
AKUPARA_SIGNED_UNSIGNED_INTEGER_PAIR(5, long long)
|
||||
AKUPARA_SIGNED_UNSIGNED_FLOAT_PAIR (6, float )
|
||||
AKUPARA_SIGNED_UNSIGNED_FLOAT_PAIR (7, double )
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Akupara/threading/atomic_ops.hpp
|
||||
*
|
||||
*
|
||||
*
|
||||
* Created by Udi Barzilai on 06/06.
|
||||
* Copyright 2006 __MyCompanyName__. All rights reserved.
|
||||
|
|
@ -91,16 +91,16 @@ namespace Akupara
|
|||
//----------------------------------------------------------------------------------------
|
||||
namespace detail
|
||||
{
|
||||
template<unsigned int _byte_count>
|
||||
struct largest_atomic_byte_count_upto
|
||||
{
|
||||
static const unsigned int value =
|
||||
machine::implements_load<_byte_count>::value && machine::implements_store<_byte_count>::value ?
|
||||
_byte_count :
|
||||
largest_atomic_byte_count_upto<_byte_count/2>::value;
|
||||
template<unsigned int _byte_count>
|
||||
struct largest_atomic_byte_count_upto
|
||||
{
|
||||
static const unsigned int value =
|
||||
machine::implements_load<_byte_count>::value && machine::implements_store<_byte_count>::value ?
|
||||
_byte_count :
|
||||
largest_atomic_byte_count_upto<_byte_count/2>::value;
|
||||
};
|
||||
|
||||
template<>
|
||||
template<>
|
||||
struct largest_atomic_byte_count_upto<0> { static const unsigned int value = 0; };
|
||||
|
||||
const unsigned int k_byte_count_best_atomic = largest_atomic_byte_count_upto<sizeof(int)>::value;
|
||||
|
|
@ -129,7 +129,7 @@ _byte_count :
|
|||
namespace detail
|
||||
{
|
||||
template<
|
||||
typename _integer_type,
|
||||
typename _integer_type,
|
||||
bool _implements_CAS = machine::implements_CAS <sizeof(_integer_type)>::value,
|
||||
bool _implements_LL_SC = machine::implements_LL_SC<sizeof(_integer_type)>::value>
|
||||
struct implementation_CAS
|
||||
|
|
@ -138,7 +138,7 @@ _byte_count :
|
|||
};
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// specialization for native CAS support
|
||||
template<typename _integer_type, bool _implements_LL_SC>
|
||||
template<typename _integer_type, bool _implements_LL_SC>
|
||||
struct implementation_CAS<_integer_type, true, _implements_LL_SC>
|
||||
{
|
||||
static const bool s_exists = true;
|
||||
|
|
@ -164,7 +164,7 @@ _byte_count :
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
} // namespace detail
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
template<typename _integer_type>
|
||||
template<typename _integer_type>
|
||||
inline bool compare_and_store(volatile _integer_type * operand_address, const _integer_type & expected_value, const _integer_type & value_to_store)
|
||||
{
|
||||
// if your compiler can't find the function to call here then there is no implementation available for your machine
|
||||
|
|
@ -181,7 +181,7 @@ _byte_count :
|
|||
namespace detail
|
||||
{
|
||||
template<
|
||||
typename _integer_type,
|
||||
typename _integer_type,
|
||||
bool _0 = machine::implements_fetch_and_add<sizeof(_integer_type)>::value,
|
||||
bool _1 = machine::implements_add_and_fetch<sizeof(_integer_type)>::value,
|
||||
bool _2 = machine::implements_LL_SC <sizeof(_integer_type)>::value,
|
||||
|
|
@ -244,7 +244,7 @@ _byte_count :
|
|||
};
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
} // namespace detail
|
||||
template<typename _integer_type>
|
||||
template<typename _integer_type>
|
||||
inline _integer_type fetch_and_add(volatile _integer_type * operand_address, const _integer_type & addend)
|
||||
{
|
||||
// if your compiler can't find the function to call here then there is no implementation available for your machine
|
||||
|
|
@ -260,7 +260,7 @@ _byte_count :
|
|||
namespace detail
|
||||
{
|
||||
template<
|
||||
typename _integer_type,
|
||||
typename _integer_type,
|
||||
bool _0 = machine::implements_add_and_fetch<sizeof(_integer_type)>::value,
|
||||
bool _1 = machine::implements_fetch_and_add<sizeof(_integer_type)>::value,
|
||||
bool _2 = machine::implements_LL_SC <sizeof(_integer_type)>::value,
|
||||
|
|
@ -323,7 +323,7 @@ _byte_count :
|
|||
};
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
} // namespace detail
|
||||
template<typename _integer_type>
|
||||
template<typename _integer_type>
|
||||
inline _integer_type add_and_fetch(volatile _integer_type * operand_address, const _integer_type & addend)
|
||||
{
|
||||
// if your compiler can't find the function to call here then there is no implementation available for your machine
|
||||
|
|
@ -335,7 +335,7 @@ _byte_count :
|
|||
|
||||
//----------------------------------------------------------------------------------------
|
||||
// add
|
||||
template<typename _integer_type>
|
||||
template<typename _integer_type>
|
||||
inline void add(volatile _integer_type * operand_address, const _integer_type & addend)
|
||||
{
|
||||
if (machine::implements_add<sizeof(_integer_type)>::value)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Akupara/threading/atomic_ops_gcc_x86.hpp
|
||||
*
|
||||
*
|
||||
*
|
||||
* Created by Udi Barzilai on 06/06.
|
||||
* Copyright 2006 __MyCompanyName__. All rights reserved.
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::WCMRAudioDevice
|
||||
// WCMRAudioDevice::WCMRAudioDevice
|
||||
//
|
||||
//! Constructor for the audio device. The derived classes will need to do more actual work, such
|
||||
//! as determining supported sampling rates, buffer sizes, and channel counts. Connection
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
//!
|
||||
//! \param *pManager : The audio device manager that's managing this device.
|
||||
//! \return Nothing.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WCMRAudioDevice::WCMRAudioDevice (WCMRAudioDeviceManager *pManager) :
|
||||
m_pMyManager (pManager)
|
||||
|
|
@ -39,19 +39,19 @@ WCMRAudioDevice::WCMRAudioDevice (WCMRAudioDeviceManager *pManager) :
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::~WCMRAudioDevice
|
||||
// WCMRAudioDevice::~WCMRAudioDevice
|
||||
//
|
||||
//! Destructor for the audio device. It release all the connections that were created.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return Nothing.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WCMRAudioDevice::~WCMRAudioDevice ()
|
||||
{
|
||||
AUTO_FUNC_DEBUG;
|
||||
try
|
||||
try
|
||||
{
|
||||
}
|
||||
catch (...)
|
||||
|
|
@ -65,14 +65,14 @@ WCMRAudioDevice::~WCMRAudioDevice ()
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::DeviceName
|
||||
// WCMRAudioDevice::DeviceName
|
||||
//
|
||||
//! Retrieves Device's name.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return The device name.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
const std::string& WCMRAudioDevice::DeviceName () const
|
||||
{
|
||||
|
|
@ -83,14 +83,14 @@ const std::string& WCMRAudioDevice::DeviceName () const
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::InputChannels
|
||||
// WCMRAudioDevice::InputChannels
|
||||
//
|
||||
//! Retrieves Input Channel information. Note that the list may be changed at run-time.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return A vector with Input Channel Names.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
const std::vector<std::string>& WCMRAudioDevice::InputChannels ()
|
||||
{
|
||||
|
|
@ -101,14 +101,14 @@ const std::vector<std::string>& WCMRAudioDevice::InputChannels ()
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::OutputChannels
|
||||
// WCMRAudioDevice::OutputChannels
|
||||
//
|
||||
//! Retrieves Output Channel Information. Note that the list may be changed at run-time.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return A vector with Output Channel Names.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
const std::vector<std::string>& WCMRAudioDevice::OutputChannels ()
|
||||
{
|
||||
|
|
@ -119,14 +119,14 @@ const std::vector<std::string>& WCMRAudioDevice::OutputChannels ()
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::SamplingRates
|
||||
// WCMRAudioDevice::SamplingRates
|
||||
//
|
||||
//! Retrieves supported sampling rate information.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return A vector with supported sampling rates.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
const std::vector<int>& WCMRAudioDevice::SamplingRates ()
|
||||
{
|
||||
|
|
@ -136,15 +136,15 @@ const std::vector<int>& WCMRAudioDevice::SamplingRates ()
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::CurrentSamplingRate
|
||||
// WCMRAudioDevice::CurrentSamplingRate
|
||||
//
|
||||
//! The device's current sampling rate. This may be overridden, if the device needs to
|
||||
//! The device's current sampling rate. This may be overridden, if the device needs to
|
||||
//! query the driver for the current rate.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return The device's current sampling rate. -1 on error.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
int WCMRAudioDevice::CurrentSamplingRate ()
|
||||
{
|
||||
|
|
@ -155,15 +155,15 @@ int WCMRAudioDevice::CurrentSamplingRate ()
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::SetCurrentSamplingRate
|
||||
// WCMRAudioDevice::SetCurrentSamplingRate
|
||||
//
|
||||
//! Change the sampling rate to be used by the device. This will most likely be overridden,
|
||||
//! Change the sampling rate to be used by the device. This will most likely be overridden,
|
||||
//! the base class simply updates the member variable.
|
||||
//!
|
||||
//! \param newRate : The rate to use (samples per sec).
|
||||
//!
|
||||
//!
|
||||
//! \return eNoErr always. The derived classes may return error codes.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WTErr WCMRAudioDevice::SetCurrentSamplingRate (int newRate)
|
||||
{
|
||||
|
|
@ -176,14 +176,14 @@ WTErr WCMRAudioDevice::SetCurrentSamplingRate (int newRate)
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::BufferSizes
|
||||
// WCMRAudioDevice::BufferSizes
|
||||
//
|
||||
//! Retrieves supported buffer size information.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return A vector with supported buffer sizes.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
const std::vector<int>& WCMRAudioDevice::BufferSizes ()
|
||||
{
|
||||
|
|
@ -195,13 +195,13 @@ const std::vector<int>& WCMRAudioDevice::BufferSizes ()
|
|||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::CurrentBufferSize
|
||||
//
|
||||
//! The device's current buffer size in use. This may be overridden, if the device needs to
|
||||
//! The device's current buffer size in use. This may be overridden, if the device needs to
|
||||
//! query the driver for the current size.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return The device's current buffer size. 0 on error.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
int WCMRAudioDevice::CurrentBufferSize ()
|
||||
{
|
||||
|
|
@ -216,9 +216,9 @@ int WCMRAudioDevice::CurrentBufferSize ()
|
|||
//! data other then the audio buffers, like frames info in SG, so it can be overridden
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return The device's current block size. 0 on error.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
int WCMRAudioDevice::CurrentBlockSize()
|
||||
{
|
||||
|
|
@ -230,13 +230,13 @@ int WCMRAudioDevice::CurrentBlockSize()
|
|||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::SetCurrentBufferSize
|
||||
//
|
||||
//! Change the buffer size to be used by the device. This will most likely be overridden,
|
||||
//! Change the buffer size to be used by the device. This will most likely be overridden,
|
||||
//! the base class simply updates the member variable.
|
||||
//!
|
||||
//! \param newSize : The buffer size to use (in sample-frames)
|
||||
//!
|
||||
//!
|
||||
//! \return eNoErr always. The derived classes may return error codes.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WTErr WCMRAudioDevice::SetCurrentBufferSize (int newSize)
|
||||
{
|
||||
|
|
@ -250,15 +250,15 @@ WTErr WCMRAudioDevice::SetCurrentBufferSize (int newSize)
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::ConnectionStatus
|
||||
// WCMRAudioDevice::ConnectionStatus
|
||||
//
|
||||
//! Retrieves the device's current connection status. This will most likely be overridden,
|
||||
//! in case some driver communication is required to query the status.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return A ConnectionStates value.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WCMRAudioDevice::ConnectionStates WCMRAudioDevice::ConnectionStatus ()
|
||||
{
|
||||
|
|
@ -270,14 +270,14 @@ WCMRAudioDevice::ConnectionStates WCMRAudioDevice::ConnectionStatus ()
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::Active
|
||||
// WCMRAudioDevice::Active
|
||||
//
|
||||
//! Retrieves Device activation status.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return true if device is active, false otherwise.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
bool WCMRAudioDevice::Active ()
|
||||
{
|
||||
|
|
@ -288,15 +288,15 @@ bool WCMRAudioDevice::Active ()
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::SetActive
|
||||
// WCMRAudioDevice::SetActive
|
||||
//
|
||||
//! Sets the device's activation status.
|
||||
//!
|
||||
//! \param newState : Should be true to activate, false to deactivate. This roughly corresponds
|
||||
//! to opening and closing the device handle/stream/audio unit.
|
||||
//!
|
||||
//!
|
||||
//! \return eNoErr always, the derived classes may return appropriate error code.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WTErr WCMRAudioDevice::SetActive (bool newState)
|
||||
{
|
||||
|
|
@ -310,14 +310,14 @@ WTErr WCMRAudioDevice::SetActive (bool newState)
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::Streaming
|
||||
// WCMRAudioDevice::Streaming
|
||||
//
|
||||
//! Retrieves Device streaming status.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return true if device is streaming, false otherwise.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
bool WCMRAudioDevice::Streaming ()
|
||||
{
|
||||
|
|
@ -333,9 +333,9 @@ bool WCMRAudioDevice::Streaming ()
|
|||
//!
|
||||
//! \param newState : Should be true to start streaming, false to stop streaming. This roughly
|
||||
//! corresponds to calling Start/Stop on the lower level interface.
|
||||
//!
|
||||
//!
|
||||
//! \return eNoErr always, the derived classes may return appropriate error code.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WTErr WCMRAudioDevice::SetStreaming (bool newState)
|
||||
{
|
||||
|
|
@ -387,15 +387,15 @@ bool WCMRAudioDevice::IsProcessActive()
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::DoIdle
|
||||
// WCMRAudioDevice::DoIdle
|
||||
//
|
||||
//! A place for doing idle time processing. The derived classes will probably do something
|
||||
//! meaningful.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return eNoErr always.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WTErr WCMRAudioDevice::DoIdle ()
|
||||
{
|
||||
|
|
@ -408,14 +408,14 @@ WTErr WCMRAudioDevice::DoIdle ()
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::InputLevels
|
||||
// WCMRAudioDevice::InputLevels
|
||||
//
|
||||
//! Retrieve current input levels.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return A vector (the same size as input channels list) that contains current input levels.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
const std::vector<float>& WCMRAudioDevice::InputLevels ()
|
||||
{
|
||||
|
|
@ -427,14 +427,14 @@ const std::vector<float>& WCMRAudioDevice::InputLevels ()
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::OutputLevels
|
||||
// WCMRAudioDevice::OutputLevels
|
||||
//
|
||||
//! Retrieve current output levels.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return A vector (the same size as output channels list) that contains current output levels.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
const std::vector<float>& WCMRAudioDevice::OutputLevels ()
|
||||
{
|
||||
|
|
@ -446,16 +446,16 @@ const std::vector<float>& WCMRAudioDevice::OutputLevels ()
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::GetMonitorInfo
|
||||
// WCMRAudioDevice::GetMonitorInfo
|
||||
//
|
||||
//! Retrieves current monitoring information.
|
||||
//!
|
||||
//! \param *pLeftChannel : Pointer to receive left monitor channel index.
|
||||
//! \param *pRightChannel : Pointer to receive right monitor channel index.
|
||||
//! \param *pGain : Pointer to receive the gain (linear) to be applied.
|
||||
//!
|
||||
//!
|
||||
//! \return Nothing.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
void WCMRAudioDevice::GetMonitorInfo (int *pLeftChannel, int *pRightChannel, float *pGain)
|
||||
{
|
||||
|
|
@ -471,15 +471,15 @@ void WCMRAudioDevice::GetMonitorInfo (int *pLeftChannel, int *pRightChannel, flo
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::SetMonitorChannels
|
||||
// WCMRAudioDevice::SetMonitorChannels
|
||||
//
|
||||
//! Used to set the channels to be used for monitoring.
|
||||
//!
|
||||
//! \param leftChannel : Left monitor channel index.
|
||||
//! \param rightChannel : Right monitor channel index.
|
||||
//!
|
||||
//!
|
||||
//! \return eNoErr always, the derived classes may return appropriate errors.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WTErr WCMRAudioDevice::SetMonitorChannels (int leftChannel, int rightChannel)
|
||||
{
|
||||
|
|
@ -493,14 +493,14 @@ WTErr WCMRAudioDevice::SetMonitorChannels (int leftChannel, int rightChannel)
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::SetMonitorGain
|
||||
// WCMRAudioDevice::SetMonitorGain
|
||||
//
|
||||
//! Used to set monitor gain (or atten).
|
||||
//!
|
||||
//! \param newGain : The new gain or atten. value to use. Specified as a linear multiplier (not dB)
|
||||
//!
|
||||
//! \param newGain : The new gain or atten. value to use. Specified as a linear multiplier (not dB)
|
||||
//!
|
||||
//! \return eNoErr always, the derived classes may return appropriate errors.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WTErr WCMRAudioDevice::SetMonitorGain (float newGain)
|
||||
{
|
||||
|
|
@ -514,15 +514,15 @@ WTErr WCMRAudioDevice::SetMonitorGain (float newGain)
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::ShowConfigPanel
|
||||
// WCMRAudioDevice::ShowConfigPanel
|
||||
//
|
||||
//! Used to show device specific config/control panel. Some interfaces may not support it.
|
||||
//! Some interfaces may require the device to be active before it can display a panel.
|
||||
//!
|
||||
//! \param pParam : A device/interface specific parameter - optional.
|
||||
//!
|
||||
//!
|
||||
//! \return eNoErr always, the derived classes may return errors.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WTErr WCMRAudioDevice::ShowConfigPanel (void *WCUNUSEDPARAM(pParam))
|
||||
{
|
||||
|
|
@ -532,16 +532,16 @@ WTErr WCMRAudioDevice::ShowConfigPanel (void *WCUNUSEDPARAM(pParam))
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDevice::SendCustomCommand
|
||||
// WCMRAudioDevice::SendCustomCommand
|
||||
//
|
||||
//! Used to Send a custom command to the audiodevice. Some interfaces may require the device
|
||||
//! Used to Send a custom command to the audiodevice. Some interfaces may require the device
|
||||
//! to be active before it can do anything in this.
|
||||
//!
|
||||
//! \param customCommand : A device/interface specific command.
|
||||
//! \param pCommandParam : A device/interface/command specific parameter - optional.
|
||||
//!
|
||||
//!
|
||||
//! \return eNoErr always, the derived classes may return errors.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WTErr WCMRAudioDevice::SendCustomCommand (int WCUNUSEDPARAM(customCommand), void *WCUNUSEDPARAM(pCommandParam))
|
||||
{
|
||||
|
|
@ -573,10 +573,10 @@ uint32_t WCMRAudioDevice::GetLatency (bool isInput)
|
|||
//
|
||||
//! The constructuor, most of the work will be done in the derived class' constructor.
|
||||
//!
|
||||
//! \param *pTheClient :
|
||||
//!
|
||||
//! \param *pTheClient :
|
||||
//!
|
||||
//! \return Nothing.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WCMRAudioDeviceManager::WCMRAudioDeviceManager(WCMRAudioDeviceManagerClient *pTheClient, eAudioDeviceFilter eCurAudioDeviceFilter)
|
||||
: m_eAudioDeviceFilter(eCurAudioDeviceFilter)
|
||||
|
|
@ -592,9 +592,9 @@ WCMRAudioDeviceManager::WCMRAudioDeviceManager(WCMRAudioDeviceManagerClient *pTh
|
|||
//! It clears the device list, releasing each of the device.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return Nothing.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WCMRAudioDeviceManager::~WCMRAudioDeviceManager()
|
||||
{
|
||||
|
|
@ -674,15 +674,15 @@ WTErr WCMRAudioDeviceManager::GetDeviceBufferSizes(const std::string & nameToMat
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRAudioDeviceManager::NotifyClient
|
||||
// WCMRAudioDeviceManager::NotifyClient
|
||||
//
|
||||
//! A helper routine used to call the client for notification.
|
||||
//!
|
||||
//! \param forReason : The reason for notification.
|
||||
//! \param *pParam : A parameter (if required) for notification.
|
||||
//!
|
||||
//!
|
||||
//! \return Nothing.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
void WCMRAudioDeviceManager::NotifyClient (WCMRAudioDeviceManagerClient::NotificationReason forReason, void *pParam)
|
||||
{
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -30,8 +30,8 @@
|
|||
//! the applications.
|
||||
//!
|
||||
//! \param pManager : The managing device manager - simply passed on to the base class.
|
||||
//!
|
||||
//!
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WCMRNativeAudioNoneDevice::WCMRNativeAudioNoneDevice (WCMRAudioDeviceManager *pManager)
|
||||
: WCMRNativeAudioDevice (pManager, false /*useMultiThreading*/)
|
||||
|
|
@ -155,7 +155,7 @@ WTErr WCMRNativeAudioNoneDevice::SetStreaming (bool newState)
|
|||
std::cerr << "WCMRNativeAudioNoneDevice::SetStreaming (): pthread_attr_init () failed!" << std::endl;
|
||||
return eGenericErr;
|
||||
}
|
||||
|
||||
|
||||
if (pthread_attr_setstacksize (&attributes, stack_size)) {
|
||||
std::cerr << "WCMRNativeAudioNoneDevice::SetStreaming (): pthread_attr_setstacksize () failed!" << std::endl;
|
||||
return eGenericErr;
|
||||
|
|
@ -203,13 +203,13 @@ void WCMRNativeAudioNoneDevice::_SilenceThread()
|
|||
(const float*)theInpBuffers,
|
||||
_m_outputBuffer,
|
||||
buffer_size,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
audioCallbackData.acdCycleStartTimeNanos =__get_time_nanos();
|
||||
|
||||
// VERY ROUGH IMPLEMENTATION:
|
||||
// VERY ROUGH IMPLEMENTATION:
|
||||
while(Streaming()) {
|
||||
|
||||
uint64_t cycleEndTimeNanos = audioCallbackData.acdCycleStartTimeNanos + cyclePeriodNanos;
|
||||
|
|
@ -236,13 +236,13 @@ void* WCMRNativeAudioNoneDevice::__SilenceThread(void *This)
|
|||
|
||||
#if defined(PLATFORM_WINDOWS)
|
||||
void WCMRNativeAudioNoneDevice::_usleep(uint64_t duration_usec)
|
||||
{
|
||||
LARGE_INTEGER ft;
|
||||
{
|
||||
LARGE_INTEGER ft;
|
||||
|
||||
ft.QuadPart = -(10*duration_usec); // Convert to 100 nanosecond interval, negative value indicates relative time
|
||||
|
||||
SetWaitableTimer(_waitableTimerForUsleep, &ft, 0, NULL, NULL, 0);
|
||||
WaitForSingleObject(_waitableTimerForUsleep, INFINITE);
|
||||
WaitForSingleObject(_waitableTimerForUsleep, INFINITE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -254,9 +254,9 @@ WCMRNativeAudioNoneDevice::__get_time_nanos ()
|
|||
// the API should be a part of WCMRCoreAudioDeviceManager to give a chance of being tied to the
|
||||
// audio device transport timeß.
|
||||
return AudioConvertHostTimeToNanos (AudioGetCurrentHostTime ());
|
||||
|
||||
|
||||
#elif PLATFORM_WINDOWS
|
||||
|
||||
|
||||
LARGE_INTEGER Frequency, Count ;
|
||||
|
||||
QueryPerformanceFrequency (&Frequency) ;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ using namespace wvNS;
|
|||
#define PROPERTY_CHANGE_TIMEOUT_SECONDS 2
|
||||
#define PROPERTY_CHANGE_RETRIES 3
|
||||
|
||||
///< Supported Sample rates
|
||||
///< Supported Sample rates
|
||||
static const double gAllSampleRates[] =
|
||||
{
|
||||
44100.0, 48000.0, 88200.0, 96000.0, 176400.0, 192000.0, -1 /* negative terminated list */
|
||||
|
|
@ -64,7 +64,7 @@ DWORD WINAPI WCMRPortAudioDevice::__DoIdle__(LPVOID lpThreadParameter)
|
|||
}
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRPortAudioDevice::WCMRPortAudioDevice
|
||||
// WCMRPortAudioDevice::WCMRPortAudioDevice
|
||||
//
|
||||
//! Constructor for the audio device. Opens the PA device
|
||||
//! and gets information about the device.
|
||||
|
|
@ -74,9 +74,9 @@ DWORD WINAPI WCMRPortAudioDevice::__DoIdle__(LPVOID lpThreadParameter)
|
|||
//! \param *pManager : The audio device manager that's managing this device.
|
||||
//! \param deviceID : The port audio device ID.
|
||||
//! \param useMultithreading : Whether to use multi-threading for audio processing. Default is true.
|
||||
//!
|
||||
//!
|
||||
//! \return Nothing.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WCMRPortAudioDevice::WCMRPortAudioDevice (WCMRPortAudioDeviceManager *pManager, unsigned int deviceID, bool useMultithreading, bool bNoCopy) :
|
||||
WCMRNativeAudioDevice (pManager, useMultithreading, bNoCopy)
|
||||
|
|
@ -230,16 +230,16 @@ void WCMRPortAudioDevice::terminateDevice()
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRPortAudioDevice::~WCMRPortAudioDevice
|
||||
// WCMRPortAudioDevice::~WCMRPortAudioDevice
|
||||
//
|
||||
//! Destructor for the audio device. The base release all the connections that were created, if
|
||||
//! they have not been already destroyed! Here we simply stop streaming, and close device
|
||||
//! handles if necessary.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return Nothing.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WCMRPortAudioDevice::~WCMRPortAudioDevice ()
|
||||
{
|
||||
|
|
@ -293,13 +293,13 @@ WTErr WCMRPortAudioDevice::UpdateDeviceInfo ()
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRPortAudioDevice::updateDeviceInfo
|
||||
// WCMRPortAudioDevice::updateDeviceInfo
|
||||
//
|
||||
//! Must be called be device processing thread
|
||||
//! Updates Device Information about channels, sampling rates, buffer sizes.
|
||||
//!
|
||||
//! \return Nothing.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
void WCMRPortAudioDevice::updateDeviceInfo (bool callerIsWaiting/*=false*/)
|
||||
{
|
||||
|
|
@ -353,7 +353,7 @@ void WCMRPortAudioDevice::updateDeviceInfo (bool callerIsWaiting/*=false*/)
|
|||
m_BufferSizes.clear();
|
||||
bool useDefaultBuffers = true;
|
||||
|
||||
// In ASIO Windows, the buffer size is set from the sound device manufacturer's control panel
|
||||
// In ASIO Windows, the buffer size is set from the sound device manufacturer's control panel
|
||||
long minSize, maxSize, preferredSize, granularity;
|
||||
PaError err = PaAsio_GetAvailableBufferSizes(m_DeviceID, &minSize, &maxSize, &preferredSize, &granularity);
|
||||
|
||||
|
|
@ -486,15 +486,15 @@ PaError WCMRPortAudioDevice::testStateValidness(int sampleRate, int bufferSize)
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRPortAudioDevice::CurrentSamplingRate
|
||||
// WCMRPortAudioDevice::CurrentSamplingRate
|
||||
//
|
||||
//! The device's current sampling rate. This may be overridden, if the device needs to
|
||||
//! The device's current sampling rate. This may be overridden, if the device needs to
|
||||
//! query the driver for the current rate.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return The device's current sampling rate. -1 on error.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
int WCMRPortAudioDevice::CurrentSamplingRate ()
|
||||
{
|
||||
|
|
@ -561,14 +561,14 @@ WTErr WCMRPortAudioDevice::ResetDevice()
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRPortAudioDevice::SetCurrentSamplingRate
|
||||
// WCMRPortAudioDevice::SetCurrentSamplingRate
|
||||
//
|
||||
//! Change the sampling rate to be used by the device.
|
||||
//! Change the sampling rate to be used by the device.
|
||||
//!
|
||||
//! \param newRate : The rate to use (samples per sec).
|
||||
//!
|
||||
//!
|
||||
//! \return eNoErr always. The derived classes may return error codes.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WTErr WCMRPortAudioDevice::SetCurrentSamplingRate (int newRate)
|
||||
{
|
||||
|
|
@ -622,13 +622,13 @@ WTErr WCMRPortAudioDevice::SetCurrentSamplingRate (int newRate)
|
|||
//**********************************************************************************************
|
||||
// WCMRPortAudioDevice::CurrentBufferSize
|
||||
//
|
||||
//! The device's current buffer size in use. This may be overridden, if the device needs to
|
||||
//! The device's current buffer size in use. This may be overridden, if the device needs to
|
||||
//! query the driver for the current size.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return The device's current buffer size. 0 on error.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
int WCMRPortAudioDevice::CurrentBufferSize ()
|
||||
{
|
||||
|
|
@ -639,13 +639,13 @@ int WCMRPortAudioDevice::CurrentBufferSize ()
|
|||
//**********************************************************************************************
|
||||
// WCMRPortAudioDevice::SetCurrentBufferSize
|
||||
//
|
||||
//! Change the buffer size to be used by the device. This will most likely be overridden,
|
||||
//! Change the buffer size to be used by the device. This will most likely be overridden,
|
||||
//! the base class simply updates the member variable.
|
||||
//!
|
||||
//! \param newSize : The buffer size to use (in sample-frames)
|
||||
//!
|
||||
//!
|
||||
//! \return eNoErr always. The derived classes may return error codes.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WTErr WCMRPortAudioDevice::SetCurrentBufferSize (int newSize)
|
||||
{
|
||||
|
|
@ -678,15 +678,15 @@ WTErr WCMRPortAudioDevice::SetCurrentBufferSize (int newSize)
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRPortAudioDevice::ConnectionStatus
|
||||
// WCMRPortAudioDevice::ConnectionStatus
|
||||
//
|
||||
//! Retrieves the device's current connection status. This will most likely be overridden,
|
||||
//! in case some driver communication is required to query the status.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return A ConnectionStates value.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WCMRPortAudioDevice::ConnectionStates WCMRPortAudioDevice::ConnectionStatus ()
|
||||
{
|
||||
|
|
@ -701,7 +701,7 @@ WCMRPortAudioDevice::ConnectionStates WCMRPortAudioDevice::ConnectionStatus ()
|
|||
// WCMRPortAudioDevice::activateDevice
|
||||
//
|
||||
//! IS CALLED BY PROCESS THREAD
|
||||
//! Sets the device into "active" state. Essentially, opens the PA device.
|
||||
//! Sets the device into "active" state. Essentially, opens the PA device.
|
||||
//! If it's an ASIO device it may result in buffer size change in some cases.
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
|
|
@ -740,7 +740,7 @@ void WCMRPortAudioDevice::activateDevice (bool callerIsWaiting/*=false*/)
|
|||
|
||||
std::cout << "API::Device " << m_DeviceName << " Opening device stream " << std::endl;
|
||||
std::cout << "Sample rate: " << m_CurrentSamplingRate << " buffer size: " << m_CurrentBufferSize << std::endl;
|
||||
paErr = Pa_OpenStream(&m_PortAudioStream,
|
||||
paErr = Pa_OpenStream(&m_PortAudioStream,
|
||||
pInS,
|
||||
pOutS,
|
||||
m_CurrentSamplingRate,
|
||||
|
|
@ -817,7 +817,7 @@ void WCMRPortAudioDevice::activateDevice (bool callerIsWaiting/*=false*/)
|
|||
// WCMRPortAudioDevice::deactivateDevice
|
||||
//
|
||||
//! IS CALLED BY PROCESS THREAD
|
||||
//! Sets the device into "inactive" state. Essentially, closes the PA device.
|
||||
//! Sets the device into "inactive" state. Essentially, closes the PA device.
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
void WCMRPortAudioDevice::deactivateDevice (bool callerIsWaiting/*=false*/)
|
||||
|
|
@ -878,7 +878,7 @@ void WCMRPortAudioDevice::deactivateDevice (bool callerIsWaiting/*=false*/)
|
|||
//
|
||||
//! Sets the devices into "streaming" state. Calls PA's Start stream routines.
|
||||
//! This roughly corresponds to calling Start on the lower level interface.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
void WCMRPortAudioDevice::startStreaming (bool callerIsWaiting/*=false*/)
|
||||
{
|
||||
|
|
@ -928,7 +928,7 @@ void WCMRPortAudioDevice::startStreaming (bool callerIsWaiting/*=false*/)
|
|||
//
|
||||
//! Sets the devices into "not streaming" state. Calls PA's Stop stream routines.
|
||||
//! This roughly corresponds to calling Stop on the lower level interface.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
void WCMRPortAudioDevice::stopStreaming (bool callerIsWaiting/*=false*/)
|
||||
{
|
||||
|
|
@ -963,15 +963,15 @@ void WCMRPortAudioDevice::stopStreaming (bool callerIsWaiting/*=false*/)
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRPortAudioDevice::resetDevice
|
||||
// WCMRPortAudioDevice::resetDevice
|
||||
//
|
||||
//! Resets the device, updates device info. Importnat: does PA reinitialization calling
|
||||
//! Pa_terminate/Pa_initialize functions.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return nothing
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
void WCMRPortAudioDevice::resetDevice (bool callerIsWaiting /*=false*/ )
|
||||
{
|
||||
|
|
@ -1007,7 +1007,7 @@ void WCMRPortAudioDevice::resetDevice (bool callerIsWaiting /*=false*/ )
|
|||
if (paErr != paNoError)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
m_CurrentBufferSize = preferredSize;
|
||||
|
||||
paErr = testStateValidness(m_CurrentSamplingRate, m_CurrentBufferSize);
|
||||
|
|
@ -1115,22 +1115,22 @@ long WCMRPortAudioDevice::ASIOMessageHook (long selector, long WCUNUSEDPARAM(val
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRPortAudioDevice::DoIdle
|
||||
// WCMRPortAudioDevice::DoIdle
|
||||
//
|
||||
//! A place for doing idle time processing. The other derived classes will probably do something
|
||||
//! meaningful.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return eNoErr always.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WTErr WCMRPortAudioDevice::DoIdle ()
|
||||
{
|
||||
WTErr retVal = eNoErr;
|
||||
|
||||
std::cout << "WCMRPortAudioDevice::DoIdle ()" << std::endl;
|
||||
HANDLE hEvents[] =
|
||||
HANDLE hEvents[] =
|
||||
{
|
||||
m_hUpdateDeviceInfoRequestedEvent,
|
||||
m_hActivateRequestedEvent,
|
||||
|
|
@ -1218,15 +1218,15 @@ WTErr WCMRPortAudioDevice::DoIdle ()
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRPortAudioDevice::SetMonitorChannels
|
||||
// WCMRPortAudioDevice::SetMonitorChannels
|
||||
//
|
||||
//! Used to set the channels to be used for monitoring.
|
||||
//!
|
||||
//! \param leftChannel : Left monitor channel index.
|
||||
//! \param rightChannel : Right monitor channel index.
|
||||
//!
|
||||
//!
|
||||
//! \return eNoErr always, the derived classes may return appropriate errors.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WTErr WCMRPortAudioDevice::SetMonitorChannels (int leftChannel, int rightChannel)
|
||||
{
|
||||
|
|
@ -1241,14 +1241,14 @@ WTErr WCMRPortAudioDevice::SetMonitorChannels (int leftChannel, int rightChannel
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRPortAudioDevice::SetMonitorGain
|
||||
// WCMRPortAudioDevice::SetMonitorGain
|
||||
//
|
||||
//! Used to set monitor gain (or atten).
|
||||
//!
|
||||
//! \param newGain : The new gain or atten. value to use. Specified as a linear multiplier (not dB)
|
||||
//!
|
||||
//! \param newGain : The new gain or atten. value to use. Specified as a linear multiplier (not dB)
|
||||
//!
|
||||
//! \return eNoErr always, the derived classes may return appropriate errors.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WTErr WCMRPortAudioDevice::SetMonitorGain (float newGain)
|
||||
{
|
||||
|
|
@ -1264,15 +1264,15 @@ WTErr WCMRPortAudioDevice::SetMonitorGain (float newGain)
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRPortAudioDevice::ShowConfigPanel
|
||||
// WCMRPortAudioDevice::ShowConfigPanel
|
||||
//
|
||||
//! Used to show device specific config/control panel. Some interfaces may not support it.
|
||||
//! Some interfaces may require the device to be active before it can display a panel.
|
||||
//!
|
||||
//! \param pParam : A device/interface specific parameter, should be the app window handle for ASIO.
|
||||
//!
|
||||
//!
|
||||
//! \return eNoErr always, the derived classes may return errors.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WTErr WCMRPortAudioDevice::ShowConfigPanel (void *pParam)
|
||||
{
|
||||
|
|
@ -1315,7 +1315,7 @@ WTErr WCMRPortAudioDevice::ShowConfigPanel (void *pParam)
|
|||
//*****************************************************************************************************
|
||||
// WCMRPortAudioDevice::TheCallback
|
||||
//
|
||||
//! The (static) Port Audio Callback function. This is a static member. It calls on the AudioCallback in the
|
||||
//! The (static) Port Audio Callback function. This is a static member. It calls on the AudioCallback in the
|
||||
//! WCMRPortAudioDevice to do the real work.
|
||||
//!
|
||||
//! \param pInputBuffer: pointer to input buffer.
|
||||
|
|
@ -1324,10 +1324,10 @@ WTErr WCMRPortAudioDevice::ShowConfigPanel (void *pParam)
|
|||
//! \param pTimeInfo: time info for PaStream callback.
|
||||
//! \param statusFlags:
|
||||
//! \param pUserData: pointer to user data, in our case the WCMRPortAudioDevice object.
|
||||
//!
|
||||
//!
|
||||
//! \return true to stop streaming else returns false.
|
||||
//******************************************************************************************************
|
||||
int WCMRPortAudioDevice::TheCallback (const void *pInputBuffer, void *pOutputBuffer, unsigned long framesPerBuffer,
|
||||
int WCMRPortAudioDevice::TheCallback (const void *pInputBuffer, void *pOutputBuffer, unsigned long framesPerBuffer,
|
||||
const PaStreamCallbackTimeInfo* /*pTimeInfo*/, PaStreamCallbackFlags statusFlags, void *pUserData )
|
||||
{
|
||||
WCMRPortAudioDevice *pMyDevice = (WCMRPortAudioDevice *)pUserData;
|
||||
|
|
@ -1342,10 +1342,10 @@ int WCMRPortAudioDevice::TheCallback (const void *pInputBuffer, void *pOutputBuf
|
|||
|
||||
|
||||
//**********************************************************************************************
|
||||
// WCMRPortAudioDevice::AudoiCallback
|
||||
// WCMRPortAudioDevice::AudoiCallback
|
||||
//
|
||||
//! Here's where the actual audio processing happens. We call upon all the active connections'
|
||||
//! sinks to provide data to us which can be put/mixed in the output buffer! Also, we make the
|
||||
//! Here's where the actual audio processing happens. We call upon all the active connections'
|
||||
//! sinks to provide data to us which can be put/mixed in the output buffer! Also, we make the
|
||||
//! input data available to any sources that may call upon us during this time!
|
||||
//!
|
||||
//! \param *pInputBuffer : Points to a buffer with recorded data.
|
||||
|
|
@ -1354,9 +1354,9 @@ int WCMRPortAudioDevice::TheCallback (const void *pInputBuffer, void *pOutputBuf
|
|||
//! which are interleaved, is fixed at Device Open (Active) time. In this implementation,
|
||||
//! the number of channels are fixed to use the maximum available.
|
||||
//! \param dropsDetected : True if dropouts were detected in input or output. Can be used to signal the GUI.
|
||||
//!
|
||||
//!
|
||||
//! \return true
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
int WCMRPortAudioDevice::AudioCallback( const float *pInputBuffer, float *pOutputBuffer, unsigned long framesPerBuffer, bool dropsDetected )
|
||||
{
|
||||
|
|
@ -1382,7 +1382,7 @@ int WCMRPortAudioDevice::AudioCallback( const float *pInputBuffer, float *pOutpu
|
|||
m_SampleCounter,
|
||||
theStartTime.MicroSeconds()*1000
|
||||
};
|
||||
|
||||
|
||||
m_pMyManager->NotifyClient (WCMRAudioDeviceManagerClient::AudioCallback, (void *)&audioCallbackData );
|
||||
|
||||
//Don't try to access after this call returns!
|
||||
|
|
@ -1404,11 +1404,11 @@ int WCMRPortAudioDevice::AudioCallback( const float *pInputBuffer, float *pOutpu
|
|||
//! \param *pTheClient : The manager's client object (which receives notifications).
|
||||
//! \param interfaceType : The PortAudio interface type to use for this manager - acts as a filter.
|
||||
//! \param useMultithreading : Whether to use multi-threading for audio processing. Default is true.
|
||||
//!
|
||||
//!
|
||||
//! \return Nothing.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WCMRPortAudioDeviceManager::WCMRPortAudioDeviceManager (WCMRAudioDeviceManagerClient *pTheClient,
|
||||
WCMRPortAudioDeviceManager::WCMRPortAudioDeviceManager (WCMRAudioDeviceManagerClient *pTheClient,
|
||||
eAudioDeviceFilter eCurAudioDeviceFilter, bool useMultithreading, bool bNocopy)
|
||||
: WCMRAudioDeviceManager (pTheClient, eCurAudioDeviceFilter)
|
||||
, m_NoneDevice(0)
|
||||
|
|
@ -1436,9 +1436,9 @@ WCMRPortAudioDeviceManager::WCMRPortAudioDeviceManager (WCMRAudioDeviceManagerCl
|
|||
//! It clears the device list, releasing each of the device.
|
||||
//!
|
||||
//! \param none
|
||||
//!
|
||||
//!
|
||||
//! \return Nothing.
|
||||
//!
|
||||
//!
|
||||
//**********************************************************************************************
|
||||
WCMRPortAudioDeviceManager::~WCMRPortAudioDeviceManager()
|
||||
{
|
||||
|
|
@ -1463,7 +1463,7 @@ WCMRPortAudioDeviceManager::~WCMRPortAudioDeviceManager()
|
|||
WCMRAudioDevice* WCMRPortAudioDeviceManager::initNewCurrentDeviceImpl(const std::string & deviceName)
|
||||
{
|
||||
destroyCurrentDeviceImpl();
|
||||
|
||||
|
||||
std::cout << "API::PortAudioDeviceManager::initNewCurrentDevice " << deviceName << std::endl;
|
||||
if (deviceName == m_NoneDevice->DeviceName() )
|
||||
{
|
||||
|
|
@ -1687,7 +1687,7 @@ WTErr WCMRPortAudioDeviceManager::generateDeviceListImpl()
|
|||
m_DeviceInfoVec.push_back(pDevInfo);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(bRejectDevice)
|
||||
{
|
||||
TRACE_MSG ("API::PortAudioDeviceManager::Device " << pDevInfo->m_DeviceName << "Rejected. \
|
||||
|
|
@ -1721,9 +1721,9 @@ WTErr WCMRPortAudioDeviceManager::generateDeviceListImpl()
|
|||
WTErr WCMRPortAudioDeviceManager::getDeviceSampleRatesImpl(const std::string & deviceName, std::vector<int>& sampleRates) const
|
||||
{
|
||||
sampleRates.clear ();
|
||||
|
||||
|
||||
WTErr retVal = eNoErr;
|
||||
|
||||
|
||||
if (m_CurrentDevice && deviceName == m_CurrentDevice->DeviceName() )
|
||||
{
|
||||
sampleRates=m_CurrentDevice->SamplingRates();
|
||||
|
|
@ -1732,7 +1732,7 @@ WTErr WCMRPortAudioDeviceManager::getDeviceSampleRatesImpl(const std::string & d
|
|||
|
||||
DeviceInfo devInfo;
|
||||
retVal = GetDeviceInfoByName(deviceName, devInfo);
|
||||
|
||||
|
||||
if (eNoErr == retVal)
|
||||
{
|
||||
sampleRates=devInfo.m_AvailableSampleRates;
|
||||
|
|
@ -1765,7 +1765,7 @@ WTErr WCMRPortAudioDeviceManager::getDeviceBufferSizesImpl(const std::string & d
|
|||
return retVal;
|
||||
}
|
||||
|
||||
DeviceInfo devInfo;
|
||||
DeviceInfo devInfo;
|
||||
retVal = GetDeviceInfoByName(deviceName, devInfo);
|
||||
|
||||
if (eNoErr == retVal)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue