Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: help me about sounds  (Read 202 times)

0 Members and 1 Guest are viewing this topic.

herbertbahia

  • Newbie
  • *
  • Posts: 6
    • View Profile
help me about sounds
« on: July 22, 2020, 04:14:51 pm »
 ::)
hello friends i need your help, i'm a c ++ student i need to embed a song in my sfml algorithm. I need an example how I do this, and if possible some software to transform music of different formats into an array. I am very grateful

Hapax

  • Hero Member
  • *****
  • Posts: 3001
  • My number of posts is shown in hexadecimal.
    • View Profile
Re: help me about sounds
« Reply #1 on: July 22, 2020, 09:01:26 pm »
Pretty sure I gave you a program to do this already :P
https://en.sfml-dev.org/forums/index.php?topic=27411.msg173876#msg173876

Just to clarify specifically, you can store the sound or music file in the program in the same way that you can store image files. Then, you can load (images/sounds) or stream (music) from them directly using loadFromMemory and openFromMemory.

Note that the memory with a music file must stay available for as long as the sf::Music uses it (in the same way the file on disk would need to stay available).
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter

herbertbahia

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: help me about sounds
« Reply #2 on: July 22, 2020, 09:49:08 pm »
I put the array there in the code but I don't know how I should call the function and the parameters I think is different from the image, I tried in several ways some give error in the compilation others lock my ide and close, but I'm happy to know that that program too will serve. I need an example. :'(

Hapax

  • Hero Member
  • *****
  • Posts: 3001
  • My number of posts is shown in hexadecimal.
    • View Profile
Re: help me about sounds
« Reply #3 on: July 23, 2020, 10:05:03 pm »
The array is just the storage of the file in memory. You would need to use the access the array as memory. You will normally be able to just use the array itself as a pointer to memory. If the memory requires different value type, you can change it in that header file.

What do you have so far? What isn't working? Show it and I'll have a look.
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter

herbertbahia

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: help me about sounds
« Reply #4 on: July 25, 2020, 06:07:16 pm »
they were configurable errors, thank you for your attention, if more questions arise I will create a new topic

 

anything