From 2df8147e355e6bcf142c913591a2bda7da9b80ca Mon Sep 17 00:00:00 2001 From: Taybin Rutkin Date: Fri, 28 Jul 2006 19:46:50 +0000 Subject: Updates to get CoreAudioSource linking again. git-svn-id: svn://localhost/ardour2/trunk@715 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/coreaudiosource.cc | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'libs/ardour') diff --git a/libs/ardour/coreaudiosource.cc b/libs/ardour/coreaudiosource.cc index 55409a8524..5e9de225d4 100644 --- a/libs/ardour/coreaudiosource.cc +++ b/libs/ardour/coreaudiosource.cc @@ -68,13 +68,13 @@ CoreAudioSource::init (const string& idstr) FSRef fsr; err = FSPathMakeRef ((UInt8*)file.c_str(), &fsr, 0); if (err != noErr) { - cerr << "FSPathMakeRef " << err << endl; + error << string_compose (_("Could not make reference to file: %1"), name()) << endmsg; throw failed_constructor(); } err = ExtAudioFileOpen (&fsr, &af); if (err != noErr) { - cerr << "ExtAudioFileOpen " << err << endl; + error << string_compose (_("Could not open file: %1"), name()) << endmsg; ExtAudioFileDispose (af); throw failed_constructor(); } @@ -85,7 +85,7 @@ CoreAudioSource::init (const string& idstr) err = ExtAudioFileGetProperty(af, kExtAudioFileProperty_FileDataFormat, &asbd_size, &file_asbd); if (err != noErr) { - cerr << "ExtAudioFileGetProperty1 " << err << endl; + error << string_compose (_("Could not get file data format for file: %1"), name()) << endmsg; ExtAudioFileDispose (af); throw failed_constructor(); } @@ -104,7 +104,7 @@ CoreAudioSource::init (const string& idstr) err = ExtAudioFileGetProperty(af, kExtAudioFileProperty_FileLengthFrames, &prop_size, &ca_frames); if (err != noErr) { - cerr << "ExtAudioFileGetProperty2 " << err << endl; + error << string_compose (_("Could not get file length for file: %1"), name()) << endmsg; ExtAudioFileDispose (af); throw failed_constructor(); } @@ -125,14 +125,14 @@ CoreAudioSource::init (const string& idstr) err = ExtAudioFileSetProperty (af, kExtAudioFileProperty_ClientDataFormat, asbd_size, &client_asbd); if (err != noErr) { - cerr << "ExtAudioFileSetProperty3 " << err << endl; + error << string_compose (_("Could not set client data format for file: %1"), name()) << endmsg; ExtAudioFileDispose (af); throw failed_constructor (); } if (_build_peakfiles) { if (initialize_peakfile (false, file)) { - error << "initialize peakfile failed" << endmsg; + error << string_compose(_("initialize peakfile failed for file %1"), name()) << endmsg; ExtAudioFileDispose (af); throw failed_constructor (); } @@ -212,7 +212,24 @@ CoreAudioSource::read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_ float CoreAudioSource::sample_rate() const { - /* XXX taybin fill me in please */ + AudioStreamBasicDescription client_asbd; + memset(&client_asbd, 0, sizeof(AudioStreamBasicDescription)); - return 44100.0f; + OSStatus err = noErr; + size_t asbd_size = sizeof(AudioStreamBasicDescription); + + err = ExtAudioFileSetProperty (af, kExtAudioFileProperty_ClientDataFormat, asbd_size, &client_asbd); + if (err != noErr) { + error << string_compose(_("Could not detect samplerate for: %1"), name()) << endmsg; + return 0.0; + } + + return client_asbd.mSampleRate; } + +int +CoreAudioSource::update_header (jack_nframes_t when, struct tm&, time_t) +{ + return 0; +} + -- cgit v1.2.3