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
+1 -1
View File
@@ -725,7 +725,7 @@ BMidiStore::ReadChunk()
ReadTrack(); ReadTrack();
else { else {
TRACE(("Skipping '%c%c%c%c' chunk (%lu bytes)", 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); SkipBytes(fByteCount);
} }
+12 -6
View File
@@ -23,7 +23,8 @@ using namespace BPrivate;
BSoftSynth::BSoftSynth() BSoftSynth::BSoftSynth()
: fSynth(NULL), : fInitCheck(false),
fSynth(NULL),
fSettings(NULL), fSettings(NULL),
fSoundPlayer(NULL) fSoundPlayer(NULL)
{ {
@@ -147,9 +148,10 @@ BSoftSynth::FlushInstrumentCache(bool startStopCache)
void void
BSoftSynth::SetVolume(double volume) BSoftSynth::SetVolume(double volume)
{ {
if (volume >= 0.0) { if (InitCheck())
fluid_synth_set_gain(fSynth, volume); if (volume >= 0.0) {
} fluid_synth_set_gain(fSynth, volume);
}
} }
@@ -434,8 +436,10 @@ BSoftSynth::_Init()
return; return;
err = fluid_synth_sfload(fSynth, fInstrumentsFile, 1); err = fluid_synth_sfload(fSynth, fInstrumentsFile, 1);
if (err < B_OK) if (err < B_OK) {
fprintf(stderr, "error in fluid_synth_sfload\n");
return; return;
}
media_raw_audio_format format = media_raw_audio_format::wildcard; media_raw_audio_format format = media_raw_audio_format::wildcard;
format.channel_count = 2; format.channel_count = 2;
@@ -444,8 +448,10 @@ BSoftSynth::_Init()
fSoundPlayer = new BSoundPlayer(&format, "Soft Synth", &PlayBuffer, NULL, this); fSoundPlayer = new BSoundPlayer(&format, "Soft Synth", &PlayBuffer, NULL, this);
err = fSoundPlayer->InitCheck(); err = fSoundPlayer->InitCheck();
if (err != B_OK) if (err != B_OK) {
fprintf(stderr, "error in BSoundPlayer\n");
return; return;
}
fSoundPlayer->SetHasData(true); fSoundPlayer->SetHasData(true);
fSoundPlayer->Start(); fSoundPlayer->Start();