Commit c0fe3827 authored by bellard's avatar bellard

audio merge (malc)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1601 c046a42c-6fe2-441c-8c8c-71466251a162
parent f04308e4
......@@ -453,8 +453,8 @@ ifneq ($(wildcard .depend),)
include .depend
endif
ifeq (0, 1)
ifeq (1, 0)
audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
fmodaudio.o alsaaudio.o mixeng.o: \
fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o gus.o adlib.o: \
CFLAGS := $(CFLAGS) -Wall -Werror -W -Wsign-compare
endif
......@@ -98,7 +98,7 @@ struct alsa_params_obt {
audfmt_e fmt;
int nchannels;
int can_pause;
snd_pcm_uframes_t buffer_size;
snd_pcm_uframes_t samples;
};
static void GCC_FMT_ATTR (2, 3) alsa_logerr (int err, const char *fmt, ...)
......@@ -121,7 +121,7 @@ static void GCC_FMT_ATTR (3, 4) alsa_logerr2 (
{
va_list ap;
AUD_log (AUDIO_CAP, "Can not initialize %s\n", typ);
AUD_log (AUDIO_CAP, "Could not initialize %s\n", typ);
va_start (ap, fmt);
AUD_vlog (AUDIO_CAP, fmt, ap);
......@@ -209,7 +209,7 @@ static int alsa_to_audfmt (int alsafmt, audfmt_e *fmt, int *endianness)
return 0;
}
#ifdef DEBUG_MISMATCHES
#if defined DEBUG_MISMATCHES || defined DEBUG
static void alsa_dump_info (struct alsa_params_req *req,
struct alsa_params_obt *obt)
{
......@@ -221,7 +221,7 @@ static void alsa_dump_info (struct alsa_params_req *req,
dolog ("============================================\n");
dolog ("requested: buffer size %d period size %d\n",
req->buffer_size, req->period_size);
dolog ("obtained: buffer size %ld\n", obt->buffer_size);
dolog ("obtained: samples %ld\n", obt->samples);
}
#endif
......@@ -234,14 +234,14 @@ static void alsa_set_threshold (snd_pcm_t *handle, snd_pcm_uframes_t threshold)
err = snd_pcm_sw_params_current (handle, sw_params);
if (err < 0) {
dolog ("Can not fully initialize DAC\n");
dolog ("Could not fully initialize DAC\n");
alsa_logerr (err, "Failed to get current software parameters\n");
return;
}
err = snd_pcm_sw_params_set_start_threshold (handle, sw_params, threshold);
if (err < 0) {
dolog ("Can not fully initialize DAC\n");
dolog ("Could not fully initialize DAC\n");
alsa_logerr (err, "Failed to set software threshold to %ld\n",
threshold);
return;
......@@ -249,7 +249,7 @@ static void alsa_set_threshold (snd_pcm_t *handle, snd_pcm_uframes_t threshold)
err = snd_pcm_sw_params (handle, sw_params);
if (err < 0) {
dolog ("Can not fully initialize DAC\n");
dolog ("Could not fully initialize DAC\n");
alsa_logerr (err, "Failed to set software parameters\n");
return;
}
......@@ -344,7 +344,8 @@ static int alsa_open (int in, struct alsa_params_req *req,
handle,
hw_params,
&period_size,
0);
0
);
if (err < 0) {
alsa_logerr2 (err, typ,
"Failed to set period time %d\n",
......@@ -357,7 +358,8 @@ static int alsa_open (int in, struct alsa_params_req *req,
handle,
hw_params,
&buffer_size,
0);
0
);
if (err < 0) {
alsa_logerr2 (err, typ,
......@@ -382,7 +384,7 @@ static int alsa_open (int in, struct alsa_params_req *req,
if (err < 0) {
alsa_logerr (
err,
"Can not get minmal period size for %s\n",
"Could not get minmal period size for %s\n",
typ
);
}
......@@ -419,7 +421,7 @@ static int alsa_open (int in, struct alsa_params_req *req,
&minval
);
if (err < 0) {
alsa_logerr (err, "Can not get minmal buffer size for %s\n",
alsa_logerr (err, "Could not get minmal buffer size for %s\n",
typ);
}
else {
......@@ -451,7 +453,7 @@ static int alsa_open (int in, struct alsa_params_req *req,
}
}
else {
dolog ("warning: buffer size is not set\n");
dolog ("warning: Buffer size is not set\n");
}
err = snd_pcm_hw_params (handle, hw_params);
......@@ -468,13 +470,13 @@ static int alsa_open (int in, struct alsa_params_req *req,
err = snd_pcm_prepare (handle);
if (err < 0) {
alsa_logerr2 (err, typ, "Can not prepare handle %p\n", handle);
alsa_logerr2 (err, typ, "Could not prepare handle %p\n", handle);
goto err;
}
obt->can_pause = snd_pcm_hw_params_can_pause (hw_params);
if (obt->can_pause < 0) {
alsa_logerr (err, "Can not get pause capability for %s\n", typ);
alsa_logerr (err, "Could not get pause capability for %s\n", typ);
obt->can_pause = 0;
}
......@@ -493,17 +495,17 @@ static int alsa_open (int in, struct alsa_params_req *req,
obt->fmt = req->fmt;
obt->nchannels = nchannels;
obt->freq = freq;
obt->buffer_size = snd_pcm_frames_to_bytes (handle, obt_buffer_size);
obt->samples = obt_buffer_size;
*handlep = handle;
#if defined DEBUG_MISMATCHES || defined DEBUG
if (obt->fmt != req->fmt ||
obt->nchannels != req->nchannels ||
obt->freq != req->freq) {
#ifdef DEBUG_MISMATCHES
dolog ("Audio paramters mismatch for %s\n", typ);
alsa_dump_info (req, obt);
#endif
}
#endif
#ifdef DEBUG
alsa_dump_info (req, obt);
......@@ -550,7 +552,7 @@ static int alsa_run_out (HWVoiceOut *hw)
}
}
alsa_logerr (avail, "Can not get amount free space\n");
alsa_logerr (avail, "Could not get amount free space\n");
return 0;
}
......@@ -618,7 +620,7 @@ static void alsa_fini_out (HWVoiceOut *hw)
}
}
static int alsa_init_out (HWVoiceOut *hw, int freq, int nchannels, audfmt_e fmt)
static int alsa_init_out (HWVoiceOut *hw, audsettings_t *as)
{
ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw;
struct alsa_params_req req;
......@@ -627,10 +629,11 @@ static int alsa_init_out (HWVoiceOut *hw, int freq, int nchannels, audfmt_e fmt)
int endianness;
int err;
snd_pcm_t *handle;
audsettings_t obt_as;
req.fmt = aud_to_alsafmt (fmt);
req.freq = freq;
req.nchannels = nchannels;
req.fmt = aud_to_alsafmt (as->fmt);
req.freq = as->freq;
req.nchannels = as->nchannels;
req.period_size = conf.period_size_out;
req.buffer_size = conf.buffer_size_out;
......@@ -644,18 +647,22 @@ static int alsa_init_out (HWVoiceOut *hw, int freq, int nchannels, audfmt_e fmt)
return -1;
}
obt_as.freq = obt.freq;
obt_as.nchannels = obt.nchannels;
obt_as.fmt = effective_fmt;
audio_pcm_init_info (
&hw->info,
obt.freq,
obt.nchannels,
effective_fmt,
&obt_as,
audio_need_to_swap_endian (endianness)
);
alsa->can_pause = obt.can_pause;
hw->bufsize = obt.buffer_size;
hw->samples = obt.samples;
alsa->pcm_buf = qemu_mallocz (hw->bufsize);
alsa->pcm_buf = audio_calloc (AUDIO_FUNC, obt.samples, 1 << hw->info.shift);
if (!alsa->pcm_buf) {
dolog ("Could not allocate DAC buffer (%d bytes)\n",
hw->samples << hw->info.shift);
alsa_anal_close (&handle);
return -1;
}
......@@ -703,8 +710,7 @@ static int alsa_ctl_out (HWVoiceOut *hw, int cmd, ...)
return 0;
}
static int alsa_init_in (HWVoiceIn *hw,
int freq, int nchannels, audfmt_e fmt)
static int alsa_init_in (HWVoiceIn *hw, audsettings_t *as)
{
ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw;
struct alsa_params_req req;
......@@ -713,10 +719,11 @@ static int alsa_init_in (HWVoiceIn *hw,
int err;
audfmt_e effective_fmt;
snd_pcm_t *handle;
audsettings_t obt_as;
req.fmt = aud_to_alsafmt (fmt);
req.freq = freq;
req.nchannels = nchannels;
req.fmt = aud_to_alsafmt (as->fmt);
req.freq = as->freq;
req.nchannels = as->nchannels;
req.period_size = conf.period_size_in;
req.buffer_size = conf.buffer_size_in;
......@@ -730,17 +737,22 @@ static int alsa_init_in (HWVoiceIn *hw,
return -1;
}
obt_as.freq = obt.freq;
obt_as.nchannels = obt.nchannels;
obt_as.fmt = effective_fmt;
audio_pcm_init_info (
&hw->info,
obt.freq,
obt.nchannels,
effective_fmt,
&obt_as,
audio_need_to_swap_endian (endianness)
);
alsa->can_pause = obt.can_pause;
hw->bufsize = obt.buffer_size;
alsa->pcm_buf = qemu_mallocz (hw->bufsize);
hw->samples = obt.samples;
alsa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift);
if (!alsa->pcm_buf) {
dolog ("Could not allocate ADC buffer (%d bytes)\n",
hw->samples << hw->info.shift);
alsa_anal_close (&handle);
return -1;
}
......
This diff is collapsed.
......@@ -24,18 +24,33 @@
#ifndef QEMU_AUDIO_H
#define QEMU_AUDIO_H
#include "sys-queue.h"
typedef void (*audio_callback_fn_t) (void *opaque, int avail);
typedef enum {
AUD_FMT_U8,
AUD_FMT_S8,
AUD_FMT_U16,
AUD_FMT_S16
AUD_FMT_U8,
AUD_FMT_S8,
AUD_FMT_U16,
AUD_FMT_S16
} audfmt_e;
typedef struct {
int freq;
int nchannels;
audfmt_e fmt;
} audsettings_t;
typedef struct AudioState AudioState;
typedef struct SWVoiceOut SWVoiceOut;
typedef struct SWVoiceIn SWVoiceIn;
typedef struct QEMUSoundCard {
AudioState *audio;
char *name;
LIST_ENTRY (QEMUSoundCard) entries;
} QEMUSoundCard;
typedef struct QEMUAudioTimeStamp {
uint64_t old_ts;
} QEMUAudioTimeStamp;
......@@ -47,46 +62,45 @@ void AUD_log (const char *cap, const char *fmt, ...)
#endif
;
void AUD_init (void);
AudioState *AUD_init (void);
void AUD_help (void);
void AUD_register_card (AudioState *s, const char *name, QEMUSoundCard *card);
void AUD_remove_card (QEMUSoundCard *card);
SWVoiceOut *AUD_open_out (
SWVoiceOut *AUD_open_out (
QEMUSoundCard *card,
SWVoiceOut *sw,
const char *name,
void *callback_opaque,
audio_callback_fn_t callback_fn,
int freq,
int nchannels,
audfmt_e fmt
audsettings_t *settings
);
void AUD_close_out (SWVoiceOut *sw);
int AUD_write (SWVoiceOut *sw, void *pcm_buf, int size);
int AUD_get_buffer_size_out (SWVoiceOut *sw);
void AUD_set_active_out (SWVoiceOut *sw, int on);
int AUD_is_active_out (SWVoiceOut *sw);
void AUD_init_time_stamp_out (SWVoiceOut *sw,
QEMUAudioTimeStamp *ts);
uint64_t AUD_time_stamp_get_elapsed_usec_out (SWVoiceOut *sw,
QEMUAudioTimeStamp *ts);
SWVoiceIn *AUD_open_in (
void AUD_close_out (QEMUSoundCard *card, SWVoiceOut *sw);
int AUD_write (SWVoiceOut *sw, void *pcm_buf, int size);
int AUD_get_buffer_size_out (SWVoiceOut *sw);
void AUD_set_active_out (SWVoiceOut *sw, int on);
int AUD_is_active_out (SWVoiceOut *sw);
void AUD_init_time_stamp_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts);
uint64_t AUD_get_elapsed_usec_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts);
SWVoiceIn *AUD_open_in (
QEMUSoundCard *card,
SWVoiceIn *sw,
const char *name,
void *callback_opaque,
audio_callback_fn_t callback_fn,
int freq,
int nchannels,
audfmt_e fmt
audsettings_t *settings
);
void AUD_close_in (SWVoiceIn *sw);
int AUD_read (SWVoiceIn *sw, void *pcm_buf, int size);
void AUD_adjust_in (SWVoiceIn *sw, int leftover);
void AUD_set_active_in (SWVoiceIn *sw, int on);
int AUD_is_active_in (SWVoiceIn *sw);
void AUD_init_time_stamp_in (SWVoiceIn *sw,
QEMUAudioTimeStamp *ts);
uint64_t AUD_time_stamp_get_elapsed_usec_in (SWVoiceIn *sw,
QEMUAudioTimeStamp *ts);
void AUD_close_in (QEMUSoundCard *card, SWVoiceIn *sw);
int AUD_read (SWVoiceIn *sw, void *pcm_buf, int size);
void AUD_set_active_in (SWVoiceIn *sw, int on);
int AUD_is_active_in (SWVoiceIn *sw);
void AUD_init_time_stamp_in (SWVoiceIn *sw, QEMUAudioTimeStamp *ts);
uint64_t AUD_get_elapsed_usec_in (SWVoiceIn *sw, QEMUAudioTimeStamp *ts);
static inline void *advance (void *p, int incr)
{
......
......@@ -24,16 +24,12 @@
#ifndef QEMU_AUDIO_INT_H
#define QEMU_AUDIO_INT_H
#include "sys-queue.h"
#ifdef CONFIG_COREAUDIO
#define FLOAT_MIXENG
/* #define RECIPROCAL */
#endif
#include "mixeng.h"
int audio_bug (const char *funcname, int cond);
struct audio_pcm_ops;
typedef enum {
......@@ -69,7 +65,6 @@ struct audio_pcm_info {
};
typedef struct HWVoiceOut {
int active;
int enabled;
int pending_disable;
int valid;
......@@ -78,7 +73,6 @@ typedef struct HWVoiceOut {
f_sample *clip;
int rpos;
int bufsize;
uint64_t ts_helper;
st_sample_t *mix_buf;
......@@ -91,13 +85,11 @@ typedef struct HWVoiceOut {
typedef struct HWVoiceIn {
int enabled;
int active;
struct audio_pcm_info info;
t_sample *conv;
int wpos;
int bufsize;
int total_samples_captured;
uint64_t ts_helper;
......@@ -109,58 +101,6 @@ typedef struct HWVoiceIn {
LIST_ENTRY (HWVoiceIn) entries;
} HWVoiceIn;
extern struct audio_driver no_audio_driver;
extern struct audio_driver oss_audio_driver;
extern struct audio_driver sdl_audio_driver;
extern struct audio_driver wav_audio_driver;
extern struct audio_driver fmod_audio_driver;
extern struct audio_driver alsa_audio_driver;
extern struct audio_driver coreaudio_audio_driver;
extern struct audio_driver dsound_audio_driver;
extern volume_t nominal_volume;
struct audio_driver {
const char *name;
const char *descr;
struct audio_option *options;
void *(*init) (void);
void (*fini) (void *);
struct audio_pcm_ops *pcm_ops;
int can_be_default;
int max_voices_out;
int max_voices_in;
int voice_size_out;
int voice_size_in;
};
typedef struct AudioState {
int fixed_settings_out;
int fixed_freq_out;
int fixed_channels_out;
int fixed_fmt_out;
int nb_hw_voices_out;
int greedy_out;
int fixed_settings_in;
int fixed_freq_in;
int fixed_channels_in;
int fixed_fmt_in;
int nb_hw_voices_in;
int greedy_in;
void *opaque;
struct audio_driver *drv;
QEMUTimer *ts;
union {
int usec;
int64_t ticks;
} period;
int plive;
} AudioState;
extern AudioState audio_state;
struct SWVoiceOut {
struct audio_pcm_info info;
t_sample *conv;
......@@ -192,22 +132,58 @@ struct SWVoiceIn {
LIST_ENTRY (SWVoiceIn) entries;
};
struct audio_driver {
const char *name;
const char *descr;
struct audio_option *options;
void *(*init) (void);
void (*fini) (void *);
struct audio_pcm_ops *pcm_ops;
int can_be_default;
int max_voices_out;
int max_voices_in;
int voice_size_out;
int voice_size_in;
};
struct audio_pcm_ops {
int (*init_out)(HWVoiceOut *hw, int freq, int nchannels, audfmt_e fmt);
int (*init_out)(HWVoiceOut *hw, audsettings_t *as);
void (*fini_out)(HWVoiceOut *hw);
int (*run_out) (HWVoiceOut *hw);
int (*write) (SWVoiceOut *sw, void *buf, int size);
int (*ctl_out) (HWVoiceOut *hw, int cmd, ...);
int (*init_in) (HWVoiceIn *hw, int freq, int nchannels, audfmt_e fmt);
int (*init_in) (HWVoiceIn *hw, audsettings_t *as);
void (*fini_in) (HWVoiceIn *hw);
int (*run_in) (HWVoiceIn *hw);
int (*read) (SWVoiceIn *sw, void *buf, int size);
int (*ctl_in) (HWVoiceIn *hw, int cmd, ...);
};
void audio_pcm_init_info (struct audio_pcm_info *info, int freq,
int nchannels, audfmt_e fmt, int swap_endian);
struct AudioState {
struct audio_driver *drv;
void *drv_opaque;
QEMUTimer *ts;
LIST_HEAD (card_head, QEMUSoundCard) card_head;
LIST_HEAD (hw_in_listhead, HWVoiceIn) hw_head_in;
LIST_HEAD (hw_out_listhead, HWVoiceOut) hw_head_out;
int nb_hw_voices_out;
int nb_hw_voices_in;
};
extern struct audio_driver no_audio_driver;
extern struct audio_driver oss_audio_driver;
extern struct audio_driver sdl_audio_driver;
extern struct audio_driver wav_audio_driver;
extern struct audio_driver fmod_audio_driver;
extern struct audio_driver alsa_audio_driver;
extern struct audio_driver coreaudio_audio_driver;
extern struct audio_driver dsound_audio_driver;
extern volume_t nominal_volume;
void audio_pcm_init_info (struct audio_pcm_info *info, audsettings_t *as,
int swap_endian);
void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len);
int audio_pcm_sw_write (SWVoiceOut *sw, void *buf, int len);
......@@ -217,6 +193,9 @@ int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int len);
int audio_pcm_hw_get_live_out (HWVoiceOut *hw);
int audio_pcm_hw_get_live_out2 (HWVoiceOut *hw, int *nb_live);
int audio_bug (const char *funcname, int cond);
void *audio_calloc (const char *funcname, int nmemb, size_t size);
#define VOICE_ENABLE 1
#define VOICE_DISABLE 2
......
This diff is collapsed.
......@@ -31,8 +31,6 @@
#define AUDIO_CAP "coreaudio"
#include "audio_int.h"
#define DEVICE_BUFFER_FRAMES (512)
struct {
int buffer_frames;
} conf = {
......@@ -132,7 +130,7 @@ static void GCC_FMT_ATTR (3, 4) coreaudio_logerr2 (
{
va_list ap;
AUD_log (AUDIO_CAP, "Can not initialize %s\n", typ);
AUD_log (AUDIO_CAP, "Could not initialize %s\n", typ);
va_start (ap, fmt);
AUD_vlog (AUDIO_CAP, fmt, ap);
......@@ -147,7 +145,7 @@ static int coreaudio_lock (coreaudioVoiceOut *core, const char *fn_name)
err = pthread_mutex_lock (&core->mutex);
if (err) {
dolog ("Can not lock voice for %s\nReason: %s\n",
dolog ("Could not lock voice for %s\nReason: %s\n",
fn_name, strerror (err));
return -1;
}
......@@ -160,7 +158,7 @@ static int coreaudio_unlock (coreaudioVoiceOut *core, const char *fn_name)
err = pthread_mutex_unlock (&core->mutex);
if (err) {
dolog ("Can not unlock voice for %s\nReason: %s\n",
dolog ("Could not unlock voice for %s\nReason: %s\n",
fn_name, strerror (err));
return -1;
}
......@@ -268,8 +266,7 @@ static int coreaudio_write (SWVoiceOut *sw, void *buf, int len)
return audio_pcm_sw_write (sw, buf, len);
}
static int coreaudio_init_out (HWVoiceOut *hw, int freq,
int nchannels, audfmt_e fmt)
static int coreaudio_init_out (HWVoiceOut *hw, audsettings_t *as)
{
OSStatus status;
coreaudioVoiceOut *core = (coreaudioVoiceOut *) hw;
......@@ -282,25 +279,22 @@ static int coreaudio_init_out (HWVoiceOut *hw, int freq,
/* create mutex */
err = pthread_mutex_init(&core->mutex, NULL);
if (err) {
dolog("Can not create mutex\nReason: %s\n", strerror (err));
dolog("Could not create mutex\nReason: %s\n", strerror (err));
return -1;
}
if (fmt == AUD_FMT_S16 || fmt == AUD_FMT_U16) {
if (as->fmt == AUD_FMT_S16 || as->fmt == AUD_FMT_U16) {
bits = 16;
endianess = 1;
}
audio_pcm_init_info (
&hw->info,
freq,
nchannels,
fmt,
as,
/* Following is irrelevant actually since we do not use
mixengs clipping routines */
audio_need_to_swap_endian (endianess)
);
hw->bufsize = 4 * conf.buffer_frames * nchannels * bits;
/* open default output device */
propertySize = sizeof(core->outputDeviceID);
......@@ -310,18 +304,18 @@ static int coreaudio_init_out (HWVoiceOut *hw, int freq,
&core->outputDeviceID);
if (status != kAudioHardwareNoError) {
coreaudio_logerr2 (status, typ,
"Can not get default output Device\n");
"Could not get default output Device\n");
return -1;
}
if (core->outputDeviceID == kAudioDeviceUnknown) {
dolog ("Can not initialize %s - Unknown Audiodevice\n", typ);
dolog ("Could not initialize %s - Unknown Audiodevice\n", typ);
return -1;
}
/* set Buffersize to conf.buffer_frames frames */
propertySize = sizeof(core->audioDevicePropertyBufferSize);
core->audioDevicePropertyBufferSize =
conf.buffer_frames * sizeof(float) * 2;
conf.buffer_frames * sizeof(float) << (as->nchannels == 2);
status = AudioDeviceSetProperty(
core->outputDeviceID,
NULL,
......@@ -332,7 +326,7 @@ static int coreaudio_init_out (HWVoiceOut *hw, int freq,
&core->audioDevicePropertyBufferSize);
if (status != kAudioHardwareNoError) {
coreaudio_logerr2 (status, typ,
"Can not set device buffer size %d\n",
"Could not set device buffer size %d\n",
kAudioDevicePropertyBufferSize);
return -1;
}
......@@ -347,9 +341,11 @@ static int coreaudio_init_out (HWVoiceOut *hw, int freq,
&propertySize,
&core->audioDevicePropertyBufferSize);
if (status != kAudioHardwareNoError) {
coreaudio_logerr2 (status, typ, "Can not get device buffer size\n");
coreaudio_logerr2 (status, typ, "Could not get device buffer size\n");
return -1;
}
hw->samples = (core->audioDevicePropertyBufferSize / sizeof (float))
>> (as->nchannels == 2);
/* get StreamFormat */
propertySize = sizeof(core->outputStreamBasicDescription);
......@@ -362,13 +358,13 @@ static int coreaudio_init_out (HWVoiceOut *hw, int freq,
&core->outputStreamBasicDescription);
if (status != kAudioHardwareNoError) {
coreaudio_logerr2 (status, typ,
"Can not get Device Stream properties\n");
"Could not get Device Stream properties\n");
core->outputDeviceID = kAudioDeviceUnknown;
return -1;
}
/* set Samplerate */
core->outputStreamBasicDescription.mSampleRate = (Float64)freq;
core->outputStreamBasicDescription.mSampleRate = (Float64)as->freq;
propertySize = sizeof(core->outputStreamBasicDescription);
status = AudioDeviceSetProperty(
core->outputDeviceID,
......@@ -379,7 +375,7 @@ static int coreaudio_init_out (HWVoiceOut *hw, int freq,
propertySize,
&core->outputStreamBasicDescription);
if (status != kAudioHardwareNoError) {
coreaudio_logerr2 (status, typ, "Can not set samplerate %d\n", freq);
coreaudio_logerr2 (status, typ, "Could not set samplerate %d\n", freq);
core->outputDeviceID = kAudioDeviceUnknown;
return -1;
}
......@@ -387,7 +383,7 @@ static int coreaudio_init_out (HWVoiceOut *hw, int freq,
/* set Callback */
status = AudioDeviceAddIOProc(core->outputDeviceID, audioDeviceIOProc, hw);
if (status != kAudioHardwareNoError) {
coreaudio_logerr2 (status, typ, "Can not set IOProc\n");
coreaudio_logerr2 (status, typ, "Could not set IOProc\n");
core->outputDeviceID = kAudioDeviceUnknown;
return -1;
}
......@@ -396,7 +392,7 @@ static int coreaudio_init_out (HWVoiceOut *hw, int freq,
if (!core->isPlaying) {
status = AudioDeviceStart(core->outputDeviceID, audioDeviceIOProc);
if (status != kAudioHardwareNoError) {
coreaudio_logerr2 (status, typ, "Can not start playback\n");
coreaudio_logerr2 (status, typ, "Could not start playback\n");
AudioDeviceRemoveIOProc(core->outputDeviceID, audioDeviceIOProc);
core->outputDeviceID = kAudioDeviceUnknown;
return -1;
......@@ -417,7 +413,7 @@ static void coreaudio_fini_out (HWVoiceOut *hw)
if (core->isPlaying) {
status = AudioDeviceStop(core->outputDeviceID, audioDeviceIOProc);
if (status != kAudioHardwareNoError) {
coreaudio_logerr (status, "Can not stop playback\n");
coreaudio_logerr (status, "Could not stop playback\n");
}
core->isPlaying = 0;
}
......@@ -425,14 +421,14 @@ static void coreaudio_fini_out (HWVoiceOut *hw)
/* remove callback */
status = AudioDeviceRemoveIOProc(core->outputDeviceID, audioDeviceIOProc);
if (status != kAudioHardwareNoError) {
coreaudio_logerr (status, "Can not remove IOProc\n");
coreaudio_logerr (status, "Could not remove IOProc\n");
}
core->outputDeviceID = kAudioDeviceUnknown;
/* destroy mutex */
err = pthread_mutex_destroy(&core->mutex);
if (err) {
dolog("Can not destroy mutex\nReason: %s\n", strerror (err));
dolog("Could not destroy mutex\nReason: %s\n", strerror (err));
}
}
......@@ -447,7 +443,7 @@ static int coreaudio_ctl_out (HWVoiceOut *hw, int cmd, ...)
if (!core->isPlaying) {
status = AudioDeviceStart(core->outputDeviceID, audioDeviceIOProc);
if (status != kAudioHardwareNoError) {
coreaudio_logerr (status, "Can not unpause playback\n");
coreaudio_logerr (status, "Could not unpause playback\n");
}
core->isPlaying = 1;
}
......@@ -458,7 +454,7 @@ static int coreaudio_ctl_out (HWVoiceOut *hw, int cmd, ...)