diff options
author | Alfred E. Heggestad <aeh@db.org> | 2014-02-13 00:01:40 +0100 |
---|---|---|
committer | Alfred E. Heggestad <aeh@db.org> | 2014-02-13 00:01:40 +0100 |
commit | e4d71aca3cc153bbac505dac430b3b5574f15016 (patch) | |
tree | edb7fb636945ed9cecbd7953d575508b7cc80a9b /modules/coreaudio | |
parent | b823b7d4481612b7047d7ad87911218893a2297b (diff) |
remove fmt parameter from ausrc/auplay api
Diffstat (limited to 'modules/coreaudio')
-rw-r--r-- | modules/coreaudio/coreaudio.c | 26 | ||||
-rw-r--r-- | modules/coreaudio/coreaudio.h | 2 | ||||
-rw-r--r-- | modules/coreaudio/player.c | 10 | ||||
-rw-r--r-- | modules/coreaudio/recorder.c | 10 |
4 files changed, 10 insertions, 38 deletions
diff --git a/modules/coreaudio/coreaudio.c b/modules/coreaudio/coreaudio.c index bb6ea64..0d21e2b 100644 --- a/modules/coreaudio/coreaudio.c +++ b/modules/coreaudio/coreaudio.c @@ -14,32 +14,6 @@ static struct auplay *auplay; static struct ausrc *ausrc; -int audio_fmt(enum aufmt fmt) -{ - switch (fmt) { - - case AUFMT_S16LE: return kAudioFormatLinearPCM; - case AUFMT_PCMA: return kAudioFormatALaw; - case AUFMT_PCMU: return kAudioFormatULaw; - default: - warning("coreaudio: unknown format %d\n", fmt); - return -1; - } -} - - -int bytesps(enum aufmt fmt) -{ - switch (fmt) { - - case AUFMT_S16LE: return 2; - case AUFMT_PCMA: return 1; - case AUFMT_PCMU: return 1; - default: return 0; - } -} - - #if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_2_0 static void interruptionListener(void *data, UInt32 inInterruptionState) { diff --git a/modules/coreaudio/coreaudio.h b/modules/coreaudio/coreaudio.h index 530e45e..67cb7d5 100644 --- a/modules/coreaudio/coreaudio.h +++ b/modules/coreaudio/coreaudio.h @@ -8,8 +8,6 @@ int audio_session_enable(void); void audio_session_disable(void); -int audio_fmt(enum aufmt fmt); -int bytesps(enum aufmt fmt); int coreaudio_player_alloc(struct auplay_st **stp, struct auplay *ap, struct auplay_prm *prm, const char *device, diff --git a/modules/coreaudio/player.c b/modules/coreaudio/player.c index 68aca4e..1243450 100644 --- a/modules/coreaudio/player.c +++ b/modules/coreaudio/player.c @@ -110,17 +110,17 @@ int coreaudio_player_alloc(struct auplay_st **stp, struct auplay *ap, goto out; fmt.mSampleRate = (Float64)prm->srate; - fmt.mFormatID = audio_fmt(prm->fmt); + fmt.mFormatID = kAudioFormatLinearPCM; fmt.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked; #ifdef __BIG_ENDIAN__ fmt.mFormatFlags |= kAudioFormatFlagIsBigEndian; #endif fmt.mFramesPerPacket = 1; - fmt.mBytesPerFrame = prm->ch * bytesps(prm->fmt); - fmt.mBytesPerPacket = prm->ch * bytesps(prm->fmt); + fmt.mBytesPerFrame = prm->ch * 2; + fmt.mBytesPerPacket = prm->ch * 2; fmt.mChannelsPerFrame = prm->ch; - fmt.mBitsPerChannel = 8*bytesps(prm->fmt); + fmt.mBitsPerChannel = 16; status = AudioQueueNewOutput(&fmt, play_handler, st, NULL, kCFRunLoopCommonModes, 0, &st->queue); @@ -131,7 +131,7 @@ int coreaudio_player_alloc(struct auplay_st **stp, struct auplay *ap, } sampc = prm->srate * prm->ch * prm->ptime / 1000; - bytc = sampc * bytesps(prm->fmt); + bytc = sampc * 2; for (i=0; i<ARRAY_SIZE(st->buf); i++) { diff --git a/modules/coreaudio/recorder.c b/modules/coreaudio/recorder.c index b1f91fc..57f2390 100644 --- a/modules/coreaudio/recorder.c +++ b/modules/coreaudio/recorder.c @@ -132,7 +132,7 @@ int coreaudio_recorder_alloc(struct ausrc_st **stp, struct ausrc *as, st->arg = arg; sampc = prm->srate * prm->ch * prm->ptime / 1000; - bytc = sampc * bytesps(prm->fmt); + bytc = sampc * 2; st->mb = mbuf_alloc(bytc); if (!st->mb) { @@ -149,7 +149,7 @@ int coreaudio_recorder_alloc(struct ausrc_st **stp, struct ausrc *as, goto out; fmt.mSampleRate = (Float64)prm->srate; - fmt.mFormatID = audio_fmt(prm->fmt); + fmt.mFormatID = kAudioFormatLinearPCM; fmt.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked; #ifdef __BIG_ENDIAN__ @@ -157,10 +157,10 @@ int coreaudio_recorder_alloc(struct ausrc_st **stp, struct ausrc *as, #endif fmt.mFramesPerPacket = 1; - fmt.mBytesPerFrame = prm->ch * bytesps(prm->fmt); - fmt.mBytesPerPacket = prm->ch * bytesps(prm->fmt); + fmt.mBytesPerFrame = prm->ch * 2; + fmt.mBytesPerPacket = prm->ch * 2; fmt.mChannelsPerFrame = prm->ch; - fmt.mBitsPerChannel = 8*bytesps(prm->fmt); + fmt.mBitsPerChannel = 16; status = AudioQueueNewInput(&fmt, record_handler, st, NULL, kCFRunLoopCommonModes, 0, &st->queue); |