-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmac_player.cpp
More file actions
36 lines (29 loc) · 752 Bytes
/
mac_player.cpp
File metadata and controls
36 lines (29 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// SPDX-License-Identifier: MIT
#include "core_audio_device.h"
#include "flow_control.h"
#include "stream.h"
int main(int argc, char *argv[]) {
EXPECTS(argc > 1, "no file provided");
::plac::FlowControl flow{};
::plac::AudioBuffer<228000> audio_buffer{};
::plac::Stream stream{audio_buffer, flow};
::plac::CoreAudioDevice device{audio_buffer, flow};
bool first{true};
for (int i{1}; i < argc; ++i) {
if (!stream.Reset(argv[i])) {
continue;
}
if (first) {
first = false;
device.Init(stream.format_);
stream.FillBuffer();
device.Playback();
}
if (device.format_ != stream.format_) {
LOG_ERROR("audio format mismatch");
break;
}
stream.Decode();
}
return 0;
}