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

OpenAL can not set currentTime in milliseconds. #661

Open
homma-ge opened this issue Jul 7, 2017 · 0 comments
Open

OpenAL can not set currentTime in milliseconds. #661

homma-ge opened this issue Jul 7, 2017 · 0 comments

Comments

@homma-ge
Copy link

homma-ge commented Jul 7, 2017

Hello.

OpenAL can not set currentTime in milliseconds. Because AL_SEC_OFFSET is set in currentTime () and setCurrentTime () in EJAudioSourceOpenAL.m.

- (float)currentTime {
	float time;
	alGetSourcef( sourceId, AL_SEC_OFFSET, &time );
	return time/44100;
}

- (void)setCurrentTime:(float)time {
	alSourcef( sourceId, AL_SEC_OFFSET, time );
}

I want to set currentTime in milliseconds. So, I'd like to change the code as follows.

- (float)currentTime {
	float time;
	alGetSourcef( sourceId, AL_SAMPLE_OFFSET, &time );
	return time/44100;
}

- (void)setCurrentTime:(float)time {
	alSourcef( sourceId, AL_SAMPLE_OFFSET, time*44100 );
}

What do you think of the code above? Please comment it.

BTW, since I am not familiar with OpenAL, I do not know how to obtain sampling rate or monaural / stereo from the current context. sorry.

Thanks.

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