Browse Source

New classes: Reverb and ReverbAudioSource. Fixes for component alpha levels, mac file chooser, MemoryInputStream.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
e6f64740d9
36 changed files with 1169 additions and 257 deletions
  1. +6
    -0
      Builds/Linux/Makefile
  2. +9
    -1
      Builds/MacOSX/Juce.xcodeproj/project.pbxproj
  3. +3
    -0
      Builds/VisualStudio2005/Juce.vcproj
  4. +3
    -0
      Builds/VisualStudio2008/Juce.vcproj
  5. +3
    -0
      Builds/VisualStudio2008_DLL/Juce.vcproj
  6. +3
    -0
      Builds/VisualStudio2010/Juce.vcxproj
  7. +9
    -0
      Builds/VisualStudio2010/Juce.vcxproj.filters
  8. +9
    -1
      Builds/iOS/Juce.xcodeproj/project.pbxproj
  9. +5
    -0
      Juce.jucer
  10. +1
    -0
      amalgamation/juce_amalgamated_template.cpp
  11. +1
    -1
      extras/Introjucer/Source/Application/jucer_Application.h
  12. +130
    -107
      juce_amalgamated.cpp
  13. +383
    -19
      juce_amalgamated.h
  14. +16
    -51
      src/audio/audio_sources/juce_AudioFormatReaderSource.cpp
  15. +4
    -3
      src/audio/audio_sources/juce_AudioFormatReaderSource.h
  16. +2
    -6
      src/audio/audio_sources/juce_BufferingAudioSource.cpp
  17. +3
    -3
      src/audio/audio_sources/juce_BufferingAudioSource.h
  18. +4
    -9
      src/audio/audio_sources/juce_ChannelRemappingAudioSource.cpp
  19. +3
    -4
      src/audio/audio_sources/juce_ChannelRemappingAudioSource.h
  20. +4
    -8
      src/audio/audio_sources/juce_IIRFilterAudioSource.cpp
  21. +4
    -6
      src/audio/audio_sources/juce_IIRFilterAudioSource.h
  22. +3
    -8
      src/audio/audio_sources/juce_ResamplingAudioSource.cpp
  23. +2
    -2
      src/audio/audio_sources/juce_ResamplingAudioSource.h
  24. +92
    -0
      src/audio/audio_sources/juce_ReverbAudioSource.cpp
  25. +82
    -0
      src/audio/audio_sources/juce_ReverbAudioSource.h
  26. +325
    -0
      src/audio/dsp/juce_Reverb.h
  27. +1
    -1
      src/core/juce_StandardHeader.h
  28. +5
    -5
      src/gui/components/juce_Component.cpp
  29. +4
    -0
      src/gui/graphics/contexts/juce_Graphics.h
  30. +12
    -11
      src/gui/graphics/imaging/juce_ImageFileFormat.cpp
  31. +14
    -9
      src/io/streams/juce_MemoryInputStream.cpp
  32. +3
    -1
      src/io/streams/juce_MemoryInputStream.h
  33. +6
    -0
      src/juce_app_includes.h
  34. +11
    -0
      src/maths/juce_MathsFunctions.h
  35. +1
    -1
      src/native/mac/juce_mac_FileChooser.mm
  36. +3
    -0
      src/native/mac/juce_mac_Fonts.mm

+ 6
- 0
Builds/Linux/Makefile View File

@@ -65,6 +65,7 @@ OBJECTS := \
$(OBJDIR)/juce_IIRFilterAudioSource_807ee8aa.o \
$(OBJDIR)/juce_MixerAudioSource_bc6f772b.o \
$(OBJDIR)/juce_ResamplingAudioSource_8511875e.o \
$(OBJDIR)/juce_ReverbAudioSource_3ae42aa6.o \
$(OBJDIR)/juce_ToneGeneratorAudioSource_77f504b3.o \
$(OBJDIR)/juce_AudioDeviceManager_c24db832.o \
$(OBJDIR)/juce_AudioIODevice_f7da876b.o \
@@ -514,6 +515,11 @@ $(OBJDIR)/juce_ResamplingAudioSource_8511875e.o: ../../src/audio/audio_sources/j
@echo "Compiling juce_ResamplingAudioSource.cpp"
@$(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/juce_ReverbAudioSource_3ae42aa6.o: ../../src/audio/audio_sources/juce_ReverbAudioSource.cpp
-@mkdir -p $(OBJDIR)
@echo "Compiling juce_ReverbAudioSource.cpp"
@$(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/juce_ToneGeneratorAudioSource_77f504b3.o: ../../src/audio/audio_sources/juce_ToneGeneratorAudioSource.cpp
-@mkdir -p $(OBJDIR)
@echo "Compiling juce_ToneGeneratorAudioSource.cpp"


+ 9
- 1
Builds/MacOSX/Juce.xcodeproj/project.pbxproj View File

@@ -32,6 +32,7 @@
6DC6DEEE8A1A6092830A79C8 = { isa = PBXBuildFile; fileRef = D86718CE7E5DEF2071AC3D17; };
2862E190ECA33D2CE1458B51 = { isa = PBXBuildFile; fileRef = 9A8053936C35A19B9E98623A; };
0791EB173E6A9F959E692AA2 = { isa = PBXBuildFile; fileRef = E2A56C23BF2BB466BB273E3E; };
3B64EF7F57EAC5C51460059D = { isa = PBXBuildFile; fileRef = 5403C2A4DEE7B9B3B34235F8; };
16D537EB6D3BFAB3AAB54B11 = { isa = PBXBuildFile; fileRef = 3988438157D4B75177703F8A; };
0C22446F12486AD139A640CB = { isa = PBXBuildFile; fileRef = 6841D6AC927D02113F3AEBD4; };
95CF50482DC7139FCB40EB1C = { isa = PBXBuildFile; fileRef = C7DB1BB9AF7FE0A2AA38D767; };
@@ -420,6 +421,8 @@
C63D6EC0555C13C1B79A6AAD = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_PositionableAudioSource.h; path = ../../src/audio/audio_sources/juce_PositionableAudioSource.h; sourceTree = SOURCE_ROOT; };
E2A56C23BF2BB466BB273E3E = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ResamplingAudioSource.cpp; path = ../../src/audio/audio_sources/juce_ResamplingAudioSource.cpp; sourceTree = SOURCE_ROOT; };
BE5DB55285441D501FED3C00 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ResamplingAudioSource.h; path = ../../src/audio/audio_sources/juce_ResamplingAudioSource.h; sourceTree = SOURCE_ROOT; };
5403C2A4DEE7B9B3B34235F8 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ReverbAudioSource.cpp; path = ../../src/audio/audio_sources/juce_ReverbAudioSource.cpp; sourceTree = SOURCE_ROOT; };
0F70C4D118AC7625B4C42CD4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ReverbAudioSource.h; path = ../../src/audio/audio_sources/juce_ReverbAudioSource.h; sourceTree = SOURCE_ROOT; };
3988438157D4B75177703F8A = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ToneGeneratorAudioSource.cpp; path = ../../src/audio/audio_sources/juce_ToneGeneratorAudioSource.cpp; sourceTree = SOURCE_ROOT; };
6AC857F51FD805D7BD3EF712 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ToneGeneratorAudioSource.h; path = ../../src/audio/audio_sources/juce_ToneGeneratorAudioSource.h; sourceTree = SOURCE_ROOT; };
6841D6AC927D02113F3AEBD4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_AudioDeviceManager.cpp; path = ../../src/audio/devices/juce_AudioDeviceManager.cpp; sourceTree = SOURCE_ROOT; };
@@ -435,6 +438,7 @@
11C1A96A35A2F03F8C34BD43 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Decibels.h; path = ../../src/audio/dsp/juce_Decibels.h; sourceTree = SOURCE_ROOT; };
E68EB4BC75216B5B56E3F937 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_IIRFilter.cpp; path = ../../src/audio/dsp/juce_IIRFilter.cpp; sourceTree = SOURCE_ROOT; };
EE2259D9768027C2C001EEAD = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_IIRFilter.h; path = ../../src/audio/dsp/juce_IIRFilter.h; sourceTree = SOURCE_ROOT; };
2C55CE1674244DB199C3033F = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Reverb.h; path = ../../src/audio/dsp/juce_Reverb.h; sourceTree = SOURCE_ROOT; };
B457515938E7141D5E79B671 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_MidiBuffer.cpp; path = ../../src/audio/midi/juce_MidiBuffer.cpp; sourceTree = SOURCE_ROOT; };
0604C2E17F0E0DFEFDA19F8D = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MidiBuffer.h; path = ../../src/audio/midi/juce_MidiBuffer.h; sourceTree = SOURCE_ROOT; };
891E0B1AD09C0EA44297E0F2 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_MidiFile.cpp; path = ../../src/audio/midi/juce_MidiFile.cpp; sourceTree = SOURCE_ROOT; };
@@ -1158,6 +1162,8 @@
C63D6EC0555C13C1B79A6AAD,
E2A56C23BF2BB466BB273E3E,
BE5DB55285441D501FED3C00,
5403C2A4DEE7B9B3B34235F8,
0F70C4D118AC7625B4C42CD4,
3988438157D4B75177703F8A,
6AC857F51FD805D7BD3EF712 ); name = audio_sources; sourceTree = "<group>"; };
BF8F3D00CE4E97468E8BBC55 = { isa = PBXGroup; children = (
@@ -1174,7 +1180,8 @@
812620B53BE820D26A63B65D,
11C1A96A35A2F03F8C34BD43,
E68EB4BC75216B5B56E3F937,
EE2259D9768027C2C001EEAD ); name = dsp; sourceTree = "<group>"; };
EE2259D9768027C2C001EEAD,
2C55CE1674244DB199C3033F ); name = dsp; sourceTree = "<group>"; };
99B60B012D5CCF0BD861011D = { isa = PBXGroup; children = (
B457515938E7141D5E79B671,
0604C2E17F0E0DFEFDA19F8D,
@@ -2063,6 +2070,7 @@
6DC6DEEE8A1A6092830A79C8,
2862E190ECA33D2CE1458B51,
0791EB173E6A9F959E692AA2,
3B64EF7F57EAC5C51460059D,
16D537EB6D3BFAB3AAB54B11,
0C22446F12486AD139A640CB,
95CF50482DC7139FCB40EB1C,


+ 3
- 0
Builds/VisualStudio2005/Juce.vcproj View File

@@ -162,6 +162,8 @@
<File RelativePath="..\..\src\audio\audio_sources\juce_PositionableAudioSource.h"/>
<File RelativePath="..\..\src\audio\audio_sources\juce_ResamplingAudioSource.cpp"/>
<File RelativePath="..\..\src\audio\audio_sources\juce_ResamplingAudioSource.h"/>
<File RelativePath="..\..\src\audio\audio_sources\juce_ReverbAudioSource.cpp"/>
<File RelativePath="..\..\src\audio\audio_sources\juce_ReverbAudioSource.h"/>
<File RelativePath="..\..\src\audio\audio_sources\juce_ToneGeneratorAudioSource.cpp"/>
<File RelativePath="..\..\src\audio\audio_sources\juce_ToneGeneratorAudioSource.h"/>
</Filter>
@@ -181,6 +183,7 @@
<File RelativePath="..\..\src\audio\dsp\juce_Decibels.h"/>
<File RelativePath="..\..\src\audio\dsp\juce_IIRFilter.cpp"/>
<File RelativePath="..\..\src\audio\dsp\juce_IIRFilter.h"/>
<File RelativePath="..\..\src\audio\dsp\juce_Reverb.h"/>
</Filter>
<Filter Name="midi">
<File RelativePath="..\..\src\audio\midi\juce_MidiBuffer.cpp"/>


+ 3
- 0
Builds/VisualStudio2008/Juce.vcproj View File

@@ -162,6 +162,8 @@
<File RelativePath="..\..\src\audio\audio_sources\juce_PositionableAudioSource.h"/>
<File RelativePath="..\..\src\audio\audio_sources\juce_ResamplingAudioSource.cpp"/>
<File RelativePath="..\..\src\audio\audio_sources\juce_ResamplingAudioSource.h"/>
<File RelativePath="..\..\src\audio\audio_sources\juce_ReverbAudioSource.cpp"/>
<File RelativePath="..\..\src\audio\audio_sources\juce_ReverbAudioSource.h"/>
<File RelativePath="..\..\src\audio\audio_sources\juce_ToneGeneratorAudioSource.cpp"/>
<File RelativePath="..\..\src\audio\audio_sources\juce_ToneGeneratorAudioSource.h"/>
</Filter>
@@ -181,6 +183,7 @@
<File RelativePath="..\..\src\audio\dsp\juce_Decibels.h"/>
<File RelativePath="..\..\src\audio\dsp\juce_IIRFilter.cpp"/>
<File RelativePath="..\..\src\audio\dsp\juce_IIRFilter.h"/>
<File RelativePath="..\..\src\audio\dsp\juce_Reverb.h"/>
</Filter>
<Filter Name="midi">
<File RelativePath="..\..\src\audio\midi\juce_MidiBuffer.cpp"/>


+ 3
- 0
Builds/VisualStudio2008_DLL/Juce.vcproj View File

@@ -164,6 +164,8 @@
<File RelativePath="..\..\src\audio\audio_sources\juce_PositionableAudioSource.h"/>
<File RelativePath="..\..\src\audio\audio_sources\juce_ResamplingAudioSource.cpp"/>
<File RelativePath="..\..\src\audio\audio_sources\juce_ResamplingAudioSource.h"/>
<File RelativePath="..\..\src\audio\audio_sources\juce_ReverbAudioSource.cpp"/>
<File RelativePath="..\..\src\audio\audio_sources\juce_ReverbAudioSource.h"/>
<File RelativePath="..\..\src\audio\audio_sources\juce_ToneGeneratorAudioSource.cpp"/>
<File RelativePath="..\..\src\audio\audio_sources\juce_ToneGeneratorAudioSource.h"/>
</Filter>
@@ -183,6 +185,7 @@
<File RelativePath="..\..\src\audio\dsp\juce_Decibels.h"/>
<File RelativePath="..\..\src\audio\dsp\juce_IIRFilter.cpp"/>
<File RelativePath="..\..\src\audio\dsp\juce_IIRFilter.h"/>
<File RelativePath="..\..\src\audio\dsp\juce_Reverb.h"/>
</Filter>
<Filter Name="midi">
<File RelativePath="..\..\src\audio\midi\juce_MidiBuffer.cpp"/>


+ 3
- 0
Builds/VisualStudio2010/Juce.vcxproj View File

@@ -148,6 +148,7 @@
<ClCompile Include="..\..\src\audio\audio_sources\juce_IIRFilterAudioSource.cpp"/>
<ClCompile Include="..\..\src\audio\audio_sources\juce_MixerAudioSource.cpp"/>
<ClCompile Include="..\..\src\audio\audio_sources\juce_ResamplingAudioSource.cpp"/>
<ClCompile Include="..\..\src\audio\audio_sources\juce_ReverbAudioSource.cpp"/>
<ClCompile Include="..\..\src\audio\audio_sources\juce_ToneGeneratorAudioSource.cpp"/>
<ClCompile Include="..\..\src\audio\devices\juce_AudioDeviceManager.cpp"/>
<ClCompile Include="..\..\src\audio\devices\juce_AudioIODevice.cpp"/>
@@ -483,6 +484,7 @@
<ClInclude Include="..\..\src\audio\audio_sources\juce_MixerAudioSource.h"/>
<ClInclude Include="..\..\src\audio\audio_sources\juce_PositionableAudioSource.h"/>
<ClInclude Include="..\..\src\audio\audio_sources\juce_ResamplingAudioSource.h"/>
<ClInclude Include="..\..\src\audio\audio_sources\juce_ReverbAudioSource.h"/>
<ClInclude Include="..\..\src\audio\audio_sources\juce_ToneGeneratorAudioSource.h"/>
<ClInclude Include="..\..\src\audio\devices\juce_AudioDeviceManager.h"/>
<ClInclude Include="..\..\src\audio\devices\juce_AudioIODevice.h"/>
@@ -491,6 +493,7 @@
<ClInclude Include="..\..\src\audio\dsp\juce_AudioSampleBuffer.h"/>
<ClInclude Include="..\..\src\audio\dsp\juce_Decibels.h"/>
<ClInclude Include="..\..\src\audio\dsp\juce_IIRFilter.h"/>
<ClInclude Include="..\..\src\audio\dsp\juce_Reverb.h"/>
<ClInclude Include="..\..\src\audio\midi\juce_MidiBuffer.h"/>
<ClInclude Include="..\..\src\audio\midi\juce_MidiFile.h"/>
<ClInclude Include="..\..\src\audio\midi\juce_MidiInput.h"/>


+ 9
- 0
Builds/VisualStudio2010/Juce.vcxproj.filters View File

@@ -265,6 +265,9 @@
<ClCompile Include="..\..\src\audio\audio_sources\juce_ResamplingAudioSource.cpp">
<Filter>Juce\Source\audio\audio_sources</Filter>
</ClCompile>
<ClCompile Include="..\..\src\audio\audio_sources\juce_ReverbAudioSource.cpp">
<Filter>Juce\Source\audio\audio_sources</Filter>
</ClCompile>
<ClCompile Include="..\..\src\audio\audio_sources\juce_ToneGeneratorAudioSource.cpp">
<Filter>Juce\Source\audio\audio_sources</Filter>
</ClCompile>
@@ -1380,6 +1383,9 @@
<ClInclude Include="..\..\src\audio\audio_sources\juce_ResamplingAudioSource.h">
<Filter>Juce\Source\audio\audio_sources</Filter>
</ClInclude>
<ClInclude Include="..\..\src\audio\audio_sources\juce_ReverbAudioSource.h">
<Filter>Juce\Source\audio\audio_sources</Filter>
</ClInclude>
<ClInclude Include="..\..\src\audio\audio_sources\juce_ToneGeneratorAudioSource.h">
<Filter>Juce\Source\audio\audio_sources</Filter>
</ClInclude>
@@ -1404,6 +1410,9 @@
<ClInclude Include="..\..\src\audio\dsp\juce_IIRFilter.h">
<Filter>Juce\Source\audio\dsp</Filter>
</ClInclude>
<ClInclude Include="..\..\src\audio\dsp\juce_Reverb.h">
<Filter>Juce\Source\audio\dsp</Filter>
</ClInclude>
<ClInclude Include="..\..\src\audio\midi\juce_MidiBuffer.h">
<Filter>Juce\Source\audio\midi</Filter>
</ClInclude>


+ 9
- 1
Builds/iOS/Juce.xcodeproj/project.pbxproj View File

@@ -32,6 +32,7 @@
6DC6DEEE8A1A6092830A79C8 = { isa = PBXBuildFile; fileRef = D86718CE7E5DEF2071AC3D17; };
2862E190ECA33D2CE1458B51 = { isa = PBXBuildFile; fileRef = 9A8053936C35A19B9E98623A; };
0791EB173E6A9F959E692AA2 = { isa = PBXBuildFile; fileRef = E2A56C23BF2BB466BB273E3E; };
3B64EF7F57EAC5C51460059D = { isa = PBXBuildFile; fileRef = 5403C2A4DEE7B9B3B34235F8; };
16D537EB6D3BFAB3AAB54B11 = { isa = PBXBuildFile; fileRef = 3988438157D4B75177703F8A; };
0C22446F12486AD139A640CB = { isa = PBXBuildFile; fileRef = 6841D6AC927D02113F3AEBD4; };
95CF50482DC7139FCB40EB1C = { isa = PBXBuildFile; fileRef = C7DB1BB9AF7FE0A2AA38D767; };
@@ -420,6 +421,8 @@
C63D6EC0555C13C1B79A6AAD = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_PositionableAudioSource.h; path = ../../src/audio/audio_sources/juce_PositionableAudioSource.h; sourceTree = SOURCE_ROOT; };
E2A56C23BF2BB466BB273E3E = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ResamplingAudioSource.cpp; path = ../../src/audio/audio_sources/juce_ResamplingAudioSource.cpp; sourceTree = SOURCE_ROOT; };
BE5DB55285441D501FED3C00 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ResamplingAudioSource.h; path = ../../src/audio/audio_sources/juce_ResamplingAudioSource.h; sourceTree = SOURCE_ROOT; };
5403C2A4DEE7B9B3B34235F8 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ReverbAudioSource.cpp; path = ../../src/audio/audio_sources/juce_ReverbAudioSource.cpp; sourceTree = SOURCE_ROOT; };
0F70C4D118AC7625B4C42CD4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ReverbAudioSource.h; path = ../../src/audio/audio_sources/juce_ReverbAudioSource.h; sourceTree = SOURCE_ROOT; };
3988438157D4B75177703F8A = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ToneGeneratorAudioSource.cpp; path = ../../src/audio/audio_sources/juce_ToneGeneratorAudioSource.cpp; sourceTree = SOURCE_ROOT; };
6AC857F51FD805D7BD3EF712 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ToneGeneratorAudioSource.h; path = ../../src/audio/audio_sources/juce_ToneGeneratorAudioSource.h; sourceTree = SOURCE_ROOT; };
6841D6AC927D02113F3AEBD4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_AudioDeviceManager.cpp; path = ../../src/audio/devices/juce_AudioDeviceManager.cpp; sourceTree = SOURCE_ROOT; };
@@ -435,6 +438,7 @@
11C1A96A35A2F03F8C34BD43 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Decibels.h; path = ../../src/audio/dsp/juce_Decibels.h; sourceTree = SOURCE_ROOT; };
E68EB4BC75216B5B56E3F937 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_IIRFilter.cpp; path = ../../src/audio/dsp/juce_IIRFilter.cpp; sourceTree = SOURCE_ROOT; };
EE2259D9768027C2C001EEAD = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_IIRFilter.h; path = ../../src/audio/dsp/juce_IIRFilter.h; sourceTree = SOURCE_ROOT; };
2C55CE1674244DB199C3033F = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Reverb.h; path = ../../src/audio/dsp/juce_Reverb.h; sourceTree = SOURCE_ROOT; };
B457515938E7141D5E79B671 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_MidiBuffer.cpp; path = ../../src/audio/midi/juce_MidiBuffer.cpp; sourceTree = SOURCE_ROOT; };
0604C2E17F0E0DFEFDA19F8D = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MidiBuffer.h; path = ../../src/audio/midi/juce_MidiBuffer.h; sourceTree = SOURCE_ROOT; };
891E0B1AD09C0EA44297E0F2 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_MidiFile.cpp; path = ../../src/audio/midi/juce_MidiFile.cpp; sourceTree = SOURCE_ROOT; };
@@ -1158,6 +1162,8 @@
C63D6EC0555C13C1B79A6AAD,
E2A56C23BF2BB466BB273E3E,
BE5DB55285441D501FED3C00,
5403C2A4DEE7B9B3B34235F8,
0F70C4D118AC7625B4C42CD4,
3988438157D4B75177703F8A,
6AC857F51FD805D7BD3EF712 ); name = audio_sources; sourceTree = "<group>"; };
BF8F3D00CE4E97468E8BBC55 = { isa = PBXGroup; children = (
@@ -1174,7 +1180,8 @@
812620B53BE820D26A63B65D,
11C1A96A35A2F03F8C34BD43,
E68EB4BC75216B5B56E3F937,
EE2259D9768027C2C001EEAD ); name = dsp; sourceTree = "<group>"; };
EE2259D9768027C2C001EEAD,
2C55CE1674244DB199C3033F ); name = dsp; sourceTree = "<group>"; };
99B60B012D5CCF0BD861011D = { isa = PBXGroup; children = (
B457515938E7141D5E79B671,
0604C2E17F0E0DFEFDA19F8D,
@@ -2067,6 +2074,7 @@
6DC6DEEE8A1A6092830A79C8,
2862E190ECA33D2CE1458B51,
0791EB173E6A9F959E692AA2,
3B64EF7F57EAC5C51460059D,
16D537EB6D3BFAB3AAB54B11,
0C22446F12486AD139A640CB,
95CF50482DC7139FCB40EB1C,


+ 5
- 0
Juce.jucer View File

@@ -155,6 +155,10 @@
resource="0" file="src/audio/audio_sources/juce_ResamplingAudioSource.cpp"/>
<FILE id="OwBLFkBfi" name="juce_ResamplingAudioSource.h" compile="0"
resource="0" file="src/audio/audio_sources/juce_ResamplingAudioSource.h"/>
<FILE id="c0kck4" name="juce_ReverbAudioSource.cpp" compile="1" resource="0"
file="src/audio/audio_sources/juce_ReverbAudioSource.cpp"/>
<FILE id="e6MDHO" name="juce_ReverbAudioSource.h" compile="0" resource="0"
file="src/audio/audio_sources/juce_ReverbAudioSource.h"/>
<FILE id="VfalfqDz" name="juce_ToneGeneratorAudioSource.cpp" compile="1"
resource="0" file="src/audio/audio_sources/juce_ToneGeneratorAudioSource.cpp"/>
<FILE id="8tIYggXl2" name="juce_ToneGeneratorAudioSource.h" compile="0"
@@ -189,6 +193,7 @@
file="src/audio/dsp/juce_IIRFilter.cpp"/>
<FILE id="Vu9xVqUfN" name="juce_IIRFilter.h" compile="0" resource="0"
file="src/audio/dsp/juce_IIRFilter.h"/>
<FILE id="niPdbF" name="juce_Reverb.h" compile="0" resource="0" file="src/audio/dsp/juce_Reverb.h"/>
</GROUP>
<GROUP id="XmZUIie8o" name="midi">
<FILE id="aVLir6CLm" name="juce_MidiBuffer.cpp" compile="1" resource="0"


+ 1
- 0
amalgamation/juce_amalgamated_template.cpp View File

@@ -184,6 +184,7 @@
#include "../src/audio/audio_sources/juce_BufferingAudioSource.cpp"
#include "../src/audio/audio_sources/juce_ChannelRemappingAudioSource.cpp"
#include "../src/audio/audio_sources/juce_IIRFilterAudioSource.cpp"
#include "../src/audio/audio_sources/juce_ReverbAudioSource.cpp"
#include "../src/audio/audio_sources/juce_MixerAudioSource.cpp"
#include "../src/audio/audio_sources/juce_ResamplingAudioSource.cpp"
#include "../src/audio/audio_sources/juce_ToneGeneratorAudioSource.cpp"


+ 1
- 1
extras/Introjucer/Source/Application/jucer_Application.h View File

@@ -127,7 +127,7 @@ public:
//==============================================================================
const String getApplicationName()
{
return "The Jucer V" + getApplicationVersion();
return String (ProjectInfo::projectName) + " " + getApplicationVersion();
}
const String getApplicationVersion()


+ 130
- 107
juce_amalgamated.cpp View File

@@ -10273,10 +10273,7 @@ MemoryInputStream::MemoryInputStream (const void* const sourceData,
position (0)
{
if (keepInternalCopy)
{
internalCopy.append (data, sourceDataSize);
data = static_cast <const char*> (internalCopy.getData());
}
createInternalCopy();
}

MemoryInputStream::MemoryInputStream (const MemoryBlock& sourceData,
@@ -10286,10 +10283,14 @@ MemoryInputStream::MemoryInputStream (const MemoryBlock& sourceData,
position (0)
{
if (keepInternalCopy)
{
internalCopy = sourceData;
data = static_cast <const char*> (internalCopy.getData());
}
createInternalCopy();
}

void MemoryInputStream::createInternalCopy()
{
internalCopy.malloc (dataSize);
memcpy (internalCopy, data, dataSize);
data = internalCopy;
}

MemoryInputStream::~MemoryInputStream()
@@ -10305,6 +10306,9 @@ int MemoryInputStream::read (void* const buffer, const int howMany)
{
jassert (howMany >= 0);
const int num = jmin (howMany, (int) (dataSize - position));
if (num <= 0)
return 0;

memcpy (buffer, data + position, num);
position += num;
return (int) num;
@@ -10312,7 +10316,7 @@ int MemoryInputStream::read (void* const buffer, const int howMany)

bool MemoryInputStream::isExhausted()
{
return (position >= dataSize);
return position >= dataSize;
}

bool MemoryInputStream::setPosition (const int64 pos)
@@ -24323,29 +24327,18 @@ BEGIN_JUCE_NAMESPACE

AudioFormatReaderSource::AudioFormatReaderSource (AudioFormatReader* const reader_,
const bool deleteReaderWhenThisIsDeleted)
: reader (reader_),
deleteReader (deleteReaderWhenThisIsDeleted),
: reader (reader_, deleteReaderWhenThisIsDeleted),
nextPlayPos (0),
looping (false)
{
jassert (reader != nullptr);
}

AudioFormatReaderSource::~AudioFormatReaderSource()
{
if (deleteReader)
delete reader;
}

void AudioFormatReaderSource::setNextReadPosition (int64 newPosition)
{
nextPlayPos = newPosition;
}
AudioFormatReaderSource::~AudioFormatReaderSource() {}

void AudioFormatReaderSource::setLooping (bool shouldLoop)
{
looping = shouldLoop;
}
int64 AudioFormatReaderSource::getTotalLength() const { return reader->lengthInSamples; }
void AudioFormatReaderSource::setNextReadPosition (int64 newPosition) { nextPlayPos = newPosition; }
void AudioFormatReaderSource::setLooping (bool shouldLoop) { looping = shouldLoop; }

int64 AudioFormatReaderSource::getNextReadPosition() const
{
@@ -24353,19 +24346,8 @@ int64 AudioFormatReaderSource::getNextReadPosition() const
: nextPlayPos;
}

int64 AudioFormatReaderSource::getTotalLength() const
{
return reader->lengthInSamples;
}

void AudioFormatReaderSource::prepareToPlay (int /*samplesPerBlockExpected*/,
double /*sampleRate*/)
{
}

void AudioFormatReaderSource::releaseResources()
{
}
void AudioFormatReaderSource::prepareToPlay (int /*samplesPerBlockExpected*/, double /*sampleRate*/) {}
void AudioFormatReaderSource::releaseResources() {}

void AudioFormatReaderSource::getNextAudioBlock (const AudioSourceChannelInfo& info)
{
@@ -24380,39 +24362,26 @@ void AudioFormatReaderSource::getNextAudioBlock (const AudioSourceChannelInfo& i

if (newEnd > newStart)
{
info.buffer->readFromAudioReader (reader,
info.startSample,
newEnd - newStart,
newStart,
true, true);
info.buffer->readFromAudioReader (reader, info.startSample,
newEnd - newStart, newStart, true, true);
}
else
{
const int endSamps = (int) reader->lengthInSamples - newStart;

info.buffer->readFromAudioReader (reader,
info.startSample,
endSamps,
newStart,
true, true);
info.buffer->readFromAudioReader (reader, info.startSample,
endSamps, newStart, true, true);

info.buffer->readFromAudioReader (reader,
info.startSample + endSamps,
newEnd,
0,
true, true);
info.buffer->readFromAudioReader (reader, info.startSample + endSamps,
newEnd, 0, true, true);
}

nextPlayPos = newEnd;
}
else
{
info.buffer->readFromAudioReader (reader,
info.startSample,
info.numSamples,
start,
true, true);

info.buffer->readFromAudioReader (reader, info.startSample,
info.numSamples, start, true, true);
nextPlayPos += info.numSamples;
}
}
@@ -24954,11 +24923,10 @@ private:
juce_ImplementSingleton (SharedBufferingAudioSourceThread)

BufferingAudioSource::BufferingAudioSource (PositionableAudioSource* source_,
const bool deleteSourceWhenDeleted_,
const bool deleteSourceWhenDeleted,
const int numberOfSamplesToBuffer_,
const int numberOfChannels_)
: source (source_),
deleteSourceWhenDeleted (deleteSourceWhenDeleted_),
: source (source_, deleteSourceWhenDeleted),
numberOfSamplesToBuffer (jmax (1024, numberOfSamplesToBuffer_)),
numberOfChannels (numberOfChannels_),
buffer (numberOfChannels_, 0),
@@ -24979,9 +24947,6 @@ BufferingAudioSource::~BufferingAudioSource()

if (thread != nullptr)
thread->removeSource (this);

if (deleteSourceWhenDeleted)
delete source;
}

void BufferingAudioSource::prepareToPlay (int samplesPerBlockExpected, double sampleRate_)
@@ -25203,21 +25168,16 @@ END_JUCE_NAMESPACE
BEGIN_JUCE_NAMESPACE

ChannelRemappingAudioSource::ChannelRemappingAudioSource (AudioSource* const source_,
const bool deleteSourceWhenDeleted_)
: requiredNumberOfChannels (2),
source (source_),
deleteSourceWhenDeleted (deleteSourceWhenDeleted_),
const bool deleteSourceWhenDeleted)
: source (source_, deleteSourceWhenDeleted),
requiredNumberOfChannels (2),
buffer (2, 16)
{
remappedInfo.buffer = &buffer;
remappedInfo.startSample = 0;
}

ChannelRemappingAudioSource::~ChannelRemappingAudioSource()
{
if (deleteSourceWhenDeleted)
delete source;
}
ChannelRemappingAudioSource::~ChannelRemappingAudioSource() {}

void ChannelRemappingAudioSource::setNumberOfChannelsToProduce (const int requiredNumberOfChannels_)
{
@@ -25379,9 +25339,8 @@ END_JUCE_NAMESPACE
BEGIN_JUCE_NAMESPACE

IIRFilterAudioSource::IIRFilterAudioSource (AudioSource* const inputSource,
const bool deleteInputWhenDeleted_)
: input (inputSource),
deleteInputWhenDeleted (deleteInputWhenDeleted_)
const bool deleteInputWhenDeleted)
: input (inputSource, deleteInputWhenDeleted)
{
jassert (inputSource != nullptr);

@@ -25389,11 +25348,7 @@ IIRFilterAudioSource::IIRFilterAudioSource (AudioSource* const inputSource,
iirFilters.add (new IIRFilter());
}

IIRFilterAudioSource::~IIRFilterAudioSource()
{
if (deleteInputWhenDeleted)
delete input;
}
IIRFilterAudioSource::~IIRFilterAudioSource() {}

void IIRFilterAudioSource::setFilterParameters (const IIRFilter& newSettings)
{
@@ -25434,6 +25389,71 @@ END_JUCE_NAMESPACE
/*** End of inlined file: juce_IIRFilterAudioSource.cpp ***/


/*** Start of inlined file: juce_ReverbAudioSource.cpp ***/
BEGIN_JUCE_NAMESPACE

ReverbAudioSource::ReverbAudioSource (AudioSource* const inputSource, const bool deleteInputWhenDeleted)
: input (inputSource, deleteInputWhenDeleted),
bypass (false)
{
jassert (inputSource != nullptr);
}

ReverbAudioSource::~ReverbAudioSource() {}

void ReverbAudioSource::prepareToPlay (int samplesPerBlockExpected, double sampleRate)
{
const ScopedLock sl (lock);
input->prepareToPlay (samplesPerBlockExpected, sampleRate);
reverb.setSampleRate (sampleRate);
}

void ReverbAudioSource::releaseResources() {}

void ReverbAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill)
{
const ScopedLock sl (lock);

input->getNextAudioBlock (bufferToFill);

if (! bypass)
{
float* const firstChannel = bufferToFill.buffer->getSampleData (0, bufferToFill.startSample);

if (bufferToFill.buffer->getNumChannels() > 1)
{
reverb.processStereo (firstChannel,
bufferToFill.buffer->getSampleData (1, bufferToFill.startSample),
bufferToFill.numSamples);
}
else
{
reverb.processMono (firstChannel, bufferToFill.numSamples);
}
}
}

void ReverbAudioSource::setParameters (const Reverb::Parameters& newParams)
{
const ScopedLock sl (lock);
reverb.setParameters (newParams);
}

void ReverbAudioSource::setBypassed (bool isBypassed) noexcept
{
if (bypass != isBypassed)
{
const ScopedLock sl (lock);
bypass = isBypassed;
reverb.reset();
}
}

END_JUCE_NAMESPACE

/*** End of inlined file: juce_ReverbAudioSource.cpp ***/


/*** Start of inlined file: juce_MixerAudioSource.cpp ***/
BEGIN_JUCE_NAMESPACE

@@ -25581,10 +25601,9 @@ END_JUCE_NAMESPACE
BEGIN_JUCE_NAMESPACE

ResamplingAudioSource::ResamplingAudioSource (AudioSource* const inputSource,
const bool deleteInputWhenDeleted_,
const bool deleteInputWhenDeleted,
const int numChannels_)
: input (inputSource),
deleteInputWhenDeleted (deleteInputWhenDeleted_),
: input (inputSource, deleteInputWhenDeleted),
ratio (1.0),
lastRatio (1.0),
buffer (numChannels_, 0),
@@ -25594,11 +25613,7 @@ ResamplingAudioSource::ResamplingAudioSource (AudioSource* const inputSource,
jassert (input != nullptr);
}

ResamplingAudioSource::~ResamplingAudioSource()
{
if (deleteInputWhenDeleted)
delete input;
}
ResamplingAudioSource::~ResamplingAudioSource() {}

void ResamplingAudioSource::setResamplingRatio (const double samplesInPerOutputSample)
{
@@ -42111,7 +42126,7 @@ void Component::paintComponent (Graphics& g)
paint (imG);
}

g.setColour (Colours::black.withAlpha (getAlpha()));
g.setColour (Colours::black);
g.drawImageAt (bufferedImage, 0, 0);
}
else
@@ -42202,9 +42217,9 @@ void Component::paintEntireComponent (Graphics& g, const bool ignoreAlphaLevel)
{
jassert (! g.isClipEmpty());

#if JUCE_DEBUG
#if JUCE_DEBUG
flags.isInsidePaintCall = true;
#endif
#endif

if (effect != nullptr)
{
@@ -42231,9 +42246,9 @@ void Component::paintEntireComponent (Graphics& g, const bool ignoreAlphaLevel)
paintComponentAndChildren (g);
}

#if JUCE_DEBUG
#if JUCE_DEBUG
flags.isInsidePaintCall = false;
#endif
#endif
}

void Component::setPaintingIsUnclipped (const bool shouldPaintWithoutClipping) noexcept
@@ -97618,22 +97633,24 @@ END_JUCE_NAMESPACE
/*** Start of inlined file: juce_ImageFileFormat.cpp ***/
BEGIN_JUCE_NAMESPACE

ImageFileFormat* ImageFileFormat::findImageFormatForStream (InputStream& input)
struct DefaultImageFormats
{
static PNGImageFormat png;
static JPEGImageFormat jpg;
static GIFImageFormat gif;
PNGImageFormat png;
JPEGImageFormat jpg;
GIFImageFormat gif;
};

ImageFileFormat* formats[4];
int numFormats = 0;
static DefaultImageFormats defaultImageFormats;

formats [numFormats++] = &png;
formats [numFormats++] = &jpg;
formats [numFormats++] = &gif;
ImageFileFormat* ImageFileFormat::findImageFormatForStream (InputStream& input)
{
ImageFileFormat* formats[] = { &defaultImageFormats.png,
&defaultImageFormats.jpg,
&defaultImageFormats.gif };

const int64 streamPos = input.getPosition();

for (int i = 0; i < numFormats; ++i)
for (int i = 0; i < numElementsInArray (formats); ++i)
{
const bool found = formats[i]->canUnderstand (input);
input.setPosition (streamPos);
@@ -272259,6 +272276,9 @@ public:
jassert (path.isEmpty()); // we might need to apply a transform to the path, so this must be empty

CGPathRef pathRef = CTFontCreatePathForGlyph (ctFontRef, (CGGlyph) glyphNumber, &renderingTransform);
if (pathRef == 0)
return false;

CGPathApply (pathRef, &path, pathApplier);
CFRelease (pathRef);

@@ -274948,7 +274968,7 @@ using namespace JUCE_NAMESPACE;
if (f.getFileName().matchesWildcard ((*filters)[i], true))
return true;

return f.isDirectory();
return f.isDirectory() && ! [[NSWorkspace sharedWorkspace] isFilePackageAtPath: filename];
}
@end

@@ -277296,6 +277316,9 @@ public:
jassert (path.isEmpty()); // we might need to apply a transform to the path, so this must be empty

CGPathRef pathRef = CTFontCreatePathForGlyph (ctFontRef, (CGGlyph) glyphNumber, &renderingTransform);
if (pathRef == 0)
return false;

CGPathApply (pathRef, &path, pathApplier);
CFRelease (pathRef);

@@ -282056,7 +282079,7 @@ using namespace JUCE_NAMESPACE;
if (f.getFileName().matchesWildcard ((*filters)[i], true))
return true;

return f.isDirectory();
return f.isDirectory() && ! [[NSWorkspace sharedWorkspace] isFilePackageAtPath: filename];
}
@end



+ 383
- 19
juce_amalgamated.h View File

@@ -73,7 +73,7 @@ namespace JuceDummyNamespace {}
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 53
#define JUCE_BUILDNUMBER 91
#define JUCE_BUILDNUMBER 92

/** Current Juce version number.

@@ -1350,6 +1350,16 @@ inline int roundFloatToInt (const float value) noexcept
return roundToInt (value);
}

#if (JUCE_INTEL && JUCE_32BIT) || defined (DOXYGEN)
/** This macro can be applied to a float variable to check whether it contains a denormalised
value, and to normalise it if necessary.
On CPUs that aren't vulnerable to denormalisation problems, this will have no effect.
*/
#define JUCE_UNDENORMALISE(x) x += 1.0f; x -= 1.0f;
#else
#define JUCE_UNDENORMALISE(x)
#endif

/** This namespace contains a few template classes for helping work out class type variations.
*/
namespace TypeHelpers
@@ -20988,7 +20998,9 @@ private:

const char* data;
size_t dataSize, position;
MemoryBlock internalCopy;
HeapBlock<char> internalCopy;

void createInternalCopy();

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MemoryInputStream);
};
@@ -29257,6 +29269,8 @@ public:

The x position is an integer, but the top and bottom of the line can be sub-pixel
positions, and these will be anti-aliased if necessary.

The bottom parameter must be greater than or equal to the top parameter.
*/
void drawVerticalLine (int x, float top, float bottom) const;

@@ -29264,6 +29278,8 @@ public:

The y position is an integer, but the left and right ends of the line can be sub-pixel
positions, and these will be anti-aliased if necessary.

The right parameter must be greater than or equal to the left parameter.
*/
void drawHorizontalLine (int y, float left, float right) const;

@@ -37982,7 +37998,8 @@ public:

/** Creates an AudioFormatReaderSource for a given reader.

@param sourceReader the reader to use as the data source
@param sourceReader the reader to use as the data source - this must
not be null
@param deleteReaderWhenThisIsDeleted if true, the reader passed-in will be deleted
when this object is deleted; if false it will be
left up to the caller to manage its lifetime
@@ -38028,8 +38045,7 @@ public:

private:

AudioFormatReader* reader;
bool deleteReader;
OptionalScopedPointer<AudioFormatReader> reader;

int64 volatile nextPlayPos;
bool volatile looping;
@@ -38506,14 +38522,13 @@ public:

private:

PositionableAudioSource* source;
bool deleteSourceWhenDeleted;
OptionalScopedPointer<PositionableAudioSource> source;
int numberOfSamplesToBuffer, numberOfChannels;
AudioSampleBuffer buffer;
CriticalSection bufferStartPosLock;
int64 volatile bufferValidStart, bufferValidEnd, nextPlayPos;
bool wasSourceLooping;
double volatile sampleRate;
bool wasSourceLooping;

friend class SharedBufferingAudioSourceThread;
bool readNextBufferChunk();
@@ -38576,8 +38591,7 @@ public:

private:

AudioSource* const input;
const bool deleteInputWhenDeleted;
OptionalScopedPointer<AudioSource> input;
double ratio, lastRatio;
AudioSampleBuffer buffer;
int bufferPos, sampsInBuffer;
@@ -38862,11 +38876,9 @@ public:

private:

int requiredNumberOfChannels;
OptionalScopedPointer<AudioSource> source;
Array <int> remappedInputs, remappedOutputs;

AudioSource* const source;
const bool deleteSourceWhenDeleted;
int requiredNumberOfChannels;

AudioSampleBuffer buffer;
AudioSourceChannelInfo remappedInfo;
@@ -39018,7 +39030,7 @@ public:

/** Creates a IIRFilterAudioSource for a given input source.

@param inputSource the input source to read from
@param inputSource the input source to read from - this must not be null
@param deleteInputWhenDeleted if true, the input source will be deleted when
this object is deleted
*/
@@ -39028,8 +39040,7 @@ public:
/** Destructor. */
~IIRFilterAudioSource();

/** Changes the filter to use the same parameters as the one being passed in.
*/
/** Changes the filter to use the same parameters as the one being passed in. */
void setFilterParameters (const IIRFilter& newSettings);

void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
@@ -39038,8 +39049,7 @@ public:

private:

AudioSource* const input;
const bool deleteInputWhenDeleted;
OptionalScopedPointer<AudioSource> input;
OwnedArray <IIRFilter> iirFilters;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (IIRFilterAudioSource);
@@ -39148,6 +39158,357 @@ private:
#endif
#ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__

#endif
#ifndef __JUCE_REVERBAUDIOSOURCE_JUCEHEADER__

/*** Start of inlined file: juce_ReverbAudioSource.h ***/
#ifndef __JUCE_REVERBAUDIOSOURCE_JUCEHEADER__
#define __JUCE_REVERBAUDIOSOURCE_JUCEHEADER__


/*** Start of inlined file: juce_Reverb.h ***/
#ifndef __JUCE_REVERB_JUCEHEADER__
#define __JUCE_REVERB_JUCEHEADER__

/**
Performs a simple reverb effect on a stream of audio data.

This is a simple stereo reverb, based on the technique and tunings used in FreeVerb.
Use setSampleRate() to prepare it, and then call processStereo() or processMono() to
apply the reverb to your audio data.

@see ReverbAudioSource
*/
class Reverb
{
public:

Reverb()
{
setParameters (Parameters());
setSampleRate (44100.0);
}

/** Holds the parameters being used by a Reverb object. */
struct Parameters
{
Parameters() noexcept
: roomSize (0.5f),
damping (0.5f),
wetLevel (0.33f),
dryLevel (0.4f),
width (1.0f),
freezeMode (0)
{}

float roomSize; /**< Room size, 0 to 1.0, where 1.0 is big, 0 is small. */
float damping; /**< Damping, 0 to 1.0, where 0 is not damped, 1.0 is fully damped. */
float wetLevel; /**< Wet level, 0 to 1.0 */
float dryLevel; /**< Dry level, 0 to 1.0 */
float width; /**< Reverb width, 0 to 1.0, where 1.0 is very wide. */
float freezeMode; /**< Freeze mode - values < 0.5 are "normal" mode, values > 0.5
put the reverb into a continuous feedback loop. */
};

/** Returns the reverb's current parameters. */
const Parameters& getParameters() const noexcept { return parameters; }

/** Applies a new set of parameters to the reverb.
Note that this doesn't attempt to lock the reverb, so if you call this in parallel with
the process method, you may get artifacts.
*/
void setParameters (const Parameters& newParams)
{
const float wetScaleFactor = 3.0f;
const float dryScaleFactor = 2.0f;

const float wet = newParams.wetLevel * wetScaleFactor;
wet1 = wet * (newParams.width * 0.5f + 0.5f);
wet2 = wet * (1.0f - newParams.width) * 0.5f;
dry = newParams.dryLevel * dryScaleFactor;
gain = isFrozen (newParams.freezeMode) ? 0.0f : 0.015f;
parameters = newParams;
shouldUpdateDamping = true;
}

/** Sets the sample rate that will be used for the reverb.
You must call this before the process methods, in order to tell it the correct sample rate.
*/
void setSampleRate (const double sampleRate)
{
jassert (sampleRate > 0);

static const short combTunings[] = { 1116, 1188, 1277, 1356, 1422, 1491, 1557, 1617 }; // (at 44100Hz)
static const short allPassTunings[] = { 556, 441, 341, 225 };
const int stereoSpread = 23;
const int intSampleRate = (int) sampleRate;

int i;
for (i = 0; i < numCombs; ++i)
{
comb[0][i].setSize ((intSampleRate * combTunings[i]) / 44100);
comb[1][i].setSize ((intSampleRate * (combTunings[i] + stereoSpread)) / 44100);
}

for (i = 0; i < numAllPasses; ++i)
{
allPass[0][i].setSize ((intSampleRate * allPassTunings[i]) / 44100);
allPass[1][i].setSize ((intSampleRate * (allPassTunings[i] + stereoSpread)) / 44100);
}

shouldUpdateDamping = true;
}

/** Clears the reverb's buffers. */
void reset()
{
for (int j = 0; j < numChannels; ++j)
{
int i;
for (i = 0; i < numCombs; ++i)
comb[j][i].clear();

for (i = 0; i < numAllPasses; ++i)
allPass[j][i].clear();
}
}

/** Applies the reverb to two stereo channels of audio data. */
void processStereo (float* const left, float* const right, const int numSamples) noexcept
{
jassert (left != nullptr && right != nullptr);

if (shouldUpdateDamping)
updateDamping();

for (int i = 0; i < numSamples; ++i)
{
const float input = (left[i] + right[i]) * gain;
float outL = 0, outR = 0;

int j;
for (j = 0; j < numCombs; ++j) // accumulate the comb filters in parallel
{
outL += comb[0][j].process (input);
outR += comb[1][j].process (input);
}

for (j = 0; j < numAllPasses; ++j) // run the allpass filters in series
{
outL = allPass[0][j].process (outL);
outR = allPass[1][j].process (outR);
}

left[i] = outL * wet1 + outR * wet2 + left[i] * dry;
right[i] = outR * wet1 + outL * wet2 + right[i] * dry;
}
}

/** Applies the reverb to a single mono channel of audio data. */
void processMono (float* const samples, const int numSamples) noexcept
{
jassert (samples != nullptr);

if (shouldUpdateDamping)
updateDamping();

for (int i = 0; i < numSamples; ++i)
{
const float input = samples[i] * gain;
float output = 0;

int j;
for (j = 0; j < numCombs; ++j) // accumulate the comb filters in parallel
output += comb[0][j].process (input);

for (j = 0; j < numAllPasses; ++j) // run the allpass filters in series
output = allPass[0][j].process (output);

samples[i] = output * wet1 + input * dry;
}
}

private:

Parameters parameters;

volatile bool shouldUpdateDamping;
float gain, wet1, wet2, dry;

inline static bool isFrozen (const float freezeMode) noexcept { return freezeMode >= 0.5f; }

void updateDamping() noexcept
{
const float roomScaleFactor = 0.28f;
const float roomOffset = 0.7f;
const float dampScaleFactor = 0.4f;

shouldUpdateDamping = false;

if (isFrozen (parameters.freezeMode))
setDamping (1.0f, 0.0f);
else
setDamping (parameters.damping * dampScaleFactor,
parameters.roomSize * roomScaleFactor + roomOffset);
}

void setDamping (const float dampingToUse, const float roomSizeToUse) noexcept
{
for (int j = 0; j < numChannels; ++j)
for (int i = numCombs; --i >= 0;)
comb[j][i].setFeedbackAndDamp (roomSizeToUse, dampingToUse);
}

class CombFilter
{
public:
CombFilter() noexcept : bufferSize (0), bufferIndex (0) {}

void setSize (const int size)
{
if (size != bufferSize)
{
bufferIndex = 0;
buffer.malloc (size);
bufferSize = size;
}

clear();
}

void clear() noexcept
{
last = 0;
zeromem (buffer, bufferSize * sizeof (float));
}

void setFeedbackAndDamp (const float f, const float d) noexcept
{
damp1 = d;
damp2 = 1.0f - d;
feedback = f;
}

inline float process (const float input) noexcept
{
const float output = buffer [bufferIndex];
last = (output * damp2) + (last * damp1);
JUCE_UNDENORMALISE (last);

float temp = input + (last * feedback);
JUCE_UNDENORMALISE (temp);
buffer [bufferIndex] = temp;
bufferIndex = (bufferIndex + 1) % bufferSize;
return output;
}

private:
HeapBlock<float> buffer;
int bufferSize, bufferIndex;
float feedback, last, damp1, damp2;

JUCE_DECLARE_NON_COPYABLE (CombFilter);
};

class AllPassFilter
{
public:
AllPassFilter() noexcept : bufferSize (0), bufferIndex (0) {}

void setSize (const int size)
{
if (size != bufferSize)
{
bufferIndex = 0;
buffer.malloc (size);
bufferSize = size;
}

clear();
}

void clear() noexcept
{
zeromem (buffer, bufferSize * sizeof (float));
}

inline float process (const float input) noexcept
{
const float bufferedValue = buffer [bufferIndex];
float temp = input + (bufferedValue * 0.5f);
JUCE_UNDENORMALISE (temp);
buffer [bufferIndex] = temp;
bufferIndex = (bufferIndex + 1) % bufferSize;
return bufferedValue - input;
}

private:
HeapBlock<float> buffer;
int bufferSize, bufferIndex;

JUCE_DECLARE_NON_COPYABLE (AllPassFilter);
};

enum { numCombs = 8, numAllPasses = 4, numChannels = 2 };

CombFilter comb [numChannels][numCombs];
AllPassFilter allPass [numChannels][numAllPasses];

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Reverb);
};

#endif // __JUCE_REVERB_JUCEHEADER__

/*** End of inlined file: juce_Reverb.h ***/

/**
An AudioSource that uses the Reverb class to apply a reverb to another AudioSource.

@see Reverb
*/
class JUCE_API ReverbAudioSource : public AudioSource
{
public:
/** Creates a ReverbAudioSource to process a given input source.

@param inputSource the input source to read from - this must not be null
@param deleteInputWhenDeleted if true, the input source will be deleted when
this object is deleted
*/
ReverbAudioSource (AudioSource* inputSource,
bool deleteInputWhenDeleted);

/** Destructor. */
~ReverbAudioSource();

/** Returns the parameters from the reverb. */
const Reverb::Parameters& getParameters() const noexcept { return reverb.getParameters(); }

/** Changes the reverb's parameters. */
void setParameters (const Reverb::Parameters& newParams);

void setBypassed (bool isBypassed) noexcept;
bool isBypassed() const noexcept { return bypass; }

void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
void releaseResources();
void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);

private:

CriticalSection lock;
OptionalScopedPointer<AudioSource> input;
Reverb reverb;
volatile bool bypass;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ReverbAudioSource);
};

#endif // __JUCE_REVERBAUDIOSOURCE_JUCEHEADER__

/*** End of inlined file: juce_ReverbAudioSource.h ***/


#endif
#ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__

@@ -44360,6 +44721,9 @@ private:
#endif
#ifndef __JUCE_IIRFILTER_JUCEHEADER__

#endif
#ifndef __JUCE_REVERB_JUCEHEADER__

#endif
#ifndef __JUCE_MIDIBUFFER_JUCEHEADER__



+ 16
- 51
src/audio/audio_sources/juce_AudioFormatReaderSource.cpp View File

@@ -33,29 +33,18 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
AudioFormatReaderSource::AudioFormatReaderSource (AudioFormatReader* const reader_,
const bool deleteReaderWhenThisIsDeleted)
: reader (reader_),
deleteReader (deleteReaderWhenThisIsDeleted),
: reader (reader_, deleteReaderWhenThisIsDeleted),
nextPlayPos (0),
looping (false)
{
jassert (reader != nullptr);
}
AudioFormatReaderSource::~AudioFormatReaderSource()
{
if (deleteReader)
delete reader;
}
AudioFormatReaderSource::~AudioFormatReaderSource() {}
void AudioFormatReaderSource::setNextReadPosition (int64 newPosition)
{
nextPlayPos = newPosition;
}
void AudioFormatReaderSource::setLooping (bool shouldLoop)
{
looping = shouldLoop;
}
int64 AudioFormatReaderSource::getTotalLength() const { return reader->lengthInSamples; }
void AudioFormatReaderSource::setNextReadPosition (int64 newPosition) { nextPlayPos = newPosition; }
void AudioFormatReaderSource::setLooping (bool shouldLoop) { looping = shouldLoop; }
int64 AudioFormatReaderSource::getNextReadPosition() const
{
@@ -63,19 +52,8 @@ int64 AudioFormatReaderSource::getNextReadPosition() const
: nextPlayPos;
}
int64 AudioFormatReaderSource::getTotalLength() const
{
return reader->lengthInSamples;
}
void AudioFormatReaderSource::prepareToPlay (int /*samplesPerBlockExpected*/,
double /*sampleRate*/)
{
}
void AudioFormatReaderSource::releaseResources()
{
}
void AudioFormatReaderSource::prepareToPlay (int /*samplesPerBlockExpected*/, double /*sampleRate*/) {}
void AudioFormatReaderSource::releaseResources() {}
void AudioFormatReaderSource::getNextAudioBlock (const AudioSourceChannelInfo& info)
{
@@ -90,39 +68,26 @@ void AudioFormatReaderSource::getNextAudioBlock (const AudioSourceChannelInfo& i
if (newEnd > newStart)
{
info.buffer->readFromAudioReader (reader,
info.startSample,
newEnd - newStart,
newStart,
true, true);
info.buffer->readFromAudioReader (reader, info.startSample,
newEnd - newStart, newStart, true, true);
}
else
{
const int endSamps = (int) reader->lengthInSamples - newStart;
info.buffer->readFromAudioReader (reader,
info.startSample,
endSamps,
newStart,
true, true);
info.buffer->readFromAudioReader (reader,
info.startSample + endSamps,
newEnd,
0,
true, true);
info.buffer->readFromAudioReader (reader, info.startSample,
endSamps, newStart, true, true);
info.buffer->readFromAudioReader (reader, info.startSample + endSamps,
newEnd, 0, true, true);
}
nextPlayPos = newEnd;
}
else
{
info.buffer->readFromAudioReader (reader,
info.startSample,
info.numSamples,
start,
true, true);
info.buffer->readFromAudioReader (reader, info.startSample,
info.numSamples, start, true, true);
nextPlayPos += info.numSamples;
}
}


+ 4
- 3
src/audio/audio_sources/juce_AudioFormatReaderSource.h View File

@@ -30,6 +30,7 @@
#include "../../threads/juce_Thread.h"
#include "../audio_file_formats/juce_AudioFormatReader.h"
#include "../dsp/juce_AudioSampleBuffer.h"
#include "../../memory/juce_OptionalScopedPointer.h"
//==============================================================================
@@ -44,7 +45,8 @@ public:
//==============================================================================
/** Creates an AudioFormatReaderSource for a given reader.
@param sourceReader the reader to use as the data source
@param sourceReader the reader to use as the data source - this must
not be null
@param deleteReaderWhenThisIsDeleted if true, the reader passed-in will be deleted
when this object is deleted; if false it will be
left up to the caller to manage its lifetime
@@ -93,8 +95,7 @@ public:
private:
//==============================================================================
AudioFormatReader* reader;
bool deleteReader;
OptionalScopedPointer<AudioFormatReader> reader;
int64 volatile nextPlayPos;
bool volatile looping;


+ 2
- 6
src/audio/audio_sources/juce_BufferingAudioSource.cpp View File

@@ -120,11 +120,10 @@ juce_ImplementSingleton (SharedBufferingAudioSourceThread)
//==============================================================================
BufferingAudioSource::BufferingAudioSource (PositionableAudioSource* source_,
const bool deleteSourceWhenDeleted_,
const bool deleteSourceWhenDeleted,
const int numberOfSamplesToBuffer_,
const int numberOfChannels_)
: source (source_),
deleteSourceWhenDeleted (deleteSourceWhenDeleted_),
: source (source_, deleteSourceWhenDeleted),
numberOfSamplesToBuffer (jmax (1024, numberOfSamplesToBuffer_)),
numberOfChannels (numberOfChannels_),
buffer (numberOfChannels_, 0),
@@ -145,9 +144,6 @@ BufferingAudioSource::~BufferingAudioSource()
if (thread != nullptr)
thread->removeSource (this);
if (deleteSourceWhenDeleted)
delete source;
}
//==============================================================================


+ 3
- 3
src/audio/audio_sources/juce_BufferingAudioSource.h View File

@@ -29,6 +29,7 @@
#include "juce_PositionableAudioSource.h"
#include "../../threads/juce_Thread.h"
#include "../dsp/juce_AudioSampleBuffer.h"
#include "../../memory/juce_OptionalScopedPointer.h"
//==============================================================================
@@ -90,14 +91,13 @@ public:
private:
//==============================================================================
PositionableAudioSource* source;
bool deleteSourceWhenDeleted;
OptionalScopedPointer<PositionableAudioSource> source;
int numberOfSamplesToBuffer, numberOfChannels;
AudioSampleBuffer buffer;
CriticalSection bufferStartPosLock;
int64 volatile bufferValidStart, bufferValidEnd, nextPlayPos;
bool wasSourceLooping;
double volatile sampleRate;
bool wasSourceLooping;
friend class SharedBufferingAudioSourceThread;
bool readNextBufferChunk();


+ 4
- 9
src/audio/audio_sources/juce_ChannelRemappingAudioSource.cpp View File

@@ -32,21 +32,16 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
ChannelRemappingAudioSource::ChannelRemappingAudioSource (AudioSource* const source_,
const bool deleteSourceWhenDeleted_)
: requiredNumberOfChannels (2),
source (source_),
deleteSourceWhenDeleted (deleteSourceWhenDeleted_),
const bool deleteSourceWhenDeleted)
: source (source_, deleteSourceWhenDeleted),
requiredNumberOfChannels (2),
buffer (2, 16)
{
remappedInfo.buffer = &buffer;
remappedInfo.startSample = 0;
}
ChannelRemappingAudioSource::~ChannelRemappingAudioSource()
{
if (deleteSourceWhenDeleted)
delete source;
}
ChannelRemappingAudioSource::~ChannelRemappingAudioSource() {}
//==============================================================================
void ChannelRemappingAudioSource::setNumberOfChannelsToProduce (const int requiredNumberOfChannels_)


+ 3
- 4
src/audio/audio_sources/juce_ChannelRemappingAudioSource.h View File

@@ -29,6 +29,7 @@
#include "juce_AudioSource.h"
#include "../../text/juce_XmlElement.h"
#include "../../containers/juce_Array.h"
#include "../../memory/juce_OptionalScopedPointer.h"
//==============================================================================
@@ -135,11 +136,9 @@ public:
private:
//==============================================================================
int requiredNumberOfChannels;
OptionalScopedPointer<AudioSource> source;
Array <int> remappedInputs, remappedOutputs;
AudioSource* const source;
const bool deleteSourceWhenDeleted;
int requiredNumberOfChannels;
AudioSampleBuffer buffer;
AudioSourceChannelInfo remappedInfo;


+ 4
- 8
src/audio/audio_sources/juce_IIRFilterAudioSource.cpp View File

@@ -29,11 +29,11 @@ BEGIN_JUCE_NAMESPACE
#include "juce_IIRFilterAudioSource.h"
//==============================================================================
IIRFilterAudioSource::IIRFilterAudioSource (AudioSource* const inputSource,
const bool deleteInputWhenDeleted_)
: input (inputSource),
deleteInputWhenDeleted (deleteInputWhenDeleted_)
const bool deleteInputWhenDeleted)
: input (inputSource, deleteInputWhenDeleted)
{
jassert (inputSource != nullptr);
@@ -41,11 +41,7 @@ IIRFilterAudioSource::IIRFilterAudioSource (AudioSource* const inputSource,
iirFilters.add (new IIRFilter());
}
IIRFilterAudioSource::~IIRFilterAudioSource()
{
if (deleteInputWhenDeleted)
delete input;
}
IIRFilterAudioSource::~IIRFilterAudioSource() {}
//==============================================================================
void IIRFilterAudioSource::setFilterParameters (const IIRFilter& newSettings)


+ 4
- 6
src/audio/audio_sources/juce_IIRFilterAudioSource.h View File

@@ -29,6 +29,7 @@
#include "juce_AudioSource.h"
#include "../dsp/juce_IIRFilter.h"
#include "../../containers/juce_OwnedArray.h"
#include "../../memory/juce_OptionalScopedPointer.h"
//==============================================================================
@@ -41,7 +42,7 @@ public:
//==============================================================================
/** Creates a IIRFilterAudioSource for a given input source.
@param inputSource the input source to read from
@param inputSource the input source to read from - this must not be null
@param deleteInputWhenDeleted if true, the input source will be deleted when
this object is deleted
*/
@@ -52,8 +53,7 @@ public:
~IIRFilterAudioSource();
//==============================================================================
/** Changes the filter to use the same parameters as the one being passed in.
*/
/** Changes the filter to use the same parameters as the one being passed in. */
void setFilterParameters (const IIRFilter& newSettings);
//==============================================================================
@@ -61,11 +61,9 @@ public:
void releaseResources();
void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
private:
//==============================================================================
AudioSource* const input;
const bool deleteInputWhenDeleted;
OptionalScopedPointer<AudioSource> input;
OwnedArray <IIRFilter> iirFilters;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (IIRFilterAudioSource);


+ 3
- 8
src/audio/audio_sources/juce_ResamplingAudioSource.cpp View File

@@ -32,10 +32,9 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
ResamplingAudioSource::ResamplingAudioSource (AudioSource* const inputSource,
const bool deleteInputWhenDeleted_,
const bool deleteInputWhenDeleted,
const int numChannels_)
: input (inputSource),
deleteInputWhenDeleted (deleteInputWhenDeleted_),
: input (inputSource, deleteInputWhenDeleted),
ratio (1.0),
lastRatio (1.0),
buffer (numChannels_, 0),
@@ -45,11 +44,7 @@ ResamplingAudioSource::ResamplingAudioSource (AudioSource* const inputSource,
jassert (input != nullptr);
}
ResamplingAudioSource::~ResamplingAudioSource()
{
if (deleteInputWhenDeleted)
delete input;
}
ResamplingAudioSource::~ResamplingAudioSource() {}
void ResamplingAudioSource::setResamplingRatio (const double samplesInPerOutputSample)
{


+ 2
- 2
src/audio/audio_sources/juce_ResamplingAudioSource.h View File

@@ -28,6 +28,7 @@
#include "juce_AudioSource.h"
#include "../../threads/juce_SpinLock.h"
#include "../../memory/juce_OptionalScopedPointer.h"
//==============================================================================
@@ -77,8 +78,7 @@ public:
private:
//==============================================================================
AudioSource* const input;
const bool deleteInputWhenDeleted;
OptionalScopedPointer<AudioSource> input;
double ratio, lastRatio;
AudioSampleBuffer buffer;
int bufferPos, sampsInBuffer;


+ 92
- 0
src/audio/audio_sources/juce_ReverbAudioSource.cpp View File

@@ -0,0 +1,92 @@
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-11 by Raw Material Software Ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the GNU General
Public License (Version 2), as published by the Free Software Foundation.
A copy of the license is included in the JUCE distribution, or can be found
online at www.gnu.org/licenses.
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.rawmaterialsoftware.com/juce for more information.
==============================================================================
*/
#include "../../core/juce_StandardHeader.h"
BEGIN_JUCE_NAMESPACE
#include "juce_ReverbAudioSource.h"
//==============================================================================
ReverbAudioSource::ReverbAudioSource (AudioSource* const inputSource, const bool deleteInputWhenDeleted)
: input (inputSource, deleteInputWhenDeleted),
bypass (false)
{
jassert (inputSource != nullptr);
}
ReverbAudioSource::~ReverbAudioSource() {}
void ReverbAudioSource::prepareToPlay (int samplesPerBlockExpected, double sampleRate)
{
const ScopedLock sl (lock);
input->prepareToPlay (samplesPerBlockExpected, sampleRate);
reverb.setSampleRate (sampleRate);
}
void ReverbAudioSource::releaseResources() {}
void ReverbAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill)
{
const ScopedLock sl (lock);
input->getNextAudioBlock (bufferToFill);
if (! bypass)
{
float* const firstChannel = bufferToFill.buffer->getSampleData (0, bufferToFill.startSample);
if (bufferToFill.buffer->getNumChannels() > 1)
{
reverb.processStereo (firstChannel,
bufferToFill.buffer->getSampleData (1, bufferToFill.startSample),
bufferToFill.numSamples);
}
else
{
reverb.processMono (firstChannel, bufferToFill.numSamples);
}
}
}
void ReverbAudioSource::setParameters (const Reverb::Parameters& newParams)
{
const ScopedLock sl (lock);
reverb.setParameters (newParams);
}
void ReverbAudioSource::setBypassed (bool isBypassed) noexcept
{
if (bypass != isBypassed)
{
const ScopedLock sl (lock);
bypass = isBypassed;
reverb.reset();
}
}
END_JUCE_NAMESPACE

+ 82
- 0
src/audio/audio_sources/juce_ReverbAudioSource.h View File

@@ -0,0 +1,82 @@
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-11 by Raw Material Software Ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the GNU General
Public License (Version 2), as published by the Free Software Foundation.
A copy of the license is included in the JUCE distribution, or can be found
online at www.gnu.org/licenses.
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.rawmaterialsoftware.com/juce for more information.
==============================================================================
*/
#ifndef __JUCE_REVERBAUDIOSOURCE_JUCEHEADER__
#define __JUCE_REVERBAUDIOSOURCE_JUCEHEADER__
#include "juce_AudioSource.h"
#include "../dsp/juce_Reverb.h"
#include "../../threads/juce_CriticalSection.h"
#include "../../memory/juce_OptionalScopedPointer.h"
//==============================================================================
/**
An AudioSource that uses the Reverb class to apply a reverb to another AudioSource.
@see Reverb
*/
class JUCE_API ReverbAudioSource : public AudioSource
{
public:
/** Creates a ReverbAudioSource to process a given input source.
@param inputSource the input source to read from - this must not be null
@param deleteInputWhenDeleted if true, the input source will be deleted when
this object is deleted
*/
ReverbAudioSource (AudioSource* inputSource,
bool deleteInputWhenDeleted);
/** Destructor. */
~ReverbAudioSource();
//==============================================================================
/** Returns the parameters from the reverb. */
const Reverb::Parameters& getParameters() const noexcept { return reverb.getParameters(); }
/** Changes the reverb's parameters. */
void setParameters (const Reverb::Parameters& newParams);
void setBypassed (bool isBypassed) noexcept;
bool isBypassed() const noexcept { return bypass; }
//==============================================================================
void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
void releaseResources();
void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
private:
//==============================================================================
CriticalSection lock;
OptionalScopedPointer<AudioSource> input;
Reverb reverb;
volatile bool bypass;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ReverbAudioSource);
};
#endif // __JUCE_REVERBAUDIOSOURCE_JUCEHEADER__

+ 325
- 0
src/audio/dsp/juce_Reverb.h View File

@@ -0,0 +1,325 @@
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-11 by Raw Material Software Ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the GNU General
Public License (Version 2), as published by the Free Software Foundation.
A copy of the license is included in the JUCE distribution, or can be found
online at www.gnu.org/licenses.
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.rawmaterialsoftware.com/juce for more information.
==============================================================================
*/
#ifndef __JUCE_REVERB_JUCEHEADER__
#define __JUCE_REVERB_JUCEHEADER__
//==============================================================================
/**
Performs a simple reverb effect on a stream of audio data.
This is a simple stereo reverb, based on the technique and tunings used in FreeVerb.
Use setSampleRate() to prepare it, and then call processStereo() or processMono() to
apply the reverb to your audio data.
@see ReverbAudioSource
*/
class Reverb
{
public:
//==============================================================================
Reverb()
{
setParameters (Parameters());
setSampleRate (44100.0);
}
//==============================================================================
/** Holds the parameters being used by a Reverb object. */
struct Parameters
{
Parameters() noexcept
: roomSize (0.5f),
damping (0.5f),
wetLevel (0.33f),
dryLevel (0.4f),
width (1.0f),
freezeMode (0)
{}
float roomSize; /**< Room size, 0 to 1.0, where 1.0 is big, 0 is small. */
float damping; /**< Damping, 0 to 1.0, where 0 is not damped, 1.0 is fully damped. */
float wetLevel; /**< Wet level, 0 to 1.0 */
float dryLevel; /**< Dry level, 0 to 1.0 */
float width; /**< Reverb width, 0 to 1.0, where 1.0 is very wide. */
float freezeMode; /**< Freeze mode - values < 0.5 are "normal" mode, values > 0.5
put the reverb into a continuous feedback loop. */
};
//==============================================================================
/** Returns the reverb's current parameters. */
const Parameters& getParameters() const noexcept { return parameters; }
/** Applies a new set of parameters to the reverb.
Note that this doesn't attempt to lock the reverb, so if you call this in parallel with
the process method, you may get artifacts.
*/
void setParameters (const Parameters& newParams)
{
const float wetScaleFactor = 3.0f;
const float dryScaleFactor = 2.0f;
const float wet = newParams.wetLevel * wetScaleFactor;
wet1 = wet * (newParams.width * 0.5f + 0.5f);
wet2 = wet * (1.0f - newParams.width) * 0.5f;
dry = newParams.dryLevel * dryScaleFactor;
gain = isFrozen (newParams.freezeMode) ? 0.0f : 0.015f;
parameters = newParams;
shouldUpdateDamping = true;
}
//==============================================================================
/** Sets the sample rate that will be used for the reverb.
You must call this before the process methods, in order to tell it the correct sample rate.
*/
void setSampleRate (const double sampleRate)
{
jassert (sampleRate > 0);
static const short combTunings[] = { 1116, 1188, 1277, 1356, 1422, 1491, 1557, 1617 }; // (at 44100Hz)
static const short allPassTunings[] = { 556, 441, 341, 225 };
const int stereoSpread = 23;
const int intSampleRate = (int) sampleRate;
int i;
for (i = 0; i < numCombs; ++i)
{
comb[0][i].setSize ((intSampleRate * combTunings[i]) / 44100);
comb[1][i].setSize ((intSampleRate * (combTunings[i] + stereoSpread)) / 44100);
}
for (i = 0; i < numAllPasses; ++i)
{
allPass[0][i].setSize ((intSampleRate * allPassTunings[i]) / 44100);
allPass[1][i].setSize ((intSampleRate * (allPassTunings[i] + stereoSpread)) / 44100);
}
shouldUpdateDamping = true;
}
/** Clears the reverb's buffers. */
void reset()
{
for (int j = 0; j < numChannels; ++j)
{
int i;
for (i = 0; i < numCombs; ++i)
comb[j][i].clear();
for (i = 0; i < numAllPasses; ++i)
allPass[j][i].clear();
}
}
//==============================================================================
/** Applies the reverb to two stereo channels of audio data. */
void processStereo (float* const left, float* const right, const int numSamples) noexcept
{
jassert (left != nullptr && right != nullptr);
if (shouldUpdateDamping)
updateDamping();
for (int i = 0; i < numSamples; ++i)
{
const float input = (left[i] + right[i]) * gain;
float outL = 0, outR = 0;
int j;
for (j = 0; j < numCombs; ++j) // accumulate the comb filters in parallel
{
outL += comb[0][j].process (input);
outR += comb[1][j].process (input);
}
for (j = 0; j < numAllPasses; ++j) // run the allpass filters in series
{
outL = allPass[0][j].process (outL);
outR = allPass[1][j].process (outR);
}
left[i] = outL * wet1 + outR * wet2 + left[i] * dry;
right[i] = outR * wet1 + outL * wet2 + right[i] * dry;
}
}
/** Applies the reverb to a single mono channel of audio data. */
void processMono (float* const samples, const int numSamples) noexcept
{
jassert (samples != nullptr);
if (shouldUpdateDamping)
updateDamping();
for (int i = 0; i < numSamples; ++i)
{
const float input = samples[i] * gain;
float output = 0;
int j;
for (j = 0; j < numCombs; ++j) // accumulate the comb filters in parallel
output += comb[0][j].process (input);
for (j = 0; j < numAllPasses; ++j) // run the allpass filters in series
output = allPass[0][j].process (output);
samples[i] = output * wet1 + input * dry;
}
}
private:
//==============================================================================
Parameters parameters;
volatile bool shouldUpdateDamping;
float gain, wet1, wet2, dry;
inline static bool isFrozen (const float freezeMode) noexcept { return freezeMode >= 0.5f; }
void updateDamping() noexcept
{
const float roomScaleFactor = 0.28f;
const float roomOffset = 0.7f;
const float dampScaleFactor = 0.4f;
shouldUpdateDamping = false;
if (isFrozen (parameters.freezeMode))
setDamping (1.0f, 0.0f);
else
setDamping (parameters.damping * dampScaleFactor,
parameters.roomSize * roomScaleFactor + roomOffset);
}
void setDamping (const float dampingToUse, const float roomSizeToUse) noexcept
{
for (int j = 0; j < numChannels; ++j)
for (int i = numCombs; --i >= 0;)
comb[j][i].setFeedbackAndDamp (roomSizeToUse, dampingToUse);
}
//==============================================================================
class CombFilter
{
public:
CombFilter() noexcept : bufferSize (0), bufferIndex (0) {}
void setSize (const int size)
{
if (size != bufferSize)
{
bufferIndex = 0;
buffer.malloc (size);
bufferSize = size;
}
clear();
}
void clear() noexcept
{
last = 0;
zeromem (buffer, bufferSize * sizeof (float));
}
void setFeedbackAndDamp (const float f, const float d) noexcept
{
damp1 = d;
damp2 = 1.0f - d;
feedback = f;
}
inline float process (const float input) noexcept
{
const float output = buffer [bufferIndex];
last = (output * damp2) + (last * damp1);
JUCE_UNDENORMALISE (last);
float temp = input + (last * feedback);
JUCE_UNDENORMALISE (temp);
buffer [bufferIndex] = temp;
bufferIndex = (bufferIndex + 1) % bufferSize;
return output;
}
private:
HeapBlock<float> buffer;
int bufferSize, bufferIndex;
float feedback, last, damp1, damp2;
JUCE_DECLARE_NON_COPYABLE (CombFilter);
};
//==============================================================================
class AllPassFilter
{
public:
AllPassFilter() noexcept : bufferSize (0), bufferIndex (0) {}
void setSize (const int size)
{
if (size != bufferSize)
{
bufferIndex = 0;
buffer.malloc (size);
bufferSize = size;
}
clear();
}
void clear() noexcept
{
zeromem (buffer, bufferSize * sizeof (float));
}
inline float process (const float input) noexcept
{
const float bufferedValue = buffer [bufferIndex];
float temp = input + (bufferedValue * 0.5f);
JUCE_UNDENORMALISE (temp);
buffer [bufferIndex] = temp;
bufferIndex = (bufferIndex + 1) % bufferSize;
return bufferedValue - input;
}
private:
HeapBlock<float> buffer;
int bufferSize, bufferIndex;
JUCE_DECLARE_NON_COPYABLE (AllPassFilter);
};
enum { numCombs = 8, numAllPasses = 4, numChannels = 2 };
CombFilter comb [numChannels][numCombs];
AllPassFilter allPass [numChannels][numAllPasses];
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Reverb);
};
#endif // __JUCE_REVERB_JUCEHEADER__

+ 1
- 1
src/core/juce_StandardHeader.h View File

@@ -33,7 +33,7 @@
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 53
#define JUCE_BUILDNUMBER 91
#define JUCE_BUILDNUMBER 92
/** Current Juce version number.


+ 5
- 5
src/gui/components/juce_Component.cpp View File

@@ -1823,7 +1823,7 @@ void Component::paintComponent (Graphics& g)
paint (imG);
}
g.setColour (Colours::black.withAlpha (getAlpha()));
g.setColour (Colours::black);
g.drawImageAt (bufferedImage, 0, 0);
}
else
@@ -1914,9 +1914,9 @@ void Component::paintEntireComponent (Graphics& g, const bool ignoreAlphaLevel)
{
jassert (! g.isClipEmpty());
#if JUCE_DEBUG
#if JUCE_DEBUG
flags.isInsidePaintCall = true;
#endif
#endif
if (effect != nullptr)
{
@@ -1943,9 +1943,9 @@ void Component::paintEntireComponent (Graphics& g, const bool ignoreAlphaLevel)
paintComponentAndChildren (g);
}
#if JUCE_DEBUG
#if JUCE_DEBUG
flags.isInsidePaintCall = false;
#endif
#endif
}
void Component::setPaintingIsUnclipped (const bool shouldPaintWithoutClipping) noexcept


+ 4
- 0
src/gui/graphics/contexts/juce_Graphics.h View File

@@ -392,6 +392,8 @@ public:
The x position is an integer, but the top and bottom of the line can be sub-pixel
positions, and these will be anti-aliased if necessary.
The bottom parameter must be greater than or equal to the top parameter.
*/
void drawVerticalLine (int x, float top, float bottom) const;
@@ -399,6 +401,8 @@ public:
The y position is an integer, but the left and right ends of the line can be sub-pixel
positions, and these will be anti-aliased if necessary.
The right parameter must be greater than or equal to the left parameter.
*/
void drawHorizontalLine (int y, float left, float right) const;


+ 12
- 11
src/gui/graphics/imaging/juce_ImageFileFormat.cpp View File

@@ -32,24 +32,25 @@ BEGIN_JUCE_NAMESPACE
#include "../../../io/files/juce_FileInputStream.h"
#include "../../../io/streams/juce_BufferedInputStream.h"
//==============================================================================
ImageFileFormat* ImageFileFormat::findImageFormatForStream (InputStream& input)
struct DefaultImageFormats
{
static PNGImageFormat png;
static JPEGImageFormat jpg;
static GIFImageFormat gif;
PNGImageFormat png;
JPEGImageFormat jpg;
GIFImageFormat gif;
};
ImageFileFormat* formats[4];
int numFormats = 0;
static DefaultImageFormats defaultImageFormats;
formats [numFormats++] = &png;
formats [numFormats++] = &jpg;
formats [numFormats++] = &gif;
ImageFileFormat* ImageFileFormat::findImageFormatForStream (InputStream& input)
{
ImageFileFormat* formats[] = { &defaultImageFormats.png,
&defaultImageFormats.jpg,
&defaultImageFormats.gif };
const int64 streamPos = input.getPosition();
for (int i = 0; i < numFormats; ++i)
for (int i = 0; i < numElementsInArray (formats); ++i)
{
const bool found = formats[i]->canUnderstand (input);
input.setPosition (streamPos);


+ 14
- 9
src/io/streams/juce_MemoryInputStream.cpp View File

@@ -39,10 +39,7 @@ MemoryInputStream::MemoryInputStream (const void* const sourceData,
position (0)
{
if (keepInternalCopy)
{
internalCopy.append (data, sourceDataSize);
data = static_cast <const char*> (internalCopy.getData());
}
createInternalCopy();
}
MemoryInputStream::MemoryInputStream (const MemoryBlock& sourceData,
@@ -52,10 +49,14 @@ MemoryInputStream::MemoryInputStream (const MemoryBlock& sourceData,
position (0)
{
if (keepInternalCopy)
{
internalCopy = sourceData;
data = static_cast <const char*> (internalCopy.getData());
}
createInternalCopy();
}
void MemoryInputStream::createInternalCopy()
{
internalCopy.malloc (dataSize);
memcpy (internalCopy, data, dataSize);
data = internalCopy;
}
MemoryInputStream::~MemoryInputStream()
@@ -71,6 +72,9 @@ int MemoryInputStream::read (void* const buffer, const int howMany)
{
jassert (howMany >= 0);
const int num = jmin (howMany, (int) (dataSize - position));
if (num <= 0)
return 0;
memcpy (buffer, data + position, num);
position += num;
return (int) num;
@@ -78,7 +82,7 @@ int MemoryInputStream::read (void* const buffer, const int howMany)
bool MemoryInputStream::isExhausted()
{
return (position >= dataSize);
return position >= dataSize;
}
bool MemoryInputStream::setPosition (const int64 pos)
@@ -93,6 +97,7 @@ int64 MemoryInputStream::getPosition()
}
//==============================================================================
#if JUCE_UNIT_TESTS
#include "../../utilities/juce_UnitTest.h"


+ 3
- 1
src/io/streams/juce_MemoryInputStream.h View File

@@ -80,7 +80,9 @@ private:
//==============================================================================
const char* data;
size_t dataSize, position;
MemoryBlock internalCopy;
HeapBlock<char> internalCopy;
void createInternalCopy();
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MemoryInputStream);
};


+ 6
- 0
src/juce_app_includes.h View File

@@ -116,6 +116,9 @@
#ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
#include "audio/audio_sources/juce_ResamplingAudioSource.h"
#endif
#ifndef __JUCE_REVERBAUDIOSOURCE_JUCEHEADER__
#include "audio/audio_sources/juce_ReverbAudioSource.h"
#endif
#ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
#include "audio/audio_sources/juce_ToneGeneratorAudioSource.h"
#endif
@@ -140,6 +143,9 @@
#ifndef __JUCE_IIRFILTER_JUCEHEADER__
#include "audio/dsp/juce_IIRFilter.h"
#endif
#ifndef __JUCE_REVERB_JUCEHEADER__
#include "audio/dsp/juce_Reverb.h"
#endif
#ifndef __JUCE_MIDIBUFFER_JUCEHEADER__
#include "audio/midi/juce_MidiBuffer.h"
#endif


+ 11
- 0
src/maths/juce_MathsFunctions.h View File

@@ -416,6 +416,17 @@ inline int roundFloatToInt (const float value) noexcept
return roundToInt (value);
}
//==============================================================================
#if (JUCE_INTEL && JUCE_32BIT) || defined (DOXYGEN)
/** This macro can be applied to a float variable to check whether it contains a denormalised
value, and to normalise it if necessary.
On CPUs that aren't vulnerable to denormalisation problems, this will have no effect.
*/
#define JUCE_UNDENORMALISE(x) x += 1.0f; x -= 1.0f;
#else
#define JUCE_UNDENORMALISE(x)
#endif
//==============================================================================
/** This namespace contains a few template classes for helping work out class type variations.
*/


+ 1
- 1
src/native/mac/juce_mac_FileChooser.mm View File

@@ -73,7 +73,7 @@ using namespace JUCE_NAMESPACE;
if (f.getFileName().matchesWildcard ((*filters)[i], true))
return true;
return f.isDirectory();
return f.isDirectory() && ! [[NSWorkspace sharedWorkspace] isFilePackageAtPath: filename];
}
@end


+ 3
- 0
src/native/mac/juce_mac_Fonts.mm View File

@@ -217,6 +217,9 @@ public:
jassert (path.isEmpty()); // we might need to apply a transform to the path, so this must be empty
CGPathRef pathRef = CTFontCreatePathForGlyph (ctFontRef, (CGGlyph) glyphNumber, &renderingTransform);
if (pathRef == 0)
return false;
CGPathApply (pathRef, &path, pathApplier);
CFRelease (pathRef);


Loading…
Cancel
Save