home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Headers / sound / accesssound.h next >
Text File  |  1991-09-26  |  3KB  |  80 lines

  1.  
  2. /*
  3.  *    accesssound.h
  4.  *    Copyright 1988-89 NeXT, Inc.
  5.  *
  6.  */
  7.  
  8. #import "soundstruct.h"
  9. #import "sounderror.h"
  10. #import <mach/cthreads.h>
  11.  
  12. #define SND_ACCESS_OUT 1
  13. #define SND_ACCESS_DSP 2
  14. #define SND_ACCESS_IN 4
  15.  
  16. typedef struct {
  17.     int priority;
  18.     int duration;
  19. } SNDNegotiationData;
  20.  
  21. typedef int (*SNDNegotiationFun)(void *arg, SNDNegotiationData *data);
  22.  
  23. #define NULL_NEGOTIATION_FUN ((SNDNegotiationFun)0)
  24.  
  25. int SNDAcquire(int access_code, int priority, int preempt, int timeout,
  26.         SNDNegotiationFun negotiation_function, void *arg,
  27.         port_t *device_port, port_t *owner_port);
  28. int SNDReset(int access_code, port_t dev_port, port_t owner_port);
  29. int SNDRelease(int access_code, port_t device_port, port_t owner_port);
  30. /*
  31.  * Acquire/release the specified resources. Acquiring a resources makes
  32.  * it active, such that other acquisition requests may fail (even in the
  33.  * requests are in the same process). These calls should bracket any use
  34.  * of the resources. These functions are automatically called by
  35.  * SNDStartPlaying and SNDStartRecording. The SNDReset function causes the
  36.  * owned resources to be reset to the state that they were when acquired.
  37.  * If access is granted, another attempt at access will cause the
  38.  * negotiation function to be called. Returning a value of zero indicateBSU that access is being released and for the caller to try again. If a
  39.  * null function is provided, ownership of the resources is absolute.
  40.  */
  41.  
  42. int SNDReserve(int access_code, int priority);
  43. /*
  44.  * Establishes exclusive use of specified resources until SNDUnreserve
  45.  * is called or the process terminates. If this routine is not called,
  46.  * then SNDStartPlaying or SNDStartRecording will obtain access and release it 
  47.  * automatically. The access_code determines which physical resources are
  48.  * to be reserved, and the priority is used to resolve conflicts.
  49.  * Use of this routine is optional; if used, it must eventually be followed by 
  50.  * a call to SNDUnreserve.
  51.  * An error code is returned if the resources cannot be reserved.
  52.  */
  53.  
  54. int SNDUnreserve(int access_code);
  55. /*
  56.  * Frees up sound resources for other processes to use.
  57.  * An error code is returned if the sound is not already reserved.
  58.  */
  59.  
  60. int SNDSetHost(char *newHostname);
  61. /*
  62.  * Chooses the host by name for subsequent playback or recording. Passing
  63.  * NULL or a zero length string restores the default, which is the local
  64.  * host. If sound is currently recording or playing, or if the sound resources
  65.  * are reserved, then the host cannot be changed.
  66.  * an error code is returned.
  67.  */
  68.  
  69. int SNDBootDSP(port_t device_port, port_t owner_port, SNDSoundStruct *dspCore);
  70. /*
  71.  * Boots the dsp specified by the device_port and owner_port (obtained via
  72.  * SNDAcquire). The boot image is specified in an SNDSoundStruct, which can
  73.  * be created by SNDReadDSPfile (see filesound.h).
  74.  * This routine uses a bootstrap downloader, making possible the loading
  75.  * of all internal and external RAM of the DSP except for the top 6 words
  76.  * of external ram.
  77.  */
  78.  
  79.  
  80.