mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 05:20:00 +02:00
add methods to set/get samples and volume
This commit is contained in:
parent
e977d28fe3
commit
0477ad79dd
2 changed files with 16 additions and 0 deletions
|
@ -152,3 +152,15 @@ void AudioInjector::addSamples(int16_t* sampleBuffer, int numSamples) {
|
|||
_indexOfNextSlot += numSamples;
|
||||
}
|
||||
}
|
||||
|
||||
int16_t& AudioInjector::sampleAt(const int index) {
|
||||
assert(index >= 0 && index < _numTotalSamples);
|
||||
|
||||
return _audioSampleArray[index];
|
||||
}
|
||||
|
||||
void AudioInjector::insertSample(const int index, int16_t sample) {
|
||||
assert (index >= 0 && index < _numTotalSamples);
|
||||
|
||||
_audioSampleArray[index] = sample;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ class AudioInjector : public QObject {
|
|||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(glm::vec3 position READ getPosition WRITE setPosition)
|
||||
Q_PROPERTY(uchar volume READ getVolume WRITE setVolume);
|
||||
public:
|
||||
AudioInjector(const char* filename);
|
||||
AudioInjector(int maxNumSamples);
|
||||
|
@ -54,6 +55,9 @@ public:
|
|||
|
||||
void addSample(const int16_t sample);
|
||||
void addSamples(int16_t* sampleBuffer, int numSamples);
|
||||
public slots:
|
||||
int16_t& sampleAt(const int index);
|
||||
void insertSample(const int index, int16_t sample);
|
||||
private:
|
||||
unsigned char _streamIdentifier[STREAM_IDENTIFIER_NUM_BYTES];
|
||||
int16_t* _audioSampleArray;
|
||||
|
|
Loading…
Reference in a new issue