8 for (
int a = 1; BASS_GetDeviceInfo(a, &info); a++)
10 if (info.flags & BASS_DEVICE_ENABLED)
13 sprintf_s(msg, 99,
"Bass::Initialize Device Enumeration %i: %s", a, info.name);
42 sprintf_s(msg, 99,
"Bass::Initialize BASS_Init success for device %i",
config->
soundDevice);
56 if (
config->
sounds.at(i).loop) flags |= BASS_SAMPLE_LOOP ;
57 if (
config->
sounds.at(i).mono) flags |= BASS_SAMPLE_MONO ;
63 sprintf_s(msg,
sizeof(msg),
"Bass::Initialize BASS_SampleLoad failed: %s",
config->
sounds.at(i).path.c_str());
86 if (command.
delay != 0.0f)
continue;
88 bool processedOne =
false;
94 sprintf_s(msg, 99,
"Bass::FrameMove Playing sample: %s (device %i)", command.
name.c_str(),
config->
soundDevice);
160 if (BASS_ErrorGetCode() == BASS_ERROR_HANDLE)
172 sprintf_s(msg, 199,
"Bass::Play BASS_ChannelSetAttribute BASS_ATTRIB_PAN failed: %s (%.1f)",
config->
sounds.at(j).trigger.c_str(),
config->
sounds.at(j).pan);
179 if (freq != -1.0f && !BASS_ChannelSetAttribute(
config->
sounds.at(j).channel, BASS_ATTRIB_FREQ, max(100, freq*
config->
sounds.at(j).baseHz)))
181 logger->
Log(
"Bass::Play BASS_ChannelSetAttribute BASS_ATTRIB_FREQ failed!",
Logger::Error, BASS_ErrorGetCode());
186 if (!BASS_ChannelSetAttribute(
config->
sounds.at(j).channel, BASS_ATTRIB_VOL, vol))
188 logger->
Log(
"Bass::Play BASS_ChannelSetAttribute BASS_ATTRIB_VOL failed!",
Logger::Error, BASS_ErrorGetCode());
192 int channelIsActive = BASS_ChannelIsActive(
config->
sounds.at(j).channel);
193 if (!
config->
sounds.at(j).loop || channelIsActive == BASS_ACTIVE_STOPPED || channelIsActive == BASS_ACTIVE_PAUSED ||
config->
sounds.at(j).restart)
209 sprintf_s(msg, 99,
"Bass::Play Could not find sound for trigger: %s (device %i)", trigger.c_str(),
config->
soundDevice);
239 HSTREAM streamHandle = BASS_StreamCreateFile(
false, filename.c_str(), 0, 0, BASS_SAMPLE_MONO);
242 else if (!BASS_ChannelPlay(streamHandle, FALSE))
260 int isActive = BASS_ChannelIsActive(streamHandle);
261 if (isActive == BASS_ACTIVE_PLAYING)
263 if (!BASS_StreamFree(streamHandle))
std::vector< Command > commandStream
okay, the portable keyboard numbers don't work like the outside keypad because the outside keypad is ...
std::vector< Sound > sounds
std::string name
command name
HSTREAM PlayStream(std::string filename) const
void Log(const char *msg, Level level=Info, int errorCode=0)
These have to be in this order.
void Play(std::string trigger, float freq=-1.0f, float vol=1.0f)
void Initialize(Logger *prmLogger, BassConfig *prmConfig, Bus *prmBus)
bool StreamIsPlaying(HSTREAM streamHandle) const
float delay
wait number of seconds before executing command
int soundDevice
The device to use... -1 = default device, 0 = no sound, 1 = first real output device. BASS_GetDeviceInfo can be used to enumerate the available devices.
void EnumerateDevices() const