/libs/ObjectAL/OpenAL/ALListener.h

http://github.com/kstenerud/ObjectAL-for-iPhone · C Header · 100 lines · 23 code · 19 blank · 58 comment · 0 complexity · 3e4180383d7358e0a0f9e290621defbb MD5 · raw file

  1. //
  2. // ALListener.h
  3. // ObjectAL
  4. //
  5. // Created by Karl Stenerud on 10-01-07.
  6. //
  7. // Copyright 2009 Karl Stenerud
  8. //
  9. // Licensed under the Apache License, Version 2.0 (the "License");
  10. // you may not use this file except in compliance with the License.
  11. // You may obtain a copy of the License at
  12. //
  13. // http://www.apache.org/licenses/LICENSE-2.0
  14. //
  15. // Unless required by applicable law or agreed to in writing, software
  16. // distributed under the License is distributed on an "AS IS" BASIS,
  17. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18. // See the License for the specific language governing permissions and
  19. // limitations under the License.
  20. //
  21. // Note: You are NOT required to make the license available from within your
  22. // iOS application. Including it in your project is sufficient.
  23. //
  24. // Attribution is not required, but appreciated :)
  25. //
  26. #import <Foundation/Foundation.h>
  27. #import "ALTypes.h"
  28. #import "OALSuspendHandler.h"
  29. @class ALContext;
  30. #pragma mark ALListener
  31. /**
  32. * The listener represents the user who is listening to sounds in 3D space.
  33. * This object controls his position, orientation, and velocity, as well as providing a master
  34. * gain. <br>
  35. * A context contains one and only one listener.
  36. */
  37. @interface ALListener : NSObject <OALSuspendManager>
  38. {
  39. ALContext* context; // Weak reference
  40. bool muted;
  41. float gain;
  42. /** Handles suspending and interrupting for this object. */
  43. OALSuspendHandler* suspendHandler;
  44. }
  45. #pragma mark Properties
  46. /** The context this listener belongs to. */
  47. @property(readonly) ALContext* context;
  48. /** Causes this listener to stop hearing sound.
  49. * It's called "muted" rather than "deaf" to give a consistent name with other mute functions.
  50. */
  51. @property(readwrite,assign) bool muted;
  52. /** Gain (volume), affecting every sound this listener hears (0.0 = no sound, 1.0 = max volume).
  53. * Only valid if this listener's context is the current context.
  54. */
  55. @property(readwrite,assign) float gain;
  56. /** Orientation (up: x, y, z, at: x, y, z).
  57. * Only valid if this listener's context is the current context.
  58. */
  59. @property(readwrite,assign) ALOrientation orientation;
  60. /** Position (x, y, z).
  61. * Only valid if this listener's context is the current context.
  62. */
  63. @property(readwrite,assign) ALPoint position;
  64. /** Velocity (x, y, z).
  65. * Only valid if this listener's context is the current context.
  66. */
  67. @property(readwrite,assign) ALVector velocity;
  68. #pragma mark Object Management
  69. /** (INTERNAL USE) Create a listener for the specified context.
  70. *
  71. * @param context the context to create this listener on.
  72. * @return A new listener.
  73. */
  74. + (id) listenerForContext:(ALContext*) context;
  75. /** (INTERNAL USE) Initialize a listener for the specified context.
  76. *
  77. * @param context the context to create this listener on.
  78. * @return The initialized listener.
  79. */
  80. - (id) initWithContext:(ALContext*) context;
  81. @end