Skip to content

Commit

Permalink
SampleBuffer: passes basic test filling the sample values. see issue #89
Browse files Browse the repository at this point in the history
  • Loading branch information
nwolek committed Apr 19, 2016
1 parent 3a1ab07 commit 3346b33
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
1 change: 1 addition & 0 deletions include/Jamoma.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ constexpr inline uint32_t Hash(const char *const str, const uint32_t seed = 0xAE
#include "JamomaLimiter.h"
#include "JamomaLowpassOnePole.h"
#include "JamomaLowpassFourPole.h"
#include "JamomaSampleBuffer.h"
#include "JamomaSync.h"
#include "JamomaWhiteNoise.h"
#include "JamomaUnitImpulse.h"
20 changes: 20 additions & 0 deletions include/objects/JamomaSampleBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,27 @@ namespace Jamoma {
*/
class SampleBuffer : public SampleBundle {
public:
static constexpr Classname classname = { "samplebuffer" };
static constexpr auto tags = { "audio", "sample" };

/** Create a SampleBuffer of a specific size.
@param channelCount The number of channels for which to allocate memory.
@param frameCount The number of samples per channel for which to allocate memory.
*/
SampleBuffer(int channelCount, int frameCount) : SampleBundle(channelCount,frameCount)
{
}

/** Default constructor creates a bundle containing a single sample. */
SampleBuffer()
: SampleBuffer(1,1)
{}


SampleBuffer(const SampleBuffer&) = default; // inheriting the default copy constructor

private:

};


Expand Down
12 changes: 7 additions & 5 deletions test/SampleBuffer/SampleBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ namespace Jamoma {
SampleBufferTest(Jamoma::UnitTest<SampleBufferTest>* test)
: mTest(test)
{
//testBasic();
testBasic();
}

/*

void testBasic()
{
Jamoma::SampleBuffer my_samples(1, 4);
Jamoma::SampleBuffer my_samples(1, 4);


my_samples.fill(1.0);

int badSampleCount = 0;
Expand All @@ -38,14 +39,15 @@ namespace Jamoma {
for (int i = 0; i < my_samples.frameCount(); i++)
{
temp = my_samples[0][i];
if (mTest->compare(temp, tempExpected) ) {
if ( ! mTest->compare(temp, tempExpected) ) {
badSampleCount++;
}
}

mTest->TEST_ASSERT("filled with ones", badSampleCount == 0);

}
*/


};

Expand Down

0 comments on commit 3346b33

Please sign in to comment.