Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SoundEffect LOOPSTART support broken #13

Closed
Sebanisu opened this issue Mar 18, 2019 · 1 comment
Closed

SoundEffect LOOPSTART support broken #13

Sebanisu opened this issue Mar 18, 2019 · 1 comment
Assignees

Comments

@Sebanisu
Copy link
Collaborator

Music will play and loop but it will not loop from marked loop point.
MonoGame issue 5186
MonoGame pull 6607
Looks like this user has an open pull request for a fix. I had trouble finding his code to test.
So if his change gets approved this issue should go away.

I might be able to do a correct loop in naudio for windows only. I was reading about it someone using a custom class to wrap around the wavestream or something like that.

@Sebanisu Sebanisu self-assigned this Mar 25, 2019
@Sebanisu
Copy link
Collaborator Author

I got woke up this morning instead of going back to bed I fixed this. It's on my fork right now. I plan on doing a pull request once I get the linux working.

I worked around this issue by swapping from Naudio to Ffmpeg. It works. I feed the audio to a DynamicSoundEffectInstance. A timer runs in the background and when it gets close to running out of audio it runs the GetFrame() function again. This time getting the next bit of audio but starting from LOOPSTART and changing the duration to total-loopstart. It works when the timebase = 1/sample_rate. If we run into files where this isn't the case it won't work and will have to tweak the code. Also if a file is long enough that duration > int32.maxvalue than could also have issues. As duration is stored in a int64 and we are running on 32bit.

Sebanisu added a commit that referenced this issue May 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant