Subversion Repositories Mobile Apps.GyroMouse

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 pmbaty 1
//
2
//  ISSoundAdditions.m (ver 1.2 - 2012.10.27)
3
//
4
//      Created by Massimo Moiso (2012-09) InerziaSoft
5
//      based on an idea of Antonio Nunes, SintraWorks
6
//
7
// Permission is granted free of charge to use this code without restriction
8
// and without limitation, with the only condition that the copyright
9
// notice and this permission shall be included in all copies.
10
//
11
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17
// THE SOFTWARE.
18
 
19
/*
20
 GOAL
21
 This is a category of NSSound build using CoreAudio to get and set the volume of the
22
 system sound and some other utility.
23
 It was implemented using the Apple documentation and various unattributed code fragments
24
 found on the net. For this reason, its use is free for all.
25
 
26
 USE
27
 To maintain the Cocoa conventions, a property-like syntax was used; the following
28
 methods ("properties") are available:
29
 
30
        (float)systemVolume                     - return the volume of the default sound device
31
        setSystemVolume(float)                  - set the volume of the default sound device
32
        (AudioDeviceID)defaultOutputDevice      - return the default output device
33
        applyMute(boolean)                      - enable or disable muting, if supported
34
 
35
 REQUIREMENTS
36
 At least MacOS X 10.6
37
 Core Audio Framework
38
 */
39
 
40
#import <Cocoa/Cocoa.h>
41
#import <CoreAudio/CoreAudio.h>
42
#import <AudioToolbox/AudioServices.h>
43
 
44
@interface NSSound (ISSoundAdditions)
45
 
46
+ (AudioDeviceID)defaultOutputDevice;
47
 
48
+ (float)systemVolume;
49
+ (void)setSystemVolume:(float)inVolume;
50
 
51
+ (void)increaseSystemVolumeBy:(float)amount;
52
+ (void)decreaseSystemVolumeBy:(float)amount;
53
 
54
+ (void)applyMute:(Boolean)m;
55
 
56
#define THRESHOLD       0.005                   //if the volume should be set under this value, the device will be muted
57
 
58
@end