comparison Plugins/Output/CoreAudio/mixer.c @ 1637:5261e37b4d55 trunk

[svn] - fully working CoreAudio plugin, based on the OSS plugin and an incomplete xmms coreaudio plugin (fink)
author nenolod
date Thu, 07 Sep 2006 11:32:59 -0700
parents
children
comparison
equal deleted inserted replaced
1636:09905c29250d 1637:5261e37b4d55
1 /* XMMS - Cross-platform multimedia player
2 * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18 #include "coreaudio.h"
19 #include <errno.h>
20 #include <CoreAudio/CoreAudio.h>
21
22 extern AudioDeviceID device_id;
23 extern gboolean playing_flag;
24 extern float left_volume, right_volume;
25
26 void osx_get_volume(int *l, int *r)
27 {
28 *l = left_volume * 100;
29 *r = right_volume * 100;
30
31 #if 0
32 float volume;
33 UInt32 size;
34 AudioDeviceID temp_device_id;
35
36 size = sizeof(float);
37
38 AudioDeviceGetProperty(device_id,1,0,kAudioDevicePropertyVolumeScalar,&size,&volume);
39
40 volume = volume * 100;
41
42 *r = volume;
43 *l = volume;
44 #endif
45 }
46
47
48 void osx_set_volume(int l, int r)
49 {
50 left_volume = (float)l / 100.0;
51 right_volume = (float) r / 100.0;
52
53
54 #if 0
55 int fd, v, cmd, devs;
56 gchar *devname;
57
58 Boolean writeable_flag;
59
60 if (AudioDeviceGetPropertyInfo(device_id,1,false,kAudioDevicePropertyVolumeScalar,NULL,&writeable_flag))
61 {
62 printf("could not get property info for volume write\n");
63 }
64 else
65 {
66 if (writeable_flag)
67 {
68 float volume;
69
70 volume = l / 100.0;
71 AudioDeviceSetProperty(device_id,NULL,1,0,kAudioDevicePropertyVolumeScalar,sizeof(float),&volume);
72 }
73 else
74 {
75 printf("volume property is not writeable\n");
76 }
77 }
78 #endif
79 }
80
81