From: Steve K. <st...@St...> - 2003-03-04 14:46:04
|
Thanks for writing back Andre! On Tue, Mar 04, 2003 at 04:49:59AM +0100, Andre Bierwirth wrote: > Hi Steve, i use the lcc Win32 Compiler for by C Source. I had also memo= ry of problems in my first nonreleased Versions. There was > some Problems with freeing of iax_frames but i=B4m not sure. It=B4s lon= g time ago. >=20 > My Sound Output is currently in Delphi GUI because i have never > Programmed C before this. It was only to try the DirectX API for > Output. (This was my first App with DirectX). Now i know enough about > C to write the Soundoutput directly in C like an Phonecore(GNOPhone) > modul. Thanks, that's what I expected, and remember from when I looked at your sources. > The bad Quality comes from my hardcoded Buffersize. On some Computers > i fix this Problem with a recompile and a bigger Outputbuffer. There > a big problems too on Win32 and DirectX. On the Snomphone you have > nearly zero latency for the Sound Output. On DirectX i have to fill a > Ringbuffer with the Audiodata. And there i have my bigest Problems the > Thread timing on Win32 is terrible. If i have a Ringbuffer with 2 > 160byte Chunks, i have many buffer underruns if i minimize and > maximize any Windows. I see currently no Soundapplications with a > smaller Latency than 50ms and DirectX, because the Threading on > Windows makes it impossible. I have try an Thread Priotity Realtime > but i have still always bufferunderuns if i minimize or maximize some > Windows. I think Microsoft=B4s Window animation have a higher priority > as a Realtime Application. With a higher Latency and a bigger Buffer > i have no Problems with the Audio quality. Interesting. =20 I think that, in our application, this should be something that is tunable at runtime, or at least compile time. =20 For our application, we'd happily bump up the latency by another 50ms or 100ms, if it meant really good quality. =20 Since I expect that many users will be using internet connections for this, there's going to be several sources of latency in the whole system: 1) Actual network transmission time: Somewhere from 2 - 2000 ms. 2) The clients' Jitter buffer. 3) The clients audio device buffer. Something we might want to look at later is to see if or how we can "combine" 2 and 3? As far as audio driver technologies, I don't know what benefits DirectX has over the "standard" windows audio interfaces, but we'll need to support "out-of-the-box" Windows installations without needing them to go and download and install DirectX, so we'll need to support the standard windows APIs as a baseline. Then, if there's benefits to it, we could detect the presence of compatible DirectX interfaces, and use them, if the user already has them installed. > I think the your Library need some Abstraction Parts for Threads and > Thread Syncronisation. It is not very difficult to Implement a PThread > for Win32. Same with Mutexes. I didn=B4t know anything about Mac, so i > can talk only about my Win32 Problems. First, Mac OS X is really very much like FreeBSD, except, in our case, for Audio stuff, and GUI stuff. So, it fully supports pthreads. For Windows, it's my understanding that their threads and "critical sections" are pretty similar to pthreads and mutexes. For another project, we just do some #defines to make them act the same way, like this: #ifndef _WIN32 #define SOCKET int #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #define SD_SEND 1 #define INET_ATON(s, a) (inet_aton(s, &a) =3D=3D 0) #define SOCKLEN socklen_t #define SOCKETERRORMSG strerror(errno) #define CLOSESOCKET(s) close(s) #define THREAD pthread_t #define THREADIDDECL(t) #define THREADCREATE(func, args, thread, id) \ pthread_create(&thread, NULL, func, args) #define THREADCREATE_ERROR -1 #define THREADFUNCDECL(func) void * func(void *args) #define THREADFUNCRET(r) void * r #define THREADJOIN(t) pthread_join(t, 0) #define MUTEX pthread_mutex_t #define MUTEXINIT(m) pthread_mutex_init(m, NULL) //TODO: check error #define MUTEXLOCK(m) pthread_mutex_lock(m) #define MUTEXUNLOCK(m) pthread_mutex_unlock(m) #define MUTEXDESTROY(m) pthread_mutex_destroy(m) #else #define INET_ATON(s, a) ((a.s_addr =3D inet_addr(s)) =3D=3D INADDR_NONE) #define SOCKLEN int #define SOCKETERRORMSG get_WSA_error_str(WSAGetLastError()) #define CLOSESOCKET(s) closesocket(s) #define THREAD HANDLE #define THREADIDDECL(t) unsigned t; #define THREADCREATE(func, args, thread, id) \ (thread =3D (HANDLE)_beginthreadex(NULL, 0, func, (PVOID)args, 0, &id)) #define THREADCREATE_ERROR NULL #define THREADFUNCDECL(func) unsigned __stdcall func(PVOID args) #define THREADFUNCRET(r) int r =3D 0 #define THREADJOIN(t) WaitForSingleObject(t, INFINITE) #define MUTEX CRITICAL_SECTION #define MUTEXINIT(m) InitializeCriticalSection(m) #define MUTEXLOCK(m) EnterCriticalSection(m) #define MUTEXUNLOCK(m) LeaveCriticalSection(m) #define MUTEXDESTROY(m) DeleteCriticalSection(m) #endif > Sorry my English :) Your English is fine, no apology needed! Thanks for joining the mailing list and helping! =20 -SteveK --=20 Steve Kann - Chief Engineer - 520 8th Ave #2300 NY 10018 - (212) 533-1= 775 HorizonLive.com - collaborate . interact . learn "The box said 'Requires Windows 95, NT, or better,' so I installed Lin= ux." |