Advertisement
Smi-ChetDev

radio meme

Aug 11th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. ImGui::Checkbox("Radio", &Shonax.Misc.radio_enable);
  2. if (Shonax.Misc.radio_enable)
  3. {
  4. static bool radioInit = false;
  5. static int govno = 0;
  6. if (govno != Shonax.Misc.radio_selected)
  7. radioInit = false;
  8. if (!radioInit) {
  9. BASS_Init(-1, 44100, BASS_DEVICE_3D, 0, NULL);
  10. stream = BASS_StreamCreateURL(stations[Shonax.Misc.radio_selected].c_str(), 0, 0, NULL, 0);
  11. radioInit = true;
  12. Shonax.Misc.radio_paused = false;
  13. govno = Shonax.Misc.radio_selected;
  14. }
  15.  
  16. static float vol = 0.1f;
  17. BASS_ChannelSetAttribute(stream, BASS_ATTRIB_VOL, vol);
  18.  
  19. if (!Shonax.Misc.radio_paused)
  20. {
  21. BASS_ChannelPlay(stream, false);
  22. }
  23.  
  24. ImGui::PushItemWidth(250);
  25. if (ImGui::Combo("##stancs", &Shonax.Misc.radio_selected, radio_name, IM_ARRAYSIZE(radio_name)))
  26. {
  27. BASS_ChannelStop(stream);
  28. stream = NULL;
  29. stream = BASS_StreamCreateURL(stations[Shonax.Misc.radio_selected].c_str(), 0, 0, NULL, 0);
  30. }
  31. if (ImGui::Button("<<", ImVec2(50, 25)))
  32. {
  33. if (Shonax.Misc.radio_selected == 0)
  34. Shonax.Misc.radio_selected = ARRAYSIZE(stations);
  35.  
  36. Shonax.Misc.radio_selected--;
  37. BASS_ChannelPause(stream);
  38. stream = NULL;
  39. stream = BASS_StreamCreateURL(stations[Shonax.Misc.radio_selected].c_str(), 0, 0, NULL, 0);
  40. }
  41. ImGui::SameLine();
  42.  
  43. char* nazvanie;
  44.  
  45. if (!Shonax.Misc.radio_paused)
  46. nazvanie = "||";
  47. else
  48. nazvanie = ">";
  49.  
  50. if (ImGui::Button(nazvanie, ImVec2(70, 25)))
  51. {
  52. Shonax.Misc.radio_paused = !Shonax.Misc.radio_paused;
  53. BASS_ChannelPause(stream);
  54. }
  55.  
  56. ImGui::SameLine();
  57. if (ImGui::Button(">>", ImVec2(50, 25))) {
  58. Shonax.Misc.radio_selected++;
  59. if (Shonax.Misc.radio_selected > ARRAYSIZE(stations) - 1)
  60. Shonax.Misc.radio_selected = 0;
  61.  
  62. BASS_ChannelPause(stream);
  63. stream = NULL;
  64. stream = BASS_StreamCreateURL(stations[Shonax.Misc.radio_selected].c_str(), 0, 0, NULL, 0);
  65. }
  66. ImGui::Spacing();
  67. ImGui::PushItemWidth(250);
  68. ImGui::SliderFloat("Volume", &vol, 0.f, 1.f);
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement