CleanCut / invaders

Open source terminal arcade game with audio - based off of the classic "Space Invaders"
206 stars 107 forks source link

Add_music_files #9

Closed Shining-Chen closed 2 years ago

Shining-Chen commented 2 years ago

adding 7 sound files and updating README.md to give information about these files

Shining-Chen commented 2 years ago

Hi Nathan, I wonder if it's time to make a folder for music files.

CleanCut commented 2 years ago

These sounds are great, thank you!

Hi Nathan, I wonder if it's time to make a folder for music files.

Yes, that's a great idea! Perhaps audio would be a good name?

What do you think would be a good way to differentiate between the sounds used in the tutorial and the new sounds?

Shining-Chen commented 2 years ago

Hi Nathan, one test is failing but I didn't change anything in main.. Should we run the test again or is it something you know how to fix? Btw, I was thinking we should probably not move your original sound files because it would be a hassle for you to re-make your videos just because of new audio files. For new audio contributions, we could have a folder like "audio contribution"?

CleanCut commented 2 years ago

Hi Nathan, one test is failing but I didn't change anything in main.. Should we run the test again or is it something you know how to fix?

Hmm...yes that was not your doing. I did cargo fmt and pushed up the commit to fix it.

Btw, I was thinking we should probably not move your original sound files because it would be a hassle for you to re-make your videos just because of new audio files.

That is not something I am worried about. It is fine if the code evolves.

For new audio contributions, we could have a folder like "audio contribution"?

I would like the folder name to be short. Either audio or sound would be fine.

The question of how to differentiate between sets of sounds still remains. Do you have any ideas?

Shining-Chen commented 2 years ago

I like audio for the folder name! Regarding how to differentiate the files used in the course and new contributions, what do you think if we create 2 sub-folders: one original for your files and one for all new contributions - let's say we give it the name contributions?

CleanCut commented 2 years ago

Regarding how to differentiate the files used in the course and new contributions, what do you think if we create 2 sub-folders: one original for your files and one for all new contributions - let's say we give it the name contributions?

That sounds fine. Go ahead. 👍🏻

CleanCut commented 2 years ago

Great!

Shining-Chen commented 2 years ago

Hi Nathan, Yes, I can fix the program so that it will find the audio files.

Regarding the 2nd point, I thought I will leave it to the users to choose which sound file they would like to use for which feature because music is such an objective thing. One might think file A is more appropriate for shooting while another might like it for hitting a target. But yes, I can make them into WAV format. Concerning similar names, could you give me an example to help me understand better?

CleanCut commented 2 years ago

Regarding the 2nd point, I thought I will leave it to the users to choose which sound file they would like to use for which feature because music is such an objective thing. One might think file A is more appropriate for shooting while another might like it for hitting a target.

Alright, that's fine.

Concerning similar names, could you give me an example to help me understand better?

What I was thinking, was that there could be different directories with the same audio file names. For example, the startup sound would always be named startup.wav, but there might be a audio/original/startup.wav, an audio/instrumental/startup.wav and (in the future) other audio/somedirectory/startup.wav. Then, if folks want different sounds, they only need to change the directory they are reading from, and nothing else.

Shining-Chen commented 2 years ago

Sounds good at this stage to me. If we need a new way to organise contributions later, we can think of something else. I can work on it this weekend and make another pull request.

CleanCut commented 2 years ago
  • We need to fix the program so it runs without crashing (it is looking for the audio in the wrong place)

☝🏻 We need to fix at least this crash in this pull request

Shining-Chen commented 2 years ago

Hi Nathan, I need your help a little bit. I tried several ways to modify the line that adds the path in main.rs without any success. Right now I have this line that looks like audio.add(item, &format!("audio/original/{}.wav", item)); I tried /audio/original/{}.wav and ../audio/original/{}.wav as well. Could you tell me what I did wrong?

CleanCut commented 2 years ago

Right now I have this line that looks like audio.add(item, &format!("audio/original/{}.wav", item));

🤔 That is correct. If I make that change on my own machine, then it works fine. Perhaps you forgot to save your file when you had that change? Or had a typo? Rarely the cache gets in a bad state -- if that is the case, then cargo clean would fix the problem.

$ git diff
diff --git a/src/main.rs b/src/main.rs
index 46c0d05..52ed8a2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -41,7 +41,7 @@ fn reset_game(in_menu: &mut bool, player: &mut Player, invaders: &mut Invaders)
 fn main() -> Result<(), Box<dyn Error>> {
     let mut audio = Audio::new();
     for item in &["explode", "lose", "move", "pew", "startup", "win"] {
-        audio.add(item, &format!("{}.wav", item));
+        audio.add(item, &format!("audio/original/{}.wav", item));
     }
     audio.play("startup");
Shining-Chen commented 2 years ago

😂 Yes, you were right. I forgot to save my file in Microsoft Code, which I had to download and use in a hurry because my IntelliJ license expired. Now it works for me too. I will make another pull request today.