make it build

This commit is contained in:
Loic Nageleisen 2016-03-21 11:31:30 +01:00
parent f109052d8b
commit 55975b0e5f
4 changed files with 17 additions and 8 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
example

View file

@ -1,2 +1,9 @@
all: all: example
clang++ -std=c++11 -stdlib=libc++ coreaudio_example.cc
example:
clang++ -std=c++11 -stdlib=libc++ -Wl,-framework,CoreAudio -Wl,-framework,AudioUnit coreaudio_example.cc coreaudio_example_main.cc -o example
clean:
rm -rf example
PHONY: clean

View file

@ -109,7 +109,7 @@ bool init (void)
void cleanup (void) void cleanup (void)
{ {
AudioUnitInstanceDispose (output_instance); AudioComponentInstanceDispose (output_instance);
} }
/* /*
@ -146,12 +146,12 @@ bool open_audio (int format, int rate, int chan, AURenderCallbackStruct * callba
AudioStreamBasicDescription streamFormat; AudioStreamBasicDescription streamFormat;
streamFormat.mSampleRate = rate; streamFormat.mSampleRate = rate;
streamFormat.mFormatID = kAudioFormatLinearPCM; streamFormat.mFormatID = kAudioFormatLinearPCM;
streamFormat.mFormatFlags = m->mFormatFlags; streamFormat.mFormatFlags = m->flags;
streamFormat.mFramesPerPacket = 1; streamFormat.mFramesPerPacket = 1;
streamFormat.mChannelsPerFrame = chan; streamFormat.mChannelsPerFrame = chan;
streamFormat.mBitsPerChannel = m->mBitsPerChannel; streamFormat.mBitsPerChannel = m->bits_per_sample;
streamFormat.mBytesPerPacket = chan * buffer_bytes_per_channel; streamFormat.mBytesPerPacket = chan * m->bytes_per_sample;
streamFormat.mBytesPerFrame = chan * buffer_bytes_per_channel; streamFormat.mBytesPerFrame = chan * m->bytes_per_sample;
printf ("Stream format:\n"); printf ("Stream format:\n");
printf (" Channels: %d\n", streamFormat.mChannelsPerFrame); printf (" Channels: %d\n", streamFormat.mChannelsPerFrame);
@ -173,7 +173,7 @@ bool open_audio (int format, int rate, int chan, AURenderCallbackStruct * callba
if (AudioOutputUnitStart (output_instance)) if (AudioOutputUnitStart (output_instance))
{ {
fprintf ("Unable to start audio unit.\n"); printf ("Unable to start audio unit.\n");
return false; return false;
} }

View file

@ -0,0 +1 @@
int main() { return 0; }