audio update: loop region

This commit is contained in:
Turanszki Janos
2019-11-09 22:51:46 +00:00
parent 173fd99c5f
commit b8addef21d
4 changed files with 11 additions and 2 deletions
+1 -1
View File
@@ -142,7 +142,7 @@ SoundWindow::SoundWindow(wiGUI* gui) : GUI(gui)
loopedCheckbox->SetEnabled(false);
volumeSlider = new wiSlider(0, 1, 1, 1000, "Volume: ");
volumeSlider->SetTooltip("Enable looping for the selected sound instance.");
volumeSlider->SetTooltip("Set volume level for the selected sound instance.");
volumeSlider->SetPos(XMFLOAT2(x + 60, y += step));
volumeSlider->SetSize(XMFLOAT2(240, 30));
volumeSlider->OnSlide([&](wiEventArgs args) {
+2
View File
@@ -302,6 +302,8 @@ namespace wiAudio
instanceinternal->buffer.pAudioData = soundinternal->audioData.data();
instanceinternal->buffer.Flags = XAUDIO2_END_OF_STREAM;
instanceinternal->buffer.LoopCount = XAUDIO2_LOOP_INFINITE;
instanceinternal->buffer.LoopBegin = UINT32(instance->loop_begin * masteringVoiceDetails.InputSampleRate);
instanceinternal->buffer.LoopLength = UINT32(instance->loop_length * masteringVoiceDetails.InputSampleRate);
hr = instanceinternal->sourceVoice->SubmitSourceBuffer(&instanceinternal->buffer);
if (FAILED(hr))
+7
View File
@@ -41,12 +41,17 @@ namespace wiAudio
struct SoundInstance
{
SUBMIX_TYPE type = SUBMIX_TYPE_SOUNDEFFECT;
float loop_begin = 0; // loop region begin in seconds (0 = from beginning)
float loop_length = 0; // loop region legth in seconds (0 = until the end)
wiCPUHandle handle = WI_NULL_HANDLE;
void operator=(SoundInstance&& other)
{
type = other.type;
loop_begin = other.loop_begin;
loop_length = other.loop_length;
handle = other.handle;
other.handle = WI_NULL_HANDLE;
}
@@ -54,6 +59,8 @@ namespace wiAudio
SoundInstance(SoundInstance&& other)
{
type = other.type;
loop_begin = other.loop_begin;
loop_length = other.loop_length;
handle = other.handle;
other.handle = WI_NULL_HANDLE;
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wiVersion
// minor features, major updates
const int minor = 31;
// minor bug fixes, alterations, refactors, updates
const int revision = 7;
const int revision = 8;
long GetVersion()