Skip to content

Commit

Permalink
remove struct in variable declarations
Browse files Browse the repository at this point in the history
It was needed in C, but is useless in C++.
  • Loading branch information
fmang committed Mar 28, 2020
1 parent b44dc2b commit 2f36584
Show file tree
Hide file tree
Showing 49 changed files with 393 additions and 393 deletions.
24 changes: 12 additions & 12 deletions include/audio/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace oshu {
*
* ```c
* SDL_Init(SDL_AUDIO|...);
* struct oshu::audio audio;
* oshu::audio audio;
* memset(&audio, 0, sizeof(audio));
* oshu::open_audio("file.ogg", &audio);
* oshu::play_audio(&audio);
Expand Down Expand Up @@ -162,7 +162,7 @@ struct audio {
/**
* The background music.
*/
struct oshu::stream music;
oshu::stream music;
/**
* Tracks for playing sound effects on top of the music.
*
Expand All @@ -173,15 +173,15 @@ struct audio {
*
* \sa oshu::play_sample
*/
struct oshu::track effects[16];
oshu::track effects[16];
/**
* Special track for the looping sample.
*
* As you can see, only one loop is supported.
*
* \sa oshu::play_loop
*/
struct oshu::track looping;
oshu::track looping;
/**
* A device ID returned by SDL, and required by most SDL audio
* functions.
Expand All @@ -206,7 +206,7 @@ struct audio {
*
* \sa oshu_audio_close
*/
int open_audio(const char *url, struct oshu::audio *audio);
int open_audio(const char *url, oshu::audio *audio);

/**
* Start playing!
Expand All @@ -216,15 +216,15 @@ int open_audio(const char *url, struct oshu::audio *audio);
*
* \sa oshu::pause_audio
*/
void play_audio(struct oshu::audio *audio);
void play_audio(oshu::audio *audio);

/**
* Pause the stream.
*
* Calling #oshu::play_audio will resume the audio playback where it was
* left playing.
*/
void pause_audio(struct oshu::audio *audio);
void pause_audio(oshu::audio *audio);

/**
* Play a sample on top of the background music.
Expand All @@ -234,7 +234,7 @@ void pause_audio(struct oshu::audio *audio);
* reached because all the effects tracks are used, the playback of one of
* the samples is stopped to play the new sample.
*/
void play_sample(struct oshu::audio *audio, struct oshu::sample *sample, float volume);
void play_sample(oshu::audio *audio, oshu::sample *sample, float volume);

/**
* Play a looping sample.
Expand All @@ -245,7 +245,7 @@ void play_sample(struct oshu::audio *audio, struct oshu::sample *sample, float v
* \sa oshu::play_sample
* \sa oshu::stop_loop
*/
void play_loop(struct oshu::audio *audio, struct oshu::sample *sample, float volume);
void play_loop(oshu::audio *audio, oshu::sample *sample, float volume);

/**
* Seek the music stream to the specifed target position in seconds.
Expand All @@ -256,7 +256,7 @@ void play_loop(struct oshu::audio *audio, struct oshu::sample *sample, float vol
* locks the audio thread, and stops all the currently playing sound effects,
* which is definitely what you want.
*/
int seek_music(struct oshu::audio *audio, double target);
int seek_music(oshu::audio *audio, double target);

/**
* Stop the looping sample.
Expand All @@ -267,12 +267,12 @@ int seek_music(struct oshu::audio *audio, double target);
*
* \sa oshu::play_loop
*/
void stop_loop(struct oshu::audio *audio);
void stop_loop(oshu::audio *audio);

/**
* Close the audio stream and free everything associated to it.
*/
void close_audio(struct oshu::audio *audio);
void close_audio(oshu::audio *audio);

/** \} */

Expand Down
32 changes: 16 additions & 16 deletions include/audio/library.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ enum sound_shelf_index {
* These pointers are NULL when no sample is available.
*/
struct sound_shelf {
struct oshu::sample *hit_normal;
struct oshu::sample *hit_whistle;
struct oshu::sample *hit_finish;
struct oshu::sample *hit_clap;
struct oshu::sample *slider_slide;
struct oshu::sample *slider_whistle;
oshu::sample *hit_normal;
oshu::sample *hit_whistle;
oshu::sample *hit_finish;
oshu::sample *hit_clap;
oshu::sample *slider_slide;
oshu::sample *slider_whistle;
};

/**
Expand All @@ -100,7 +100,7 @@ struct sound_room {
*
* \sa size
*/
struct oshu::sound_shelf *shelves;
oshu::sound_shelf *shelves;
/**
* Indices of the shelves.
*
Expand Down Expand Up @@ -157,9 +157,9 @@ struct sound_library {
* Format of the samples in the library.
*/
struct SDL_AudioSpec *format;
struct oshu::sound_room normal;
struct oshu::sound_room soft;
struct oshu::sound_room drum;
oshu::sound_room normal;
oshu::sound_room soft;
oshu::sound_room drum;
};

/**
Expand All @@ -173,12 +173,12 @@ struct sound_library {
*
* \sa oshu::close_sound_library
*/
void open_sound_library(struct oshu::sound_library *library, struct SDL_AudioSpec *format);
void open_sound_library(oshu::sound_library *library, struct SDL_AudioSpec *format);

/**
* Delete all the loaded samples from the library.
*/
void close_sound_library(struct oshu::sound_library *library);
void close_sound_library(oshu::sound_library *library);

/**
* Locate a sample on the filesystem and insert it into the library.
Expand All @@ -187,22 +187,22 @@ void close_sound_library(struct oshu::sound_library *library);
*
* \sa oshu::register_sound
*/
int register_sample(struct oshu::sound_library *library, enum oshu::sample_set_family set, int index, int type);
int register_sample(oshu::sound_library *library, enum oshu::sample_set_family set, int index, int type);

/**
* Load every sample required to play a hit sound effect.
*
* \sa oshu::register_sample
* \sa oshu::populate_library
*/
void register_sound(struct oshu::sound_library *library, struct oshu::hit_sound *sound);
void register_sound(oshu::sound_library *library, oshu::hit_sound *sound);

/**
* Find every sample reference into a beatmap and load them into the library.
*
* \sa oshu::register_sound
*/
void populate_library(struct oshu::sound_library *library, struct oshu::beatmap *beatmap);
void populate_library(oshu::sound_library *library, oshu::beatmap *beatmap);

/**
* Play all the samples associated to the hit sound.
Expand All @@ -213,7 +213,7 @@ void populate_library(struct oshu::sound_library *library, struct oshu::beatmap
*
* \sa oshu_find_sample
*/
void play_sound(struct oshu::sound_library *library, struct oshu::hit_sound *sound, struct oshu::audio *audio);
void play_sound(oshu::sound_library *library, oshu::hit_sound *sound, oshu::audio *audio);

/** \} */

Expand Down
4 changes: 2 additions & 2 deletions include/audio/sample.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ struct sample {
*
* \sa oshu::destroy_sample
*/
int load_sample(const char *path, struct SDL_AudioSpec *spec, struct oshu::sample *sample);
int load_sample(const char *path, struct SDL_AudioSpec *spec, oshu::sample *sample);

/**
* Free the sample's PCM samples buffer.
*
* The sample object is left in an unspecified state.
*/
void destroy_sample(struct oshu::sample *sample);
void destroy_sample(oshu::sample *sample);


/** \} */
Expand Down
8 changes: 4 additions & 4 deletions include/audio/stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ struct stream {
*
* \sa oshu::close_stream
*/
int open_stream(const char *url, struct oshu::stream *stream);
int open_stream(const char *url, oshu::stream *stream);

/**
* Read *nb_samples* float samples from an audio stream.
Expand All @@ -186,7 +186,7 @@ int open_stream(const char *url, struct oshu::stream *stream);
*
* \sa oshu::stream::finished
*/
int read_stream(struct oshu::stream *stream, float *samples, int nb_samples);
int read_stream(oshu::stream *stream, float *samples, int nb_samples);

/**
* Seek the stream to the specifed target position in seconds.
Expand All @@ -202,12 +202,12 @@ int read_stream(struct oshu::stream *stream, float *samples, int nb_samples);
* There's often some kind of audio distortion glitch right after seeking.
*
*/
int seek_stream(struct oshu::stream *stream, double target);
int seek_stream(oshu::stream *stream, double target);

/**
* Close an audio stream, and free everything we can.
*/
void close_stream(struct oshu::stream *stream);
void close_stream(oshu::stream *stream);

/** \} */

Expand Down
8 changes: 4 additions & 4 deletions include/audio/track.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct track {
* This pointer is automatically reset to NULL when the sample is done
* playing.
*/
struct oshu::sample *sample;
oshu::sample *sample;
/**
* The position in the #sample buffer, in samples per channel.
*
Expand Down Expand Up @@ -71,15 +71,15 @@ struct track {
*
* \sa oshu::track
*/
void start_track(struct oshu::track *track, struct oshu::sample *sample, float volume, int loop);
void start_track(oshu::track *track, oshu::sample *sample, float volume, int loop);

/**
* Stop the playback on a track.
*
* It gets useful when a sample is looping, as it wouldn't stop by itself
* otherwise.
*/
void stop_track(struct oshu::track *track);
void stop_track(oshu::track *track);

/**
* Mix a track on top of an audio stream.
Expand All @@ -99,7 +99,7 @@ void stop_track(struct oshu::track *track);
* when the stream is inactive, or less than *nb_samples* when the sample has
* reached an end.
*/
int mix_track(struct oshu::track *track, float *samples, int nb_samples);
int mix_track(oshu::track *track, float *samples, int nb_samples);

/** \} */

Expand Down
Loading

0 comments on commit 2f36584

Please sign in to comment.