コード例 #1
0
ファイル: streamsource.c プロジェクト: ezhangle/motor
void audio_StreamSource_rewind(audio_StreamSource *source) {
  // TODO Skip to end of current buffers if playing or paused
  audio_SourceState state = source->common.state;

  audio_StreamSource_stop(source);

  if(state == audio_SourceState_playing) {
    audio_StreamSource_play(source);
  } else {
    prepareToPlay(source);
    source->common.state = audio_SourceState_paused;
  }
}
コード例 #2
0
ファイル: audio.c プロジェクト: dns/CLove
static int l_audio_SourceCommon_play(lua_State* state) {
	if (moduleData.audio_type == audio_type_stream){
		audio_StreamSource* source = (audio_StreamSource *)lua_touserdata(state, 1);
		audio_StreamSource_play(source);
	}
	else
	{
		audio_StaticSource* source = (audio_StaticSource *)lua_touserdata(state, 1);
		audio_StaticSource_play(source);
	}

	return 0;
}
コード例 #3
0
ファイル: audio.c プロジェクト: dns/CLove
Obj* c_audio_play(void* root, Obj** env, Obj** list)
{
	if (length(*list) != 1)
		error("Expected <custom> to play in audio-play.");

	Obj* arg = eval(root, env, &(*list)->car);

	if (moduleData.audio_type == audio_type_static)
	{
		audio_StaticSource* source = (audio_StaticSource*)arg->custom;
		audio_StaticSource_play(source);
		return True;
	}

	audio_StreamSource* source = (audio_StreamSource*)arg->custom;
	audio_StreamSource_play(source);

	return True;
}