ObjectivelyMVC 0.1.0
Object oriented MVC framework for OpenGL, SDL2 and GNU C
Public Member Functions | Data Fields | Protected Attributes
SoundStage Struct Reference

The SoundStage type. More...

#include <SoundStage.h>

Inheritance diagram for SoundStage:

Public Member Functions

Class * _SoundStage (void)
 The SoundStage archetype. More...
 
SoundStageinit (SoundStage *self)
 Initializes this SoundStage with the default device and configuration. More...
 
void play (const SoundStage *self, const char *sound)
 Enqueues the given Sound for playback. More...
 
void playResourceName (const SoundStage *, const Sound *sound)
 

Data Fields

Object object
 The superclass. More...
 

Protected Attributes

SoundStageInterface * interface
 The interface. More...
 

Detailed Description

The SoundStage type.

Definition at line 40 of file SoundStage.h.

Member Function Documentation

◆ _SoundStage()

Class * _SoundStage ( void  )

The SoundStage archetype.

Returns
The SoundStage Class.

Definition at line 120 of file SoundStage.c.

120 {
121 static Class *clazz;
122 static Once once;
123
124 do_once(&once, {
125 clazz = _initialize(&(const ClassDef) {
126 .name = "SoundStage",
127 .superclass = _Object(),
128 .instanceSize = sizeof(SoundStage),
129 .interfaceOffset = offsetof(SoundStage, interface),
130 .interfaceSize = sizeof(SoundStageInterface),
132 .destroy = destroy,
133 });
134 });
135
136 return clazz;
137}
static void destroy(Class *clazz)
Definition: SoundStage.c:108
static void initialize(Class *clazz)
Definition: SoundStage.c:91
The SoundStage type.
Definition: SoundStage.h:40
SoundStageInterface * interface
The interface.
Definition: SoundStage.h:51

◆ init()

SoundStage * init ( SoundStage self)

Initializes this SoundStage with the default device and configuration.

Parameters
selfThe SoundStage.
Returns
The initialized SoundStage, or NULL on error.

Definition at line 55 of file SoundStage.c.

55 {
56
57 self = (SoundStage *) super(Object, self, init);
58 if (self) {
59
60 if (Mix_OpenAudioDevice(48000, AUDIO_S16SYS, 2, 2048, NULL, SDL_AUDIO_ALLOW_ANY_CHANGE) == 0) {
61 MVC_LogInfo("Opened audio device for playback\n");
62 } else {
63 MVC_LogError("Failed to open audio device: %s\n", SDL_GetError());
64 self = release(self);
65 }
66 }
67
68 return self;
69}
#define MVC_LogInfo(fmt,...)
Definition: Log.h:49
#define MVC_LogError(fmt,...)
Definition: Log.h:55
SoundStage * init(SoundStage *self)
Initializes this SoundStage with the default device and configuration.
Definition: SoundStage.c:55

◆ play()

void play ( const SoundStage self,
const char *  sound 
)

Enqueues the given Sound for playback.

Parameters
selfThe SoundStage.
soundThe Sound.

◆ playResourceName()

void playResourceName ( const SoundStage ,
const Sound sound 
)

Field Documentation

◆ interface

SoundStageInterface* SoundStage::interface
protected

The interface.

Definition at line 51 of file SoundStage.h.

◆ object

Object SoundStage::object

The superclass.

Definition at line 45 of file SoundStage.h.


The documentation for this struct was generated from the following files: