mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 09:01:39 -05:00
-Implemented worker requestNewBuffer function
This commit is contained in:
parent
30ef6c4330
commit
e472b4fcd4
1 changed files with 13 additions and 1 deletions
|
@ -13,11 +13,11 @@ using namespace std;
|
|||
|
||||
namespace Worker
|
||||
{
|
||||
/// loads a sample into a new AudioBuffer, returning the buffer
|
||||
static AudioBuffer* loadSample( string path )
|
||||
{
|
||||
SndfileHandle infile( path, SFM_READ );
|
||||
|
||||
cout << "Worker: loadSample() TODO: fix memory leak using Shared()" << endl;
|
||||
AudioBuffer* ab = new AudioBuffer();
|
||||
|
||||
std::vector<float> buf( infile.frames(), 0.f );
|
||||
|
@ -35,6 +35,18 @@ namespace Worker
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// allocates a new audiobuffer of the desired size and returns it
|
||||
static AudioBuffer* allocateNewBuffer(int size)
|
||||
{
|
||||
AudioBuffer* ab = new AudioBuffer();
|
||||
|
||||
std::vector<float> buf( size, 0.f );
|
||||
|
||||
ab->nonRtSetSample( buf );
|
||||
|
||||
return ab;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // LUPPP_WORKER_H
|
||||
|
|
Loading…
Add table
Reference in a new issue