/** * \brief Sets the volume of a channel. * \param channel A channel index. * \param volume The volume to set. */ void ItDecoder::set_channel_volume(int channel, int volume) { const unsigned int num_channels = get_num_channels(); const unsigned int num_patterns = ModPlug_NumPatterns(modplug_file); for (unsigned int pattern = 0; pattern < num_patterns; ++pattern) { unsigned int num_rows; ModPlugNote* notes = ModPlug_GetPattern(modplug_file, pattern, &num_rows); for (unsigned int j = channel; j < num_rows * num_channels; j += num_channels) { notes[j].Volume = volume; } } }
/** * \brief Returns the volume of a channel. * \param channel A channel index. * \return The volume of this channel. */ int ItDecoder::get_channel_volume(int channel) { const int num_patterns = ModPlug_NumPatterns(modplug_file); Debug::check_assertion(channel >= 0 && channel < get_num_channels(), "Invalid channel number"); if (num_patterns == 0) { return 0; } unsigned int num_rows = 0; ModPlugNote* notes = ModPlug_GetPattern(modplug_file, 0, &num_rows); if (num_rows == 0) { return 0; } return notes[0].Volume; }
ModPlugNote* sfMod::Mod::GetPattern(int pattern, unsigned int* numrows) const { return ModPlug_GetPattern(file_, pattern, numrows); }