winecoreaudio: Initial Audio Driver for Mac OS X.

This commit is contained in:
Emmanuel Maillard 2006-05-28 22:46:23 +02:00 committed by Alexandre Julliard
parent 5931739cde
commit 144a5353ef
11 changed files with 1769 additions and 2 deletions

16
configure vendored

File diff suppressed because one or more lines are too long

View File

@ -160,6 +160,8 @@ AC_SUBST(OPENGL_LIBS,"")
dnl **** Check for header files ****
AC_CHECK_HEADERS(\
AudioUnit/AudioUnit.h \
CoreAudio/CoreAudio.h \
IOKit/IOKitLib.h \
alsa/asoundlib.h \
arpa/inet.h \
@ -1133,6 +1135,11 @@ case $host_os in
AC_SUBST(COREFOUNDATIONLIB,"-framework CoreFoundation")
AC_SUBST(IOKITLIB,"-framework IOKit -framework CoreFoundation")
AC_SUBST(LDEXECFLAGS,["-image_base 0x7bf00000 -Wl,-segaddr,WINE_DOS,0x00000000,-segaddr,WINE_SHARED_HEAP,0x7ffe0000"])
if test "$ac_cv_header_CoreAudio_CoreAudio_h" = "yes" -a "$ac_cv_header_AudioUnit_AudioUnit_h" = "yes"
then
dnl CoreServices needed by AudioUnit
AC_SUBST(COREAUDIO,"-framework CoreAudio -framework AudioUnit -framework CoreServices")
fi
case $host_cpu in
*powerpc*)
CFLAGS="$CFLAGS -ffixed-r13"
@ -1729,6 +1736,7 @@ dlls/winmm/tests/Makefile
dlls/winmm/winealsa/Makefile
dlls/winmm/winearts/Makefile
dlls/winmm/wineaudioio/Makefile
dlls/winmm/winecoreaudio/Makefile
dlls/winmm/wineesd/Makefile
dlls/winmm/winejack/Makefile
dlls/winmm/winenas/Makefile

View File

@ -170,6 +170,7 @@ BASEDIRS = \
winmm/winealsa \
winmm/winearts \
winmm/wineaudioio \
winmm/winecoreaudio \
winmm/wineesd \
winmm/winejack \
winmm/winenas \
@ -275,6 +276,7 @@ SYMLINKS_SO = \
winealsa.drv.so \
winearts.drv.so \
wineaudioio.drv.so \
winecoreaudio.drv.so \
wineesd.drv.so \
winejack.drv.so \
winenas.drv.so \
@ -319,6 +321,9 @@ winearts.drv.so: winmm/winearts/winearts.drv.so
wineaudioio.drv.so: winmm/wineaudioio/wineaudioio.drv.so
$(RM) $@ && $(LN_S) winmm/wineaudioio/wineaudioio.drv.so $@
winecoreaudio.drv.so: winmm/winecoreaudio/winecoreaudio.drv.so
$(RM) $@ && $(LN_S) winmm/winecoreaudio/winecoreaudio.drv.so $@
wineesd.drv.so: winmm/wineesd/wineesd.drv.so
$(RM) $@ && $(LN_S) winmm/wineesd/wineesd.drv.so $@
@ -919,6 +924,7 @@ user/user32.dll.so: user
winmm/winealsa/winealsa.drv.so: winmm/winealsa
winmm/winearts/winearts.drv.so: winmm/winearts
winmm/wineaudioio/wineaudioio.drv.so: winmm/wineaudioio
winmm/winecoreaudio/winecoreaudio.drv.so: winmm/winecoreaudio
winmm/wineesd/wineesd.drv.so: winmm/wineesd
winmm/winejack/winejack.drv.so: winmm/winejack
winmm/winenas/winenas.drv.so: winmm/winenas

1
dlls/winmm/winecoreaudio/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
Makefile

View File

@ -0,0 +1,16 @@
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = winecoreaudio.drv
IMPORTS = winmm user32 kernel32
EXTRALIBS = $(LIBUUID) @COREAUDIO@
C_SRCS = \
audio.c \
audiounit.c \
coreaudio.c
@MAKE_DLL_RULES@
### Dependencies:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,141 @@
/*
* Wine Driver for CoreAudio / AudioUnit
*
* Copyright 2005, 2006 Emmanuel Maillard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wave);
#ifdef HAVE_AUDIOUNIT_AUDIOUNIT_H
#include <AudioUnit/AudioUnit.h>
static char streamStr[512] = {0};
static char *streamDescription(AudioStreamBasicDescription stream)
{
sprintf(streamStr, "\n mSampleRate : %f\n mFormatID : %c%c%c%c\n mFormatFlags : %lX\n mBytesPerPacket : %u\n mFramesPerPacket : %u\n mBytesPerFrame : %u\n mChannelsPerFrame : %u\n mBitsPerChannel : %u\n",
stream.mSampleRate,
(char) (stream.mFormatID >> 24),
(char) (stream.mFormatID >> 16),
(char) (stream.mFormatID >> 8),
(char) stream.mFormatID,
stream.mFormatFlags,
stream.mBytesPerPacket,
stream.mFramesPerPacket,
stream.mBytesPerFrame,
stream.mChannelsPerFrame,
stream.mBitsPerChannel);
return streamStr;
}
extern OSStatus CoreAudio_woAudioUnitIOProc(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData);
int AudioUnit_CreateDefaultAudioUnit(void *wwo, AudioUnit *au)
{
OSStatus err;
ComponentDescription desc;
AURenderCallbackStruct callbackStruct;
desc.componentType = kAudioUnitType_Output;
desc.componentSubType = kAudioUnitSubType_DefaultOutput;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
Component comp = FindNextComponent(NULL, &desc);
if (comp == NULL)
return 0;
err = OpenAComponent(comp, au);
if (comp == NULL)
return 0;
callbackStruct.inputProc = CoreAudio_woAudioUnitIOProc;
callbackStruct.inputProcRefCon = wwo;
err = AudioUnitSetProperty( *au,
kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Input,
0,
&callbackStruct,
sizeof(callbackStruct));
return (err == noErr);
}
int AudioUnit_CloseAudioUnit(AudioUnit au)
{
OSStatus err = CloseComponent(au);
return (err == noErr);
}
int AudioUnit_InitializeWithStreamDescription(AudioUnit au, AudioStreamBasicDescription stream)
{
OSStatus err = noErr;
err = AudioUnitSetProperty(au, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input,
0, &stream, sizeof(AudioStreamBasicDescription));
if (err != noErr)
{
ERR("AudioUnitSetProperty return an error %c%c%c%c\n", (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
return 0;
}
err = AudioUnitInitialize(au);
if (err != noErr)
{
ERR("AudioUnitInitialize return an error %c%c%c%c\n", (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
return 0;
}
return 1;
}
int AudioUnit_SetVolume(AudioUnit au, float left, float right)
{
OSStatus err = noErr;
err = AudioUnitSetParameter(au, kHALOutputParam_Volume, kAudioUnitParameterFlag_Output, 0, left, 0);
if (err != noErr)
{
ERR("AudioUnitSetParameter return an error %c%c%c%c\n", (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
return 0;
}
return 1;
}
int AudioUnit_GetVolume(AudioUnit au, float *left, float *right)
{
OSStatus err = noErr;
err = AudioUnitGetParameter(au, kHALOutputParam_Volume, kAudioUnitParameterFlag_Output, 0, left);
if (err != noErr)
{
ERR("AudioUnitGetParameter return an error %c%c%c%c\n", (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
return 0;
}
*right = *left;
return 1;
}
#endif

View File

@ -0,0 +1,114 @@
/*
* Wine Driver for CoreAudio
*
* Copyright 2005 Emmanuel Maillard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "mmddk.h"
#include "coreaudio.h"
#include "wine/library.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(coreaudio);
#ifdef HAVE_COREAUDIO_COREAUDIO_H
/**************************************************************************
* CoreAudio_drvLoad [internal]
*/
static LRESULT CoreAudio_drvLoad(void)
{
TRACE("()\n");
CoreAudio_WaveInit();
return 1;
}
/**************************************************************************
* CoreAudio_drvFree [internal]
*/
static LRESULT CoreAudio_drvFree(void)
{
TRACE("()\n");
CoreAudio_WaveRelease();
return 1;
}
/**************************************************************************
* CoreAudio_drvOpen [internal]
*/
static LRESULT CoreAudio_drvOpen(LPSTR str)
{
TRACE("(%s)\n", str);
return 1;
}
/**************************************************************************
* CoreAudio_drvClose [internal]
*/
static DWORD CoreAudio_drvClose(DWORD dwDevID)
{
TRACE("(%08lx)\n", dwDevID);
return 1;
}
#endif /* HAVE_COREAUDIO_COREAUDIO_H */
/**************************************************************************
* DriverProc (WINECOREAUDIO.1)
*/
LRESULT CALLBACK CoreAudio_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
LPARAM dwParam1, LPARAM dwParam2)
{
TRACE("(%08lX, %p, %s (%08X), %08lX, %08lX)\n",
dwDevID, hDriv, wMsg == DRV_LOAD ? "DRV_LOAD" :
wMsg == DRV_FREE ? "DRV_FREE" :
wMsg == DRV_OPEN ? "DRV_OPEN" :
wMsg == DRV_CLOSE ? "DRV_CLOSE" :
wMsg == DRV_ENABLE ? "DRV_ENABLE" :
wMsg == DRV_DISABLE ? "DRV_DISABLE" :
wMsg == DRV_QUERYCONFIGURE ? "DRV_QUERYCONFIGURE" :
wMsg == DRV_CONFIGURE ? "DRV_CONFIGURE" :
wMsg == DRV_INSTALL ? "DRV_INSTALL" :
wMsg == DRV_REMOVE ? "DRV_REMOVE" : "UNKNOWN",
wMsg, dwParam1, dwParam2);
switch(wMsg) {
#ifdef HAVE_COREAUDIO_COREAUDIO_H
case DRV_LOAD: return CoreAudio_drvLoad();
case DRV_FREE: return CoreAudio_drvFree();
case DRV_OPEN: return CoreAudio_drvOpen((LPSTR)dwParam1);
case DRV_CLOSE: return CoreAudio_drvClose(dwDevID);
case DRV_ENABLE: return 1;
case DRV_DISABLE: return 1;
case DRV_QUERYCONFIGURE: return 1;
case DRV_CONFIGURE: MessageBoxA(0, "CoreAudio driver!", "CoreAudio driver", MB_OK); return 1;
case DRV_INSTALL: return DRVCNF_RESTART;
case DRV_REMOVE: return DRVCNF_RESTART;
#endif
default:
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
}
}

View File

@ -0,0 +1,28 @@
/* Definition for CoreAudio drivers : wine multimedia system
*
* Copyright 2005 Emmanuel Maillard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WINE_COREAUDIO_H
#define __WINE_COREAUDIO_H
extern LONG CoreAudio_WaveInit(void);
extern void CoreAudio_WaveRelease(void);
/* extern BOOL CoreAudio_MidiInit(void); */
#endif /* __WINE_COREAUDIO_H */

View File

@ -0,0 +1,2 @@
@ stdcall -private DriverProc(long long long long long) CoreAudio_DriverProc
@ stdcall -private wodMessage(long long long long long) CoreAudio_wodMessage

View File

@ -26,6 +26,9 @@
/* Define to 1 if you have the <asm/types.h> header file. */
#undef HAVE_ASM_TYPES_H
/* Define to 1 if you have the <AudioUnit/AudioUnit.h> header file. */
#undef HAVE_AUDIOUNIT_AUDIOUNIT_H
/* Define to 1 if you have the <audio/audiolib.h> header file. */
#undef HAVE_AUDIO_AUDIOLIB_H
@ -47,6 +50,9 @@
/* Define to 1 if you have the `connect' function. */
#undef HAVE_CONNECT
/* Define to 1 if you have the <CoreAudio/CoreAudio.h> header file. */
#undef HAVE_COREAUDIO_COREAUDIO_H
/* Define to 1 if you have the <cups/cups.h> header file. */
#undef HAVE_CUPS_CUPS_H