Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!   (93,064 visits to this link)

    2. News

    1. GTA Online

      1. Find Lobbies & Players
      2. Guides & Strategies
      3. Vehicles
      4. Content Creator
      5. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    4. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    5. GTA Chinatown Wars

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    9. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption 2

    2. Red Dead Redemption

    3. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Forum Support

    2. Site Suggestions

Shmoopy

[REQ|DOC|SA] Request custom opcodes

Recommended Posts

Shmoopy

titleopco.png



Welcome to Opcodes Customs, the place where you can request opcodes to be made. Do you think that a certain opcode should exist ? Do you believe that your opcode can save hundreds of code lines? Then feel free to post your request below.



Don't forget to give credits if you're going to use any of the plugins below for your mod


Thanks



Retired


Edited by Shmoopy

Share this post


Link to post
Share on other sites
Shmoopy

[table]

Anttweakbaranttweak.pngDownloadSASCM.ini

0AF6=1,show_cursor %1d%

0AF7=1,ATB_draw %1d%

0AF8=2, %2d% = ATB_create_bar %1d%

0AF9=1,ATB_delete_bar %1d%

0AFA=5,ATB_add_int_var_to_bar %1d% var_name %2d% id %3d% _var %4d% params %5d% 0AFB=5,ATB_add_float_var_to_bar %1d% var_name %2d% id %3d% _var %f% params %5d% 0AFC=5,ATB_add_bool_var_to_bar %1d% var_name %2d% id %3d% _var %d% params %5d% 0AFD=5,ATB_add_char_var_to_bar %1d% var_name %2d% id %3d% _var %4d% params %5d% 0AFE=8,ATB_add_color_var_to_bar %1d% var_name %2d% id %3d% rgba %4d% %5d% %6d% %7d% params %8d% 0AFF=0,ATB_mouse_press_check

0B06=0,ATB_check_key_press_check

0B07=2,%2d% = ATB_get_int_var id %1d%

0B08=2,%2f% = ATB_get_float_var id %1d%

0B09=2,%2d% = ATB_get_bool_var id %1d%

0B0A=2,%2d% = ATB_get_char_var id %1d%

0B0B=5,%2d% %3d% %4d% %5d% = ATB_get_rgba_var id %1d%

0B0C=1, ATB_define %1d%

0B0D=6,ATB_add_button bar %1d% btn_name %2d% id %3d% params %4d% call_func %5p% active %6d%

0B0E=5,%2d% %3d% %4d% %5d% = ATB_get_quat_var id %1d%

0B0F=8,ATB_add_quat_var_to_bar %1d% var_name %2d% id %3d% var %4f% %5f% %6f% %7f% params %8d%

 

Opcodes.txt

0AF6: show_cursor 1

0AF7: ATB_draw 1

0AF8: [email protected] = ATB_create_bar "Main Menu"

0AF9: ATB_delete_bar [email protected]

0AFA: ATB_add_int_var_to_bar [email protected] var_name "Int1" id 1 _var 21 params "label='Int' min=0 max=30"

0AFB: ATB_add_float_var_to_bar [email protected] var_name "Float1" id 1 _var 1.4 params "label='Float'"

0AFC: ATB_add_bool_var_to_bar [email protected] var_name "Bool1" id 1 _var 1 params "label='Bool'"

0AFD: ATB_add_char_var_to_bar [email protected] var_name "Char1" id 1 _var "Hello world" params "label='String'"

0AFE: ATB_add_color_var_to_bar [email protected] var_name "Color1" id 1 rgba 255 0 0 255 params "label='Color'"

0AFF: ATB_mouse_press_check

0B06: ATB_check_key_press_check

0B07: [email protected] = ATB_get_int_var id 1

0B08: [email protected] = ATB_get_float_var id 1

0B09: [email protected] = ATB_get_bool_var id 1

0B0A: [email protected] = ATB_get_char_var id 1

0B0B: [email protected] [email protected] [email protected] [email protected] = ATB_get_rgba_var id 1

0B0C: ATB_define "'Main Menu' size='200 200' color='200 0 0' alpha =230"

0B0D: ATB_add_button bar [email protected] btn_name "Btn1" id 1 params "label='Button'" call_func @SpawnActor active 1

0B0E: [email protected] [email protected] [email protected] [email protected] = ATB_get_quat_var id 1

0B0F: ATB_add_quat_var_to_bar [email protected] var_name "Quat1" id 1 var 0.0 0.2 0.1 0.0 params "label='Rotation'"

 

Sample

 

0AF8: [email protected] = ATB_create_bar "Main Menu"0B0C:  ATB_define "'Main Menu' size='200 200' color='200 0 0' alpha =230"0AFA: ATB_add_int_var_to_bar [email protected] var_name "Int1" id 1 _var 21 params "label='Int' min=0 max=24"0AFB: ATB_add_float_var_to_bar [email protected] var_name "Float1" id 1 _var 1.4 params "label='Float'"0AFC: ATB_add_bool_var_to_bar [email protected] var_name "Bool1" id 1 _var 1 params "label='Bool'"0AFD: ATB_add_char_var_to_bar [email protected] var_name "Char1" id 1 _var "Hello world" params "label='String'"0AFE: ATB_add_color_var_to_bar [email protected] var_name "Color1" id 1 rgba 255 0 0 255 params "label='Color'"0B0F: ATB_add_quat_var_to_bar [email protected] var_name "Quat1" id 1 var 0.0 0.0 0.0 0.0 params "label='Rotation'"0B0D: ATB_add_button bar [email protected] btn_name "Btn1" id 1 params "label='Set time'" call_func @SetTime active 10AF6: show_cursor 10AF7: ATB_draw 1while truewait 00AFF: ATB_mouse_press_check0B06: ATB_check_key_press_checkend0A93: end_custom_thread:SetTime0B07: [email protected] = ATB_get_int_var id 100C0: set_current_time [email protected] 0return

 

 

[/table] Edited by Shmoopy

Share this post


Link to post
Share on other sites
Shmoopy

[table]

Text to speechtts.pngDownloadSASCM.ini

0BA0=1,TTS_say %1d%

 

Opcodes.txt

0BA0: TTS_say "Hello World !"

 

Sample

 

00BF: [email protected] = current_time_hours, [email protected] = current_time_minutes 0AD3: [email protected] = format "%d hours %d minutes" [email protected] [email protected] 0BA0: TTS_say "<pitch middle="2">The time is" 0BA0: TTS_say [email protected] 0BA0: TTS_say "<rate speed="-2"> Have a nice day!"

 

 

[/table] Edited by Shmoopy

Share this post


Link to post
Share on other sites
Junior_Djjr

Hm, interesting stuff here :)

 

My dream is return the frequencies of a song in a variable. Thus playing an MP3 music, read the current bass of spectrum and put in the movement of the speakers.

 

Here's a workaround version where when you press a button or use the mouse, increases a value and that value is the speaker vibrate:

 

 

 

Years ago I already tried it with my friend, but it was complicated and did not have good results:

 

 

(sh*tty video)

 

 

It was necessary even not use opcodes to load and play a song, we had to use functions directly from bass.dll

So I guess I should have not only one but several opcodes

 

Or at least a .dll/.asi/.cleo with direct functions from bass.dll since opcodes may not be as useful here, what do you think?

 

If it is not asking too much, also the addition of sound effects like reverb to add effects on the environment in which it is being played such music, as well as boost the low frequencies (bass boost). That sort of thing would be very useful not only for music, but sound effects mods

 

 

Here's the documentation of bass.dll where we use for the first test:

http://www.un4seen.com/doc/

Edited by Junior_Djjr

Share this post


Link to post
Share on other sites
Shmoopy
Here's the documentation of bass.dll where we use for the first test:

 

http://www.un4seen.com/doc/

Alright, Working on a bass plugin, good thing is that it already comes with gta:sa.

Share this post


Link to post
Share on other sites
Junior_Djjr
Will have some problem with not work if Cleo Library is updated? I remember that when updates, the addresses of the functions changes and so it was only possible to create for only one version of Cleo.

Perhaps it was the way we created.

Edited by Junior_Djjr

Share this post


Link to post
Share on other sites
Shmoopy

Bass plugin 90% ready, just remembered to add some sound fx opcodes (Reverb,Echo etc ... ) :colgate:

I've added what you wanted, I mean the float value of the sound spectrum. It works perfectly and I think that it will suit the speakers vibration :happy:

 

Edit: Is your sound in 3D or 2D? Because I tested with 2D sound

Edited by Shmoopy

Share this post


Link to post
Share on other sites
Junior_Djjr

Thanks man, you have no idea how much people want and ask me for it.

It will also be very nice to hear music with some graphic spectrum in screen corner :D

 

And, 3D

Edited by Junior_Djjr

Share this post


Link to post
Share on other sites
Shmoopy

[table]

Audio Plugin *ASI filebass.pngDownloadSASCM.ini

0BA1=4,%4d% = BASS_load_file %1d% freq %2d% type %3d%
0BA2=1,BASS_play %1d%
0BA3=0,BASS_free
0BA4=4,%4f% = BASS_get_data %1d% type %2d% bit %3d%
0BA5=2,BASS_set_FX %1d% effect %2d%
0BA6=3,%3d% = BASS_load_file3D %1d% freq %2d%
0BA7=4,BASS_3DSet %1d% pos %2d% %3d% %4d%
0BA8=1,BASS_pause %1d%
0BA9=1,BASS_stop %1d%
0BAA=2,%2d% = BASS_is_playing %1d%
0BAB=7,FX_set_chorus_params %1d% _wetdrymix %2d% _depth %3d% _feedback %4d% _frequency %5d% _waveform %6d% _delay %7d%
0BAC=7,FX_set_compres_params %1d% _gain %2d% _attack %3d% _release %4d% _threshold %5d% _ratio %6d% _predelay %7d%
0BAD=6,FX_set_distor_params %1d% _gain %2d% _edge %3d% _freq %4d% _bandw %5d% _lowpass %6d%
0BAE=6,FX_set_echo_params %1d% _wetdrymix %2d% _feedback %3d% _ldelay %4d% _rdelay %5d% _pandelay %6d%
0BAF=6,FX_set_flanger_params %1d% _wetdrymix %2d% _depth %3d% _feedback %4d% _freq %5d% _delay %6d%
0BB0=3,FX_set_gargle_params %1d% rate %2d% waveshape %3d%
0BB1=5,FX_set_reverb_params %1d% gain %2d% mix %3d% time %4d% freq %5d%

 

Opcodes.txt

0BA1: [email protected] = BASS_load_file "CLEO/file.mp3" freq 44100 type BASS_STREAM_AUTOFREE
0BA2: BASS_play [email protected]
0BA3: BASS_free
0BA4: [email protected] = BASS_get_data [email protected] type BASS_DATA_FFT1024 bit 1
0BA5: BASS_set_FX [email protected] effect BASS_FX_DX8_CHORUS
0BA6: [email protected] = BASS_load_file3D "ocarina.mp3" freq 44100
0BA7: BASS_3DSet [email protected] pos 2488.56 -1666.84 12.38
0BA8: BASS_pause [email protected]
0BA9: BASS_stop [email protected]
0BAA: [email protected] = BASS_is_playing [email protected]
0BAB: FX_set_chorus_params [email protected] _wetdrymix{0.0;100.0} 50.0 _depth{0.0;100.0} 10.0 _feedback{-99.0;99,0} 25.0 _frequency{0.0;10.0} 1.1 _waveform{0;1} 1 _delay{0.0;20.0} 16.0
0BAC: FX_set_compres_params [email protected] _gain{-60.0;60.0} 0.0 _attack{0.1;500.0} 10.0 _release{50.0;3000.0} 200.0 _threshold{-60.0;0.0} -20.0 _ratio{1.0;100.0} 3.0 _predelay{0.0;4.0} 4.0
0BAD: FX_set_distor_params [email protected] _gain{-60.0;0.0} -18.0 _edge{0.0;100.0} 15.0 _freq{100.0;8000.0} 2400.0 _bandw{100.0;8000.0} 2400.0 _lowpass{100.0;8000.0} 8000.0
0BAE: FX_set_echo_params [email protected] _wetdrymix{0.0;100.0} 50.0 _feedback{0.0;100.0} 50.0 _ldelay{0.0;2000.0} 500.0 _rdelay{0.0;2000.0} 500.0 _pandelay{1;0}0
0BAF: FX_set_flanger_params [email protected] _wetdrymix{0.0;100.0} 50.0 _depth{0.0;100.0} 100.0 _feedback{-99.0;99,0} 50.0 _freq{0.0;10.0} 0.25 _delay{0.0;4.0} 2.0
0BB0: FX_set_gargle_params [email protected] rate{1;1000} 20 waveshape{1;0} 0
0BB1: FX_set_reverb_params [email protected] gain{-96.0;0.0} 0.0 mix{-96.0;0.0} 0.0 time{0.1;3000.0} 1000.0 freq{0.001;0.999} 0.001

 

Sample

 

0BA6: [email protected] = BASS_load_file3D "ocarina.mp3" freq 44100 wait 2500BA7: BASS_3DSet [email protected] pos 2488.56 -1666.84 12.38//0BA5: BASS_set_FX [email protected] effect BASS_FX_DX8_CHORUS0BA2: BASS_play [email protected]//**** Draw simple spectrum ***//while truewait 00BA4: [email protected] = BASS_get_data [email protected] type BASS_DATA_FFT1024 bit 10BA4: [email protected] = BASS_get_data [email protected] type BASS_DATA_FFT1024 bit 20BA4: [email protected] = BASS_get_data [email protected] type BASS_DATA_FFT1024 bit 30BA4: [email protected] = BASS_get_data [email protected] type BASS_DATA_FFT1024 bit [email protected] = 10.0 // Amplification [email protected] *= [email protected] *= [email protected] *= [email protected] *= 100.0  006B: [email protected] *= [email protected]  006B: [email protected] *= [email protected]  006B: [email protected] *= [email protected]  006B: [email protected] *= [email protected]  038E: draw_box_position 320.0 224.0 size 10.0 [email protected] RGBA 255 0 0 255038E: draw_box_position 340.0 224.0 size 10.0 [email protected] RGBA 255 0 0 255038E: draw_box_position 360.0 224.0 size 10.0 [email protected] RGBA 255 0 0 255038E: draw_box_position 380.0 224.0 size 10.0 [email protected] RGBA 255 0 0 25503F0: enable_text_draw 0end

 

 


Constants

 

const/********************BASS_load_file type*************************/BASS_SAMPLE_8BITS		= 1	// 8 bitBASS_SAMPLE_FLOAT		= 256	// 32-bit floating-pointBASS_SAMPLE_MONO		= 2	// monoBASS_SAMPLE_LOOP		= 4	// loopedBASS_SAMPLE_3D			= 8	// 3D functionalityBASS_SAMPLE_SOFTWARE	= 16	// not using hardware mixingBASS_SAMPLE_MUTEMAX		= 32	// mute at max distance (3D only)BASS_SAMPLE_VAM			= 64	// DX7 voice allocation & managementBASS_SAMPLE_FX			= 128	// old implementation of DX8 effectsBASS_SAMPLE_OVER_VOL	= 0x10000	// override lowest volumeBASS_SAMPLE_OVER_POS	= 0x20000	// override longest playingBASS_SAMPLE_OVER_DIST	= 0x30000 // override furthest from listener (3D only)BASS_STREAM_PRESCAN		= 0x20000 // enable pin-point seeking/length (MP3/MP2/MP1)BASS_STREAM_AUTOFREE	= 0x40000	// automatically free the stream when it stop/endsBASS_STREAM_RESTRATE	= 0x80000	// restrict the download rate of internet file streamsBASS_STREAM_BLOCK		= 0x100000 // download/play internet file stream in small blocksBASS_STREAM_DECODE		= 0x200000 // don't play the stream, only decode (BASS_ChannelGetData)BASS_STREAM_STATUS		= 0x800000 // give server status info (HTTP/ICY tags) in DOWNLOADPROC/********************BASS_get_data type*************************/BASS_DATA_AVAILABLE	= 0			// query how much data is bufferedBASS_DATA_FIXED		= 0x20000000	// flag: return 8.24 fixed-point dataBASS_DATA_FLOAT		= 0x40000000	// flag: return floating-point sample dataBASS_DATA_FFT256	= 0x80000000	// 256 sample FFTBASS_DATA_FFT512	= 0x80000001	// 512 FFTBASS_DATA_FFT1024	= 0x80000002	// 1024 FFTBASS_DATA_FFT2048	= 0x80000003	// 2048 FFTBASS_DATA_FFT4096	= 0x80000004	// 4096 FFTBASS_DATA_FFT8192	= 0x80000005	// 8192 FFTBASS_DATA_FFT16384	= 0x80000006	// 16384 FFTBASS_DATA_FFT_INDIVIDUAL = 0x10	// FFT flag: FFT for each channel, else all combinedBASS_DATA_FFT_NOWINDOW	= 0x20	// FFT flag: no Hanning windowBASS_DATA_FFT_REMOVEDC	= 0x40	// FFT flag: pre-remove DC biasBASS_DATA_FFT_COMPLEX	= 0x80	// FFT flag: return complex data/********************BASS_set_FX effect*************************/BASS_FX_DX8_CHORUS = 0BASS_FX_DX8_COMPRESSOR = 1BASS_FX_DX8_DISTORTION = 2BASS_FX_DX8_ECHO = 3BASS_FX_DX8_FLANGER = 4BASS_FX_DX8_GARGLE = 5BASS_FX_DX8_I3DL2REVERB = 6BASS_FX_DX8_PARAMEQ = 7BASS_FX_DX8_REVERB = 8end

 

 

[/table] Edited by Shmoopy

Share this post


Link to post
Share on other sites
Junior_Djjr

[table]Audio Plugin[/table]

I think you made a mistake in the files :bored:

 

Bass.cleo is the same file of Anttweakbar.cleo, 64512 bytes, also Bass.cleo asked for AntTweakBar.dll

 

 


It seems incredible, mainly BASS_set_FX, but you could add opcodes for attach in a car, object or pedestrian, or any type of entity? (any entity would be interesting, more dynamic than cleo 4)

Use coords have a delay in motion, if I eg add 3D sound in a car and drives, the sound will delay and stay behind.

Apparently the audio attach in cleo 4 works by simply changing the coordinate pointer or something.

 

 

edit: Also, need some 0AB9: to know if the song is playing or ended etc, an indispensable thing to create a complete MP3 mod. This?

 

edit: How BASS_set_FX works? Should not be more parameters?

I think this plugin will help a lot in this project ;)

Edited by Junior_Djjr

Share this post


Link to post
Share on other sites
Shmoopy

Done, as for the attach to entity ones, get the vehicle position and do set_pos in a while vehicle.exists loop. Until I find a suitable way to attach the streams to entities.

 



[table]Audio Plugin[/table]
I think you made a mistake in the files :bored:

Bass.cleo is the same file of Anttweakbar.cleo, 64512 bytes, also Bass.cleo asked for AntTweakBar.dll



It seems incredible, mainly BASS_set_FX, but you could add opcodes for attach in a car, object or pedestrian, or any type of entity? (any entity would be interesting, more dynamic than cleo 4)
Use coords have a delay in motion, if I eg add 3D sound in a car and drives, the sound will delay and stay behind.
Apparently the audio attach in cleo 4 works by simply changing the coordinate pointer or something.


edit: Also, need some 0AB9: to know if the song is playing or ended etc, an indispensable thing to create a complete MP3 mod. This?

edit: How BASS_set_FX works? Should not be more parameters?
I think this plugin will help a lot in this project ;)

 

Done except for the attach_to_entity ones, I need to test them first, apparently there is no other way than creating a loop which gets the entity's position while it exists, can be done both in scm and c++ but I prefer that you do it in scm until I find a solution.

Share this post


Link to post
Share on other sites
Junior_Djjr

 

 

[table]Audio Plugin[/table]

I think you made a mistake in the files :bored:

 

Bass.cleo is the same file of Anttweakbar.cleo, 64512 bytes, also Bass.cleo asked for AntTweakBar.dll

 

 


It seems incredible, mainly BASS_set_FX, but you could add opcodes for attach in a car, object or pedestrian, or any type of entity? (any entity would be interesting, more dynamic than cleo 4)

Use coords have a delay in motion, if I eg add 3D sound in a car and drives, the sound will delay and stay behind.

Apparently the audio attach in cleo 4 works by simply changing the coordinate pointer or something.

 

 

edit: Also, need some 0AB9: to know if the song is playing or ended etc, an indispensable thing to create a complete MP3 mod. This?

 

edit: How BASS_set_FX works? Should not be more parameters?

I think this plugin will help a lot in this project ;)

 

Done except for the attach_to_entity ones, I need to test them first, apparently there is no other way than creating a loop which gets the entity's position while it exists, can be done both in scm and c++ but I prefer that you do it in scm until I find a solution.

 

SoundSystem.cpp in Cleo Library's source

 

 

 

 

#include "SoundSystem.h"#include "bass.h"#include "DebugLog.h"#include "CleoInstance.h"#include "CMenuManager.h"#include <windows.h>namespace CLEO{    HWND CDECL (*CreateMainWindow)(HINSTANCE hinst);    HWND CDECL OnCreateMainWindow(HINSTANCE hinst)    {        if (HIWORD(BASS_GetVersion()) != BASSVERSION)            Error("An incorrect version of bass.dll has been loaded");        TRACE("Creating main window...");        HWND hwnd = CreateMainWindow(hinst);        if (!GetThisInstance().soundSystem.Init(hwnd))            TRACE("SoundSystem::Init() failed. Error code: %d", BASS_ErrorGetCode());        return hwnd;    }        CPlaceable *camera;    void SoundSystem::inject(CodeInjector& inj)    {        TRACE("Injecting SoundSystem...");        GameVersionManager& gvm = GetThisInstance().versionManager;        CreateMainWindow = gvm.TranslateMemoryAddress(MA_CREATE_MAIN_WINDOW_FUNCTION);        inj.ReplaceFunction(OnCreateMainWindow, gvm.TranslateMemoryAddress(MA_CALL_CREATE_MAIN_WINDOW));        camera = gvm.TranslateMemoryAddress(MA_CAMERA);    }    void EnumerateBassDevices(int& total, int& enabled, int& default_device)    {        BASS_DEVICEINFO info;        for (default_device = -1, enabled = 0, total = 0; BASS_GetDeviceInfo(total, &info); ++total)        {            if (info.flags & BASS_DEVICE_ENABLED) ++enabled;            if (info.flags & BASS_DEVICE_DEFAULT) default_device = total;            TRACE("Found sound device %d%s: %s", total, default_device == total ?                " (default)" : "", info.name);        }    }    bool SoundSystem::Init(HWND hwnd)    {        const BASS_3DVECTOR pos(0, 0, 0), vel(0, 0, 0), front(0, -1, 0), top(0, 0, 1);        int default_device, total_devices, enabled_devices;        BASS_DEVICEINFO info = { nullptr, nullptr, 0 };        EnumerateBassDevices(total_devices, enabled_devices, default_device);        if (forceDevice != -1 && BASS_GetDeviceInfo(forceDevice, &info) &&            info.flags & BASS_DEVICE_ENABLED)            default_device = forceDevice;        TRACE("On system found %d devices, %d enabled devices, assuming device to use: %d (%s)",            total_devices, enabled_devices, default_device, BASS_GetDeviceInfo(default_device, &info) ?                info.name : "Unknown device");        if (BASS_Init(default_device, 44100, BASS_DEVICE_3D, hwnd, nullptr) &&            BASS_Set3DFactors(1.0f, 0.3f, 1.0f) &&            BASS_Set3DPosition(&pos, &vel, &front, &top))        {            TRACE("SoundSystem initialized");            initialized = true;            this->hwnd = hwnd;            BASS_Apply3D();            return true;        }        Warning("Could not initialize BASS sound system");        return false;    }    SoundSystem::SoundSystem(void)        : initialized(false), forceDevice(-1), paused(false)    {        // TODO: give to user an ability to force a sound device to use (ini-file or cmd-line?)    }    SoundSystem::~SoundSystem(void)    {        TRACE("Closing SoundSystem...");        UnloadAllStreams();        if (initialized) BASS_Free();    }    CAudioStream *SoundSystem::LoadStream(const char *filename, bool in3d)    {        CAudioStream *result = in3d ? new C3dAudioStream(filename) : new CAudioStream(filename);        if (result->OK)        {            streams.insert(result);            return result;        }        delete result;        return nullptr;    }        void SoundSystem::UnloadStream(CAudioStream *stream)    {        if (streams.erase(stream))            delete stream;        else            TRACE("Unloading of stream that is not in list of loaded streams");    }    void SoundSystem::UnloadAllStreams()    {        std::for_each(streams.begin(), streams.end(),            [](CAudioStream *stream)            {                delete stream;            });        streams.clear();    }    void SoundSystem::Update()    {        if (menuManager->menuActive || IsIconic(hwnd))    // if in menu or window minimized        {            if (!paused)            {                // entering menu - pause all streams                paused = true;                std::for_each(streams.begin(), streams.end(),                    [](CAudioStream *stream)                    {                        if (stream->state == CAudioStream::playing)                            stream->Pause(false);                    });            }        }        else        {            if (paused)            {                // exiting menu - resume all paused streams                paused = false;                std::for_each(streams.begin(), streams.end(),                    [](CAudioStream *stream)                    {                        if (stream->state == CAudioStream::playing)                            stream->Resume();                    });            }            // not in menu            // process camera movements            BASS_Set3DPosition((BASS_3DVECTOR *)&camera->xyz->matrix.pos, nullptr,                (BASS_3DVECTOR *)&camera->xyz->matrix.at, (BASS_3DVECTOR *)&camera->xyz->matrix.top);            // process all streams            std::for_each(streams.begin(), streams.end(),                [](CAudioStream *stream)                {                    stream->Process();                });            // apply above changes            BASS_Apply3D();        }    }    CAudioStream::CAudioStream()        : streamInternal(0), state(no), OK(false)    {    }    CAudioStream::CAudioStream(const char *src) : state(no), OK(false)    {        if (!(streamInternal = BASS_StreamCreateFile(FALSE, src, 0, 0, 0)) &&            !(streamInternal = BASS_StreamCreateURL(src, 0, 0, nullptr, nullptr)))        {            TRACE("Loading audiostream %s failed. Error code: %d", src, BASS_ErrorGetCode());        }        else OK = true;    }    CAudioStream::~CAudioStream()    {        if (streamInternal) BASS_StreamFree(streamInternal);    }    C3dAudioStream::C3dAudioStream(const char *src)        : CAudioStream::CAudioStream(), link(nullptr)    {        unsigned flags = BASS_SAMPLE_3D | BASS_SAMPLE_MONO | BASS_SAMPLE_SOFTWARE;        if (!(streamInternal = BASS_StreamCreateFile(FALSE, src, 0, 0, flags)) &&            !(streamInternal = BASS_StreamCreateURL(src, 0, flags, nullptr, nullptr)))        {            TRACE("Loading 3d-audiostream %s failed. Error code: %d", src, BASS_ErrorGetCode());        }        else OK = true;    }    C3dAudioStream::~C3dAudioStream()    {        if (streamInternal) BASS_StreamFree(streamInternal);    }    void CAudioStream::Play()    {        BASS_ChannelPlay(streamInternal, TRUE);        state = playing;    }    void CAudioStream::Pause(bool change_state)    {        BASS_ChannelPause(streamInternal);        if (change_state) state = paused;    }    void CAudioStream::Stop()    {        BASS_ChannelPause(streamInternal);        BASS_ChannelSetPosition(streamInternal, 0, BASS_POS_BYTE);        state = paused;    }    void CAudioStream::Resume()    {        BASS_ChannelPlay(streamInternal, FALSE);        state = playing;    }    unsigned CAudioStream::GetLength()    {        return (unsigned)BASS_ChannelBytes2Seconds(streamInternal,            BASS_ChannelGetLength(streamInternal, BASS_POS_BYTE));    }    unsigned CAudioStream::GetState()    {        if (state == stopped) return -1;        switch (BASS_ChannelIsActive(streamInternal))        {        case BASS_ACTIVE_STOPPED:        default:            return -1;        case BASS_ACTIVE_PLAYING:        case BASS_ACTIVE_STALLED:            return 1;        case BASS_ACTIVE_PAUSED:            return 2;            };    }    float CAudioStream::GetVolume()    {        float result;        if (!BASS_ChannelGetAttribute(streamInternal, BASS_ATTRIB_VOL, &result))            return -1.0f;        return result;    }    void CAudioStream::SetVolume(float val)    {        BASS_ChannelSetAttribute(streamInternal,BASS_ATTRIB_VOL, val);    }        void CAudioStream::Loop(bool enable)    {        BASS_ChannelFlags(streamInternal, enable ? BASS_SAMPLE_LOOP : 0, BASS_SAMPLE_LOOP);    }    void CAudioStream::Process()    {        // no actions required    }    void CAudioStream::Set3dPosition(const RwV3d& pos)    {        TRACE("Unimplemented CAudioStream::Set3dPosition()");    }        void CAudioStream::Link(CPlaceable *placable)    {        TRACE("Unimplemented CAudioStream::Link()");    }    void C3dAudioStream::Set3dPosition(const RwV3d& pos)    {        BASS_ChannelSet3DPosition(streamInternal,            reinterpret_cast<const BASS_3DVECTOR *>(&pos), nullptr, nullptr);    }    void C3dAudioStream::Link(CPlaceable *placable)    {        link = placable;    }        void C3dAudioStream::Process()    {        // update playing position of the linked object        if (link && state == playing)            BASS_ChannelSet3DPosition(streamInternal,            reinterpret_cast<const BASS_3DVECTOR *>(&link->placement.pos), nullptr, nullptr);    }}

 

Look at the end. This help?

 

Edit:

 

	//0AC3=2,link_3d_audiostream %1d% to_object %2d%	OpcodeResult opcode_0AC3(CScriptThread *thread)	{		CAudioStream *stream; unsigned handle;		RetrieveScriptParams(thread, stream, handle);		stream->Link(GetObjectPool().atHandle(handle));		return OR_CONTINUE;	}
CustomOpcodeSystem.cpp Edited by Junior_Djjr

Share this post


Link to post
Share on other sites
Junior_Djjr

I tested and worked :D
Man, the vibration was perfect!

This plugin will help a lot, thanks a lot!

 

But for some reason the 3d was silent, works spectrum and everything, but even I going to the location (Grove) did not hear anything

Share this post


Link to post
Share on other sites
Shmoopy

I tested and worked :D

Man, the vibration was perfect!

This plugin will help a lot, thanks a lot!

 

But for some reason the 3d was silent, works spectrum and everything, but even I going to the location (Grove) did not hear anything

 

Did you test with the Sample ?

Because it works for me

Hold on I made a mistake

 

Rename it to bass.asi instead of cleo and put in in the main folder.

Edited by Shmoopy

Share this post


Link to post
Share on other sites
Junior_Djjr

Yeah, worked now, but looks like with wrong freq, I don't know why, 44100 worked for 2D, the song and my windows are also with 44100

 

So, please fix the sound continuing when the game is paused, TTS.cleo also have this problem.

Wow, It was automatically fixed :blink:

Edited by Junior_Djjr

Share this post


Link to post
Share on other sites
Shmoopy

Yeah, worked now, but looks like with wrong freq, I don't know why, 44100 worked for 2D, the song and my windows are also with 44100

 

So, please fix the sound continuing when the game is paused, TTS.cleo also have this problem.

Plugin is now an asi file, test the 3d sound now, everything works for me, the sound pauses when in Mainmenu, as for tts.cleo i will fix it later.

Edited by Shmoopy

Share this post


Link to post
Share on other sites
Junior_Djjr

I understand now, only .asi the sound pauses with the game, .cleo not.

Share this post


Link to post
Share on other sites
Shmoopy

I understand now, only .asi the sound pauses with the game, .cleo not.

Does the 3D sound work?

Share this post


Link to post
Share on other sites
Junior_Djjr

With .asi worked but bugged, like wrong freq

Remember me a bug when I played Prototype with 192000 hz, then I changed to 44100 hz and worked, but not now.

 

For some reason, when I minimize the game and come back, when leaving the pause sound becomes normal during half a second and then bugs again.

 

Chopped sounds as if the music was cut off.

 

btw: I'm using the latest version of bass.dll, 110.207 bytes

Edited by Junior_Djjr

Share this post


Link to post
Share on other sites
Shmoopy

With .asi worked but bugged, like wrong freq

Remember me a bug when I played Prototype with 192000 hz, then I changed to 44100 hz and worked, but not now.

 

For some reason, when I minimize the game and come back, when leaving the pause sound becomes normal during half a second and then bugs again.

 

Chopped sounds as if the music was cut off.

 

btw: I'm using the latest version of bass.dll, 110.207 bytes

Send me the sound file you play

my bass version is 2.4.10.0, the one which comes with GTA:SA

Edited by Shmoopy

Share this post


Link to post
Share on other sites
Junior_Djjr

:D:D

 

(watch in 720p60 for 60 FPS)

The result is becoming incredible

Edited by Junior_Djjr

Share this post


Link to post
Share on other sites
Shmoopy

Seriously I have no idea how you did those bass vibrations, Thats wicked sick! How did you make them move like that in a game like Gta:sa?

 

Edit: I also noticed that chopping bug and the noise when playing 6.mp3 in 3D, altough it plays fine in 2D without bugs. I'll try to fix it tonight

Edited by Shmoopy

Share this post


Link to post
Share on other sites
Junior_Djjr

Seriously I have no idea how you did those bass vibrations, Thats wicked sick! How did you make them move like that in a game like Gta:sa?

There is not much mystery:
The speaker is a separate mesh with the axis in front, when we decrease the Y size, the part behind gives the feeling of going forward, then immediately (in the next frame) we increase the Y size to make the speaker go back.
Small and simple rules. It is basically the same as occur in real life :)
Edited by Junior_Djjr

Share this post


Link to post
Share on other sites
Junior_Djjr

About the bug, try to set your FPS limit in "1" or other low value

Compare with high FPS, like 60

 

If you set "1" apparently it's okay, but pay close attention, the cut is exactly in the process the game. While the game is not being processed (stopped) the audio is running, and that millisecond's process, the audio will take a quick break, thus creating the chop effect at high FPS.

Something is making the audio will not be processed while the game is being.

Edited by Junior_Djjr

Share this post


Link to post
Share on other sites
Junior_Djjr
Any progress?

Others also had problems with the 3D sound


And....... your bass plugin make all other cleo's audiostreams don't work
Edited by Junior_Djjr

Share this post


Link to post
Share on other sites
Shmoopy

 

Any progress?
Others also had problems with the 3D sound
And....... your bass plugin make all other cleo's audiostreams don't work

 

I couldn't find a solution so I stopped trying, I'll send you the source code when I get home so you can work on it, maybe you'll have more success than me

Edited by Shmoopy

Share this post


Link to post
Share on other sites
Junior_Djjr

I couldn't find a solution so I stopped trying, I'll send you the source code when I get home so you can work on it, maybe you'll have more success than me

Nop, but my friend :p he has worked with it previously.

Share this post


Link to post
Share on other sites
Bigbossbro08

GTA VC needs to open custom IFPs loading opcode system like GTA SA. Can you make one for VC?

Share this post


Link to post
Share on other sites
Shmoopy

GTA VC needs to open custom IFPs loading opcode system like GTA SA. Can you make one for VC?

I'm not familiar with GTA VC in terms of scripting. On the other hand if you need anything GTA SA related then feel free to ask.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.