winecoreaudio: Consolidate formatting of FOURCC values in a function.

This commit is contained in:
Ken Thomases 2009-10-11 14:11:19 -05:00 committed by Alexandre Julliard
parent 47c27742d0
commit 1b5ca01aeb
5 changed files with 46 additions and 81 deletions

View File

@ -487,10 +487,7 @@ BOOL CoreAudio_GetDevCaps (void)
propertySize = MAXPNAMELEN;
status = AudioDeviceGetProperty(devId, 0 , FALSE, kAudioDevicePropertyDeviceName, &propertySize, name);
if (status) {
ERR("AudioHardwareGetProperty for kAudioDevicePropertyDeviceName return %c%c%c%c\n", (char) (status >> 24),
(char) (status >> 16),
(char) (status >> 8),
(char) status);
ERR("AudioHardwareGetProperty for kAudioDevicePropertyDeviceName return %s\n", wine_dbgstr_fourcc(status));
return FALSE;
}
@ -504,21 +501,15 @@ BOOL CoreAudio_GetDevCaps (void)
propertySize = sizeof(CoreAudio_DefaultDevice.streamDescription);
status = AudioDeviceGetProperty(devId, 0, FALSE , kAudioDevicePropertyStreamFormat, &propertySize, &CoreAudio_DefaultDevice.streamDescription);
if (status != noErr) {
ERR("AudioHardwareGetProperty for kAudioDevicePropertyStreamFormat return %c%c%c%c\n", (char) (status >> 24),
(char) (status >> 16),
(char) (status >> 8),
(char) status);
ERR("AudioHardwareGetProperty for kAudioDevicePropertyStreamFormat return %s\n", wine_dbgstr_fourcc(status));
return FALSE;
}
TRACE("Device Stream Description mSampleRate : %f\n mFormatID : %c%c%c%c\n"
TRACE("Device Stream Description mSampleRate : %f\n mFormatID : %s\n"
"mFormatFlags : %lX\n mBytesPerPacket : %lu\n mFramesPerPacket : %lu\n"
"mBytesPerFrame : %lu\n mChannelsPerFrame : %lu\n mBitsPerChannel : %lu\n",
CoreAudio_DefaultDevice.streamDescription.mSampleRate,
(char) (CoreAudio_DefaultDevice.streamDescription.mFormatID >> 24),
(char) (CoreAudio_DefaultDevice.streamDescription.mFormatID >> 16),
(char) (CoreAudio_DefaultDevice.streamDescription.mFormatID >> 8),
(char) CoreAudio_DefaultDevice.streamDescription.mFormatID,
wine_dbgstr_fourcc(CoreAudio_DefaultDevice.streamDescription.mFormatID),
CoreAudio_DefaultDevice.streamDescription.mFormatFlags,
CoreAudio_DefaultDevice.streamDescription.mBytesPerPacket,
CoreAudio_DefaultDevice.streamDescription.mFramesPerPacket,
@ -566,10 +557,7 @@ LONG CoreAudio_WaveInit(void)
propertySize = sizeof(CoreAudio_DefaultDevice.outputDeviceID);
status = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &propertySize, &CoreAudio_DefaultDevice.outputDeviceID);
if (status) {
ERR("AudioHardwareGetProperty return %c%c%c%c for kAudioHardwarePropertyDefaultOutputDevice\n", (char) (status >> 24),
(char) (status >> 16),
(char) (status >> 8),
(char) status);
ERR("AudioHardwareGetProperty return %s for kAudioHardwarePropertyDefaultOutputDevice\n", wine_dbgstr_fourcc(status));
return DRV_FAILURE;
}
if (CoreAudio_DefaultDevice.outputDeviceID == kAudioDeviceUnknown) {
@ -1010,10 +998,7 @@ static DWORD wodClose(WORD wDevID)
err = AudioUnitUninitialize(audioUnit);
if (err) {
ERR("AudioUnitUninitialize return %c%c%c%c\n", (char) (err >> 24),
(char) (err >> 16),
(char) (err >> 8),
(char) err);
ERR("AudioUnitUninitialize return %s\n", wine_dbgstr_fourcc(err));
return MMSYSERR_ERROR; /* FIXME return an error based on the OSStatus */
}
@ -1299,10 +1284,8 @@ static DWORD wodPause(WORD wDevID)
* render callback will just produce silence.
*/
status = AudioOutputUnitStop(WOutDev[wDevID].audioUnit);
if (status) {
WARN("AudioOutputUnitStop return %c%c%c%c\n",
(char) (status >> 24), (char) (status >> 16), (char) (status >> 8), (char) status);
}
if (status)
WARN("AudioOutputUnitStop return %s\n", wine_dbgstr_fourcc(status));
OSSpinLockLock(&WOutDev[wDevID].lock);
if (WOutDev[wDevID].state == WINE_WS_PLAYING)
@ -1342,8 +1325,7 @@ static DWORD wodRestart(WORD wDevID)
status = AudioOutputUnitStart(WOutDev[wDevID].audioUnit);
if (status) {
ERR("AudioOutputUnitStart return %c%c%c%c\n",
(char) (status >> 24), (char) (status >> 16), (char) (status >> 8), (char) status);
ERR("AudioOutputUnitStart return %s\n", wine_dbgstr_fourcc(status));
return MMSYSERR_ERROR; /* FIXME return an error based on the OSStatus */
}
@ -1391,8 +1373,7 @@ static DWORD wodReset(WORD wDevID)
status = AudioOutputUnitStart(wwo->audioUnit);
if (status) {
ERR( "AudioOutputUnitStart return %c%c%c%c\n",
(char) (status >> 24), (char) (status >> 16), (char) (status >> 8), (char) status);
ERR( "AudioOutputUnitStart return %s\n", wine_dbgstr_fourcc(status));
return MMSYSERR_ERROR; /* FIXME return an error based on the OSStatus */
}
@ -2063,17 +2044,10 @@ static DWORD widClose(WORD wDevID)
* that lock and trying to grab the wwi->lock in the callback. */
err = AudioUnitUninitialize(wwi->audioUnit);
if (err)
{
ERR("AudioUnitUninitialize return %c%c%c%c\n", (char) (err >> 24),
(char) (err >> 16),
(char) (err >> 8),
(char) err);
}
ERR("AudioUnitUninitialize return %s\n", wine_dbgstr_fourcc(err));
if (!AudioUnit_CloseAudioUnit(wwi->audioUnit))
{
ERR("Can't close AudioUnit\n");
}
OSSpinLockLock(&wwi->lock);

View File

@ -32,6 +32,7 @@
#undef DPRINTF
#undef STDMETHODCALLTYPE
#include "coreaudio.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wave);
@ -99,14 +100,14 @@ int AudioUnit_InitializeWithStreamDescription(AudioUnit au, AudioStreamBasicDesc
if (err != noErr)
{
ERR("AudioUnitSetProperty return an error %c%c%c%c\n", (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
ERR("AudioUnitSetProperty return an error %s\n", wine_dbgstr_fourcc(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);
ERR("AudioUnitInitialize return an error %s\n", wine_dbgstr_fourcc(err));
return 0;
}
return 1;
@ -120,7 +121,7 @@ int AudioUnit_SetVolume(AudioUnit au, float left, float right)
if (err != noErr)
{
ERR("AudioUnitSetParameter return an error %c%c%c%c\n", (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
ERR("AudioUnitSetParameter return an error %s\n", wine_dbgstr_fourcc(err));
return 0;
}
return 1;
@ -133,7 +134,7 @@ int AudioUnit_GetVolume(AudioUnit au, float *left, float *right)
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);
ERR("AudioUnitGetParameter return an error %s\n", wine_dbgstr_fourcc(err));
return 0;
}
*right = *left;
@ -336,7 +337,7 @@ int SynthUnit_CreateDefaultSynthUnit(AUGraph *graph, AudioUnit *synth)
err = NewAUGraph(graph);
if (err != noErr)
{
ERR_(midi)("NewAUGraph return %c%c%c%c\n", (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
ERR_(midi)("NewAUGraph return %s\n", wine_dbgstr_fourcc(err));
return 0;
}
@ -351,7 +352,7 @@ int SynthUnit_CreateDefaultSynthUnit(AUGraph *graph, AudioUnit *synth)
err = AUGraphNewNode(*graph, &desc, 0, NULL, &synthNode);
if (err != noErr)
{
ERR_(midi)("AUGraphNewNode cannot create synthNode : %c%c%c%c\n", (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
ERR_(midi)("AUGraphNewNode cannot create synthNode : %s\n", wine_dbgstr_fourcc(err));
return 0;
}
@ -362,14 +363,14 @@ int SynthUnit_CreateDefaultSynthUnit(AUGraph *graph, AudioUnit *synth)
err = AUGraphNewNode(*graph, &desc, 0, NULL, &outNode);
if (err != noErr)
{
ERR_(midi)("AUGraphNewNode cannot create outNode %c%c%c%c\n", (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
ERR_(midi)("AUGraphNewNode cannot create outNode %s\n", wine_dbgstr_fourcc(err));
return 0;
}
err = AUGraphOpen(*graph);
if (err != noErr)
{
ERR_(midi)("AUGraphOpen return %c%c%c%c\n", (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
ERR_(midi)("AUGraphOpen return %s\n", wine_dbgstr_fourcc(err));
return 0;
}
@ -377,7 +378,7 @@ int SynthUnit_CreateDefaultSynthUnit(AUGraph *graph, AudioUnit *synth)
err = AUGraphConnectNodeInput(*graph, synthNode, 0, outNode, 0);
if (err != noErr)
{
ERR_(midi)("AUGraphConnectNodeInput cannot connect synthNode to outNode : %c%c%c%c\n", (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
ERR_(midi)("AUGraphConnectNodeInput cannot connect synthNode to outNode : %s\n", wine_dbgstr_fourcc(err));
return 0;
}
@ -385,7 +386,7 @@ int SynthUnit_CreateDefaultSynthUnit(AUGraph *graph, AudioUnit *synth)
err = AUGraphGetNodeInfo(*graph, synthNode, 0, 0, 0, synth);
if (err != noErr)
{
ERR_(midi)("AUGraphGetNodeInfo return %c%c%c%c\n", (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
ERR_(midi)("AUGraphGetNodeInfo return %s\n", wine_dbgstr_fourcc(err));
return 0;
}
@ -399,14 +400,14 @@ int SynthUnit_Initialize(AudioUnit synth, AUGraph graph)
err = AUGraphInitialize(graph);
if (err != noErr)
{
ERR_(midi)("AUGraphInitialize(%p) return %c%c%c%c\n", graph, (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
ERR_(midi)("AUGraphInitialize(%p) return %s\n", graph, wine_dbgstr_fourcc(err));
return 0;
}
err = AUGraphStart(graph);
if (err != noErr)
{
ERR_(midi)("AUGraphStart(%p) return %c%c%c%c\n", graph, (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
ERR_(midi)("AUGraphStart(%p) return %s\n", graph, wine_dbgstr_fourcc(err));
return 0;
}
@ -420,14 +421,14 @@ int SynthUnit_Close(AUGraph graph)
err = AUGraphStop(graph);
if (err != noErr)
{
ERR_(midi)("AUGraphStop(%p) return %c%c%c%c\n", graph, (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
ERR_(midi)("AUGraphStop(%p) return %s\n", graph, wine_dbgstr_fourcc(err));
return 0;
}
err = DisposeAUGraph(graph);
if (err != noErr)
{
ERR_(midi)("DisposeAUGraph(%p) return %c%c%c%c\n", graph, (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
ERR_(midi)("DisposeAUGraph(%p) return %s\n", graph, wine_dbgstr_fourcc(err));
return 0;
}

View File

@ -20,6 +20,8 @@
#ifndef __WINE_COREAUDIO_H
#define __WINE_COREAUDIO_H
#include "wine/debug.h"
extern LONG CoreAudio_WaveInit(void);
extern void CoreAudio_WaveRelease(void);
@ -29,4 +31,12 @@ extern void CoreAudio_MIDIRelease(void);
extern LONG CoreAudio_MixerInit(void);
extern void CoreAudio_MixerRelease(void);
/* fourcc is in native order, where MSB is the first character. */
static inline const char* wine_dbgstr_fourcc(unsigned long fourcc)
{
char buf[4] = { (char) (fourcc >> 24), (char) (fourcc >> 16),
(char) (fourcc >> 8), (char) fourcc };
return wine_dbgstr_an(buf, sizeof(buf));
}
#endif /* __WINE_COREAUDIO_H */

View File

@ -40,6 +40,7 @@
#include "mmddk.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "coreaudio.h"
WINE_DEFAULT_DEBUG_CHANNEL(midi);
@ -356,7 +357,7 @@ static DWORD MIDIOut_Data(WORD wDevID, DWORD dwParam)
err = MusicDeviceMIDIEvent(destinations[wDevID].synth, (evt & 0xF0) | chn, d1, d2, 0);
if (err != noErr)
{
ERR("MusicDeviceMIDIEvent(%p, %04x, %04x, %04x, %d) return %c%c%c%c\n", destinations[wDevID].synth, (evt & 0xF0) | chn, d1, d2, 0, (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
ERR("MusicDeviceMIDIEvent(%p, %04x, %04x, %04x, %d) return %s\n", destinations[wDevID].synth, (evt & 0xF0) | chn, d1, d2, 0, wine_dbgstr_fourcc(err));
return MMSYSERR_ERROR;
}
}
@ -434,7 +435,7 @@ static DWORD MIDIOut_LongData(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize)
err = MusicDeviceSysEx(destinations[wDevID].synth, (const UInt8 *) lpData, lpMidiHdr->dwBufferLength);
if (err != noErr)
{
ERR("MusicDeviceSysEx(%p, %p, %d) return %c%c%c%c\n", destinations[wDevID].synth, lpData, lpMidiHdr->dwBufferLength, (char) (err >> 24), (char) (err >> 16), (char) (err >> 8), (char) err);
ERR("MusicDeviceSysEx(%p, %p, %d) return %s\n", destinations[wDevID].synth, lpData, lpMidiHdr->dwBufferLength, wine_dbgstr_fourcc(err));
return MMSYSERR_ERROR;
}
}

View File

@ -364,10 +364,7 @@ LONG CoreAudio_MixerInit(void)
status = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &propertySize, NULL);
if (status)
{
ERR("AudioHardwareGetPropertyInfo for kAudioHardwarePropertyDevices return %c%c%c%c\n", (char) (status >> 24),
(char) (status >> 16),
(char) (status >> 8),
(char) status);
ERR("AudioHardwareGetPropertyInfo for kAudioHardwarePropertyDevices return %s\n", wine_dbgstr_fourcc(status));
return DRV_FAILURE;
}
@ -396,10 +393,7 @@ LONG CoreAudio_MixerInit(void)
status = AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &propertySize, deviceArray);
if (status)
{
ERR("AudioHardwareGetProperty for kAudioHardwarePropertyDevices return %c%c%c%c\n", (char) (status >> 24),
(char) (status >> 16),
(char) (status >> 8),
(char) status);
ERR("AudioHardwareGetProperty for kAudioHardwarePropertyDevices return %s\n", wine_dbgstr_fourcc(status));
goto error;
}
@ -413,10 +407,7 @@ LONG CoreAudio_MixerInit(void)
propertySize = MAXPNAMELEN;
status = AudioDeviceGetProperty(line->deviceID, 0 , FALSE, kAudioDevicePropertyDeviceName, &propertySize, name);
if (status) {
ERR("AudioHardwareGetProperty for kAudioDevicePropertyDeviceName return %c%c%c%c\n", (char) (status >> 24),
(char) (status >> 16),
(char) (status >> 8),
(char) status);
ERR("AudioHardwareGetProperty for kAudioDevicePropertyDeviceName return %s\n", wine_dbgstr_fourcc(status));
goto error;
}
@ -433,10 +424,7 @@ LONG CoreAudio_MixerInit(void)
propertySize = sizeof(UInt32);
status = AudioDeviceGetPropertyInfo(line->deviceID, 0, FALSE, kAudioDevicePropertyStreams, &propertySize, &write );
if (status) {
ERR("AudioDeviceGetPropertyInfo for kAudioDevicePropertyDataSource return %c%c%c%c\n", (char) (status >> 24),
(char) (status >> 16),
(char) (status >> 8),
(char) status);
ERR("AudioDeviceGetPropertyInfo for kAudioDevicePropertyDataSource return %s\n", wine_dbgstr_fourcc(status));
goto error;
}
@ -448,10 +436,7 @@ LONG CoreAudio_MixerInit(void)
propertySize = sizeof(streamDescription);
status = AudioDeviceGetProperty(line->deviceID, 0, FALSE , kAudioDevicePropertyStreamFormat, &propertySize, &streamDescription);
if (status != noErr) {
ERR("AudioHardwareGetProperty for kAudioDevicePropertyStreamFormat return %c%c%c%c\n", (char) (status >> 24),
(char) (status >> 16),
(char) (status >> 8),
(char) status);
ERR("AudioHardwareGetProperty for kAudioDevicePropertyStreamFormat return %s\n", wine_dbgstr_fourcc(status));
goto error;
}
line->numChannels = streamDescription.mChannelsPerFrame;
@ -462,10 +447,7 @@ LONG CoreAudio_MixerInit(void)
propertySize = sizeof(UInt32);
status = AudioDeviceGetPropertyInfo(line->deviceID, 0, TRUE, kAudioDevicePropertyStreams, &propertySize, &write );
if (status) {
ERR("AudioDeviceGetPropertyInfo for kAudioDevicePropertyStreams return %c%c%c%c\n", (char) (status >> 24),
(char) (status >> 16),
(char) (status >> 8),
(char) status);
ERR("AudioDeviceGetPropertyInfo for kAudioDevicePropertyStreams return %s\n", wine_dbgstr_fourcc(status));
goto error;
}
if ( (propertySize / sizeof(AudioStreamID)) != 0)
@ -476,10 +458,7 @@ LONG CoreAudio_MixerInit(void)
propertySize = sizeof(streamDescription);
status = AudioDeviceGetProperty(line->deviceID, 0, TRUE, kAudioDevicePropertyStreamFormat, &propertySize, &streamDescription);
if (status != noErr) {
ERR("AudioHardwareGetProperty for kAudioDevicePropertyStreamFormat return %c%c%c%c\n", (char) (status >> 24),
(char) (status >> 16),
(char) (status >> 8),
(char) status);
ERR("AudioHardwareGetProperty for kAudioDevicePropertyStreamFormat return %s\n", wine_dbgstr_fourcc(status));
goto error;
}
line->numChannels = streamDescription.mChannelsPerFrame;