File: ex_audio_devices.c

package info (click to toggle)
allegro5 2%3A5.2.10.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,820 kB
  • sloc: ansic: 109,795; cpp: 12,976; objc: 4,592; java: 2,845; python: 2,595; javascript: 1,238; sh: 1,008; makefile: 40; xml: 27; pascal: 24
file content (39 lines) | stat: -rw-r--r-- 775 bytes parent folder | download | duplicates (2)
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
37
38
39
/* This example lists the available audio devices.
 */
#define ALLEGRO_UNSTABLE

#include <stdio.h>
#include "allegro5/allegro.h"
#include "allegro5/allegro_audio.h"

#include "common.c"

int main(int argc, char **argv)
{
   (void)argc;
   (void)argv;

   if (!al_init()) {
      abort_example("Could not init Allegro.\n");
   }

   if (!al_install_audio()) {
      abort_example("Could not init sound!\n");
   }

   open_log();

   int count = al_get_num_audio_output_devices();
   if (count < 0) {
      log_printf("Platform not supported.\n");
      goto done;
   }

   for (int i = 0; i < count; i++) {
      const ALLEGRO_AUDIO_DEVICE* device = al_get_audio_output_device(i);
      log_printf("%s\n", al_get_audio_device_name(device));
   }

done:
   close_log(true);
}