Implemented the softsynth support classes and a skeleton for

the synth itself.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7565 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
mahlzeit 2004-05-13 16:46:06 +00:00
parent 83a19c8e57
commit fbaf754a21
6 changed files with 647 additions and 106 deletions

View File

@ -11,6 +11,7 @@ SharedLibrary midi :
MidiSynthFile.cpp
MidiText.cpp
Samples.cpp
SoftSynth.cpp
Synth.cpp
;

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2002-2004 Matthijs Hollemans
* Copyright (c) 2003 Jerome Leveque
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -22,137 +23,144 @@
#include "debug.h"
#include "MidiSynth.h"
#include "SoftSynth.h"
using namespace BPrivate;
//------------------------------------------------------------------------------
BMidiSynth::BMidiSynth()
{
/* not complete yet */
if (be_synth == NULL)
{
new BSynth();
}
be_synth->clientCount++;
inputEnabled = false;
transpose = 0;
creationTime = system_time();
}
//------------------------------------------------------------------------------
BMidiSynth::~BMidiSynth()
{
UNIMPLEMENTED
be_synth->clientCount--;
}
//------------------------------------------------------------------------------
status_t BMidiSynth::EnableInput(bool enable, bool loadInstruments)
{
UNIMPLEMENTED
return B_ERROR;
status_t err = B_OK;
inputEnabled = enable;
if (loadInstruments)
{
err = be_synth->synth->LoadAllInstruments();
}
return err;
}
//------------------------------------------------------------------------------
bool BMidiSynth::IsInputEnabled(void) const
{
UNIMPLEMENTED
return false;
return inputEnabled;
}
//------------------------------------------------------------------------------
void BMidiSynth::SetVolume(double volume)
{
UNIMPLEMENTED
be_synth->synth->SetVolume(volume);
}
//------------------------------------------------------------------------------
double BMidiSynth::Volume(void) const
{
UNIMPLEMENTED
return 0;
return be_synth->synth->Volume();
}
//------------------------------------------------------------------------------
void BMidiSynth::SetTransposition(int16 offset)
{
UNIMPLEMENTED
transpose = offset;
}
//------------------------------------------------------------------------------
int16 BMidiSynth::Transposition(void) const
{
UNIMPLEMENTED
return 0;
return transpose;
}
//------------------------------------------------------------------------------
void BMidiSynth::MuteChannel(int16 channel, bool do_mute)
{
UNIMPLEMENTED
fprintf(stderr, "[midi] MuteChannel is broken; don't use it\n");
}
//------------------------------------------------------------------------------
void BMidiSynth::GetMuteMap(char* pChannels) const
{
UNIMPLEMENTED
fprintf(stderr, "[midi] GetMuteMap is broken; don't use it\n");
}
//------------------------------------------------------------------------------
void BMidiSynth::SoloChannel(int16 channel, bool do_solo)
{
UNIMPLEMENTED
fprintf(stderr, "[midi] SoloChannel is broken; don't use it\n");
}
//------------------------------------------------------------------------------
void BMidiSynth::GetSoloMap(char* pChannels) const
{
UNIMPLEMENTED
fprintf(stderr, "[midi] GetSoloMap is broken; don't use it\n");
}
//------------------------------------------------------------------------------
status_t BMidiSynth::LoadInstrument(int16 instrument)
{
UNIMPLEMENTED
return B_ERROR;
return be_synth->synth->LoadInstrument(instrument);
}
//------------------------------------------------------------------------------
status_t BMidiSynth::UnloadInstrument(int16 instrument)
{
UNIMPLEMENTED
return B_ERROR;
return be_synth->synth->UnloadInstrument(instrument);
}
//------------------------------------------------------------------------------
status_t BMidiSynth::RemapInstrument(int16 from, int16 to)
{
UNIMPLEMENTED
return B_ERROR;
return be_synth->synth->RemapInstrument(from, to);
}
//------------------------------------------------------------------------------
void BMidiSynth::FlushInstrumentCache(bool startStopCache)
{
UNIMPLEMENTED
be_synth->synth->FlushInstrumentCache(startStopCache);
}
//------------------------------------------------------------------------------
uint32 BMidiSynth::Tick(void) const
{
UNIMPLEMENTED
return 0;
return (uint32) (system_time() - creationTime);
}
//------------------------------------------------------------------------------
@ -160,7 +168,10 @@ uint32 BMidiSynth::Tick(void) const
void BMidiSynth::NoteOff(
uchar channel, uchar note, uchar velocity, uint32 time)
{
UNIMPLEMENTED
if (inputEnabled)
{
be_synth->synth->NoteOff(channel, note + transpose, velocity, time);
}
}
//------------------------------------------------------------------------------
@ -168,7 +179,10 @@ void BMidiSynth::NoteOff(
void BMidiSynth::NoteOn(
uchar channel, uchar note, uchar velocity, uint32 time)
{
UNIMPLEMENTED
if (inputEnabled)
{
be_synth->synth->NoteOn(channel, note + transpose, velocity, time);
}
}
//------------------------------------------------------------------------------
@ -176,7 +190,11 @@ void BMidiSynth::NoteOn(
void BMidiSynth::KeyPressure(
uchar channel, uchar note, uchar pressure, uint32 time)
{
UNIMPLEMENTED
if (inputEnabled)
{
be_synth->synth->KeyPressure(
channel, note + transpose, pressure, time);
}
}
//------------------------------------------------------------------------------
@ -184,7 +202,11 @@ void BMidiSynth::KeyPressure(
void BMidiSynth::ControlChange(
uchar channel, uchar controlNumber, uchar controlValue, uint32 time)
{
UNIMPLEMENTED
if (inputEnabled)
{
be_synth->synth->ControlChange(
channel, controlNumber, controlValue, time);
}
}
//------------------------------------------------------------------------------
@ -192,28 +214,40 @@ void BMidiSynth::ControlChange(
void BMidiSynth::ProgramChange(
uchar channel, uchar programNumber, uint32 time)
{
UNIMPLEMENTED
if (inputEnabled)
{
be_synth->synth->ProgramChange(channel, programNumber, time);
}
}
//------------------------------------------------------------------------------
void BMidiSynth::ChannelPressure(uchar channel, uchar pressure, uint32 time)
{
UNIMPLEMENTED
if (inputEnabled)
{
be_synth->synth->ChannelPressure(channel, pressure, time);
}
}
//------------------------------------------------------------------------------
void BMidiSynth::PitchBend(uchar channel, uchar lsb, uchar msb, uint32 time)
{
UNIMPLEMENTED
if (inputEnabled)
{
be_synth->synth->PitchBend(channel, lsb, msb, time);
}
}
//------------------------------------------------------------------------------
void BMidiSynth::AllNotesOff(bool controlOnly, uint32 time)
void BMidiSynth::AllNotesOff(bool justChannel, uint32 time)
{
UNIMPLEMENTED
if (inputEnabled)
{
be_synth->synth->AllNotesOff(justChannel, time);
}
}
//------------------------------------------------------------------------------
@ -227,7 +261,7 @@ void BMidiSynth::_ReservedMidiSynth4() { }
void BMidiSynth::Run()
{
UNIMPLEMENTED
// do nothing
}
//------------------------------------------------------------------------------

View File

@ -28,8 +28,6 @@
BSamples::BSamples()
{
/* not complete yet */
if (be_synth == NULL)
{
new BSynth();
@ -40,7 +38,7 @@ BSamples::BSamples()
BSamples::~BSamples()
{
UNIMPLEMENTED
// do nothing
}
//------------------------------------------------------------------------------
@ -51,14 +49,14 @@ void BSamples::Start(
double sampleVolume, double stereoPosition, int32 hook_arg,
sample_loop_hook pLoopContinueProc, sample_exit_hook pDoneProc)
{
UNIMPLEMENTED
fprintf(stderr, "[midi] BSamples is not supported\n");
}
//------------------------------------------------------------------------------
bool BSamples::IsPaused(void) const
{
UNIMPLEMENTED
fprintf(stderr, "[midi] BSamples is not supported\n");
return false;
}
@ -66,28 +64,28 @@ bool BSamples::IsPaused(void) const
void BSamples::Pause(void)
{
UNIMPLEMENTED
fprintf(stderr, "[midi] BSamples is not supported\n");
}
//------------------------------------------------------------------------------
void BSamples::Resume(void)
{
UNIMPLEMENTED
fprintf(stderr, "[midi] BSamples is not supported\n");
}
//------------------------------------------------------------------------------
void BSamples::Stop(void)
{
UNIMPLEMENTED
fprintf(stderr, "[midi] BSamples is not supported\n");
}
//------------------------------------------------------------------------------
bool BSamples::IsPlaying(void) const
{
UNIMPLEMENTED
fprintf(stderr, "[midi] BSamples is not supported\n");
return false;
}
@ -95,14 +93,14 @@ bool BSamples::IsPlaying(void) const
void BSamples::SetVolume(double newVolume)
{
UNIMPLEMENTED
fprintf(stderr, "[midi] BSamples is not supported\n");
}
//------------------------------------------------------------------------------
double BSamples::Volume(void) const
{
UNIMPLEMENTED
fprintf(stderr, "[midi] BSamples is not supported\n");
return 0;
}
@ -110,14 +108,14 @@ double BSamples::Volume(void) const
void BSamples::SetSamplingRate(double newRate)
{
UNIMPLEMENTED
fprintf(stderr, "[midi] BSamples is not supported\n");
}
//------------------------------------------------------------------------------
double BSamples::SamplingRate(void) const
{
UNIMPLEMENTED
fprintf(stderr, "[midi] BSamples is not supported\n");
return 0;
}
@ -125,14 +123,14 @@ double BSamples::SamplingRate(void) const
void BSamples::SetPlacement(double stereoPosition)
{
UNIMPLEMENTED
fprintf(stderr, "[midi] BSamples is not supported\n");
}
//------------------------------------------------------------------------------
double BSamples::Placement(void) const
{
UNIMPLEMENTED
fprintf(stderr, "[midi] BSamples is not supported\n");
return 0;
}
@ -140,7 +138,7 @@ double BSamples::Placement(void) const
void BSamples::EnableReverb(bool useReverb)
{
UNIMPLEMENTED
fprintf(stderr, "[midi] BSamples is not supported\n");
}
//------------------------------------------------------------------------------

389
src/kits/midi/SoftSynth.cpp Normal file
View File

@ -0,0 +1,389 @@
/*
* Copyright (c) 2004 Matthijs Hollemans
* Copyright (c) 2003 Jerome Leveque
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include <FindDirectory.h>
#include <string.h>
#include <stdlib.h>
#include "debug.h"
#include "SoftSynth.h"
using namespace BPrivate;
//------------------------------------------------------------------------------
BSoftSynth::BSoftSynth()
{
instrumentsFile = NULL;
SetDefaultInstrumentsFile();
sampleRate = 22050;
interpMode = B_LINEAR_INTERPOLATION;
maxVoices = 28;
limiterThreshold = 7;
reverbEnabled = true;
reverbMode = B_REVERB_BALLROOM;
volumeScale = 1.0;
}
//------------------------------------------------------------------------------
BSoftSynth::~BSoftSynth()
{
Unload();
}
//------------------------------------------------------------------------------
void BSoftSynth::Unload(void)
{
/* TODO: purge samples from memory */
free(instrumentsFile);
instrumentsFile = NULL;
}
//------------------------------------------------------------------------------
bool BSoftSynth::IsLoaded(void) const
{
return instrumentsFile != NULL;
}
//------------------------------------------------------------------------------
status_t BSoftSynth::SetDefaultInstrumentsFile()
{
char buf[B_PATH_NAME_LENGTH + 1];
if (B_OK == find_directory(
B_SYNTH_DIRECTORY, NULL, false, buf, B_PATH_NAME_LENGTH))
{
strcat(buf, B_BIG_SYNTH_FILE);
return SetInstrumentsFile(buf);
}
return B_ERROR;
}
//------------------------------------------------------------------------------
status_t BSoftSynth::SetInstrumentsFile(const char* path)
{
if (path == NULL)
{
return B_BAD_VALUE;
}
if (IsLoaded())
{
Unload();
}
instrumentsFile = strdup(path);
return B_OK;
}
//------------------------------------------------------------------------------
status_t BSoftSynth::LoadAllInstruments()
{
/* TODO: Should load all of the instruments from the sample bank. */
UNIMPLEMENTED
return B_OK;
}
//------------------------------------------------------------------------------
status_t BSoftSynth::LoadInstrument(int16 instrument)
{
UNIMPLEMENTED
return B_OK;
}
//------------------------------------------------------------------------------
status_t BSoftSynth::UnloadInstrument(int16 instrument)
{
UNIMPLEMENTED
return B_OK;
}
//------------------------------------------------------------------------------
status_t BSoftSynth::RemapInstrument(int16 from, int16 to)
{
UNIMPLEMENTED
return B_OK;
}
//------------------------------------------------------------------------------
void BSoftSynth::FlushInstrumentCache(bool startStopCache)
{
// TODO: we may decide not to support this function because it's weird!
UNIMPLEMENTED
}
//------------------------------------------------------------------------------
void BSoftSynth::SetVolume(double volume)
{
if (volume >= 0.0)
{
volumeScale = volume;
}
}
//------------------------------------------------------------------------------
double BSoftSynth::Volume(void) const
{
return volumeScale;
}
//------------------------------------------------------------------------------
status_t BSoftSynth::SetSamplingRate(int32 rate)
{
// TODO: According to the BeBook, we should round rate to the nearest
// acceptable value. However, this function may change depending on the
// softsynth back-end we'll use.
if (rate == 11025 || rate == 22050 || rate == 44100)
{
sampleRate = rate;
return B_OK;
}
return B_BAD_VALUE;
}
//------------------------------------------------------------------------------
int32 BSoftSynth::SamplingRate() const
{
return sampleRate;
}
//------------------------------------------------------------------------------
status_t BSoftSynth::SetInterpolation(interpolation_mode mode)
{
// TODO: this function could change depending on the synth back-end.
interpMode = mode;
return B_OK;
}
//------------------------------------------------------------------------------
interpolation_mode BSoftSynth::Interpolation() const
{
return interpMode;
}
//------------------------------------------------------------------------------
status_t BSoftSynth::EnableReverb(bool enabled)
{
reverbEnabled = enabled;
return B_OK;
}
//------------------------------------------------------------------------------
bool BSoftSynth::IsReverbEnabled() const
{
return reverbEnabled;
}
//------------------------------------------------------------------------------
void BSoftSynth::SetReverb(reverb_mode mode)
{
// TODO: this function could change depending on the synth back-end.
reverbMode = mode;
}
//------------------------------------------------------------------------------
reverb_mode BSoftSynth::Reverb() const
{
return reverbMode;
}
//------------------------------------------------------------------------------
status_t BSoftSynth::SetMaxVoices(int32 max)
{
// TODO: this function could change depending on the synth back-end.
if (max > 0 && max <= 32)
{
maxVoices = max;
return B_OK;
}
return B_BAD_VALUE;
}
//------------------------------------------------------------------------------
int16 BSoftSynth::MaxVoices(void) const
{
return maxVoices;
}
//------------------------------------------------------------------------------
status_t BSoftSynth::SetLimiterThreshold(int32 threshold)
{
// TODO: this function could change depending on the synth back-end.
if (threshold > 0 && threshold <= 32)
{
limiterThreshold = threshold;
return B_OK;
}
return B_BAD_VALUE;
}
//------------------------------------------------------------------------------
int16 BSoftSynth::LimiterThreshold(void) const
{
return limiterThreshold;
}
//------------------------------------------------------------------------------
void BSoftSynth::Pause(void)
{
UNIMPLEMENTED
}
//------------------------------------------------------------------------------
void BSoftSynth::Resume(void)
{
UNIMPLEMENTED
}
//------------------------------------------------------------------------------
void BSoftSynth::NoteOff(
uchar channel, uchar note, uchar velocity, uint32 time)
{
UNIMPLEMENTED
}
//------------------------------------------------------------------------------
void BSoftSynth::NoteOn(
uchar channel, uchar note, uchar velocity, uint32 time)
{
UNIMPLEMENTED
}
//------------------------------------------------------------------------------
void BSoftSynth::KeyPressure(
uchar channel, uchar note, uchar pressure, uint32 time)
{
UNIMPLEMENTED
}
//------------------------------------------------------------------------------
void BSoftSynth::ControlChange(
uchar channel, uchar controlNumber, uchar controlValue, uint32 time)
{
UNIMPLEMENTED
}
//------------------------------------------------------------------------------
void BSoftSynth::ProgramChange(
uchar channel, uchar programNumber, uint32 time)
{
UNIMPLEMENTED
}
//------------------------------------------------------------------------------
void BSoftSynth::ChannelPressure(
uchar channel, uchar pressure, uint32 time)
{
UNIMPLEMENTED
}
//------------------------------------------------------------------------------
void BSoftSynth::PitchBend(
uchar channel, uchar lsb, uchar msb, uint32 time)
{
UNIMPLEMENTED
}
//------------------------------------------------------------------------------
void BSoftSynth::SystemExclusive(void* data, size_t length, uint32 time)
{
UNIMPLEMENTED
}
//------------------------------------------------------------------------------
void BSoftSynth::SystemCommon(
uchar status, uchar data1, uchar data2, uint32 time)
{
UNIMPLEMENTED
}
//------------------------------------------------------------------------------
void BSoftSynth::SystemRealTime(uchar status, uint32 time)
{
UNIMPLEMENTED
}
//------------------------------------------------------------------------------
void BSoftSynth::TempoChange(int32 beatsPerMinute, uint32 time)
{
UNIMPLEMENTED
}
//------------------------------------------------------------------------------
void BSoftSynth::AllNotesOff(bool justChannel, uint32 time)
{
UNIMPLEMENTED
}
//------------------------------------------------------------------------------

104
src/kits/midi/SoftSynth.h Normal file
View File

@ -0,0 +1,104 @@
/*
* Copyright (c) 2004 Matthijs Hollemans
* Copyright (c) 2003 Jerome Leveque
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef _SOFT_SYNTH_H
#define _SOFT_SYNTH_H
#include <Midi.h>
#include <Synth.h>
namespace BPrivate {
class BSoftSynth
{
public:
void Unload(void);
bool IsLoaded(void) const;
status_t SetDefaultInstrumentsFile();
status_t SetInstrumentsFile(const char* path);
status_t LoadAllInstruments();
status_t LoadInstrument(int16 instrument);
status_t UnloadInstrument(int16 instrument);
status_t RemapInstrument(int16 from, int16 to);
void FlushInstrumentCache(bool startStopCache);
void SetVolume(double volume);
double Volume(void) const;
status_t SetSamplingRate(int32 rate);
int32 SamplingRate() const;
status_t SetInterpolation(interpolation_mode mode);
interpolation_mode Interpolation() const;
status_t EnableReverb(bool enabled);
bool IsReverbEnabled() const;
void SetReverb(reverb_mode mode);
reverb_mode Reverb() const;
status_t SetMaxVoices(int32 max);
int16 MaxVoices(void) const;
status_t SetLimiterThreshold(int32 threshold);
int16 LimiterThreshold(void) const;
void Pause(void);
void Resume(void);
void NoteOff(uchar, uchar, uchar, uint32);
void NoteOn(uchar, uchar, uchar, uint32);
void KeyPressure(uchar, uchar, uchar, uint32);
void ControlChange(uchar, uchar, uchar, uint32);
void ProgramChange(uchar, uchar, uint32);
void ChannelPressure(uchar, uchar, uint32);
void PitchBend(uchar, uchar, uchar, uint32);
void SystemExclusive(void*, size_t, uint32);
void SystemCommon(uchar, uchar, uchar, uint32);
void SystemRealTime(uchar, uint32);
void TempoChange(int32, uint32);
void AllNotesOff(bool, uint32);
private:
friend class BSynth;
friend class BMidiSynth;
BSoftSynth();
~BSoftSynth();
char* instrumentsFile;
int32 sampleRate;
interpolation_mode interpMode;
int16 maxVoices;
int16 limiterThreshold;
reverb_mode reverbMode;
bool reverbEnabled;
double volumeScale;
};
} // namespace BPrivate
#endif // _SYNTH_CONSUMER_H

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2002-2004 Matthijs Hollemans
* Copyright (c) 2003 Jerome Leveque
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -22,35 +23,32 @@
#include "debug.h"
#include "Synth.h"
#include "SoftSynth.h"
BSynth* be_synth = NULL;
using namespace BPrivate;
//------------------------------------------------------------------------------
BSynth::BSynth()
{
/* not complete yet */
delete be_synth;
be_synth = this;
Init();
}
//------------------------------------------------------------------------------
BSynth::BSynth(synth_mode synth)
BSynth::BSynth(synth_mode mode)
{
/* not complete yet */
delete be_synth;
be_synth = this;
Init();
synthMode = mode;
}
//------------------------------------------------------------------------------
BSynth::~BSynth()
{
/* not complete yet */
delete synth;
be_synth = NULL;
}
@ -58,102 +56,107 @@ BSynth::~BSynth()
status_t BSynth::LoadSynthData(entry_ref* instrumentsFile)
{
UNIMPLEMENTED
return B_ERROR;
if (instrumentsFile == NULL)
{
return B_BAD_VALUE;
}
return synth->SetInstrumentsFile(instrumentsFile->name);
}
//------------------------------------------------------------------------------
status_t BSynth::LoadSynthData(synth_mode synth)
status_t BSynth::LoadSynthData(synth_mode mode)
{
UNIMPLEMENTED
return B_ERROR;
// Our softsynth doesn't support multiple modes like Be's synth did.
// Therefore, if you use this function, the synth will revert to its
// default instruments bank. However, we do keep track of the current
// synth_mode here, in order not to confuse old applications.
synthMode = mode;
if (synthMode == B_SAMPLES_ONLY)
{
fprintf(stderr, "[midi] LoadSynthData: BSamples is not supported\n");
}
return synth->SetDefaultInstrumentsFile();
}
//------------------------------------------------------------------------------
synth_mode BSynth::SynthMode(void)
{
UNIMPLEMENTED
return B_NO_SYNTH;
return synthMode;
}
//------------------------------------------------------------------------------
void BSynth::Unload(void)
{
UNIMPLEMENTED
synth->Unload();
}
//------------------------------------------------------------------------------
bool BSynth::IsLoaded(void) const
{
UNIMPLEMENTED
return false;
return synth->IsLoaded();
}
//------------------------------------------------------------------------------
status_t BSynth::SetSamplingRate(int32 sample_rate)
{
UNIMPLEMENTED
return B_ERROR;
return synth->SetSamplingRate(sample_rate);
}
//------------------------------------------------------------------------------
int32 BSynth::SamplingRate() const
{
UNIMPLEMENTED
return 0;
return synth->SamplingRate();
}
//------------------------------------------------------------------------------
status_t BSynth::SetInterpolation(interpolation_mode interp_mode)
{
UNIMPLEMENTED
return B_ERROR;
return synth->SetInterpolation(interp_mode);
}
//------------------------------------------------------------------------------
interpolation_mode BSynth::Interpolation() const
{
UNIMPLEMENTED
return B_DROP_SAMPLE;
return synth->Interpolation();
}
//------------------------------------------------------------------------------
void BSynth::SetReverb(reverb_mode rev_mode)
{
UNIMPLEMENTED
synth->SetReverb(rev_mode);
}
//------------------------------------------------------------------------------
reverb_mode BSynth::Reverb() const
{
UNIMPLEMENTED
return B_REVERB_NONE;
return synth->Reverb();
}
//------------------------------------------------------------------------------
status_t BSynth::EnableReverb(bool reverb_enabled)
{
UNIMPLEMENTED
return B_ERROR;
return synth->EnableReverb(reverb_enabled);
}
//------------------------------------------------------------------------------
bool BSynth::IsReverbEnabled() const
{
UNIMPLEMENTED
return false;
return synth->IsReverbEnabled();
}
//------------------------------------------------------------------------------
@ -161,23 +164,27 @@ bool BSynth::IsReverbEnabled() const
status_t BSynth::SetVoiceLimits(
int16 maxSynthVoices, int16 maxSampleVoices, int16 limiterThreshhold)
{
UNIMPLEMENTED
return B_ERROR;
status_t err = B_OK;
err = synth->SetMaxVoices(maxSynthVoices);
if (err == B_OK)
{
err = synth->SetLimiterThreshold(limiterThreshhold);
}
return err;
}
//------------------------------------------------------------------------------
int16 BSynth::MaxSynthVoices(void) const
{
UNIMPLEMENTED
return 0;
return synth->MaxVoices();
}
//------------------------------------------------------------------------------
int16 BSynth::MaxSampleVoices(void) const
{
UNIMPLEMENTED
fprintf(stderr, "[midi] MaxSampleVoices: BSamples not supported\n");
return 0;
}
@ -185,37 +192,35 @@ int16 BSynth::MaxSampleVoices(void) const
int16 BSynth::LimiterThreshhold(void) const
{
UNIMPLEMENTED
return 0;
return synth->LimiterThreshold();
}
//------------------------------------------------------------------------------
void BSynth::SetSynthVolume(double theVolume)
{
UNIMPLEMENTED
synth->SetVolume(theVolume);
}
//------------------------------------------------------------------------------
double BSynth::SynthVolume(void) const
{
UNIMPLEMENTED
return 0;
return synth->Volume();
}
//------------------------------------------------------------------------------
void BSynth::SetSampleVolume(double theVolume)
{
UNIMPLEMENTED
fprintf(stderr, "[midi] SetSampleVolume: BSamples not supported\n");
}
//------------------------------------------------------------------------------
double BSynth::SampleVolume(void) const
{
UNIMPLEMENTED
fprintf(stderr, "[midi] SampleVolume: BSamples not supported\n");
return 0;
}
@ -224,7 +229,7 @@ double BSynth::SampleVolume(void) const
status_t BSynth::GetAudio(
int16* pLeft, int16* pRight, int32 max_samples) const
{
UNIMPLEMENTED
fprintf(stderr, "[midi] GetAudio is not supported\n");
return B_ERROR;
}
@ -232,29 +237,39 @@ status_t BSynth::GetAudio(
void BSynth::Pause(void)
{
UNIMPLEMENTED
synth->Pause();
}
//------------------------------------------------------------------------------
void BSynth::Resume(void)
{
UNIMPLEMENTED
synth->Resume();
}
//------------------------------------------------------------------------------
void BSynth::SetControllerHook(int16 controller, synth_controller_hook cback)
{
UNIMPLEMENTED
fprintf(stderr, "[midi] SetControllerHook is not supported\n");
}
//------------------------------------------------------------------------------
void BSynth::Init()
{
delete be_synth;
be_synth = this;
synthMode = B_NO_SYNTH;
clientCount = 0;
synth = new BSoftSynth();
}
//------------------------------------------------------------------------------
int32 BSynth::CountClients(void) const
{
UNIMPLEMENTED
return 0;
return clientCount;
}
//------------------------------------------------------------------------------