Volume adjustment method, device and storage medium
By monitoring the player volume change at the application layer at the first frame layer of the smartphone, and transmitting the target volume value to the second frame layer through cross-language interactive components, the problem that the application sound volume cannot be adjusted independently is solved, and the effect of independent volume adjustment and interface simplification is achieved.
Patent Information
- Application Number
- CN202010754329.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-30
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2040-07-30
AI Technical Summary
In smartphones, the sound volume of the application cannot be adjusted independently, resulting in the sound volume of all applications increasing or decreasing at the same time, and independent volume adjustment for different applications cannot be achieved.
The player volume change of the application layer is monitored through the first frame layer, and the target volume value is obtained, and transmitted to the second frame layer through the cross-language interaction component, adjusting the volume of the audio output module.
Independent volume adjustment for different applications is realized, the interface addition and transplantation process is simplified, the adjustment speed is improved, and the second framework layer and application layer are decoupled.
Smart Images

Figure CN114063963B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of information technology, and in particular to a volume adjustment method, device and storage medium. Background Art
[0002] The sounds in smartphones include media volume, ringtone volume, and notification volume. If some applications use the same volume (such as media volume), the volume of the applications will be consistent, and the volume of each application will increase or decrease at the same time as the media volume is adjusted, making it impossible to adjust different applications separately. In order to achieve separate adjustment for different applications, it is currently implemented at the relatively low level of the operating system, that is, the native layer, which requires adding more interfaces and is difficult to transplant. Summary of the invention
[0003] The present disclosure provides a volume adjustment method, device and storage medium.
[0004] According to a first aspect of an embodiment of the present disclosure, there is provided a volume adjustment method, comprising:
[0005] Monitor the volume change of the player in the application layer through the first framework layer to obtain the target volume value to be adjusted;
[0006] The target volume value is transmitted to the second framework layer through the cross-language interaction component; wherein the second framework layer and the first framework layer use different programming languages;
[0007] The volume of the audio output module is adjusted to the target volume value through the second framework layer.
[0008] Optionally, the step of monitoring the volume change of the player of the application layer through the first framework layer to obtain the target volume value to be adjusted includes:
[0009] Monitoring, through the first framework layer, configuration information updated by the application layer when the volume of the player changes;
[0010] The target volume value is determined according to the configuration information.
[0011] Optionally, monitoring, by the first framework layer, configuration information updated by the application layer when the volume of the player changes includes:
[0012] The first framework layer configures the APC class interface through sound playback and reads interface parameters;
[0013] According to the interface parameters, the configuration information updated by the application layer when the volume of the player changes is determined; an instance of the APC class corresponds to one player.
[0014] Optionally, the first framework layer configures an APC class interface through sound playback and reads interface parameters, including:
[0015] The first framework layer accesses the first volume coefficient setting interface in the first player base class of the first framework layer by calling the volume setting interface in the instance of the APC class, and reads the interface parameters.
[0016] Optionally, the method further comprises:
[0017] Determine whether an instance of the audio track class is created in the second framework layer, and obtain a determination result;
[0018] Based on the determination result, determining whether the target volume value obtained based on the first framework layer can be set to take effect;
[0019] The step of transmitting the target volume value to the second framework layer through the cross-language interaction component includes:
[0020] When it is determined that the target volume value obtained based on the first framework layer can be set to take effect, the target volume value converted by the cross-language interaction component is transmitted to the instance of the audio track class of the second framework layer through the first player volume setting interface of the first framework layer.
[0021] Optionally, the first framework layer configures an APC class interface through sound playback and reads interface parameters, including:
[0022] When it is determined that the target volume value obtained based on the first framework layer can be set to take effect, the first framework layer accesses the first volume coefficient setting interface in the first player base class of the first framework layer by calling the volume setting interface in the instance of the APC class, and reads the interface parameters.
[0023] Optionally, the method further comprises:
[0024] When it is determined that the target volume value obtained based on the first framework layer cannot be set to take effect, changing the calling parameters of the second player volume setting interface in the second player base class of the second framework layer; wherein the changed calling parameters are used to call back the second volume coefficient setting interface of the second framework layer;
[0025] The first framework layer configures the APC class interface through sound playback and reads interface parameters, including:
[0026] The first framework layer accesses the second player volume setting interface with changed calling parameters in the second player base class of the second framework layer by calling the volume setting interface in the instance of the APC class;
[0027] Through the second player volume setting interface, the second volume coefficient setting interface of the second framework layer is called to read the interface parameters.
[0028] Optionally, the configuration information includes: a change coefficient value determined by the application layer according to the detected adjustment operation and an adjustment amount generated by the operating system according to the change coefficient value; the change coefficient value is used to indicate the change amount generated based on the detected adjustment operation;
[0029] The step of determining the target volume value according to the configuration information includes:
[0030] The target volume value is determined based on the variation coefficient value, the adjustment amount and the maximum volume of the player.
[0031] Optionally, the step of monitoring the volume change of the player of the application layer through the first framework layer to obtain the target volume value to be adjusted includes:
[0032] Scan the instance of the sound playback configuration APC class corresponding to the player of the application layer, and determine the instance of the APC class corresponding to the player whose volume has changed; wherein the identifier of the instance of the APC class and the declaration parameters of the instance of the APC class can be used to determine the application corresponding to the instance of the APC class.
[0033] Optionally, the method further comprises:
[0034] After obtaining the target volume value to be adjusted, the volume setting interface of the instance of the APC class is called to save the target volume value in a setting map; wherein the data structure of the setting map is a hash structure.
[0035] According to a second aspect of an embodiment of the present disclosure, there is provided a volume adjustment device, comprising:
[0036] A monitoring module, used to monitor the volume change of the player of the application layer through the first framework layer to obtain a target volume value to be adjusted;
[0037] A transmission module, used to transmit the target volume value to a second framework layer through a cross-language interaction component; wherein the second framework layer and the first framework layer use different programming languages;
[0038] An adjustment module is used to adjust the volume of the audio output module to the target volume value through the second framework layer.
[0039] Optionally, the monitoring module includes:
[0040] A configuration information acquisition module, used to monitor, through the first framework layer, the configuration information updated by the application layer when the volume of the player changes;
[0041] A determination module is used to determine the target volume value according to the configuration information.
[0042] Optionally, the configuration information acquisition module includes:
[0043] A parameter reading module, used for the first framework layer to configure the APC class interface through sound playback and read interface parameters;
[0044] The configuration information acquisition submodule is used to determine the configuration information updated by the application layer when the volume of the player changes according to the interface parameters; an instance of the APC class corresponds to one player.
[0045] Optionally, the parameter reading module is further used to:
[0046] The first framework layer accesses the first volume coefficient setting interface in the first player base class of the first framework layer by calling the volume setting interface in the instance of the APC class, and reads the interface parameters.
[0047] Optionally, the device further comprises:
[0048] An instance determination module, used to determine whether an instance of the audio track class is created in the second framework layer, and obtain a determination result;
[0049] An effectiveness determination module, used to determine whether the target volume value obtained based on the first framework layer can be set to take effect based on the determination result;
[0050] The transmission module is also used to transmit the target volume value converted by the cross-language interaction component to the instance of the audio track class of the second framework layer through the first player volume setting interface of the first framework layer when it is determined that the target volume value obtained based on the first framework layer can be set to take effect.
[0051] Optionally, the parameter reading module is further used to:
[0052] When it is determined that the target volume value obtained based on the first framework layer can be set to take effect, the first framework layer accesses the first volume coefficient setting interface in the first player base class of the first framework layer by calling the volume setting interface in the instance of the APC class, and reads the interface parameters.
[0053] Optionally, the device further comprises:
[0054] A changing module, used for changing the calling parameters of the second player volume setting interface in the second player base class of the second framework layer when it is determined that the target volume value obtained based on the first framework layer cannot be set to take effect; wherein the changed calling parameters are used to call back the second volume coefficient setting interface of the second framework layer;
[0055] The parameter reading module is also used for:
[0056] The first framework layer accesses the second player volume setting interface with changed calling parameters in the second player base class of the second framework layer by calling the volume setting interface in the instance of the APC class;
[0057] Through the second player volume setting interface, the second volume coefficient setting interface of the second framework layer is called to read the interface parameters.
[0058] Optionally, the configuration information includes: a change coefficient value determined by the application layer according to the detected adjustment operation and an adjustment amount generated by the operating system according to the change coefficient value; the change coefficient value is used to indicate the change amount generated based on the detected adjustment operation;
[0059] The determining module is further used for:
[0060] The target volume value is determined based on the variation coefficient value, the adjustment amount and the maximum volume of the player.
[0061] Optionally, the monitoring module is further used to:
[0062] Scan the instance of the sound playback configuration APC class corresponding to the player of the application layer, and determine the instance of the APC class corresponding to the player whose volume has changed; wherein the identifier of the instance of the APC class and the declaration parameters of the instance of the APC class can be used to determine the application corresponding to the instance of the APC class.
[0063] Optionally, the device further comprises:
[0064] The storage module is used to call the volume setting interface of the instance of the sound playback configuration APC class to save the volume value in the setting map after obtaining the target volume value to be adjusted; wherein the data structure of the setting map is a hash structure.
[0065] According to a third aspect of an embodiment of the present disclosure, there is provided a volume adjustment device, comprising:
[0066] processor;
[0067] a memory for storing processor-executable instructions;
[0068] The processor is configured to: implement any one of the methods described in the first aspect above when executing the executable instructions stored in the memory.
[0069] According to a fourth aspect of an embodiment of the present disclosure, a non-temporary computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, can implement the steps of the method provided in any one of the first aspects above.
[0070] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0071] The volume adjustment method provided by the embodiment of the present disclosure monitors the volume change of the player of the application layer through the first framework layer to obtain the target volume value to be adjusted; the target volume value is transmitted to the second framework layer through the cross-language interaction component; wherein the programming languages used by the second framework layer and the first framework layer are different; the volume of the audio output module is adjusted to the target volume value through the second framework layer. In this way, the volume adjustment control can be implemented directly in the first framework layer (such as the Java layer), and then transmitted to the second framework layer (such as the Native layer) for the final adjustment of the hardware, so that the adjustment takes effect. In this way, since the processing is performed in the first framework layer, only the code of the first framework layer can be operated without changing the code of the second framework layer, so it is easier to transplant. In addition, through the introduction of the first framework layer, the application layer does not need to establish a dedicated interface between the second framework layer and each application of the application layer, but can interact with the first framework layer through the application layer, so that the second framework layer and the application layer are decoupled. In addition, by adjusting in the first frame, the volume changes of the player can be monitored directly in the first frame, which can reduce the problem of multiple cross-layer calls caused by the need to monitor through the first frame layer even if the sound adjustment is implemented in the second frame layer in the prior art, thereby improving the adjustment speed.
[0072] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0074] Figure 1 The figure is a flow chart of a volume adjustment method according to an exemplary embodiment.
[0075] Figure 2 A schematic diagram of the architecture of an operating system.
[0076] Figure 3 It is the correspondence between the application and the instance of the APC class.
[0077] Figure 4 The figure is a flowchart of reading interface parameters.
[0078] Figure 5 The implementation process of volume adjustment is different in the Native layer and the Java layer.
[0079] Figure 6 The figure is a schematic structural diagram of a volume adjustment device according to an exemplary embodiment.
[0080] Figure 7 The figure is a block diagram of a volume adjustment device according to an exemplary embodiment. DETAILED DESCRIPTION
[0081] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0082] The present disclosure provides a volume adjustment method. Figure 1 is a flow chart of a volume adjustment method according to an exemplary embodiment. Figure 1 As shown, the method comprises the following steps:
[0083] Step 101, monitoring the volume change of the player of the application layer through the first framework layer to obtain the target volume value to be adjusted;
[0084] Step 102: transmitting the target volume value to a second framework layer through a cross-language interaction component; wherein the second framework layer and the first framework layer use different programming languages;
[0085] Step 103: Adjust the volume of the audio output module to the target volume value through the second framework layer.
[0086] It should be noted that the volume adjustment method is applied to a terminal device installed with an Android operating system.
[0087] Here, the volume adjustment in the disclosed embodiment is aimed at: the application layer adjusts the volume of the player based on the user input, that is, for example, it detects that the music player on the terminal device is playing, and detects that the volume of the music player is adjusted. After the hardware on the terminal device detects the user's adjustment operation, it calls various functional components in the system service to finally change the output volume of the music player. Moreover, based on the user's current adjustment operation, only the volume of the player corresponding to the adjustment operation is adjusted, and the volume of other players in the terminal device remains unchanged. In this way, targeted adjustment is achieved.
[0088] The first framework layer and the second framework layer both belong to the application framework layer in the Android operating system. However, compared with the first framework layer, the second framework layer is a bottom framework layer that is more closely coupled with the hardware.
[0089] Figure 2 is a schematic diagram of the architecture of an operating system, such as Figure 2 As shown, the second framework layer is closer to the underlying framework layer than the first framework layer, and realizes language conversion through cross-language interaction components, thereby realizing information interaction. The application layer is arranged on the first framework layer.
[0090] The first framework layer and the second framework layer are written in different programming languages.
[0091] In some embodiments, the code of the second framework layer is native code of the operating system.
[0092] Since the second framework layer is more closely coupled to the hardware, the programming language of the second framework layer is closer to the machine language and is more closely coupled to the rest of the operating system. Therefore, it is easier to write and modify the first framework layer than the second framework layer.
[0093] By introducing the first framework layer and decoupling the application layer from the second framework layer, the coupling between the framework layer including the first framework layer and the second framework layer and the application layer can be lowered, and the portability is higher.
[0094] For example, the first framework layer includes: a Java framework (Framework Java) layer; the code of the first framework layer is written in Java language.
[0095] The second framework layer includes: a native framework (Framework Native) layer; the code of the second framework layer is written in C or C++ language.
[0096] When the first framework layer and the second framework layer need to exchange information, language conversion is required. In the embodiment of the present disclosure, the information exchange between the first framework layer and the second framework layer is achieved through a cross-language interaction component.
[0097] The cross-language interaction component (JNI) is used to write programs through the Java native interface to ensure the portability of codes on different platforms.
[0098] The application layer belongs to the layer in the Android operating system that directly interacts with the user.
[0099] Audio-related application software is implemented in the application layer, and audio-related application software includes: music player, telephone, video player and other software with sound output.
[0100] Since multiple applications are installed in a terminal device, most applications have corresponding players, plus the system volume, there are multiple players in a terminal device. When the volume of the player changes, it is necessary to sense the volume change in time, so that subsequent operations can be triggered and the adjustment can take effect. Here, in the embodiment of the present disclosure, the volume change of the player of the application layer is monitored through the first framework layer.
[0101] It should be noted that an application may include only one player, multiple players, or no player.
[0102] It should also be noted that the first framework layer monitors the volume changes of all applications contained in the entire application layer, and is a common framework layer for all applications. Therefore, the first framework layer can adapt well to the updates of applications in the application layer. For example, after the application of the application layer is installed, an instance of the AudioPlaybackConfiguration (APC) class is applied to the first framework layer. The parameters of the instance of the APC class include: the application identifier of the application. In this way, the first framework layer can monitor the corresponding application through the application identifier in the instance parameters of the APC class to quickly obtain the volume changes of the application's player. In this way, due to the introduction of the first framework layer, a better application installation and operation environment can be provided for the entire operating system, and the configuration may take effect faster in the adjustment operation.
[0103] In order to reduce missed adjustments, the monitoring may be performed continuously in real time upon detecting that the terminal device is powered on.
[0104] The target volume value refers to the adjusted volume value.
[0105] Here, the volume change of the player of the application layer is monitored by the first framework layer to obtain the target volume value to be adjusted, including: monitoring the volume change of the player of the application layer through the first framework layer to determine the amount of change; and determining the adjusted target volume value based on the amount of change and the maximum volume of the player.
[0106] Here, the maximum volume of the player refers to the maximum volume that the player can produce; it can be obtained by querying the hardware parameters of the player. The maximum volume that the player can produce is determined by the hardware parameters of the player. Different types of players have different hardware parameters, and the maximum volumes that can be produced are also different.
[0107] The variation includes: the variation, or the ratio of the variation to the maximum volume. For example, assuming the maximum volume is 100 decibels, the variation may be 30 decibels or 30%.
[0108] Here, the target volume value to be adjusted is obtained by monitoring the volume change of the player of the application layer through the first framework layer, and it also includes: monitoring the configuration information updated by the application layer when the player volume changes through the first framework layer; and determining the target volume value according to the configuration information.
[0109] The configuration information records the status information corresponding to the player, and the status information includes: the current volume information of the player, the volume information before the player is adjusted, or the volume change information of the player.
[0110] After the volume of the player in the application layer changes, the player will generate corresponding configuration information in the first framework layer. Then the first framework layer can determine the target volume value by directly monitoring the configuration information.
[0111] After obtaining the target volume value, the first framework layer can pass the target volume value to the second framework layer by calling the language conversion of the cross-language interaction component, and then the second framework layer adjusts the volume of the audio output module to the target volume value to achieve the final adjustment.
[0112] The audio output module includes: a speaker or a sound device.
[0113] It should be noted that in the volume adjustment on the terminal device, the audio output module of the hardware system can only be called through the bottom layer of the operating system, that is, the call to the hardware system can be realized through the second framework layer. In this way, in the embodiment of the present disclosure, after the first framework layer determines the target volume value, it is also necessary to pass the target volume value to the second framework layer to realize the final configuration.
[0114] In this way, the embodiment of the present disclosure directly implements the method of adjusting and controlling the volume in the first framework layer (such as the Java layer). Since the processing is performed in the first framework layer, only the code of the first framework layer can be operated without changing the code of the second framework layer (the code of the second framework layer is the native code of the operating system), so it is easier to transplant. Through the introduction of the first framework layer, the application layer does not need to establish a dedicated interface between the second framework layer and each application of the application layer, but can interact with the first framework layer through the application layer, thus decoupling the second framework layer and the application layer. In addition, the method of adjusting in the first framework can also directly monitor the volume changes of the player in the first framework, which can reduce the problem of multiple cross-layer calls caused by the need to monitor through the first framework layer even if the sound adjustment is implemented in the second framework layer in the prior art, thereby improving the adjustment speed.
[0115] In some embodiments, the step of monitoring the volume change of the player of the application layer through the first framework layer to obtain the target volume value to be adjusted includes:
[0116] Monitoring, through the first framework layer, configuration information updated by the application layer when the volume of the player changes;
[0117] The target volume value is determined according to the configuration information.
[0118] Here, the configuration information refers to the information in an instance of the AudioPlaybackConfiguration (APC) class; wherein one player corresponds to one instance of the APC class.
[0119] This APC class and the instance of the APC class are both established in the first framework layer.
[0120] The configuration information contains status information corresponding to the player, including current volume information of the player, volume information before adjustment of the player, or volume change information of the player. Then, the volume change of the player can be reflected through the configuration information.
[0121] Here, when the volume of the application player in the application layer needs to change, it will actively write the volume change information into the instance of the APC class corresponding to itself. In this way, the first framework layer will monitor the changes in the configuration information in each APC class instance. If there is a change, the volume setting (SetVolume) interface in the APC class is called to access the volume coefficient setting (SetVolumeMutiplier) interface in the first player base class to read the interface parameters, and then determine the configuration information, and then determine the target volume value based on the configuration information.
[0122] The configuration information is monitored through the first framework layer, specifically, the configuration information updated by the application layer when the volume of the player changes is monitored through the first framework layer. That is, the configuration information corresponding to all players is monitored, and when it is determined that the configuration information of one or more players has changed, the target volume value corresponding to the player whose configuration information has changed is determined.
[0123] In this way, the embodiment of the present disclosure can determine the target volume value by directly monitoring the configuration information through the first framework layer; and since the first framework layer is not a native code, it is convenient to write and set up a monitoring program to implement various types of monitoring; in addition, it is relatively easy to obtain the volume change of the player through monitoring.
[0124] In some embodiments, monitoring, by the first framework layer, configuration information updated by the application layer when the volume of the player changes includes:
[0125] Monitor the volume changes of the player in the application layer through the playback activity monitoring class in the first framework layer;
[0126] After the volume of the player changes, the configuration information of the player whose volume changes is obtained through the playback activity configuration acquisition method in the playback activity monitoring class.
[0127] Here, the playback activity monitoring class (PlaybackActivityMonitor.java) is used to monitor the state changes of the player, and the state changes include: volume changes, playback progress changes or playback speed changes, etc. The state changes will correspond to state information. Here, the state information of volume changes includes: the current volume information of the player, the volume information before the player is adjusted, or the volume change information of the player.
[0128] The getActivePlaybackConfigurations method is a method in the play activity monitoring class, and is used to obtain the configuration information of the player in the activated state.
[0129] The player in the activated state refers to the player whose volume has been adjusted.
[0130] In this way, the volume change of the player in the application layer can be monitored through the playback activity monitoring class in the first framework layer, and then the configuration information can be determined, without the need to process the native code in the second framework layer to obtain it. This reduces the difficulty of operation and is more convenient in transplantation.
[0131] In some embodiments, monitoring, by the first framework layer, configuration information updated by the application layer when the player volume changes includes:
[0132] The first framework layer configures the APC class interface through sound playback and reads interface parameters;
[0133] According to the interface parameters, the configuration information updated by the application layer when the volume of the player changes is determined; an instance of the APC class corresponds to one player.
[0134] The instance of the APC class integrates the interface of the APC class, so each first framework layer can read the configuration information in the corresponding instance of the APC class, determine the need to adjust the interface reading parameters, and determine the configuration information.
[0135] Here, the instance of the APC class includes configuration information and an interface for sound settings, such as a volume setting (SetVolume) interface.
[0136] The instance of the APC class corresponds to a player and is used to record the status information of the player; one instance of the APC class corresponds to one player. Since some applications may contain multiple players, the application will correspond to multiple instances of the APC class. Figure 3 It is the correspondence between the application (Application, APP) and the instance of the APC class, such as Figure 3 As shown, Application 1, Application 2, and Application 3 each correspond to 2 instances of the APC class.
[0137] The interface parameters are used to obtain configuration information updated by the application layer when the player volume changes.
[0138] The first framework layer can call the interface of the APC class to read the interface parameters, and then directly obtain the configuration information updated by the application layer when the player volume changes through the interface parameters. In this way, only based on the call to the interface in the instance of the APC class at the first framework layer, the sound change amount of the player can be determined by obtaining the configuration information updated when the player volume changes, which is relatively convenient and quick in implementation.
[0139] In some embodiments, the first framework layer configures an APC class interface through sound playback and reads interface parameters, including:
[0140] The first framework layer accesses the first volume coefficient setting interface in the first player base class of the first framework layer by calling the volume setting interface in the instance of the APC class, and reads the interface parameters.
[0141] Here, the volume setting (SetVolume) interface belongs to the interface of the APC class, and is used to implement access to other classes and to implement the volume setting adjusted by the adjustment operation.
[0142] The first player base class (PlayerBase.java) refers to the player base class corresponding to the first framework layer.
[0143] The player base class is a player encapsulation library in the operating system, which includes multiple different types of interfaces, for example, a volume coefficient setting (SetVolumeMutiplier) interface or a player volume setting (playerSetVolume) interface.
[0144] The first volume coefficient setting interface belongs to the volume coefficient setting (SetVolumeMutiplier) interface of the first framework layer, and is used to read interface parameters to obtain configuration information.
[0145] here, Figure 4 This is a flow chart of reading interface parameters, such as Figure 4 As shown, after detecting that the volume progress bar of the player is dragged, the instance of the sound playback configuration APC class whose volume of the player has changed is determined through the playback activity configuration acquisition method in the playback activity monitoring class. Based on this, the first framework layer accesses the first volume coefficient setting interface in the first player base class of the first framework layer by calling the volume setting interface in the instance of the APC class, and reads the interface parameters, which specifically includes:
[0146] The first framework layer accesses the proxy player by calling the volume setting interface in the instance of the APC class;
[0147] Access the player's executable application through the first class interface in the proxy player;
[0148] Accessing the first player base class through the second class interface of the player's executable application;
[0149] The interface parameters are read through the first volume coefficient setting interface in the first player base class.
[0150] The proxy player (PlayerProxy) is used to implement service proxy between different application processes. The first type of interface in the proxy player includes: volume setting (SetVolume) interface.
[0151] The executable application program (IplayerShell) of the player is used to access the player base class at the application process based on the service agent; in the embodiment of the present disclosure, specifically, the first player base class of the first framework layer is accessed.
[0152] The second type of interface of the executable application of the player also includes: a volume setting (SetVolume) interface.
[0153] The first volume coefficient setting interface refers to the volume coefficient setting interface in the first player base class.
[0154] In this way, by calling the volume setting (SetVolume) interface layer by layer, the first volume coefficient setting interface in the first player base class can be accessed, and the interface parameters can be read through the first volume coefficient setting interface to obtain configuration information. Since the volume setting interface belongs to the APC class interface, it can be processed in the first framework layer to achieve adjustment.
[0155] In some embodiments, the method further comprises:
[0156] Determine whether an instance of the audio track class is created in the second framework layer, and obtain a determination result;
[0157] Based on the determination result, it is determined whether the target volume value obtained based on the first framework layer can be set to take effect.
[0158] Here, the instance of the audio track class (AudioTrack) is used to receive the target volume value, and then set the target volume value to take effect.
[0159] It should be noted that some types of playback files (such as AUDIOPLAYER_FROM_URIFD type) will directly set the target volume value to the second framework layer through the player's data resource setting method (setDataSource) at runtime, and will not create an instance of the audio track class (AudioTrack) in the second framework layer. Since there is no instance of the audio track class (AudioTrack) in the second framework layer, the target volume value obtained based on the first framework layer cannot be transmitted to the second framework layer for the setting to take effect.
[0160] It can be seen that the adjustment of the target volume value will take effect only if an instance of AudioTrack is actively created in the second framework layer. Then, by determining whether an instance of the audio track class is created in the second framework layer, it can be predicted whether the target volume value obtained based on the first framework layer can be set to take effect.
[0161] The determination result includes: an instance of the audio track class is created in the second framework layer, or an instance of the audio track class is not created in the second framework layer.
[0162] The determining, based on the determination result, whether the target volume value obtained based on the first framework layer can be set to take effect includes:
[0163] When an instance of the audio track class is created in the second framework layer, it is determined that the target volume value obtained based on the first framework layer can be set to take effect;
[0164] When no instance of the audio track class is created in the second framework layer, it is determined that the target volume value obtained based on the first framework layer cannot be set to take effect.
[0165] In this way, by directly determining whether an instance of the audio track class is created in the second framework layer, it is possible to preliminarily predict whether the target volume value can be set to take effect. Based on this feature, it is possible to predict in advance whether it can take effect, which can improve efficiency.
[0166] Here, transmitting the target volume value to the second framework layer through the cross-language interaction component includes:
[0167] When it is determined that the target volume value obtained based on the first framework layer can be set to take effect, the target volume value converted by the cross-language interaction component is transmitted to the instance of the audio track class of the second framework layer through the first player volume setting interface of the first framework layer.
[0168] The first player volume setting interface refers to: a player volume setting (playerSetVolume) interface of the first framework layer, which is used to set the target volume value to the second framework layer side.
[0169] The determination that the target volume value obtained based on the first framework layer can be set to take effect is a predictive method. Then, when it is predicted that the target volume value can be set to take effect based on the creation of an instance of the audio track class, it means that the above-mentioned adjustment processing based on the first framework layer can take effect, then the target volume value converted by the cross-language interaction component can be directly transmitted to the instance of the audio track class of the second framework layer through the first player volume setting interface of the first framework layer, and then the volume of the audio output module can be adjusted to the target volume value through the instance of the audio track class of the second framework layer.
[0170] In this way, the target volume value converted by the cross-language interaction component is transmitted to the instance of the audio track class of the second framework layer through the first player volume setting interface of the first framework layer. The information setting between the first framework layer and the second framework layer can be realized through the interface call at the first framework, providing a basis for the subsequent adjustment of the volume of the audio output module.
[0171] In some embodiments, the first framework layer configures an APC class interface through sound playback and reads interface parameters, including:
[0172] When it is determined that the target volume value obtained based on the first framework layer can be set to take effect, the first framework layer accesses the first volume coefficient setting interface in the first player base class of the first framework layer by calling the volume setting interface in the instance of the APC class, and reads the interface parameters.
[0173] Here, the determination that the target volume value obtained based on the first framework layer can be set to take effect is a predictive method. Then, it means that in the present disclosure, the adjustment processing based on the first framework layer can take effect, that is, the volume adjustment method based on the first framework layer in the present disclosure can be adopted.
[0174] In this way, the first framework layer reads the interface parameters through the interface of the sound playback configuration APC class, and can be executed based on the first framework layer when it is determined that the target volume value obtained based on the first framework layer can be set to take effect. In this way, by predicting the effectiveness, the possibility of adjusting the volume based on the first framework layer is increased.
[0175] In some embodiments, the method further comprises:
[0176] When it is determined that the target volume value obtained based on the first framework layer cannot be set to take effect, changing the calling parameters of the second player volume setting interface in the second player base class of the second framework layer; wherein the changed calling parameters are used to call back the second volume coefficient setting interface of the second framework layer;
[0177] The first framework layer configures the APC class interface through sound playback and reads interface parameters, including:
[0178] The first framework layer accesses the second player volume setting interface with changed calling parameters in the second player base class of the second framework layer by calling the volume setting interface in the instance of the APC class;
[0179] Through the second player volume setting interface, the second volume coefficient setting interface of the second framework layer is called to read the interface parameters.
[0180] Here, when it is predicted that the target volume value obtained based on the first framework layer cannot be set to take effect, it means that using the first framework layer to implement volume adjustment will not produce any results. At this time, the second volume coefficient setting interface of the second framework layer is called back by changing the calling parameters of the second player volume setting interface in the second player base class of the second framework layer, and the interface parameters are obtained through the second framework layer to obtain the change coefficient value (mVolMultiplier).
[0181] The second player base class (PlayerBase.cpp) refers to the player base class corresponding to the second framework layer.
[0182] The second player volume setting interface refers to: a player volume setting (playerSetVolume) interface of the second framework layer, which is used to call back the second volume coefficient setting interface of the second framework layer under the effect of the changed calling parameters to obtain the change coefficient value.
[0183] Here, since it is predicted that it will not take effect, the first framework layer accesses the second player volume setting interface with changed calling parameters in the second player base class of the second framework layer by calling the volume setting interface in the instance of the APC class, and calls the second volume coefficient setting interface of the second framework layer through the second player volume setting interface to read the interface parameters.
[0184] In this way, if the volume adjustment cannot be implemented based on the first framework layer, the calling parameters of the second player volume setting interface in the second player base class of the second framework layer can be changed to obtain the change coefficient value (mVolMultiplier) through the second framework layer, and the volume adjustment setting can also take effect. In this way, the volume adjustment processing of various types of playback files can be adapted.
[0185] In some embodiments, the configuration information includes: a change coefficient value determined by the application layer according to a detected adjustment operation and an adjustment amount generated by the operating system according to the change coefficient value; the change coefficient value is used to indicate the change amount generated based on the detected adjustment operation.
[0186] Here, the variation coefficient value (mVolMultiplier) refers to the volume variation value determined based on the detected adjustment operation, and the variation coefficient value reflects the volume variation of the player.
[0187] The adjustment amount (mPanMultiplierL) refers to the adjustment amount generated by the operating system according to the variation coefficient value, and is used to match the detected adjustment operation, that is, after the user actively adjusts the volume of the application layer player, the operating system will also generate an adjustment amount according to the adjustment operation.
[0188] Since the volume adjustment in the embodiment of the present disclosure is for the volume adjustment of the player at the application layer actively performed by the user, after the hardware system detects the user's adjustment operation, it feeds back the adjustment operation to the application layer, and the application layer determines the change coefficient value according to the detected adjustment operation.
[0189] The application layer determines the variation coefficient value according to the detected adjustment operation, including:
[0190] The hardware system generates feedback information based on the detected adjustment operations;
[0191] The application layer determines a change coefficient value according to the feedback information.
[0192] Here, the feedback information includes: the detected change coefficient value and the volume value before the adjustment operation.
[0193] The variation coefficient value is used to indicate the variation amount generated by the adjustment operation based on the detection.
[0194] As described above, the variation includes: the variation, or the ratio of the variation to the maximum volume of the player. For example, assuming the maximum volume is 100 decibels, the variation can be 30 decibels or 30%. The maximum volume of the player refers to the maximum volume that the player can produce; it can be obtained by querying the hardware parameters of the player.
[0195] Based on the above configuration information, determining the target volume value according to the configuration information includes:
[0196] The target volume value is determined based on the variation coefficient value, the adjustment amount and the maximum volume of the player.
[0197] Here, the maximum volume of the player refers to the maximum volume that the player can produce, which can be obtained by querying the hardware parameters of the player. The maximum volume that the player can produce is determined by the hardware parameters of the player.
[0198] The step of determining the target volume value based on the variation coefficient value, the adjustment amount, and the maximum volume of the player includes:
[0199] The target volume value is determined based on the product of the variation coefficient value, the adjustment amount and the maximum volume of the player. That is:
[0200] Vol=mVolMultiplier*mVolume*mPanMultiplierL;
[0201] In the formula, Vol is the target volume value, mVolMultiplier is the variation coefficient value, mPanMultiplierL is the adjustment amount generated by the operating system according to the variation coefficient value, and mVolume is the maximum volume of the player.
[0202] The target volume value includes: the target volume value of the left channel (finalLeftVol) and the target volume value of the right channel (finalRightVol), that is:
[0203] finalLeftVol=mVolMultiplier*mLeftVolume*mPanMultiplierL;
[0204] finalRightVol=mVolMultiplier*mRightVolume*mPanMultiplierL;
[0205] In the formula, the finalLeftVol is the target volume value of the left channel, finalRightVol is the target volume value of the right channel, mVolMultiplier is the variation coefficient value, the mPanMultiplierL is the adjustment amount generated by the operating system according to the variation coefficient value, the mLeftVolume is the maximum volume of the left channel of the player, and the mRightVolume is the maximum volume of the right channel of the player.
[0206] In this way, the target volume values of the left and right channels can be calculated respectively by the change coefficient value determined in the configuration information, and the adjustment amount and maximum volume obtained by querying. Since the calculation is performed at the first framework layer, the amount of calculation at the second framework layer can be reduced.
[0207] In some embodiments, the step of monitoring the volume change of the player of the application layer through the first framework layer to obtain the target volume value to be adjusted includes:
[0208] Scan the instance of the APC class corresponding to the player at the application layer, and determine the instance of the APC class corresponding to the player whose volume has changed; wherein the identifier of the instance of the APC class and the declaration parameters of the instance of the APC class can be used to determine the application corresponding to the instance of the APC class.
[0209] Here, the identifier of the instance of the APC class is used to characterize the instance of the APC class. Since one player corresponds to one instance of the APC class, there will be many instances of the APC class in the terminal device, so they can be distinguished by the identifier of the instance of the APC class.
[0210] The declaration parameters of the instance of the APC class are used to reflect the status information of the corresponding player, and the status information includes: the current volume information of the player, the volume information before the player is adjusted, or the volume change information of the player.
[0211] Then there will be a corresponding relationship between the identifier of the instance of the APC class and the player, and there will also be a corresponding relationship between the player and the application. Therefore, through the identifier of the instance of the APC class and the declaration parameters of the instance of the APC class, the application corresponding to the instance of the APC class can be determined, thereby achieving precise adjustment for different applications.
[0212] In some embodiments, the method further comprises:
[0213] After obtaining the target volume value to be adjusted, the volume setting interface of the instance of the APC class is called to save the target volume value in a setting map; wherein the data structure of the setting map is a hash structure.
[0214] The setting map includes: a hash map (hashmap); the data structure of the hash map is a hash structure.
[0215] The hash map is used to save the volume corresponding to the application, and is stored in the form of a key-value pair. The key is the package name corresponding to the APC class, and the value is the target volume value. When the terminal device is turned on and restarted, the volume can be reset based on the hash map.
[0216] The setting map stores the target volume values of all players in the terminal device, so that after restarting the application, the target volume values can be quickly used to output the sound.
[0217] Here, after obtaining the target volume value, the volume will still be used the next time the application is started, and the target volume value is stored in the database. Since accessing and writing the database takes up more memory, it is not conducive to quickly setting the target volume value to take effect after each restart of the application.
[0218] In the disclosed embodiment, after obtaining the target volume value, the volume setting interface of the instance of the APC class is called to save the target volume value in the setting map, so that the target volume value corresponding to each player can be quickly read. Then, after the user reopens the application to which the player belongs, the target volume value can be quickly used to output the sound, thereby improving the efficiency of setting the target volume value.
[0219] It should be noted that the embodiments of the present disclosure can be applied to game scenarios, multi-screen interactive scenarios, or navigation and music scenarios; in the game scenario, when listening to music during the game, the user can increase the background sound of the game and reduce the volume of the music player to achieve a better experience. In the multi-screen interactive scenario, when multiple applications are opened at the same time, the volume of each application can be set, and the volume of the application with a higher priority can be set higher to obtain a better user experience. In the navigation and music scenario, the navigation volume can be increased and the music playback volume can be reduced to avoid unclear navigation broadcast sound.
[0220] The operating system supports the concept of stream to adjust the sound, for example, the media volume uses music stream (MUSIC_STREAM), the notification sound uses notification stream (STREAM_NOTIFICATION), and the ringtone uses ringtone stream (STREAM_RING). If some applications all use MUSIC_STREAM, then when adjusting the volume of the application, the volume of the application will all use this volume, and the sound size is consistent. The sound increases or decreases at the same time as the volume of MUSIC_STREAM, and the two applications cannot be adjusted separately. In order to solve this problem, in some embodiments, the volume can be adjusted at the native layer. However, since there is no interface for directly adjusting the volume of the audio track (AudioTrack) class in the Android operating system, if the volume adjustment is implemented at the native layer, it is necessary to increase the native interface, through which the volume set by the Java layer and the relevant parameters of the player are set to take effect. In this way, setting the volume directly at the audio track (AudioTrack) class of the native layer will ignore the implementation of the Java layer.
[0221] For example, Figure 5 The implementation process of volume adjustment is different in the Native layer and the Java layer, such as Figure 5 As shown, different types of playback files are accessed through the volume setting interface in the APC class corresponding to different applications in the Java layer. For example, audio tracks (AudioTrack), sound pools (SoundPool), and media players (MediaPlayer), where AudioTrack mainly plays pulse code modulation (PCM) stream type sounds; SoundPool mainly plays some short sounds, such as touch sounds; MediaPlayer mainly plays media audio files, for example, mp3 or mp4 files. The volume setting interface of the Native layer can only access some software library packages (Openssl), and due to the limited accessible files, it is relatively restricted in implementation. Therefore, the volume adjustment method in the above embodiment can be used to achieve adjustment.
[0222] It should also be noted that since MediaPlayer and Audio Track support setting the above-mentioned Vol to the Native layer, but SoundPool does not support it, in order to solve this problem, in the embodiment of the present disclosure, for SoundPool, the volume is also multiplied by mVolMultiplier when setting it, so that SoundPool.java also supports mVolMultiplier.
[0223] In this way, the volume adjustment method provided by the embodiment of the present disclosure monitors the volume change of the player of the application layer through the first framework layer to obtain the target volume value to be adjusted; the target volume value is transmitted to the second framework layer through the cross-language interaction component; wherein the programming language adopted by the second framework layer and the first framework layer is different; the volume of the audio output module is adjusted to the target volume value through the second framework layer. In this way, the volume adjustment control can be realized directly in the first framework layer (such as the Java layer), and then transmitted to the second framework layer (such as the Native layer) for the final adjustment of the hardware, so that the adjustment takes effect. In this way, since the processing is performed in the first framework layer, only the code of the first framework layer can be operated without changing the code of the second framework layer (the code of the second framework layer is the native code of the operating system), so it is easier to transplant. In addition, the way of adjusting in the first framework can also directly monitor the volume change of the player in the first framework, which can reduce the problem of multiple cross-layer calls caused by monitoring through the first framework layer even if the sound adjustment is realized at the second framework layer in the prior art, and improve the adjustment speed.
[0224] Figure 6 is a structural diagram of a volume adjustment device according to an exemplary embodiment. Figure 6 As shown, the volume adjustment device 500 includes:
[0225] A monitoring module 501, used to monitor the volume change of the player of the application layer through the first framework layer to obtain a target volume value to be adjusted;
[0226] A transmission module 502, configured to transmit the target volume value to a second framework layer through a cross-language interaction component; wherein the second framework layer and the first framework layer use different programming languages;
[0227] The adjustment module 503 is used to adjust the volume of the audio output module to the target volume value through the second framework layer.
[0228] In some embodiments, the monitoring module includes:
[0229] A configuration information acquisition module, used to monitor, through the first framework layer, the configuration information updated by the application layer when the volume of the player changes;
[0230] A determination module is used to determine the target volume value according to the configuration information.
[0231] In some embodiments, the configuration information acquisition module includes:
[0232] A parameter reading module, used for the first framework layer to configure the APC class interface through sound playback and read interface parameters;
[0233] The configuration information acquisition submodule is used to determine the configuration information updated by the application layer when the volume of the player changes according to the interface parameters; an instance of the APC class corresponds to one player.
[0234] In some embodiments, the parameter reading module is further used to:
[0235] The first framework layer accesses the first volume coefficient setting interface in the first player base class of the first framework layer by calling the volume setting interface in the instance of the APC class, and reads the interface parameters.
[0236] In some embodiments, the apparatus further comprises:
[0237] An instance determination module, used to determine whether an instance of the audio track class is created in the second framework layer, and obtain a determination result;
[0238] An effectiveness determination module, used to determine whether the target volume value obtained based on the first framework layer can be set to take effect based on the determination result;
[0239] The transmission module is also used to transmit the target volume value converted by the cross-language interaction component to the instance of the audio track class of the second framework layer through the first player volume setting interface of the first framework layer when it is determined that the target volume value obtained based on the first framework layer can be set to take effect.
[0240] In some embodiments, the parameter reading module is further used to:
[0241] When it is determined that the target volume value obtained based on the first framework layer can be set to take effect, the first framework layer accesses the first volume coefficient setting interface in the first player base class of the first framework layer by calling the volume setting interface in the instance of the APC class, and reads the interface parameters.
[0242] In some embodiments, the apparatus further comprises:
[0243] A changing module, used for changing the calling parameters of the second player volume setting interface in the second player base class of the second framework layer when it is determined that the target volume value obtained based on the first framework layer cannot be set to take effect; wherein the changed calling parameters are used to call back the second volume coefficient setting interface of the second framework layer;
[0244] The parameter reading module is also used for:
[0245] The first framework layer accesses the second player volume setting interface with changed calling parameters in the second player base class of the second framework layer by calling the volume setting interface in the instance of the APC class;
[0246] Through the second player volume setting interface, the second volume coefficient setting interface of the second framework layer is called to read the interface parameters.
[0247] In some embodiments, the configuration information includes: a change coefficient value determined by the application layer according to the detected adjustment operation and an adjustment amount generated by the operating system according to the change coefficient value; the change coefficient value is used to indicate the change amount generated based on the detected adjustment operation;
[0248] The determining module is further used for:
[0249] The target volume value is determined based on the variation coefficient value, the adjustment amount and the maximum volume of the player.
[0250] In some embodiments, the monitoring module is further used to:
[0251] Scan the instance of the sound playback configuration APC class corresponding to the player of the application layer, and determine the instance of the APC class corresponding to the player whose volume has changed; wherein the identifier of the instance of the APC class and the declaration parameters of the instance of the APC class can be used to determine the application corresponding to the instance of the APC class.
[0252] In some embodiments, the apparatus further comprises:
[0253] The storage module is used to call the volume setting interface of the instance of the sound playback configuration APC class to save the volume value in the setting map after obtaining the target volume value to be adjusted; wherein the data structure of the setting map is a hash structure.
[0254] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0255] Figure 7 1 is a block diagram of a volume adjustment device 1800 according to an exemplary embodiment. For example, the device 1800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0256] Reference Figure 7, the device 1800 may include one or more of the following components: a processing component 1802 , a memory 1804 , a power component 1806 , a multimedia component 1808 , an audio component 1810 , an input / output (I / O) interface 1812 , a sensor component 1814 , and a communication component 1816 .
[0257] The processing component 1802 generally controls the overall operation of the device 1800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 1802 may include one or more processors 1820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 1802 may also include one or more modules to facilitate the interaction between the processing component 1802 and other components. For example, the processing component 1802 may include a multimedia module to facilitate the interaction between the multimedia component 1808 and the processing component 1802.
[0258] The memory 1804 is configured to store various types of data to support operations on the device 1800. Examples of such data include instructions for any application or method operating on the device 1800, contact data, phone book data, messages, pictures, videos, etc. The memory 1804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.
[0259] The power component 1806 provides power to the various components of the device 1800. The power component 1806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device 1800.
[0260] The multimedia component 1808 includes a screen that provides an output interface between the device 1800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1808 includes a front camera and / or a rear camera. When the device 1800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and / or the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0261] The audio component 1810 is configured to output and / or input audio signals. For example, the audio component 1810 includes a microphone (MIC), and when the device 1800 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 1804 or sent via the communication component 1816. In some embodiments, the audio component 1810 also includes a speaker for outputting audio signals.
[0262] I / O interface 1812 provides an interface between processing component 1802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, a home button, a volume button, a start button, and a lock button.
[0263] The sensor assembly 1814 includes one or more sensors for providing various aspects of the status assessment of the device 1800. For example, the sensor assembly 1814 can detect the open / closed state of the device 1800, the relative positioning of components, such as the display and keypad of the device 1800, the sensor assembly 1814 can also detect the position change of the device 1800 or a component of the device 1800, the presence or absence of user contact with the device 1800, the orientation or acceleration / deceleration of the device 1800, and the temperature change of the device 1800. The sensor assembly 1814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 1814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0264] The communication component 1816 is configured to facilitate wired or wireless communication between the device 1800 and other devices. The device 1800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 1816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology or other technologies.
[0265] In an exemplary embodiment, the device 1800 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above-mentioned methods.
[0266] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 1804 including instructions, and the instructions can be executed by a processor 1820 of the device 1800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0267] A non-transitory computer-readable storage medium enables the above-mentioned volume adjustment method to be performed when instructions in the storage medium are executed by a processor.
[0268] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.
[0269] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A volume adjustment method, characterized in that: include: The method comprises: monitoring, through the first framework layer, the volume change of the player of the application layer, and obtaining the target volume value to be adjusted, including: monitoring, through the first framework layer, the configuration information updated by the application layer when the volume of the player changes; and determining the target volume value according to the configuration information; The target volume value is transmitted to a second framework layer through a cross-language interaction component; wherein the second framework layer and the first framework layer use different programming languages; and the second framework layer is a local framework layer; The volume of the audio output module is adjusted to the target volume value through the second framework layer.
2. The method according to claim 1, characterized in that The monitoring, through the first framework layer, of configuration information updated by the application layer when the volume of the player changes includes: The first framework layer configures the APC class interface through sound playback and reads interface parameters; According to the interface parameters, the configuration information updated by the application layer when the volume of the player changes is determined; an instance of the APC class corresponds to one player.
3. The method according to claim 2, characterized in that The first framework layer configures the APC class interface through sound playback and reads interface parameters, including: The first framework layer accesses the first volume coefficient setting interface in the first player base class of the first framework layer by calling the volume setting interface in the instance of the APC class, and reads the interface parameters.
4. The method according to claim 2, characterized in that: The method further comprises: Determine whether an instance of the audio track class is created in the second framework layer, and obtain a determination result; Based on the determination result, determining whether the target volume value obtained based on the first framework layer can be set to take effect; The step of transmitting the target volume value to the second framework layer through the cross-language interaction component includes: When it is determined that the target volume value obtained based on the first framework layer can be set to take effect, the target volume value converted by the cross-language interaction component is transmitted to the instance of the audio track class of the second framework layer through the first player volume setting interface of the first framework layer.
5. The method according to claim 4, characterized in that The first framework layer configures the APC class interface through sound playback and reads interface parameters, including: When it is determined that the target volume value obtained based on the first framework layer can be set to take effect, the first framework layer accesses the first volume coefficient setting interface in the first player base class of the first framework layer by calling the volume setting interface in the instance of the APC class, and reads the interface parameters.
6. The method according to claim 4, characterized in that The method further comprises: When it is determined that the target volume value obtained based on the first framework layer cannot be set to take effect, changing the calling parameters of the second player volume setting interface in the second player base class of the second framework layer; wherein the changed calling parameters are used to call back the second volume coefficient setting interface of the second framework layer; The first framework layer configures the APC class interface through sound playback and reads interface parameters, including: The first framework layer accesses the second player volume setting interface with changed calling parameters in the second player base class of the second framework layer by calling the volume setting interface in the instance of the APC class; Through the second player volume setting interface, the second volume coefficient setting interface of the second framework layer is called to read the interface parameters.
7. The method according to claim 1, characterized in that The configuration information includes: a change coefficient value determined by the application layer according to the detected adjustment operation and an adjustment amount generated by the operating system according to the change coefficient value; the change coefficient value is used to indicate the change amount generated based on the detected adjustment operation; The step of determining the target volume value according to the configuration information includes: The target volume value is determined based on the variation coefficient value, the adjustment amount and the maximum volume of the player.
8. The method according to claim 1, characterized in that The step of monitoring the volume change of the player of the application layer through the first framework layer to obtain the target volume value to be adjusted includes: Scan the instance of the sound playback configuration APC class corresponding to the player of the application layer, and determine the instance of the APC class corresponding to the player whose volume has changed; wherein the identifier of the instance of the APC class and the declaration parameters of the instance of the APC class can be used to determine the application corresponding to the instance of the APC class.
9. The method according to claim 1, characterized in that: The method further comprises: After obtaining the target volume value to be adjusted, the volume setting interface of the instance of the APC class is called to save the target volume value in a setting map; wherein the data structure of the setting map is a hash structure.
10. A volume adjustment device, characterized in that: include: A monitoring module, used to monitor the volume change of the player of the application layer through the first framework layer to obtain a target volume value to be adjusted; The monitoring module includes: a configuration information acquisition module, used to monitor the configuration information updated by the application layer when the player volume changes through the first framework layer; a determination module, used to determine the target volume value according to the configuration information; A transmission module, used to transmit the target volume value to a second framework layer through a cross-language interaction component; wherein the second framework layer and the first framework layer use different programming languages; and the second framework layer is a local framework layer; An adjustment module is used to adjust the volume of the audio output module to the target volume value through the second framework layer.
11. The device according to claim 10, characterized in that The configuration information acquisition module includes: A parameter reading module, used for the first framework layer to configure the APC class interface through sound playback and read interface parameters; The configuration information acquisition submodule is used to determine the configuration information updated by the application layer when the volume of the player changes according to the interface parameters; an instance of the APC class corresponds to one player.
12. The device according to claim 11, characterized in that The parameter reading module is also used for: The first framework layer accesses the first volume coefficient setting interface in the first player base class of the first framework layer by calling the volume setting interface in the instance of the APC class, and reads the interface parameters.
13. The device according to claim 11, characterized in that The device also includes: An instance determination module, used to determine whether an instance of the audio track class is created in the second framework layer, and obtain a determination result; An effectiveness determination module, used to determine whether the target volume value obtained based on the first framework layer can be set to take effect based on the determination result; The transmission module is also used to transmit the target volume value converted by the cross-language interaction component to the instance of the audio track class of the second framework layer through the first player volume setting interface of the first framework layer when it is determined that the target volume value obtained based on the first framework layer can be set to take effect.
14. The device according to claim 13, characterized in that The parameter reading module is also used for: When it is determined that the target volume value obtained based on the first framework layer can be set to take effect, the first framework layer accesses the first volume coefficient setting interface in the first player base class of the first framework layer by calling the volume setting interface in the instance of the APC class, and reads the interface parameters.
15. The device according to claim 13, characterized in that The device also includes: A changing module, used for changing the calling parameters of the second player volume setting interface in the second player base class of the second framework layer when it is determined that the target volume value obtained based on the first framework layer cannot be set to take effect; wherein the changed calling parameters are used to call back the second volume coefficient setting interface of the second framework layer; The parameter reading module is also used for: The first framework layer accesses the second player volume setting interface with changed calling parameters in the second player base class of the second framework layer by calling the volume setting interface in the instance of the APC class; Through the second player volume setting interface, the second volume coefficient setting interface of the second framework layer is called to read the interface parameters.
16. The device according to claim 10, characterized in that The configuration information includes: a change coefficient value determined by the application layer according to the detected adjustment operation and an adjustment amount generated by the operating system according to the change coefficient value; the change coefficient value is used to indicate the change amount generated based on the detected adjustment operation; The determining module is further used for: The target volume value is determined based on the variation coefficient value, the adjustment amount and the maximum volume of the player.
17. The device according to claim 10, characterized in that The monitoring module is further used for: Scan the instance of the sound playback configuration APC class corresponding to the player of the application layer, and determine the instance of the APC class corresponding to the player whose volume has changed; wherein the identifier of the instance of the APC class and the declaration parameters of the instance of the APC class can be used to determine the application corresponding to the instance of the APC class.
18. The device according to claim 10, characterized in that The device also includes: The storage module is used to call the volume setting interface of the instance of the sound playback configuration APC class to save the volume value in the setting map after obtaining the target volume value to be adjusted; wherein the data structure of the setting map is a hash structure.
19. A volume adjustment device, characterized in that: The device comprises at least: a processor and a memory for storing executable instructions that can be run on the processor, wherein: When the processor is used to run the executable instructions, the executable instructions execute the steps in the method provided in any one of claims 1 to 9 above.
20. A non-transitory computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the steps of the method provided in any one of claims 1 to 9.
Citation Information
Patent Citations
Volume adjusting method and device and storage medium
CN110191355A