mirror of
https://github.com/lloeki/coreaudio_example.git
synced 2025-12-06 03:04:38 +01:00
make it build
This commit is contained in:
parent
f109052d8b
commit
55975b0e5f
4 changed files with 17 additions and 8 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
example
|
||||
11
Makefile
11
Makefile
|
|
@ -1,2 +1,9 @@
|
|||
all:
|
||||
clang++ -std=c++11 -stdlib=libc++ coreaudio_example.cc
|
||||
all: example
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ bool init (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;
|
||||
streamFormat.mSampleRate = rate;
|
||||
streamFormat.mFormatID = kAudioFormatLinearPCM;
|
||||
streamFormat.mFormatFlags = m->mFormatFlags;
|
||||
streamFormat.mFormatFlags = m->flags;
|
||||
streamFormat.mFramesPerPacket = 1;
|
||||
streamFormat.mChannelsPerFrame = chan;
|
||||
streamFormat.mBitsPerChannel = m->mBitsPerChannel;
|
||||
streamFormat.mBytesPerPacket = chan * buffer_bytes_per_channel;
|
||||
streamFormat.mBytesPerFrame = chan * buffer_bytes_per_channel;
|
||||
streamFormat.mBitsPerChannel = m->bits_per_sample;
|
||||
streamFormat.mBytesPerPacket = chan * m->bytes_per_sample;
|
||||
streamFormat.mBytesPerFrame = chan * m->bytes_per_sample;
|
||||
|
||||
printf ("Stream format:\n");
|
||||
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))
|
||||
{
|
||||
fprintf ("Unable to start audio unit.\n");
|
||||
printf ("Unable to start audio unit.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
1
coreaudio_example_main.cc
Normal file
1
coreaudio_example_main.cc
Normal file
|
|
@ -0,0 +1 @@
|
|||
int main() { return 0; }
|
||||
Loading…
Add table
Add a link
Reference in a new issue