Page 1 of 1

{SOLVED} Can't get sound test button to work

Posted: Thu Dec 12, 2019 4:56 am
by Ibitz
This is what my current Preferences/Settings screen code looks like:

# Preferences
#
# Screen that allows the user to change the preferences.
# http://www.renpy.org/doc/html/screen_sp ... prefereces

screen preferences:

tag menu

# The background of the menu.
window:
add "settings_screen"

# Include the navigation.
use quick_menu5

# Put the navigation columns in a three-wide grid.
grid 3 1:
style_group "prefs"
xfill True

# The left column.
vbox:
frame:
style_group "pref"
has vbox

label _("Display")
textbutton _("Window") action Preference("display", "window")
textbutton _("Fullscreen") action Preference("display", "fullscreen")

frame:
style_group "pref"
has vbox

label _("Transitions")
textbutton _("All") action Preference("transitions", "all")
textbutton _("None") action Preference("transitions", "none")

frame:
style_group "pref"
has vbox

label _("Text Speed")
bar value Preference("text speed")


vbox:
frame:
style_group "pref"
has vbox

label _("Skip")
textbutton _("Seen Messages") action Preference("skip", "seen")
textbutton _("All Messages") action Preference("skip", "all")


frame:
style_group "pref"
has vbox

label _("After Choices")
textbutton _("Stop Skipping") action Preference("after choices", "stop")
textbutton _("Keep Skipping") action Preference("after choices", "skip")

frame:
style_group "pref"
has vbox

label _("Auto-Forward Time")
bar value Preference("auto-forward time")

if config.has_voice:
textbutton _("Wait for Voice") action Preference("wait for voice", "toggle")

vbox:
frame:
style_group "pref"
has vbox

label _("Music Volume")
bar value Preference("music volume")

frame:
style_group "pref"
has vbox

label _("Sound Volume")
bar value Preference("sound volume")

if config.sample_sound:
textbutton _("Test"):
action Play("sound", config.sample_sound)
style "soundtest_button"

frame:
style_group "pref"
has vbox

textbutton _("Joystick...") action Preference("joystick")

init -2 python:
style.pref_frame.xfill = True
style.pref_frame.xmargin = 25
style.pref_frame.top_margin = 35

style.pref_button_text.color = "#fff"
style.pref_button_text.size = 12
style.pref_button_text.font = "LoveYaLikeASister.ttf"
style.pref_button_text.outlines = [(2, "#000000", 0, 0)]
style.pref_button_text.hover_outlines = [(2, "#C700B3", 0, 0)]
style.pref_button_text.selected_outlines = [(2, "#00D1FB", 0, 0)]
style.pref_button_text.selected_hover_outlines = [(2, "#FA0D00", 0, 0)]

style.pref_vbox.xfill = True
style.pref_button.size_group = "pref"
style.pref_button.xalign = 0.5
style.pref_button.background = Frame("button_Idle.png",10,10)
style.pref_button.hover_background = Frame("button_Hover.png",10,10)
style.pref_button.selected_background = Frame("button_Idle.png",10,10)
style.pref_button.selected_hover_background = Frame("button_Selected.png",10,10)
style.pref_button.yminimum = 30

style.pref_slider.xmaximum = 192
style.pref_slider.xalign = 0.5
style.pref_slider.left_bar = "left.png"
style.pref_slider.right_bar = "right.png"
style.pref_slider.hover_left_bar = "left_hover.png"
style.pref_slider.ymaximum = 20
style.pref_slider.xmaximum = 180

style.soundtest_button.xalign = 0.0

style.pref_frame.background = Frame("grunge-scratches2.jpg")

For some reason, I just cannot get the sound test button to show up. Could it be because I can't get music or sounds recognized? What do I do about this?

Re: Can't get sound test button to work

Posted: Thu Dec 12, 2019 5:34 am
by isobellesophia
Try this putting on the gui.rpy.

Code: Select all

define config.sample_sound = True

Re: Can't get sound test button to work

Posted: Thu Dec 12, 2019 4:24 pm
by Ibitz
Thank you for the response. Sadly, that didn't seem to work. :/

Re: Can't get sound test button to work

Posted: Thu Dec 12, 2019 5:14 pm
by Imperf3kt
You need to go to options.rpy and set config.has_sound to True

Here's an example from a file I have on hand

Code: Select all

## Sounds and music ############################################################

## These three variables control which mixers are shown to the player by
## default. Setting one of these to False will hide the appropriate mixer.

define config.has_sound = True
define config.has_music = True
define config.has_voice = False
define config.default_music_volume = 0.6

## To allow the user to play a test sound on the sound or voice channel,
## uncomment a line below and use it to set a sample sound to play.

define config.sample_sound = "sample-sound.ogg"
# define config.sample_voice = "sample-voice.ogg"


Re: Can't get sound test button to work

Posted: Wed Dec 18, 2019 8:31 pm
by Ibitz
Thank you again, Imperf3kt! After using your suggestion and tweaking my code a bit, I finally got it to work. Thank you! :)