Skip to content

Instantly share code, notes, and snippets.

@typeoneerror
Last active December 12, 2015 04:09
Show Gist options
  • Select an option

  • Save typeoneerror/4712397 to your computer and use it in GitHub Desktop.

Select an option

Save typeoneerror/4712397 to your computer and use it in GitHub Desktop.

To start, we have a channelPlaying bool, which is passed as a "reference" to isPlaying using the syntax &channelPlaying. This seems to be somewhat a matter of style, but there are differences, though FMOD's examples uses the & version, so I've updated it to that one.

Secondly, FMODExChannel::isPlaying is the definition of a member function on the FMODExChannel. We call that with instance->isPlaying(), not instance::isPlaying() (which would be for a class function, afaik). Both references and class/instance operators seem to be similar to PHP style, which makes sense.

- bool *channelPlaying;
- self->mChannel::isPlaying(channelPlaying);
- bool isPlaying = self->mPlayState == PLAYING && *channelPlaying;
+ FMOD_RESULT result = FMOD_OK;
+ bool channelPlaying;
+
+ result = self->mChannel->isPlaying(&channelPlaying);
+ bool isPlaying = self->mPlayState == PLAYING && channelPlaying;
@NoobsArePeople2
Copy link

My understanding is that when written instance->method() rather than instance.method() instance is a pointer.

:: just resolves scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment