Component capable of capturing and playing back audio.
More...
#include <synthclone/sampler.h>
Component capable of capturing and playing back audio.
◆ Sampler()
synthclone::Sampler::Sampler |
( |
const QString & |
name, |
|
|
QObject * |
parent = 0 |
|
) |
| |
|
explicitprotected |
Constructs a new Sampler.
This constructor cannot be called directly; instead, subclasses should call this constructor in their constructors.
- Parameters
-
name | The initial name for the sampler. |
parent | The parent object of the sampler. |
◆ ~Sampler()
virtual synthclone::Sampler::~Sampler |
( |
| ) |
|
|
protectedvirtual |
◆ abortJob()
virtual void synthclone::Sampler::abortJob |
( |
| ) |
|
|
pure virtual |
Aborts the current job.
It's possible for this method to be called before the session reflects that the current job is done, but after the Sampler has finished the current job. In that case, this method should do nothing.
- See also
- startJob()
◆ jobAborted
void synthclone::Sampler::jobAborted |
( |
| ) |
|
|
signal |
Emitted when a job has been aborted.
◆ jobCompleted
void synthclone::Sampler::jobCompleted |
( |
| ) |
|
|
signal |
Emitted when a job finishes.
◆ jobError
void synthclone::Sampler::jobError |
( |
const QString & |
message | ) |
|
|
signal |
Emitted when a job cannot be completed due to an error.
- Parameters
-
message | The error message. |
◆ startJob()
Starts a new job.
Jobs should be run asynchronously, and should be able to be aborted within a reasonable time interval. How the job is handled depends on the job type.
If the job's type is:
... then:
- Play the given audio.
- Use the progressChanged() and statusChanged() signals to indicate progress.
- When playing is complete, emit a jobCompleted() signal.
If an error occurs during the playing process:
- Stop playing the sample.
- Emit a jobError() signal.
If abort() is called during the playing process:
- Stop playing the sample.
- Emit a jobAborted() signal.
If the job's type is:
... then:
- Send a MIDI control message on the given MIDI channel for each control item that's set to a specific value.
- Send a MIDI note on message on the given MIDI channel for the given note and velocity values.
- If the channel pressure value is set, send a MIDI channel pressure message on the given MIDI channel with the given channel pressure value.
- If the aftertouch value is set, send a MIDI aftertouch message on the given MIDI channel with the given aftertouch value.
- If there is any known latency for the MIDI port and/or audio ports, then wait that time before sampling. Note that any time spent sending the MIDI aftertouch and/or control pressure messages should be subtracted from the wait time.
- Retrieve data until Zone::getSampleTime() has passed. Use the progressChanged() and statusChanged() signals to indicate progress.
- After sampling is complete, send a MIDI note off event on the given MIDI channel.
- Wait the amount of time specified by Zone::getReleaseTime(). Use the progressChanged() and statusChanged() signals to indicate progress.
- Send an all sound off event on the given channel.
- Send a reset all controllers event on the given channel.
- Make sure that all of the audio data has been written to the given stream. Whether or not this is done asynchronously or after all data is retrieved is up to the sampler implementation.
- When sampling is complete, emit the jobCompleted() signal.
If an error occurs during the sampling process:
- If MIDI messages have been sent, execute steps 7-10 above (if possible).
- Emit a jobError() signal.
If abort() is called during this operation:
- If MIDI messages have been sent, execute steps 7-10 above (if possible).
- Emit a jobAborted() signal.
- Parameters
-
job | The job to be run. |
stream | A stream object. If the job type is:
... then the object will be a SampleInputStream. If the job type is:
... then the object will be a SampleOutputStream. Use qobject_cast to cast the object to the appropriate type. |
The documentation for this class was generated from the following file: