From 083b91d4ba75feadb8472b0d82bd75f67ff428f8 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Sat, 29 Mar 2008 00:58:21 +0000 Subject: [PATCH] * Added Flanger and AudioAdapter audio addons from Cortex to the build * Actually I could only try if they build and work inside the vm, I do not have sound available somewhere, so could please someone test whether the results are reasonable? They cannot be added to the image until someone approves that they are working fine... * got rid of most compiler warnings git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24636 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/cortex/Jamfile | 2 ++ .../addons/AudioAdapter/AudioAdapterAddOn.cpp | 2 +- .../addons/AudioAdapter/AudioAdapterNode.cpp | 2 +- .../AudioAdapter/AudioAdapterParams.cpp | 2 +- src/apps/cortex/addons/AudioAdapter/Jamfile | 25 +++++++++++++++++++ .../cortex/addons/Flanger/FlangerAddOn.cpp | 2 +- src/apps/cortex/addons/Flanger/FlangerAddOn.h | 2 +- src/apps/cortex/addons/Flanger/FlangerApp.cpp | 2 +- .../cortex/addons/Flanger/FlangerNode.cpp | 2 +- src/apps/cortex/addons/Flanger/Jamfile | 15 +++++++++++ src/apps/cortex/addons/Jamfile | 7 ++++++ .../cortex/addons/audioOps/AudioAdapterOp.cpp | 2 +- .../cortex/addons/audioOps/AudioAdapterOp.h | 2 +- src/apps/cortex/addons/common/AudioBuffer.cpp | 10 ++++---- src/apps/cortex/addons/common/AudioBuffer.h | 2 +- .../cortex/addons/common/AudioFilterNode.cpp | 18 ++++++++----- .../cortex/addons/common/AudioFilterNode.h | 12 ++++++--- .../addons/common/IAudioFilterOpFactory.h | 2 +- src/apps/cortex/addons/common/IAudioOp.h | 2 +- .../cortex/addons/common/IAudioOpFactory.h | 2 +- src/apps/cortex/addons/common/IAudioOpHost.h | 3 ++- src/apps/cortex/addons/common/IParameterSet.h | 3 ++- .../addons/common/MediaNodeControlApp.h | 2 +- src/apps/cortex/addons/common/RawBuffer.cpp | 16 ++++++------ .../cortex/addons/common/audio_buffer_tools.h | 2 +- 25 files changed, 103 insertions(+), 38 deletions(-) create mode 100644 src/apps/cortex/addons/AudioAdapter/Jamfile create mode 100644 src/apps/cortex/addons/Flanger/Jamfile create mode 100644 src/apps/cortex/addons/Jamfile diff --git a/src/apps/cortex/Jamfile b/src/apps/cortex/Jamfile index 8bd6aeeadb..d9f70a319c 100644 --- a/src/apps/cortex/Jamfile +++ b/src/apps/cortex/Jamfile @@ -16,3 +16,5 @@ SubInclude HAIKU_TOP src apps cortex TipManager ; SubInclude HAIKU_TOP src apps cortex TransportView ; SubInclude HAIKU_TOP src apps cortex ValControl ; SubInclude HAIKU_TOP src apps cortex support ; + +SubInclude HAIKU_TOP src apps cortex addons ; diff --git a/src/apps/cortex/addons/AudioAdapter/AudioAdapterAddOn.cpp b/src/apps/cortex/addons/AudioAdapter/AudioAdapterAddOn.cpp index d25f8ff48f..c4471f1fc4 100644 --- a/src/apps/cortex/addons/AudioAdapter/AudioAdapterAddOn.cpp +++ b/src/apps/cortex/addons/AudioAdapter/AudioAdapterAddOn.cpp @@ -102,4 +102,4 @@ status_t AudioAdapterAddOn::GetConfigurationFor( } -// END -- AudioAdapterAddOn.cpp -- \ No newline at end of file +// END -- AudioAdapterAddOn.cpp -- diff --git a/src/apps/cortex/addons/AudioAdapter/AudioAdapterNode.cpp b/src/apps/cortex/addons/AudioAdapter/AudioAdapterNode.cpp index 48300702d5..1b7db738b1 100644 --- a/src/apps/cortex/addons/AudioAdapter/AudioAdapterNode.cpp +++ b/src/apps/cortex/addons/AudioAdapter/AudioAdapterNode.cpp @@ -500,4 +500,4 @@ _AudioAdapterNode::_broadcastOutputFormatParams() -// END -- AudioAdapterNode.cpp -- \ No newline at end of file +// END -- AudioAdapterNode.cpp -- diff --git a/src/apps/cortex/addons/AudioAdapter/AudioAdapterParams.cpp b/src/apps/cortex/addons/AudioAdapter/AudioAdapterParams.cpp index b4cc9ddfeb..12cdec5bac 100644 --- a/src/apps/cortex/addons/AudioAdapter/AudioAdapterParams.cpp +++ b/src/apps/cortex/addons/AudioAdapter/AudioAdapterParams.cpp @@ -6,7 +6,7 @@ #include status_t -_AudioAdapterParams::store(parameterID, const void* data, size_t size) +_AudioAdapterParams::store(int32 parameterID, const void* data, size_t size) { if (size < sizeof(int32)) return B_NO_MEMORY; diff --git a/src/apps/cortex/addons/AudioAdapter/Jamfile b/src/apps/cortex/addons/AudioAdapter/Jamfile new file mode 100644 index 0000000000..be184055e7 --- /dev/null +++ b/src/apps/cortex/addons/AudioAdapter/Jamfile @@ -0,0 +1,25 @@ +SubDir HAIKU_TOP src apps cortex addons AudioAdapter ; + +SubDirHdrs [ FDirName $(HAIKU_TOP) src apps cortex addons common ] ; +SubDirHdrs [ FDirName $(HAIKU_TOP) src apps cortex addons audioOps ] ; + +SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src apps cortex addons common ] ; +SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src apps cortex addons audioOps ] ; + +Addon cortex_audioadapter.media_addon : + AudioAdapterAddOn.cpp + AudioAdapterNode.cpp + AudioAdapterParams.cpp + + # audioOps/ + AudioAdapterOp.cpp + + # common/ + AudioBuffer.cpp + AudioFilterNode.cpp + IParameterSet.cpp + RawBuffer.cpp + SoundUtils.cpp + + : be media +; diff --git a/src/apps/cortex/addons/Flanger/FlangerAddOn.cpp b/src/apps/cortex/addons/Flanger/FlangerAddOn.cpp index fb9b436a5c..865166a964 100644 --- a/src/apps/cortex/addons/Flanger/FlangerAddOn.cpp +++ b/src/apps/cortex/addons/Flanger/FlangerAddOn.cpp @@ -88,4 +88,4 @@ status_t FlangerAddOn::GetConfigurationFor( return B_OK; } -// END -- FlangerAddOn.h -- \ No newline at end of file +// END -- FlangerAddOn.h -- diff --git a/src/apps/cortex/addons/Flanger/FlangerAddOn.h b/src/apps/cortex/addons/Flanger/FlangerAddOn.h index 412bc12802..4aa3a1b7c9 100644 --- a/src/apps/cortex/addons/Flanger/FlangerAddOn.h +++ b/src/apps/cortex/addons/Flanger/FlangerAddOn.h @@ -42,4 +42,4 @@ virtual status_t AutoStart( bool * out_has_more) { return B_OK; } }; -#endif /*__FlangerAddOn_H__*/ \ No newline at end of file +#endif /*__FlangerAddOn_H__*/ diff --git a/src/apps/cortex/addons/Flanger/FlangerApp.cpp b/src/apps/cortex/addons/Flanger/FlangerApp.cpp index f0498ad5b6..5c488fb097 100644 --- a/src/apps/cortex/addons/Flanger/FlangerApp.cpp +++ b/src/apps/cortex/addons/Flanger/FlangerApp.cpp @@ -22,4 +22,4 @@ int main(int argc, char** argv) { return 0; } -// END -- FlangerApp.cpp -- \ No newline at end of file +// END -- FlangerApp.cpp -- diff --git a/src/apps/cortex/addons/Flanger/FlangerNode.cpp b/src/apps/cortex/addons/Flanger/FlangerNode.cpp index 507b4b3776..b0739da50a 100644 --- a/src/apps/cortex/addons/Flanger/FlangerNode.cpp +++ b/src/apps/cortex/addons/Flanger/FlangerNode.cpp @@ -1449,7 +1449,7 @@ void FlangerNode::filterBuffer( if(readFrameLo != (int32)fReadFrame) { // interpolate (A) - int32 readFrameHi = (int32)ceil(fReadFrame); + uint32 readFrameHi = (int32)ceil(fReadFrame); delayedFrame.channel[0] *= ((float)readFrameHi - fReadFrame); if(stereo) delayedFrame.channel[1] *= ((float)readFrameHi - fReadFrame); diff --git a/src/apps/cortex/addons/Flanger/Jamfile b/src/apps/cortex/addons/Flanger/Jamfile new file mode 100644 index 0000000000..44e18525bf --- /dev/null +++ b/src/apps/cortex/addons/Flanger/Jamfile @@ -0,0 +1,15 @@ +SubDir HAIKU_TOP src apps cortex addons Flanger ; + +SubDirHdrs [ FDirName $(HAIKU_TOP) src apps cortex addons common ] ; +SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src apps cortex addons common ] ; +Addon cortex_flanger.media_addon : + FlangerApp.cpp + FlangerAddOn.cpp + FlangerNode.cpp + AudioBuffer.cpp + MediaNodeControlApp.cpp + RawBuffer.cpp + SoundUtils.cpp + : be media + : Resource.rsrc +; diff --git a/src/apps/cortex/addons/Jamfile b/src/apps/cortex/addons/Jamfile new file mode 100644 index 0000000000..73ba7f5187 --- /dev/null +++ b/src/apps/cortex/addons/Jamfile @@ -0,0 +1,7 @@ +SubDir HAIKU_TOP src apps cortex addons ; + +SetSubDirSupportedPlatformsBeOSCompatible ; + +SubInclude HAIKU_TOP src apps cortex addons AudioAdapter ; +SubInclude HAIKU_TOP src apps cortex addons Flanger ; + diff --git a/src/apps/cortex/addons/audioOps/AudioAdapterOp.cpp b/src/apps/cortex/addons/audioOps/AudioAdapterOp.cpp index 15eebc451c..2d7bd9aef9 100644 --- a/src/apps/cortex/addons/audioOps/AudioAdapterOp.cpp +++ b/src/apps/cortex/addons/audioOps/AudioAdapterOp.cpp @@ -666,4 +666,4 @@ IParameterSet* AudioAdapterOpFactory::createParameterSet() { } -// END -- AudioAdapterOp.cpp -- \ No newline at end of file +// END -- AudioAdapterOp.cpp -- diff --git a/src/apps/cortex/addons/audioOps/AudioAdapterOp.h b/src/apps/cortex/addons/audioOps/AudioAdapterOp.h index b78a84b58a..6071abdfd2 100644 --- a/src/apps/cortex/addons/audioOps/AudioAdapterOp.h +++ b/src/apps/cortex/addons/audioOps/AudioAdapterOp.h @@ -25,4 +25,4 @@ public: // *** INTERFACE IParameterSet* createParameterSet(); //nyi }; -#endif /*__AudioAdapterOp_H__*/ \ No newline at end of file +#endif /*__AudioAdapterOp_H__*/ diff --git a/src/apps/cortex/addons/common/AudioBuffer.cpp b/src/apps/cortex/addons/common/AudioBuffer.cpp index b94a82f855..b63b48c86f 100644 --- a/src/apps/cortex/addons/common/AudioBuffer.cpp +++ b/src/apps/cortex/addons/common/AudioBuffer.cpp @@ -279,7 +279,7 @@ uint32 AudioBuffer::findMin(uint32 fromFrame, uint32 frameCount, n = 0; } - float fCur; + float fCur = 0; convert_sample(pCur, fCur, m_format.format); if(fCur < pMin[n % channels]) { @@ -332,7 +332,7 @@ uint32 AudioBuffer::findMax(uint32 fromFrame, uint32 frameCount, n = 0; } - float fCur; + float fCur = 0; convert_sample(pCur, fCur, m_format.format); if(fCur > pMax[n % channels]) { @@ -384,7 +384,7 @@ uint32 AudioBuffer::findPeaks(uint32 fromFrame, uint32 frameCount, n = 0; } - float fCur; + float fCur = 0; convert_sample(pCur, fCur, m_format.format); if(fabs(fCur) > pPeaks[n % channels]) { @@ -437,7 +437,7 @@ uint32 AudioBuffer::average(uint32 fromFrame, uint32 frameCount, n = 0; } - float fCur; + float fCur = 0; convert_sample(pCur, fCur, m_format.format); pAverage[n%channels] += fCur; @@ -453,4 +453,4 @@ uint32 AudioBuffer::average(uint32 fromFrame, uint32 frameCount, // -------------------------------------------------------- // -// END -- AudioBuffer.h -- \ No newline at end of file +// END -- AudioBuffer.h -- diff --git a/src/apps/cortex/addons/common/AudioBuffer.h b/src/apps/cortex/addons/common/AudioBuffer.h index a2bd5771c7..67ca422802 100644 --- a/src/apps/cortex/addons/common/AudioBuffer.h +++ b/src/apps/cortex/addons/common/AudioBuffer.h @@ -142,4 +142,4 @@ protected: // members media_raw_audio_format m_format; }; -#endif /* __AudioBuffer_H__ */ \ No newline at end of file +#endif /* __AudioBuffer_H__ */ diff --git a/src/apps/cortex/addons/common/AudioFilterNode.cpp b/src/apps/cortex/addons/common/AudioFilterNode.cpp index 8e17a3d052..01f48d9819 100644 --- a/src/apps/cortex/addons/common/AudioFilterNode.cpp +++ b/src/apps/cortex/addons/common/AudioFilterNode.cpp @@ -595,7 +595,10 @@ void AudioFilterNode::Disconnected( // mark disconnected m_input.source = media_source::null; - status_t err = getRequiredInputFormat(m_input.format); +#ifdef DEBUG + status_t err = +#endif + getRequiredInputFormat(m_input.format); ASSERT(err == B_OK); // remove operation @@ -819,13 +822,16 @@ void AudioFilterNode::Disconnect( PRINT(("\tbad destination\n")); return; } - + // clean up m_output.destination = media_destination::null; - - status_t err = getRequiredOutputFormat(m_output.format); + +#ifdef DEBUG + status_t err = +#endif + getRequiredOutputFormat(m_output.format); ASSERT(err == B_OK); - + updateBufferGroup(); if(m_op) { @@ -1512,4 +1518,4 @@ void AudioFilterNode::processBuffer( // PRINT(("### output size: %ld\n", outputBuffer->Header()->size_used)); } -// END -- AudioFilterNode.cpp -- \ No newline at end of file +// END -- AudioFilterNode.cpp -- diff --git a/src/apps/cortex/addons/common/AudioFilterNode.h b/src/apps/cortex/addons/common/AudioFilterNode.h index 8f048c648d..3ab9b78e3b 100644 --- a/src/apps/cortex/addons/common/AudioFilterNode.h +++ b/src/apps/cortex/addons/common/AudioFilterNode.h @@ -105,7 +105,10 @@ public: // *** HOOKS media_format preferred; preferred.type = B_MEDIA_RAW_AUDIO; - status_t err = getPreferredInputFormat(preferred); +#ifdef DEBUG + status_t err = +#endif + getPreferredInputFormat(preferred); ASSERT(err == B_OK); _specialize_raw_audio_format(preferred, ioFormat); } @@ -121,7 +124,10 @@ public: // *** HOOKS media_format preferred; preferred.type = B_MEDIA_RAW_AUDIO; - status_t err = getPreferredOutputFormat(preferred); +#ifdef DEBUG + status_t err = +#endif + getPreferredOutputFormat(preferred); ASSERT(err == B_OK); string_for_format(preferred, fmt_buffer, 255); @@ -469,4 +475,4 @@ private: // *** add-on stuff BMediaAddOn* m_addOn; }; -#endif /*__AudioFilterNode_H__*/ \ No newline at end of file +#endif /*__AudioFilterNode_H__*/ diff --git a/src/apps/cortex/addons/common/IAudioFilterOpFactory.h b/src/apps/cortex/addons/common/IAudioFilterOpFactory.h index 64cd728bf9..380152b945 100644 --- a/src/apps/cortex/addons/common/IAudioFilterOpFactory.h +++ b/src/apps/cortex/addons/common/IAudioFilterOpFactory.h @@ -45,4 +45,4 @@ public: // *** HOOKS }; -#endif /*__IAudioFilterOpFactory_H__*/ \ No newline at end of file +#endif /*__IAudioFilterOpFactory_H__*/ diff --git a/src/apps/cortex/addons/common/IAudioOp.h b/src/apps/cortex/addons/common/IAudioOp.h index 77d3406820..b105556b5a 100644 --- a/src/apps/cortex/addons/common/IAudioOp.h +++ b/src/apps/cortex/addons/common/IAudioOp.h @@ -87,4 +87,4 @@ public: // *** OPTIONAL INTERFACE }; -#endif /*__IAudioOp_H__*/ \ No newline at end of file +#endif /*__IAudioOp_H__*/ diff --git a/src/apps/cortex/addons/common/IAudioOpFactory.h b/src/apps/cortex/addons/common/IAudioOpFactory.h index 6af8320d90..a98d09b55f 100644 --- a/src/apps/cortex/addons/common/IAudioOpFactory.h +++ b/src/apps/cortex/addons/common/IAudioOpFactory.h @@ -50,4 +50,4 @@ public: // *** HOOKS virtual ~IAudioOpFactory() {} }; -#endif /*__IAudioOpFactory_H__*/ \ No newline at end of file +#endif /*__IAudioOpFactory_H__*/ diff --git a/src/apps/cortex/addons/common/IAudioOpHost.h b/src/apps/cortex/addons/common/IAudioOpHost.h index b63c960c2c..382cb68a34 100644 --- a/src/apps/cortex/addons/common/IAudioOpHost.h +++ b/src/apps/cortex/addons/common/IAudioOpHost.h @@ -11,7 +11,8 @@ class IParameterSet; class IAudioOpHost { public: // *** REQUIRED INTERFACE + virtual ~IAudioOpHost() { } virtual IParameterSet* parameterSet() const =0; }; -#endif /*__IAudioOpHost_H__*/ \ No newline at end of file +#endif /*__IAudioOpHost_H__*/ diff --git a/src/apps/cortex/addons/common/IParameterSet.h b/src/apps/cortex/addons/common/IParameterSet.h index 3d2ee07e80..69086b230e 100644 --- a/src/apps/cortex/addons/common/IParameterSet.h +++ b/src/apps/cortex/addons/common/IParameterSet.h @@ -10,6 +10,7 @@ #ifndef __IParameterSet_H__ #define __IParameterSet_H__ +#include #include class IParameterSet { @@ -63,4 +64,4 @@ private: // *** IMPLEMENTATION // map of parameter ID -> change time +++++ }; -#endif /*__IParameterSet_H__*/ \ No newline at end of file +#endif /*__IParameterSet_H__*/ diff --git a/src/apps/cortex/addons/common/MediaNodeControlApp.h b/src/apps/cortex/addons/common/MediaNodeControlApp.h index 80c36fac11..b4c6b72cc2 100644 --- a/src/apps/cortex/addons/common/MediaNodeControlApp.h +++ b/src/apps/cortex/addons/common/MediaNodeControlApp.h @@ -29,4 +29,4 @@ private: // members media_node m_node; }; -#endif /*__MediaNodeControlApp_H__*/ \ No newline at end of file +#endif /*__MediaNodeControlApp_H__*/ diff --git a/src/apps/cortex/addons/common/RawBuffer.cpp b/src/apps/cortex/addons/common/RawBuffer.cpp index 726b455343..6b57b633e2 100644 --- a/src/apps/cortex/addons/common/RawBuffer.cpp +++ b/src/apps/cortex/addons/common/RawBuffer.cpp @@ -19,12 +19,13 @@ RawBuffer::RawBuffer( rtm_pool* pFromPool) : m_pData(0), - m_allocatedSize(0), + m_pPool(pFromPool), m_frameSize(frameSize), m_frames(frames), + m_allocatedSize(0), m_bCircular(bCircular), - m_bOwnData(true), - m_pPool(pFromPool) { + m_bOwnData(true) +{ if(m_frames) resize(m_frames); @@ -40,12 +41,13 @@ RawBuffer::RawBuffer( rtm_pool* pFromPool) : m_pData(pData), - m_allocatedSize(0), + m_pPool(pFromPool), m_frameSize(frameSize), m_frames(frames), - m_bOwnData(false), + m_allocatedSize(0), m_bCircular(bCircular), - m_pPool(pFromPool) {} + m_bOwnData(false) +{} RawBuffer::RawBuffer(const RawBuffer& clone) { operator=(clone); @@ -289,4 +291,4 @@ void RawBuffer::free() { } -// END -- RawBuffer.cpp -- \ No newline at end of file +// END -- RawBuffer.cpp -- diff --git a/src/apps/cortex/addons/common/audio_buffer_tools.h b/src/apps/cortex/addons/common/audio_buffer_tools.h index 96c11c0c9c..b701b13c85 100644 --- a/src/apps/cortex/addons/common/audio_buffer_tools.h +++ b/src/apps/cortex/addons/common/audio_buffer_tools.h @@ -136,7 +136,7 @@ inline void convert_sample(void* pIn, void* pOut, else { // two-step cases - float fTemp; + float fTemp = 0; convert_sample(pIn, fTemp, in_audio_format); convert_sample(fTemp, pOut, out_audio_format); }