fix a crash in SetVolume, fix debug build

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18005 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2006-07-02 11:15:18 +00:00
parent 8815fed657
commit e2e2e542ed
2 changed files with 13 additions and 7 deletions

View File

@ -725,7 +725,7 @@ BMidiStore::ReadChunk()
ReadTrack();
else {
TRACE(("Skipping '%c%c%c%c' chunk (%lu bytes)",
fourcc[0], fourcc[1], fourcc[2], fourcc[3], byteCount))
fourcc[0], fourcc[1], fourcc[2], fourcc[3], fByteCount))
SkipBytes(fByteCount);
}

View File

@ -23,7 +23,8 @@ using namespace BPrivate;
BSoftSynth::BSoftSynth()
: fSynth(NULL),
: fInitCheck(false),
fSynth(NULL),
fSettings(NULL),
fSoundPlayer(NULL)
{
@ -147,9 +148,10 @@ BSoftSynth::FlushInstrumentCache(bool startStopCache)
void
BSoftSynth::SetVolume(double volume)
{
if (volume >= 0.0) {
fluid_synth_set_gain(fSynth, volume);
}
if (InitCheck())
if (volume >= 0.0) {
fluid_synth_set_gain(fSynth, volume);
}
}
@ -434,8 +436,10 @@ BSoftSynth::_Init()
return;
err = fluid_synth_sfload(fSynth, fInstrumentsFile, 1);
if (err < B_OK)
if (err < B_OK) {
fprintf(stderr, "error in fluid_synth_sfload\n");
return;
}
media_raw_audio_format format = media_raw_audio_format::wildcard;
format.channel_count = 2;
@ -444,8 +448,10 @@ BSoftSynth::_Init()
fSoundPlayer = new BSoundPlayer(&format, "Soft Synth", &PlayBuffer, NULL, this);
err = fSoundPlayer->InitCheck();
if (err != B_OK)
if (err != B_OK) {
fprintf(stderr, "error in BSoundPlayer\n");
return;
}
fSoundPlayer->SetHasData(true);
fSoundPlayer->Start();