You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
161 lines
4.1 KiB
161 lines
4.1 KiB
5 years ago
|
#ifndef __SYSTEMSOUND__
|
||
|
#define __SYSTEMSOUND__
|
||
|
|
||
|
#ifndef __MACTYPES__
|
||
|
#include <MacTypes.h>
|
||
|
#endif
|
||
|
|
||
|
#ifndef __FILES__
|
||
|
#include <Files.h>
|
||
|
#endif
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
#if PRAGMA_ONCE
|
||
|
#pragma once
|
||
|
#endif
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
extern "C" {
|
||
|
#endif
|
||
|
|
||
|
#if PRAGMA_IMPORT
|
||
|
#pragma import on
|
||
|
#endif
|
||
|
|
||
|
/* ================================================================================ */
|
||
|
/* Errors */
|
||
|
/* ================================================================================ */
|
||
|
enum {
|
||
|
kSystemSoundNoError = 0,
|
||
|
kSystemSoundUnspecifiedError = -1500
|
||
|
};
|
||
|
|
||
|
/* ================================================================================ */
|
||
|
/* Types */
|
||
|
/* ================================================================================ */
|
||
|
typedef UInt32 SystemSoundActionID;
|
||
|
/* ================================================================================ */
|
||
|
/* Public APIs */
|
||
|
/* ================================================================================ */
|
||
|
/*
|
||
|
* AlertSoundPlay()
|
||
|
*
|
||
|
* Summary:
|
||
|
* Play an Alert Sound
|
||
|
*
|
||
|
* Discussion:
|
||
|
* Play the user's current alert sound, interrupting any previously
|
||
|
* playing alert sound.
|
||
|
*
|
||
|
* Availability:
|
||
|
* Non-Carbon CFM: not available
|
||
|
* CarbonLib: not available in CarbonLib 1.x
|
||
|
* Mac OS X: in version 10.2 and later
|
||
|
*/
|
||
|
EXTERN_API_C( void )
|
||
|
AlertSoundPlay(void);
|
||
|
|
||
|
|
||
|
/*
|
||
|
* SystemSoundPlay()
|
||
|
*
|
||
|
* Summary:
|
||
|
* Play a System Sound
|
||
|
*
|
||
|
* Discussion:
|
||
|
* Immediately play the sound designated by actionID. Use for one
|
||
|
* time actions that do not require a duration or modification
|
||
|
* during playback. Sustain loops in the sound will be ignored.
|
||
|
*
|
||
|
* Parameters:
|
||
|
*
|
||
|
* inAction:
|
||
|
* A SystemSoundActionID indicating the desired System Sound to be
|
||
|
* played.
|
||
|
*
|
||
|
* Availability:
|
||
|
* Non-Carbon CFM: not available
|
||
|
* CarbonLib: not available in CarbonLib 1.x
|
||
|
* Mac OS X: in version 10.2 and later
|
||
|
*/
|
||
|
EXTERN_API_C( void )
|
||
|
SystemSoundPlay(SystemSoundActionID inAction);
|
||
|
|
||
|
|
||
|
/*
|
||
|
* SystemSoundGetActionID()
|
||
|
*
|
||
|
* Summary:
|
||
|
* Create a 'custom' System Sound by providing an audio file.
|
||
|
*
|
||
|
* Discussion:
|
||
|
* If the user wants to add a sound that can be played via
|
||
|
* SystemSoundPlay(), an FSRef for an audio file can be passed and a
|
||
|
* SystemSoundActionID, which can be passed to SystemSoundPlay(),
|
||
|
* will be returned .
|
||
|
*
|
||
|
* Parameters:
|
||
|
*
|
||
|
* userFile:
|
||
|
* An const FSRef * for the audio file to be used as a System
|
||
|
* Sound. Any audio file supported by the AudioFile APIs in the
|
||
|
* AudioToolbox framework may be used.
|
||
|
*
|
||
|
* outAction:
|
||
|
* If successful, a SystemSoundActionID will be returned, which in
|
||
|
* turn can be passed to SystemSoundPlay().
|
||
|
*
|
||
|
* Availability:
|
||
|
* Non-Carbon CFM: not available
|
||
|
* CarbonLib: not available in CarbonLib 1.x
|
||
|
* Mac OS X: in version 10.2 and later
|
||
|
*/
|
||
|
EXTERN_API_C( OSStatus )
|
||
|
SystemSoundGetActionID(
|
||
|
const FSRef * userFile,
|
||
|
SystemSoundActionID * outAction);
|
||
|
|
||
|
|
||
|
/*
|
||
|
* SystemSoundRemoveActionID()
|
||
|
*
|
||
|
* Summary:
|
||
|
* Remove a 'custom' System Sound.
|
||
|
*
|
||
|
* Discussion:
|
||
|
* If the user no longer needs to use the custom system sound that
|
||
|
* was created via SystemSoundGetActionID, this function should be
|
||
|
* called so the SystemSoundServer can release resources that are no
|
||
|
* longer needed.
|
||
|
*
|
||
|
* Parameters:
|
||
|
*
|
||
|
* inAction:
|
||
|
* A SystemSoundActionID indicating the desired System Sound to be
|
||
|
* removed.
|
||
|
*
|
||
|
* Availability:
|
||
|
* Non-Carbon CFM: not available
|
||
|
* CarbonLib: not available in CarbonLib 1.x
|
||
|
* Mac OS X: in version 10.2 and later
|
||
|
*/
|
||
|
EXTERN_API_C( OSStatus )
|
||
|
SystemSoundRemoveActionID(SystemSoundActionID inAction);
|
||
|
|
||
|
|
||
|
|
||
|
#ifdef PRAGMA_IMPORT_OFF
|
||
|
#pragma import off
|
||
|
#elif PRAGMA_IMPORT
|
||
|
#pragma import reset
|
||
|
#endif
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
#endif /* __SYSTEMSOUND__ */
|
||
|
|