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.

Audio.h 4.0KB

10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* Audio Library for Teensy 3.X
  2. * Copyright (c) 2014, Paul Stoffregen, paul@pjrc.com
  3. *
  4. * Development of this audio library was funded by PJRC.COM, LLC by sales of
  5. * Teensy and Audio Adaptor boards. Please support PJRC's efforts to develop
  6. * open source software by purchasing Teensy or other PJRC products.
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9. * of this software and associated documentation files (the "Software"), to deal
  10. * in the Software without restriction, including without limitation the rights
  11. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. * copies of the Software, and to permit persons to whom the Software is
  13. * furnished to do so, subject to the following conditions:
  14. *
  15. * The above copyright notice, development funding notice, and this permission
  16. * notice shall be included in all copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  24. * THE SOFTWARE.
  25. */
  26. #ifndef Audio_h_
  27. #define Audio_h_
  28. #if TEENSYDUINO < 120
  29. #error "Teensyduino version 1.20 or later is required to compile the Audio library."
  30. #endif
  31. #ifdef __AVR__
  32. #error "The Audio Library only works with Teensy 3.X. Teensy 2.0 is unsupported."
  33. #endif
  34. #include "DMAChannel.h"
  35. #if !defined(DMACHANNEL_HAS_BEGIN) || !defined(DMACHANNEL_HAS_BOOLEAN_CTOR)
  36. #error "You need to update DMAChannel.h & DMAChannel.cpp"
  37. #error "https://github.com/PaulStoffregen/cores/blob/master/teensy3/DMAChannel.h"
  38. #error "https://github.com/PaulStoffregen/cores/blob/master/teensy3/DMAChannel.cpp"
  39. #endif
  40. // When changing multiple audio object settings that must update at
  41. // the same time, these functions allow the audio library interrupt
  42. // to be disabled. For example, you may wish to begin playing a note
  43. // in response to reading an analog sensor. If you have "velocity"
  44. // information, you might start the sample playing and also adjust
  45. // the gain of a mixer channel. Use AudioNoInterrupts() first, then
  46. // make both changes to the 2 separate objects. Then allow the audio
  47. // library to update with AudioInterrupts(). Both changes will happen
  48. // at the same time, because AudioNoInterrupts() prevents any updates
  49. // while you make changes.
  50. //
  51. #define AudioNoInterrupts() (NVIC_DISABLE_IRQ(IRQ_SOFTWARE))
  52. #define AudioInterrupts() (NVIC_ENABLE_IRQ(IRQ_SOFTWARE))
  53. // include all the library headers, so a sketch can use a single
  54. // #include <Audio.h> to get the whole library
  55. //
  56. #include "analyze_fft256.h"
  57. #include "analyze_fft1024.h"
  58. #include "analyze_print.h"
  59. #include "analyze_tonedetect.h"
  60. #include "analyze_notefreq.h"
  61. #include "analyze_peak.h"
  62. #include "analyze_rms.h"
  63. #include "control_sgtl5000.h"
  64. #include "control_wm8731.h"
  65. #include "control_ak4558.h"
  66. #include "control_cs4272.h"
  67. #include "effect_bitcrusher.h"
  68. #include "effect_chorus.h"
  69. #include "effect_fade.h"
  70. #include "effect_flange.h"
  71. #include "effect_envelope.h"
  72. #include "effect_multiply.h"
  73. #include "effect_delay.h"
  74. #include "effect_delay_ext.h"
  75. #include "effect_midside.h"
  76. #include "filter_biquad.h"
  77. #include "filter_fir.h"
  78. #include "filter_variable.h"
  79. #include "input_adc.h"
  80. #include "input_i2s.h"
  81. #include "input_i2s_quad.h"
  82. #include "mixer.h"
  83. #include "output_dac.h"
  84. #include "output_i2s.h"
  85. #include "output_i2s_quad.h"
  86. #include "output_pwm.h"
  87. #include "output_spdif.h"
  88. #include "play_memory.h"
  89. #include "play_queue.h"
  90. #include "play_sd_raw.h"
  91. #include "play_sd_wav.h"
  92. #include "play_serialflash_raw.h"
  93. #include "record_queue.h"
  94. #include "synth_tonesweep.h"
  95. #include "synth_sine.h"
  96. #include "synth_waveform.h"
  97. #include "synth_dc.h"
  98. #include "synth_whitenoise.h"
  99. #include "synth_pinknoise.h"
  100. #endif