01. How can I use SAMPLEPOOL?
A. Main purpose of SAMPLEPOOL - to generate code of some action sequence like this:
B. You can use it to generate samples, loops and sequences in *.wav.
C. SAMPLEPOOL is simple instrument for live playing.
02. Program window overview
03. Drag and Drop
04. Sample
05. Action
When you create action, action window opens.
Also you can open it by clicking on small action buttons above sample.
06. Envelopes
07. Mouse wheel using
Use mouse wheel to zoom in sample viewer and "Edit" action.
Use mouse wheel to move knobs with greater accuracy.
08. Importing
"Import" icon is not action. Drop it to include pool saved in file into current pool.
You can save any sample as single pool to use it in other pools.
09. What is "Close" action?
"Close" action does nothing in SAMPLEPOOL.
But in generated code this action releases memory allocated for sample.
Use it for temporary samples.
10. How can I use this for demo and 32-exe-music?
At first, generate code that contains action data (for example data.h):
In downloaded archive you can find "source" folder.
This is source of SAMPLEPOOL engine.
You need to include this headers:
#include <stdlib.h>
#include <math.h>
#include "qsp.h"
#include "data.h"
Array "outlen" is array of lengths. Array "output" is array of samples.
int* outlen = 0;
double** output = 0;
...
outlen = new int [SAMPLENUM+1];
output = new double* [SAMPLENUM+1];
...
This is code to generate samples:
...
QSP::GenerateSamples(ACTIONNUM, SAMPLENUM,
REALDATA, INTDATA, CHARDATA, ACTIONS, DEST, output, outlen);
...
After generating you have mono samples (as arrays of double) and output[0]==0,
outlen[0]==0.
You can use it with miniFMOD or other sample based player.
Source code is well commented. For more details see source.
11. Sample code of using SAMPLEPOOL + miniFMOD
void sampleloadcallback(void *buff, int lenbytes, int numbits, int instno, int sampno)
{
double val;
double* wave;
switch(instno)
{
case 0:
wave = output[15];
break;
case 1:
wave = output[16];
break;
case 3:
wave = output[17];
break;
case 4:
wave = output[18];
break;
case 5:
wave = output[1];
break;
case 6:
wave = output[4];
break;
case 7:
wave = output[9];
break;
case 8:
wave = output[8];
break;
case 9:
wave = output[11];
break;
case 10:
wave = output[14];
break;
default:
return;
}
for (int i=0; i<lenbytes/2; i++)
{
val = wave[i];
val = QSP::Clip(val);
((signed short int*)(buff))[i] = 32765.0*val;
}
}