15 #include "../include/tscope5/audio_internal.h"
16 #include "../include/tscope5/system_internal.h"
18 #include <allegro5/allegro_acodec.h>
35 ts5_log(TS5_LOGLEVEL_6,
"%s: ts5_check_audio\n", calling_function);
59 ts5_log(TS5_LOGLEVEL_1,
"%s: Installing Tscope5 audio\n",
62 if (!al_install_audio()) {
63 ts5_fatal(
"%s: could not install Tscope5 audio\n",
67 if (!al_init_acodec_addon()) {
68 ts5_fatal(
"%s: could not install Tscope5 audio codec addon\n",
72 ALLEGRO_CHANNEL_CONF channels;
74 if (_ts5_status.audio.channels==TS5_MONO) {
75 channels=ALLEGRO_CHANNEL_CONF_1;
77 else if (_ts5_status.audio.channels==TS5_STEREO) {
78 channels=ALLEGRO_CHANNEL_CONF_2;
81 ts5_fatal(
"%s: unknown channel configuration requested\n",
98 _ts5_data.audio.voice = al_create_voice(_ts5_status.audio.frequency,
99 ALLEGRO_AUDIO_DEPTH_INT16, channels);
101 if (!_ts5_data.audio.voice) {
102 ts5_fatal(
"%s: could not create voice\n", calling_function);
105 _ts5_data.audio.mixer = al_create_mixer(_ts5_status.audio.frequency,
106 ALLEGRO_AUDIO_DEPTH_FLOAT32, channels);
108 if (!_ts5_data.audio.mixer) {
109 ts5_fatal(
"%s: could not create mixer\n", calling_function);
112 if (!al_attach_mixer_to_voice(_ts5_data.audio.mixer,
113 _ts5_data.audio.voice)) {
114 ts5_fatal(
"%s: could not attach mixer to voice\n",
132 ts5_log(TS5_LOGLEVEL_1,
"Uninstalling Tscope5 audio\n");
134 al_detach_mixer(_ts5_data.audio.mixer);
135 al_detach_voice(_ts5_data.audio.voice);
137 al_destroy_mixer(_ts5_data.audio.mixer);
138 al_destroy_voice(_ts5_data.audio.voice);
140 _ts5_data.audio.mixer = NULL;
141 _ts5_data.audio.voice = NULL;
143 al_uninstall_audio();