summaryrefslogtreecommitdiff
path: root/libs/ardour/coreaudiosource.cc
diff options
context:
space:
mode:
authorTaybin Rutkin <taybin@taybin.com>2006-07-28 19:46:50 +0000
committerTaybin Rutkin <taybin@taybin.com>2006-07-28 19:46:50 +0000
commit2df8147e355e6bcf142c913591a2bda7da9b80ca (patch)
treecd4db6d18470073a0647209fe7d1081094897f66 /libs/ardour/coreaudiosource.cc
parent7aad85ed0223fe9ef70ab0723df8e392b126d06e (diff)
Updates to get CoreAudioSource linking again.
git-svn-id: svn://localhost/ardour2/trunk@715 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/coreaudiosource.cc')
-rw-r--r--libs/ardour/coreaudiosource.cc33
1 files changed, 25 insertions, 8 deletions
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;
+}
+