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

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Ibitz
Regular
Posts: 63
Joined: Thu Jul 27, 2017 4:47 pm
Projects: Magical Disarray (WIP)
Organization: Ibitz Visual Novels
Deviantart: http://ibitz.deviant
itch: ibitz
Contact:

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

#1 Post by Ibitz » Thu Dec 12, 2019 4:56 am

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?
Last edited by Ibitz on Wed Dec 18, 2019 8:32 pm, edited 1 time in total.
Image

Ibitz is a self-taught coder/artist who works alone on their games. All games I create are freeware. If you need any help with coding or creating your game, just let me know. I'd be more than happy to help.

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Can't get sound test button to work

#2 Post by isobellesophia » Thu Dec 12, 2019 5:34 am

Try this putting on the gui.rpy.

Code: Select all

define config.sample_sound = True
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
Ibitz
Regular
Posts: 63
Joined: Thu Jul 27, 2017 4:47 pm
Projects: Magical Disarray (WIP)
Organization: Ibitz Visual Novels
Deviantart: http://ibitz.deviant
itch: ibitz
Contact:

Re: Can't get sound test button to work

#3 Post by Ibitz » Thu Dec 12, 2019 4:24 pm

Thank you for the response. Sadly, that didn't seem to work. :/
Image

Ibitz is a self-taught coder/artist who works alone on their games. All games I create are freeware. If you need any help with coding or creating your game, just let me know. I'd be more than happy to help.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3205
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Can't get sound test button to work

#4 Post by Imperf3kt » Thu Dec 12, 2019 5:14 pm

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"

Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Free Android GUI - Updated occasionally

User avatar
Ibitz
Regular
Posts: 63
Joined: Thu Jul 27, 2017 4:47 pm
Projects: Magical Disarray (WIP)
Organization: Ibitz Visual Novels
Deviantart: http://ibitz.deviant
itch: ibitz
Contact:

Re: Can't get sound test button to work

#5 Post by Ibitz » Wed Dec 18, 2019 8:31 pm

Thank you again, Imperf3kt! After using your suggestion and tweaking my code a bit, I finally got it to work. Thank you! :)
Image

Ibitz is a self-taught coder/artist who works alone on their games. All games I create are freeware. If you need any help with coding or creating your game, just let me know. I'd be more than happy to help.

Post Reply

Who is online

Users browsing this forum: ArRated Games, Bing [Bot], Google [Bot], Mjhay