Use AudioFile.h instead of ExtAudioFile.h.
git-svn-id: svn://localhost/trunk/ardour2@352 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
aed3483e14
commit
4c9e99322e
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include <ardour/source.h>
|
#include <ardour/source.h>
|
||||||
|
|
||||||
#include <AudioToolbox/ExtendedAudioFile.h>
|
#include <AudioToolbox/AudioFile.h>
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
|
|
||||||
@ -45,8 +45,8 @@ class CoreAudioSource : public Source {
|
|||||||
private:
|
private:
|
||||||
static string peak_dir;
|
static string peak_dir;
|
||||||
|
|
||||||
ExtAudioFileRef* af_ref;
|
AudioFileID af;
|
||||||
uint16_t n_channels;
|
AudioStreamBasicDescription _info;
|
||||||
|
|
||||||
uint16_t channel;
|
uint16_t channel;
|
||||||
mutable float *tmpbuf;
|
mutable float *tmpbuf;
|
||||||
|
@ -79,14 +79,18 @@ CoreAudioSource::init (const string& idstr, bool build_peak)
|
|||||||
if (err) {
|
if (err) {
|
||||||
throw failed_constructor();
|
throw failed_constructor();
|
||||||
}
|
}
|
||||||
err = ExtAudioFileOpen (ref, af_ref);
|
err = AudioFileOpen (ref, 0, fsRdPerm, &af);
|
||||||
if (err) {
|
if (err) {
|
||||||
throw failed_constructor();
|
throw failed_constructor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* XXX get value for n_channels */
|
||||||
|
UInt32 size = sizeof(AudioStreamBasicDescription);
|
||||||
|
memset (_info, 0, size);
|
||||||
|
|
||||||
if (channel >= n_channels) {
|
if (channel >= n_channels) {
|
||||||
error << string_compose(_("CoreAudioSource: file only contains %1 channels; %2 is invalid as a channel number"), n_channels, channel) << endmsg;
|
error << string_compose(_("CoreAudioSource: file only contains %1 channels; %2 is invalid as a channel number"), n_channels, channel) << endmsg;
|
||||||
ExtAudioFileDispose(*af_ref);
|
AudioFileClose(af);
|
||||||
throw failed_constructor();
|
throw failed_constructor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +107,7 @@ CoreAudioSource::init (const string& idstr, bool build_peak)
|
|||||||
|
|
||||||
if (build_peak) {
|
if (build_peak) {
|
||||||
if (initialize_peakfile (false, file)) {
|
if (initialize_peakfile (false, file)) {
|
||||||
ExtAudioFileDispose(*af_ref);
|
AudioFileClose(af);
|
||||||
throw failed_constructor ();
|
throw failed_constructor ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,20 +147,16 @@ CoreAudioSource::read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt) co
|
|||||||
}
|
}
|
||||||
|
|
||||||
AudioBufferList abl;
|
AudioBufferList abl;
|
||||||
AudioBuffer ab;
|
|
||||||
|
|
||||||
abl.mNumberBuffers = 1;
|
abl.mNumberBuffers = 1;
|
||||||
abl.mBuffers[0] = ab;
|
abl.mBuffers[0].mNumberChannels = n_channels;
|
||||||
ab.mNumberChannels = n_channels;
|
|
||||||
ab.mDataByteSize = cnt;
|
|
||||||
ab.mData = dst;
|
|
||||||
|
|
||||||
|
|
||||||
if (n_channels == 1) {
|
if (n_channels == 1) {
|
||||||
uint32_t ioNumber = cnt;
|
abl.mBuffers[0].mDataByteSize = cnt * sizeof(float);
|
||||||
err = ExtAudioFileRead(*af_ref, (UInt32*)&ioNumber, &abl);
|
abl.mBuffers[0].mData = dst;
|
||||||
|
nread = cnt;
|
||||||
|
err = ExtAudioFileRead(*af_ref, (UInt32*)&nread, &abl);
|
||||||
_read_data_count = cnt * sizeof(float);
|
_read_data_count = cnt * sizeof(float);
|
||||||
return ioNumber;
|
return nread;
|
||||||
}
|
}
|
||||||
|
|
||||||
real_cnt = cnt * n_channels;
|
real_cnt = cnt * n_channels;
|
||||||
|
Loading…
Reference in New Issue
Block a user