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

start offsets #7

Closed
JohnPaulHarold opened this issue Jun 11, 2016 · 5 comments
Closed

start offsets #7

JohnPaulHarold opened this issue Jun 11, 2016 · 5 comments

Comments

@JohnPaulHarold
Copy link
Contributor

Currently, you can make a Sound, and play it. But what if I want to make the Sound, and play it 10 seconds later, or at a specific context.currentTime?

What's stopping Pz from doing this, if anything?

@alemangui
Copy link
Owner

Nothing really, it's just a use case that hasn't come up. I would be OK with implementing this. Perhaps as an optional parameter to the playfunction.

@JohnPaulHarold
Copy link
Contributor Author

OK, have got something almost ready to go with this, but I'm getting failing tests. I pulled down a zip of master and ran gulp tests in that, and that's also reporting the same failing tests.

Firefox 47.0.0 (Windows 10 0.0.0) Sound actions should trigger 'end' when ended FAILED
        Expected spy endCallback to have been called.
        sound</<@C:/Users/John-Paul Harold/Code/pizzicato/tests/Sound.test.js:237:6
Firefox 47.0.0 (Windows 10 0.0.0) Sound actions should stop automatically when file sound is over FAILED
        Expected true to be false.
        click</<@C:/Users/John-Paul Harold/Code/pizzicato/tests/Sound.test.js:261:6

@alemangui Do you see tests failing also? I can raise this as a separate issue if required.

@alemangui
Copy link
Owner

alemangui commented Jun 19, 2016

I have been taking a look at this as well. I have an API prepared that would allow to pass 2 parameters two the play function:

sound.play(when, offset);

So calling sound.play(2, 4); will play the sound after two seconds starting from 00:04.

Do you have any remarks on this API?

There is one main issue that has prevented me from merging this. Which was described by you in issue #1: the offset is off for tracks loaded from external files that loop. I have opened issue #9 to address this issue.

The second issue has to do with testing and it's probably the same you are describing. In TravisCI, sometimes I get a failing test (link here) that is related to the loading of a wav file. My guess is that it's linked to the timeout time of that particular test, but I have not been able to reproduce it locally. I have entered issue #10 to follow up.

I will enter both issues separately, and will most likely merge the code for the when and offset parameters and deal with the above issues separately.

alemangui added a commit that referenced this issue Jun 19, 2016
…and 'offset'. Adds testing and documentation.
@JohnPaulHarold
Copy link
Contributor Author

I've pushed my local branch if you wish to compare against it, but the only real change is that I added the duration param for completeness.

So, the idea on the first param is that it will always add the context.currentTime to the user desired when? I think I like that, good choice :-) With mine, I'd just assumed the user would be taking care of that, but I think your's is a nice touch. Right now, I can't think of any downsides to this.

@alemangui
Copy link
Owner

Cheers 👍 I will take a look at your local branch as well. I will close this issue but feel free to open a new one if you have any remarks.

alemangui added a commit that referenced this issue Jun 26, 2016
…and 'offset'. Adds testing and documentation.
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

2 participants