Skip to content

Commit

Permalink
Fixing various warnings, including some omissions on the error code c…
Browse files Browse the repository at this point in the history
…hange..
  • Loading branch information
jarikomppa committed Jun 22, 2014
1 parent 897e195 commit a78778f
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 24 deletions.
1 change: 0 additions & 1 deletion demos/multimusic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ int main(int argc, char *argv[])
cycle++;
// Render stuff
render();
int h;
// Poll for events, and handle the ones we care about.
SDL_Event event;
while (SDL_PollEvent(&event))
Expand Down
8 changes: 4 additions & 4 deletions demos/space/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void render()
float v = fabs(w[i] + (rand() % 500)/10000.0f);
if (v > 1) v = 1;
float h = 132 * v / 2;
drawrect(317+i, 231 + 66-h, 1, h*2, 0xff009f00);
drawrect(317+i, 231 + 66-(int)floor(h), 1, (int)floor(h*2), 0xff009f00);
}

float *f = gMusicBus.calcFFT();
Expand All @@ -152,7 +152,7 @@ void render()
float v = f[(i & ~7) + 5] / 2;
float h = 60 * v;
if (h > 60) h = 60;
drawrect(62+i,383+60-h,1,h,0xff007f00);
drawrect(62+i,383+60-(int)floor(h),1,(int)floor(h),0xff007f00);
}

int loop = gSoloud.getLoopCount(speechhandle);
Expand Down Expand Up @@ -201,7 +201,7 @@ int main(int argc, char *argv[])
gSpeech.setFilter(0, &gLofi);
gSpeech.setFilter(2, &gReso);
gLofi.setParams(8000,4);
gFlanger.setParams(0.002,100);
gFlanger.setParams(0.002f,100);
// gReso.setParams(SoLoud::BiquadResonantFilter::LOWPASS, 8000, 500, 5);
gReso.setParams(SoLoud::BiquadResonantFilter::BANDPASS, 8000, 1000, 0.5);

Expand All @@ -218,7 +218,7 @@ int main(int argc, char *argv[])
gSpeech.setLooping(1);

speechhandle = gSpeechBus.play(gSpeech, 3, -0.25);
gSoloud.setRelativePlaySpeed(speechhandle, 1.2);
gSoloud.setRelativePlaySpeed(speechhandle, 1.2f);

gSoloud.oscillateFilterParameter(speechhandle, 0, SoLoud::LofiFilter::SAMPLERATE, 2000, 8000, 4);

Expand Down
6 changes: 3 additions & 3 deletions include/soloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,9 @@ namespace SoLoud
// Global filter instance
FilterInstance *mFilterInstance[FILTERS_PER_STREAM];
// Find a free voice, stopping the oldest if no free voice is found.
unsigned int findFreeVoice();
// Converts handle to voice, if the handle is valid.
unsigned int getVoiceFromHandle(handle aVoiceHandle) const;
int findFreeVoice();
// Converts handle to voice, if the handle is valid. Returns -1 if not.
int getVoiceFromHandle(handle aVoiceHandle) const;
// Converts voice + playindex into handle
handle getHandleFromVoice(unsigned int aVoice) const;
// Stop voice (not handle).
Expand Down
16 changes: 8 additions & 8 deletions include/soloud_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ namespace SoLoud
{
enum SOLOUD_ERRORS
{
SO_NO_ERROR = 0, // No error
INVALID_PARAMETER = -1, // Some parameter is invalid
FILE_NOT_FOUND = -2, // File not found
FILE_LOAD_FAILED = -3, // File found, but could not be loaded
DLL_NOT_FOUND = -4, // DLL not found, or wrong DLL
OUT_OF_MEMORY = -5, // Out of memory
NOT_IMPLEMENTED = -6, // Feature not implemented
UNKNOWN_ERROR = -7 // Other error
SO_NO_ERROR = 0, // No error
INVALID_PARAMETER = 1, // Some parameter is invalid
FILE_NOT_FOUND = 2, // File not found
FILE_LOAD_FAILED = 3, // File found, but could not be loaded
DLL_NOT_FOUND = 4, // DLL not found, or wrong DLL
OUT_OF_MEMORY = 5, // Out of memory
NOT_IMPLEMENTED = 6, // Feature not implemented
UNKNOWN_ERROR = 7 // Other error
};
};
#endif
2 changes: 1 addition & 1 deletion src/audiosource/modplug/soloud_modplug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ namespace SoLoud
FILE * f = fopen(aFilename, "rb");
if (!f)
{
return -1;
return FILE_NOT_FOUND;
}

if (mData)
Expand Down
2 changes: 1 addition & 1 deletion src/audiosource/speech/klatt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ void klatt::parwave(klatt_frame *frame, short int *jwave)
float sourc; /* Sound source if all-parallel config used */
float glotout; /* Output of glottal sound source */
float par_glotout; /* Output of parallelglottal sound sourc */
float voice; /* Current sample of voicing waveform */
float voice = 0; /* Current sample of voicing waveform */
float frics; /* Frication sound source */
float aspiration; /* Aspiration sound source */
int nrand; /* Varible used by random number generator */
Expand Down
3 changes: 1 addition & 2 deletions src/core/soloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ namespace SoLoud
}
#endif
if (!inited)
return -10;
return UNKNOWN_ERROR;
return 0;
}

Expand Down Expand Up @@ -450,7 +450,6 @@ namespace SoLoud
unsigned int j;
float step = mVoice[i]->mSamplerate / aSamplerate;
int step_fixed = (int)floor(step * FIXPOINT_FRAC_MUL);
float samples_per_block = SAMPLE_GRANULARITY / step;
unsigned int outofs = 0;

if (mVoice[i]->mDelaySamples)
Expand Down
2 changes: 1 addition & 1 deletion src/core/soloud_audiosource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace SoLoud
mAudioSourceID = 0;
mActiveFader = 0;
mChannels = 1;
mBusHandle = -1;
mBusHandle = ~0u;
mLoopCount = 0;
int i;
for (i = 0; i < FILTERS_PER_STREAM; i++)
Expand Down
2 changes: 1 addition & 1 deletion src/core/soloud_core_basicops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace SoLoud
{
if (mUnlockMutexFunc) mUnlockMutexFunc(mMutex);
delete instance;
return -1;
return UNKNOWN_ERROR;
}
if (!aSound.mAudioSourceID)
{
Expand Down
4 changes: 2 additions & 2 deletions src/core/soloud_core_getters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace SoLoud
return (aVoice + 1) | (mVoice[aVoice]->mPlayIndex << 12);
}

unsigned int Soloud::getVoiceFromHandle(handle aVoiceHandle) const
int Soloud::getVoiceFromHandle(handle aVoiceHandle) const
{
// If this is a voice group handle, pick the first handle from the group
handle *h = voiceGroupHandleToArray(aVoiceHandle);
Expand Down Expand Up @@ -202,7 +202,7 @@ namespace SoLoud
return v != 0;
}

unsigned int Soloud::findFreeVoice()
int Soloud::findFreeVoice()
{
int i;
unsigned int lowest_play_index_value = 0xffffffff;
Expand Down

0 comments on commit a78778f

Please sign in to comment.